diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main')
157 files changed, 11216 insertions, 10711 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java index 45bc27d840..3b768cbc3b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.appc.payload; import java.util.Optional; - import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersHealthCheck; import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersQuiesce; import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersResumeTraffic; @@ -34,67 +33,69 @@ import org.onap.so.bpmn.appc.payload.beans.SnapshotAction; import org.onap.so.bpmn.appc.payload.beans.StartStopAction; import org.onap.so.bpmn.appc.payload.beans.UpgradeAction; import org.onap.so.bpmn.core.json.JsonUtils; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; public class PayloadClient { - protected static ObjectMapper mapper = new ObjectMapper(); - - private PayloadClient() {} - - public static Optional<String> upgradeFormat(Optional<String> payload, String vnfName) throws JsonProcessingException{ - UpgradeAction payloadResult = new UpgradeAction(); - ConfigurationParametersUpgrade configParams = new ConfigurationParametersUpgrade(); - String payloadString = payload.isPresent() ? payload.get() : ""; - String existingSoftware = JsonUtils.getJsonValue(payloadString, "existing_software_version"); - String newSoftware = JsonUtils.getJsonValue(payloadString, "new_software_version"); - configParams.setExistingSoftwareVersion(existingSoftware); - configParams.setNewSoftwareVersion(newSoftware); - configParams.setVnfName(vnfName); - payloadResult.setConfigurationParameters(configParams); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - public static Optional<String> resumeTrafficFormat(String vnfName) throws JsonProcessingException{ - ResumeTrafficAction payloadResult = new ResumeTrafficAction(); - ConfigurationParametersResumeTraffic configParams = new ConfigurationParametersResumeTraffic(); - configParams.setVnfName(vnfName); - payloadResult.setConfigurationParameters(configParams); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - public static Optional<String> quiesceTrafficFormat(Optional<String> payload, String vnfName) throws JsonProcessingException{ - QuiesceTrafficAction payloadResult = new QuiesceTrafficAction(); - ConfigurationParametersQuiesce configParams = new ConfigurationParametersQuiesce(); - String payloadString = payload.isPresent() ? payload.get() : ""; - String operationsTimeout = JsonUtils.getJsonValue(payloadString, "operations_timeout"); - configParams.setOperationsTimeout(operationsTimeout); - configParams.setVnfName(vnfName); - payloadResult.setConfigurationParameters(configParams); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - public static Optional<String> startStopFormat(String aicIdentity) throws JsonProcessingException{ - StartStopAction payloadResult = new StartStopAction(); - payloadResult.setAicIdentity(aicIdentity); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - public static Optional<String> healthCheckFormat(String vnfName, String vnfHostIpAddress) throws JsonProcessingException{ - HealthCheckAction payloadResult = new HealthCheckAction(); - RequestParametersHealthCheck requestParams = new RequestParametersHealthCheck(); - requestParams.setHostIpAddress(vnfHostIpAddress); - payloadResult.setRequestParameters(requestParams); - return Optional.of((mapper.writeValueAsString(payloadResult))); - } - - public static Optional<String> snapshotFormat(String vmId, String identityUrl)throws JsonProcessingException{ - SnapshotAction payloadResult = new SnapshotAction(); - payloadResult.setVmId(vmId); - payloadResult.setIdentityUrl(identityUrl); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - + protected static ObjectMapper mapper = new ObjectMapper(); + + private PayloadClient() {} + + public static Optional<String> upgradeFormat(Optional<String> payload, String vnfName) + throws JsonProcessingException { + UpgradeAction payloadResult = new UpgradeAction(); + ConfigurationParametersUpgrade configParams = new ConfigurationParametersUpgrade(); + String payloadString = payload.isPresent() ? payload.get() : ""; + String existingSoftware = JsonUtils.getJsonValue(payloadString, "existing_software_version"); + String newSoftware = JsonUtils.getJsonValue(payloadString, "new_software_version"); + configParams.setExistingSoftwareVersion(existingSoftware); + configParams.setNewSoftwareVersion(newSoftware); + configParams.setVnfName(vnfName); + payloadResult.setConfigurationParameters(configParams); + return Optional.of(mapper.writeValueAsString(payloadResult)); + } + + public static Optional<String> resumeTrafficFormat(String vnfName) throws JsonProcessingException { + ResumeTrafficAction payloadResult = new ResumeTrafficAction(); + ConfigurationParametersResumeTraffic configParams = new ConfigurationParametersResumeTraffic(); + configParams.setVnfName(vnfName); + payloadResult.setConfigurationParameters(configParams); + return Optional.of(mapper.writeValueAsString(payloadResult)); + } + + public static Optional<String> quiesceTrafficFormat(Optional<String> payload, String vnfName) + throws JsonProcessingException { + QuiesceTrafficAction payloadResult = new QuiesceTrafficAction(); + ConfigurationParametersQuiesce configParams = new ConfigurationParametersQuiesce(); + String payloadString = payload.isPresent() ? payload.get() : ""; + String operationsTimeout = JsonUtils.getJsonValue(payloadString, "operations_timeout"); + configParams.setOperationsTimeout(operationsTimeout); + configParams.setVnfName(vnfName); + payloadResult.setConfigurationParameters(configParams); + return Optional.of(mapper.writeValueAsString(payloadResult)); + } + + public static Optional<String> startStopFormat(String aicIdentity) throws JsonProcessingException { + StartStopAction payloadResult = new StartStopAction(); + payloadResult.setAicIdentity(aicIdentity); + return Optional.of(mapper.writeValueAsString(payloadResult)); + } + + public static Optional<String> healthCheckFormat(String vnfName, String vnfHostIpAddress) + throws JsonProcessingException { + HealthCheckAction payloadResult = new HealthCheckAction(); + RequestParametersHealthCheck requestParams = new RequestParametersHealthCheck(); + requestParams.setHostIpAddress(vnfHostIpAddress); + payloadResult.setRequestParameters(requestParams); + return Optional.of((mapper.writeValueAsString(payloadResult))); + } + + public static Optional<String> snapshotFormat(String vmId, String identityUrl) throws JsonProcessingException { + SnapshotAction payloadResult = new SnapshotAction(); + payloadResult.setVmId(vmId); + payloadResult.setIdentityUrl(identityUrl); + return Optional.of(mapper.writeValueAsString(payloadResult)); + } + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigModifyAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigModifyAction.java index 3c39a8d66c..4ca99c3b34 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigModifyAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigModifyAction.java @@ -25,35 +25,32 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"request-parameters", -"configuration-parameters" -}) +@JsonPropertyOrder({"request-parameters", "configuration-parameters"}) public class ConfigModifyAction { -@JsonProperty("request-parameters") -private RequestParametersConfigModify requestParameters; -@JsonProperty("configuration-parameters") -private ConfigurationParametersConfigModify configurationParameters; - -@JsonProperty("request-parameters") -public RequestParametersConfigModify getRequestParameters() { -return requestParameters; -} - -@JsonProperty("request-parameters") -public void setRequestParameters(RequestParametersConfigModify requestParameters) { -this.requestParameters = requestParameters; -} - -@JsonProperty("configuration-parameters") -public ConfigurationParametersConfigModify getConfigurationParameters() { -return configurationParameters; -} - -@JsonProperty("configuration-parameters") -public void setConfigurationParameters(ConfigurationParametersConfigModify configurationParameters) { -this.configurationParameters = configurationParameters; -} + @JsonProperty("request-parameters") + private RequestParametersConfigModify requestParameters; + @JsonProperty("configuration-parameters") + private ConfigurationParametersConfigModify configurationParameters; + + @JsonProperty("request-parameters") + public RequestParametersConfigModify getRequestParameters() { + return requestParameters; + } + + @JsonProperty("request-parameters") + public void setRequestParameters(RequestParametersConfigModify requestParameters) { + this.requestParameters = requestParameters; + } + + @JsonProperty("configuration-parameters") + public ConfigurationParametersConfigModify getConfigurationParameters() { + return configurationParameters; + } + + @JsonProperty("configuration-parameters") + public void setConfigurationParameters(ConfigurationParametersConfigModify configurationParameters) { + this.configurationParameters = configurationParameters; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigScaleOutPayload.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigScaleOutPayload.java index 9035f4d506..aa50a90265 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigScaleOutPayload.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigScaleOutPayload.java @@ -1,19 +1,15 @@ -/* ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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 +/* + * ============LICENSE_START======================================================= ONAP - SO + * ================================================================================ 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 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. * ============LICENSE_END========================================================= */ @@ -21,38 +17,37 @@ package org.onap.so.bpmn.appc.payload.beans; import java.util.HashMap; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; public class ConfigScaleOutPayload { - @JsonProperty("request-parameters") - private RequestParametersConfigScaleOut requestParameters; - @JsonProperty("configuration-parameters") - private Map<String, String> configurationParameters = new HashMap<>(); - - public RequestParametersConfigScaleOut getRequestParameters() { - return requestParameters; - } - - public void setRequestParameters(RequestParametersConfigScaleOut requestParameters) { - this.requestParameters = requestParameters; - } - - public Map<String, String> getConfigurationParameters() { - return configurationParameters; - } - - public void setConfigurationParameters(Map<String, String> configurationParameters) { - this.configurationParameters = configurationParameters; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("ConfigScaleOutPayload{"); - sb.append("requestParameters=").append(requestParameters); - sb.append(", configurationParameters='").append(configurationParameters); - sb.append('}'); - return sb.toString(); - } + @JsonProperty("request-parameters") + private RequestParametersConfigScaleOut requestParameters; + @JsonProperty("configuration-parameters") + private Map<String, String> configurationParameters = new HashMap<>(); + + public RequestParametersConfigScaleOut getRequestParameters() { + return requestParameters; + } + + public void setRequestParameters(RequestParametersConfigScaleOut requestParameters) { + this.requestParameters = requestParameters; + } + + public Map<String, String> getConfigurationParameters() { + return configurationParameters; + } + + public void setConfigurationParameters(Map<String, String> configurationParameters) { + this.configurationParameters = configurationParameters; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("ConfigScaleOutPayload{"); + sb.append("requestParameters=").append(requestParameters); + sb.append(", configurationParameters='").append(configurationParameters); + sb.append('}'); + return sb.toString(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java index c88169bb80..422a49c5ed 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java @@ -25,34 +25,31 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"node0_hostname", -"node0_backup_router_address" -}) +@JsonPropertyOrder({"node0_hostname", "node0_backup_router_address"}) public class ConfigurationParametersConfigModify { -@JsonProperty("node0_hostname") -private String node0Hostname; -@JsonProperty("node0_backup_router_address") -private String node0BackupRouterAddress; - -@JsonProperty("node0_hostname") -public String getNode0Hostname() { -return node0Hostname; -} - -@JsonProperty("node0_hostname") -public void setNode0Hostname(String node0Hostname) { -this.node0Hostname = node0Hostname; -} - -@JsonProperty("node0_backup_router_address") -public String getNode0BackupRouterAddress() { -return node0BackupRouterAddress; -} - -@JsonProperty("node0_backup_router_address") -public void setNode0BackupRouterAddress(String node0BackupRouterAddress) { -this.node0BackupRouterAddress = node0BackupRouterAddress; -} + @JsonProperty("node0_hostname") + private String node0Hostname; + @JsonProperty("node0_backup_router_address") + private String node0BackupRouterAddress; + + @JsonProperty("node0_hostname") + public String getNode0Hostname() { + return node0Hostname; + } + + @JsonProperty("node0_hostname") + public void setNode0Hostname(String node0Hostname) { + this.node0Hostname = node0Hostname; + } + + @JsonProperty("node0_backup_router_address") + public String getNode0BackupRouterAddress() { + return node0BackupRouterAddress; + } + + @JsonProperty("node0_backup_router_address") + public void setNode0BackupRouterAddress(String node0BackupRouterAddress) { + this.node0BackupRouterAddress = node0BackupRouterAddress; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java index a8964f3bc5..8c9e636d9e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java @@ -25,21 +25,19 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vnf_name" -}) +@JsonPropertyOrder({"vnf_name"}) public class ConfigurationParametersHealthCheck { -@JsonProperty("vnf_name") -private String vnfName; + @JsonProperty("vnf_name") + private String vnfName; -@JsonProperty("vnf_name") -public String getVnfName() { -return vnfName; -} + @JsonProperty("vnf_name") + public String getVnfName() { + return vnfName; + } -@JsonProperty("vnf_name") -public void setVnfName(String vnfName) { -this.vnfName = vnfName; -} + @JsonProperty("vnf_name") + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java index 878a136962..2a6ff4874a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java @@ -25,35 +25,32 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vnf_name", -"operations_timeout" -}) +@JsonPropertyOrder({"vnf_name", "operations_timeout"}) public class ConfigurationParametersQuiesce { -@JsonProperty("vnf_name") -private String vnfName; -@JsonProperty("operations_timeout") -private String operationsTimeout; - -@JsonProperty("vnf_name") -public String getVnfName() { -return vnfName; -} - -@JsonProperty("vnf_name") -public void setVnfName(String vnfName) { -this.vnfName = vnfName; -} - -@JsonProperty("operations_timeout") -public String getOperationsTimeout() { -return operationsTimeout; -} - -@JsonProperty("operations_timeout") -public void setOperationsTimeout(String operationsTimeout) { -this.operationsTimeout = operationsTimeout; -} + @JsonProperty("vnf_name") + private String vnfName; + @JsonProperty("operations_timeout") + private String operationsTimeout; + + @JsonProperty("vnf_name") + public String getVnfName() { + return vnfName; + } + + @JsonProperty("vnf_name") + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } + + @JsonProperty("operations_timeout") + public String getOperationsTimeout() { + return operationsTimeout; + } + + @JsonProperty("operations_timeout") + public void setOperationsTimeout(String operationsTimeout) { + this.operationsTimeout = operationsTimeout; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java index 6b5e59f2e0..3875450c7d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java @@ -25,21 +25,19 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vnf_name" -}) +@JsonPropertyOrder({"vnf_name"}) public class ConfigurationParametersResumeTraffic { -@JsonProperty("vnf_name") -private String vnfName; + @JsonProperty("vnf_name") + private String vnfName; -@JsonProperty("vnf_name") -public String getVnfName() { -return vnfName; -} + @JsonProperty("vnf_name") + public String getVnfName() { + return vnfName; + } -@JsonProperty("vnf_name") -public void setVnfName(String vnfName) { -this.vnfName = vnfName; -} + @JsonProperty("vnf_name") + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java index 6bd397a63a..1f1bdf91d5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java @@ -25,47 +25,43 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vnf_name", -"existing_software_version", -"new_software_version" -}) +@JsonPropertyOrder({"vnf_name", "existing_software_version", "new_software_version"}) public class ConfigurationParametersUpgrade { -@JsonProperty("vnf_name") -private String vnfName; -@JsonProperty("existing_software_version") -private String existingSoftwareVersion; -@JsonProperty("new_software_version") -private String newSoftwareVersion; + @JsonProperty("vnf_name") + private String vnfName; + @JsonProperty("existing_software_version") + private String existingSoftwareVersion; + @JsonProperty("new_software_version") + private String newSoftwareVersion; -@JsonProperty("vnf_name") -public String getVnfName() { -return vnfName; -} + @JsonProperty("vnf_name") + public String getVnfName() { + return vnfName; + } -@JsonProperty("vnf_name") -public void setVnfName(String vnfName) { -this.vnfName = vnfName; -} + @JsonProperty("vnf_name") + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } -@JsonProperty("existing_software_version") -public String getExistingSoftwareVersion() { -return existingSoftwareVersion; -} + @JsonProperty("existing_software_version") + public String getExistingSoftwareVersion() { + return existingSoftwareVersion; + } -@JsonProperty("existing_software_version") -public void setExistingSoftwareVersion(String existingSoftwareVersion) { -this.existingSoftwareVersion = existingSoftwareVersion; -} + @JsonProperty("existing_software_version") + public void setExistingSoftwareVersion(String existingSoftwareVersion) { + this.existingSoftwareVersion = existingSoftwareVersion; + } -@JsonProperty("new_software_version") -public String getNewSoftwareVersion() { -return newSoftwareVersion; -} + @JsonProperty("new_software_version") + public String getNewSoftwareVersion() { + return newSoftwareVersion; + } -@JsonProperty("new_software_version") -public void setNewSoftwareVersion(String newSoftwareVersion) { -this.newSoftwareVersion = newSoftwareVersion; -} + @JsonProperty("new_software_version") + public void setNewSoftwareVersion(String newSoftwareVersion) { + this.newSoftwareVersion = newSoftwareVersion; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/HealthCheckAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/HealthCheckAction.java index 4d194650c4..0964a09cb9 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/HealthCheckAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/HealthCheckAction.java @@ -25,34 +25,31 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"request-parameters", -"configuration-parameters" -}) +@JsonPropertyOrder({"request-parameters", "configuration-parameters"}) public class HealthCheckAction { -@JsonProperty("request-parameters") -private RequestParametersHealthCheck requestParameters; -@JsonProperty("configuration-parameters") -private ConfigurationParametersHealthCheck configurationParameters; - -@JsonProperty("request-parameters") -public RequestParametersHealthCheck getRequestParameters() { -return requestParameters; -} - -@JsonProperty("request-parameters") -public void setRequestParameters(RequestParametersHealthCheck requestParameters) { -this.requestParameters = requestParameters; -} - -@JsonProperty("configuration-parameters") -public ConfigurationParametersHealthCheck getConfigurationParameters() { -return configurationParameters; -} - -@JsonProperty("configuration-parameters") -public void setConfigurationParameters(ConfigurationParametersHealthCheck configurationParameters) { -this.configurationParameters = configurationParameters; -} + @JsonProperty("request-parameters") + private RequestParametersHealthCheck requestParameters; + @JsonProperty("configuration-parameters") + private ConfigurationParametersHealthCheck configurationParameters; + + @JsonProperty("request-parameters") + public RequestParametersHealthCheck getRequestParameters() { + return requestParameters; + } + + @JsonProperty("request-parameters") + public void setRequestParameters(RequestParametersHealthCheck requestParameters) { + this.requestParameters = requestParameters; + } + + @JsonProperty("configuration-parameters") + public ConfigurationParametersHealthCheck getConfigurationParameters() { + return configurationParameters; + } + + @JsonProperty("configuration-parameters") + public void setConfigurationParameters(ConfigurationParametersHealthCheck configurationParameters) { + this.configurationParameters = configurationParameters; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/QuiesceTrafficAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/QuiesceTrafficAction.java index 0b16c6ca90..7125ad77b8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/QuiesceTrafficAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/QuiesceTrafficAction.java @@ -25,21 +25,19 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"configuration-parameters" -}) +@JsonPropertyOrder({"configuration-parameters"}) public class QuiesceTrafficAction { -@JsonProperty("configuration-parameters") -private ConfigurationParametersQuiesce configurationParameters; + @JsonProperty("configuration-parameters") + private ConfigurationParametersQuiesce configurationParameters; -@JsonProperty("configuration-parameters") -public ConfigurationParametersQuiesce getConfigurationParameters() { -return configurationParameters; -} + @JsonProperty("configuration-parameters") + public ConfigurationParametersQuiesce getConfigurationParameters() { + return configurationParameters; + } -@JsonProperty("configuration-parameters") -public void setConfigurationParameters(ConfigurationParametersQuiesce configurationParameters) { -this.configurationParameters = configurationParameters; -} + @JsonProperty("configuration-parameters") + public void setConfigurationParameters(ConfigurationParametersQuiesce configurationParameters) { + this.configurationParameters = configurationParameters; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigModify.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigModify.java index 58c9234d60..2b314cb580 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigModify.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigModify.java @@ -25,22 +25,20 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vnf-host-ip-address" -}) +@JsonPropertyOrder({"vnf-host-ip-address"}) public class RequestParametersConfigModify { -@JsonProperty("vnf-host-ip-address") -private String vnfHostIpAddress; + @JsonProperty("vnf-host-ip-address") + private String vnfHostIpAddress; -@JsonProperty("vnf-host-ip-address") -public String getVnfHostIpAddress() { -return vnfHostIpAddress; -} + @JsonProperty("vnf-host-ip-address") + public String getVnfHostIpAddress() { + return vnfHostIpAddress; + } -@JsonProperty("vnf-host-ip-address") -public void setVnfHostIpAddress(String vnfHostIpAddress) { -this.vnfHostIpAddress = vnfHostIpAddress; -} + @JsonProperty("vnf-host-ip-address") + public void setVnfHostIpAddress(String vnfHostIpAddress) { + this.vnfHostIpAddress = vnfHostIpAddress; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigScaleOut.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigScaleOut.java index 0333fd7a78..1a9e04b9e2 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigScaleOut.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigScaleOut.java @@ -1,19 +1,15 @@ -/* ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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 +/* + * ============LICENSE_START======================================================= ONAP - SO + * ================================================================================ 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 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. * ============LICENSE_END========================================================= */ @@ -23,33 +19,33 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class RequestParametersConfigScaleOut { - @JsonProperty("vnf-host-ip-address") - private String vnfHostIpAddress; - @JsonProperty("vf-module-id") - private String vfModuleId; - - public String getVnfHostIpAddress() { - return vnfHostIpAddress; - } - - public void setVnfHostIpAddress(String vnfHostIpAddress) { - this.vnfHostIpAddress = vnfHostIpAddress; - } - - public String getVfModuleId() { - return vfModuleId; - } - - public void setVfModuleId(String vfModuleId) { - this.vfModuleId = vfModuleId; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("RequestParametersConfigScaleOut{"); - sb.append("vnf-host-ip-address=").append(vnfHostIpAddress); - sb.append(", vf-module-id='").append(vfModuleId); - sb.append('}'); - return sb.toString(); - } + @JsonProperty("vnf-host-ip-address") + private String vnfHostIpAddress; + @JsonProperty("vf-module-id") + private String vfModuleId; + + public String getVnfHostIpAddress() { + return vnfHostIpAddress; + } + + public void setVnfHostIpAddress(String vnfHostIpAddress) { + this.vnfHostIpAddress = vnfHostIpAddress; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("RequestParametersConfigScaleOut{"); + sb.append("vnf-host-ip-address=").append(vnfHostIpAddress); + sb.append(", vf-module-id='").append(vfModuleId); + sb.append('}'); + return sb.toString(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java index 60030ee3dd..2fe8e744f9 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java @@ -25,34 +25,32 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vnf-name" -}) +@JsonPropertyOrder({"vnf-name"}) public class RequestParametersHealthCheck { -@JsonProperty("vnf-name") -private String vnfName; -@JsonProperty("host-ip-address") -private String hostIpAddress; - -@JsonProperty("vnf-name") -public String getVnfName() { - return vnfName; -} - -@JsonProperty("vnf-name") -public void setVnfName(String vnfName) { - this.vnfName = vnfName; -} - -@JsonProperty("host-ip-address") -public void setHostIpAddress(String hostIpAddress) { - this.hostIpAddress = hostIpAddress; -} - -@JsonProperty("host-ip-address") -public String getHostIpAddress() { - return hostIpAddress; -} + @JsonProperty("vnf-name") + private String vnfName; + @JsonProperty("host-ip-address") + private String hostIpAddress; + + @JsonProperty("vnf-name") + public String getVnfName() { + return vnfName; + } + + @JsonProperty("vnf-name") + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } + + @JsonProperty("host-ip-address") + public void setHostIpAddress(String hostIpAddress) { + this.hostIpAddress = hostIpAddress; + } + + @JsonProperty("host-ip-address") + public String getHostIpAddress() { + return hostIpAddress; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ResumeTrafficAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ResumeTrafficAction.java index b642a376fe..5afdc4198a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ResumeTrafficAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ResumeTrafficAction.java @@ -25,21 +25,19 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"configuration-parameters" -}) +@JsonPropertyOrder({"configuration-parameters"}) public class ResumeTrafficAction { -@JsonProperty("configuration-parameters") -private ConfigurationParametersResumeTraffic configurationParameters; + @JsonProperty("configuration-parameters") + private ConfigurationParametersResumeTraffic configurationParameters; -@JsonProperty("configuration-parameters") -public ConfigurationParametersResumeTraffic getConfigurationParameters() { -return configurationParameters; -} + @JsonProperty("configuration-parameters") + public ConfigurationParametersResumeTraffic getConfigurationParameters() { + return configurationParameters; + } -@JsonProperty("configuration-parameters") -public void setConfigurationParameters(ConfigurationParametersResumeTraffic configurationParameters) { -this.configurationParameters = configurationParameters; -} + @JsonProperty("configuration-parameters") + public void setConfigurationParameters(ConfigurationParametersResumeTraffic configurationParameters) { + this.configurationParameters = configurationParameters; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/SnapshotAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/SnapshotAction.java index 0499e5d6c0..431c97814e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/SnapshotAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/SnapshotAction.java @@ -25,35 +25,32 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vm-id", -"identity-url" -}) +@JsonPropertyOrder({"vm-id", "identity-url"}) public class SnapshotAction { -@JsonProperty("vm-id") -private String vmId; -@JsonProperty("identity-url") -private String identityUrl; - -@JsonProperty("vm-id") -public String getVmId() { -return vmId; -} - -@JsonProperty("vm-id") -public void setVmId(String vmId) { -this.vmId = vmId; -} - -@JsonProperty("identity-url") -public String getIdentityUrl() { -return identityUrl; -} - -@JsonProperty("identity-url") -public void setIdentityUrl(String identityUrl) { -this.identityUrl = identityUrl; -} + @JsonProperty("vm-id") + private String vmId; + @JsonProperty("identity-url") + private String identityUrl; + + @JsonProperty("vm-id") + public String getVmId() { + return vmId; + } + + @JsonProperty("vm-id") + public void setVmId(String vmId) { + this.vmId = vmId; + } + + @JsonProperty("identity-url") + public String getIdentityUrl() { + return identityUrl; + } + + @JsonProperty("identity-url") + public void setIdentityUrl(String identityUrl) { + this.identityUrl = identityUrl; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/StartStopAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/StartStopAction.java index f2b5b905a5..58231c0602 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/StartStopAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/StartStopAction.java @@ -25,21 +25,19 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - " AICIdentity " -}) +@JsonPropertyOrder({" AICIdentity "}) public class StartStopAction { - @JsonProperty(" AICIdentity ") - private String aicIdentity; + @JsonProperty(" AICIdentity ") + private String aicIdentity; - @JsonProperty(" AICIdentity ") - public String getAicIdentity() { - return aicIdentity; - } + @JsonProperty(" AICIdentity ") + public String getAicIdentity() { + return aicIdentity; + } - @JsonProperty(" AICIdentity ") - public void setAicIdentity(String aicIdentity) { - this.aicIdentity = aicIdentity; - } + @JsonProperty(" AICIdentity ") + public void setAicIdentity(String aicIdentity) { + this.aicIdentity = aicIdentity; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/UpgradeAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/UpgradeAction.java index 3e07f328ce..e6a60a52f5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/UpgradeAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/UpgradeAction.java @@ -25,21 +25,19 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"configuration-parameters" -}) +@JsonPropertyOrder({"configuration-parameters"}) public class UpgradeAction { -@JsonProperty("configuration-parameters") -private ConfigurationParametersUpgrade configurationParameters; + @JsonProperty("configuration-parameters") + private ConfigurationParametersUpgrade configurationParameters; -@JsonProperty("configuration-parameters") -public ConfigurationParametersUpgrade getConfigurationParameters() { -return configurationParameters; -} + @JsonProperty("configuration-parameters") + public ConfigurationParametersUpgrade getConfigurationParameters() { + return configurationParameters; + } -@JsonProperty("configuration-parameters") -public void setConfigurationParameters(ConfigurationParametersUpgrade configurationParameters) { -this.configurationParameters = configurationParameters; -} + @JsonProperty("configuration-parameters") + public void setConfigurationParameters(ConfigurationParametersUpgrade configurationParameters) { + this.configurationParameters = configurationParameters; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java index 1ffd9dd167..c087d586e7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java @@ -22,17 +22,21 @@ package org.onap.so.bpmn.common; import java.io.Serializable; import java.util.Map; - import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; public interface BuildingBlockExecution { - public GeneralBuildingBlock getGeneralBuildingBlock(); - public <T> T getVariable(String key); - public <T> T getRequiredVariable(String key) throws RequiredExecutionVariableExeception; - public void setVariable(String key, Serializable value); - public Map<ResourceKey, String> getLookupMap(); - public String getFlowToBeCalled(); + public GeneralBuildingBlock getGeneralBuildingBlock(); + + public <T> T getVariable(String key); + + public <T> T getRequiredVariable(String key) throws RequiredExecutionVariableExeception; + + public void setVariable(String key, Serializable value); + + public Map<ResourceKey, String> getLookupMap(); + + public String getFlowToBeCalled(); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGenerator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGenerator.java index 5a126ffe7d..f09aae67d1 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGenerator.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGenerator.java @@ -25,9 +25,9 @@ import org.springframework.context.annotation.AnnotationBeanNameGenerator; import org.springframework.util.ClassUtils; public class DefaultToShortClassNameBeanNameGenerator extends AnnotationBeanNameGenerator { - - @Override - protected String buildDefaultBeanName(BeanDefinition definition) { - return ClassUtils.getShortName(definition.getBeanClassName()); - } + + @Override + protected String buildDefaultBeanName(BeanDefinition definition) { + return ClassUtils.getShortName(definition.getBeanClassName()); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java index 39a209efa8..31fef7c6f7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java @@ -23,14 +23,12 @@ package org.onap.so.bpmn.common; import java.io.Serializable; import java.util.HashMap; import java.util.Map; - import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.common.exceptions.MalformedBuildingBlockInputException; import org.onap.so.bpmn.common.exceptions.MissingBuildingBlockInputException; import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectExecution.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectExecution.java index 56b059ec16..036c054ed9 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectExecution.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectExecution.java @@ -26,9 +26,9 @@ import org.springframework.stereotype.Component; @Component public class InjectExecution { - public DelegateExecutionImpl execute (DelegateExecution execution, DelegateExecutionImpl impl) { - - impl.setDelegateExecution(execution); - return impl; - } + public DelegateExecutionImpl execute(DelegateExecution execution, DelegateExecutionImpl impl) { + + impl.setDelegateExecution(execution); + return impl; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java index adf1dc01c0..3791c5d461 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java @@ -32,45 +32,42 @@ import org.onap.so.client.sdno.SDNOValidatorImpl; import org.springframework.stereotype.Component; /* - * This object is intended to be a helper for acquiring classes - * that cannot be acquired via Spring injection. + * This object is intended to be a helper for acquiring classes that cannot be acquired via Spring injection. * * It brings two benefits: * - * 1) Enforces acquisition of a new copy of these classes every - * time to help with picking up properties files changes, etc - * 2) The classes are exposed in such a way that mocks of them can - * still be injected when testing the Spring objects that use - * them + * 1) Enforces acquisition of a new copy of these classes every time to help with picking up properties files changes, + * etc 2) The classes are exposed in such a way that mocks of them can still be injected when testing the Spring objects + * that use them */ @Component public class InjectionHelper { - public AAIResourcesClient getAaiClient() { - return new AAIResourcesClient(); - } + public AAIResourcesClient getAaiClient() { + return new AAIResourcesClient(); + } - public AAIQueryClient getAaiQueryClient() { - return new AAIQueryClient(); - } + public AAIQueryClient getAaiQueryClient() { + return new AAIQueryClient(); + } - public SDNOValidator getSdnoValidator() { - return new SDNOValidatorImpl(); - } + public SDNOValidator getSdnoValidator() { + return new SDNOValidatorImpl(); + } - public AAICommonObjectMapperProvider getAaiCommonObjectMapperProvider() { - return new AAICommonObjectMapperProvider(); - } + public AAICommonObjectMapperProvider getAaiCommonObjectMapperProvider() { + return new AAICommonObjectMapperProvider(); + } - public AAIResultWrapper getAaiResultWrapper(String json) { - return new AAIResultWrapper(json); - } + public AAIResultWrapper getAaiResultWrapper(String json) { + return new AAIResultWrapper(json); + } - public PolicyClientImpl getPolicyClient() { - return new PolicyClientImpl(); - } + public PolicyClientImpl getPolicyClient() { + return new PolicyClientImpl(); + } - public CDSProcessingClient getCdsClient(CDSProcessingListener listener) { - return new CDSProcessingClient(listener); - } + public CDSProcessingClient getCdsClient(CDSProcessingListener listener) { + return new CDSProcessingClient(listener); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java index af93c1bfc0..73047cf961 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java @@ -22,7 +22,6 @@ package org.onap.so.bpmn.common.baseclient; import java.util.ArrayList; import java.util.List; - import org.onap.so.logging.jaxrs.filter.SpringClientFilter; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; @@ -35,18 +34,18 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestTemplate; -//TODO move to common location -public class BaseClient<I,O> { +// TODO move to common location +public class BaseClient<I, O> { + + private HttpHeaders httpHeader; + private String targetUrl; - private HttpHeaders httpHeader; - private String targetUrl; + public HttpHeaders getHttpHeader() { + return httpHeader; + } - public HttpHeaders getHttpHeader() { - return httpHeader; - } - public HttpHeaders setDefaultHttpHeaders(String auth) { - httpHeader = new HttpHeaders(); + httpHeader = new HttpHeaders(); httpHeader.set("Authorization", auth); httpHeader.setContentType(MediaType.APPLICATION_JSON); List<MediaType> acceptMediaTypes = new ArrayList<MediaType>(); @@ -56,34 +55,36 @@ public class BaseClient<I,O> { return httpHeader; } - public void setHttpHeader(HttpHeaders httpHeader) { - this.httpHeader = httpHeader; - } + public void setHttpHeader(HttpHeaders httpHeader) { + this.httpHeader = httpHeader; + } - public String getTargetUrl() { - return targetUrl; - } + public String getTargetUrl() { + return targetUrl; + } - public void setTargetUrl(String targetUrl) { - this.targetUrl = targetUrl; - } + public void setTargetUrl(String targetUrl) { + this.targetUrl = targetUrl; + } - public O get(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { - return run(data, HttpMethod.GET, typeRef, uriVariables); - } + public O get(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { + return run(data, HttpMethod.GET, typeRef, uriVariables); + } - public O post(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { - return run(data, HttpMethod.POST, typeRef, uriVariables); - } - - public O run(I data, HttpMethod method, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { - HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader()); - RestTemplate restTemplate = new RestTemplate(); - restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory())); - restTemplate.getInterceptors().add(new SpringClientFilter()); - ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef, - uriVariables); - return responseEntity.getBody(); - } + public O post(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException { + return run(data, HttpMethod.POST, typeRef, uriVariables); + } + + public O run(I data, HttpMethod method, ParameterizedTypeReference<O> typeRef, Object... uriVariables) + throws RestClientException { + HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader()); + RestTemplate restTemplate = new RestTemplate(); + restTemplate + .setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory())); + restTemplate.getInterceptors().add(new SpringClientFilter()); + ResponseEntity<O> responseEntity = + restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef, uriVariables); + return responseEntity.getBody(); + } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MalformedBuildingBlockInputException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MalformedBuildingBlockInputException.java index 1da989bfb7..cedb8ecc33 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MalformedBuildingBlockInputException.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MalformedBuildingBlockInputException.java @@ -21,27 +21,26 @@ package org.onap.so.bpmn.common.exceptions; public class MalformedBuildingBlockInputException extends RuntimeException { - private static final long serialVersionUID = -9168146273898271648L; + private static final long serialVersionUID = -9168146273898271648L; - public MalformedBuildingBlockInputException() { - super(); - } + public MalformedBuildingBlockInputException() { + super(); + } - public MalformedBuildingBlockInputException(String message) { - super(message); - } + public MalformedBuildingBlockInputException(String message) { + super(message); + } - public MalformedBuildingBlockInputException(String message, Throwable cause) { - super(message, cause); - } + public MalformedBuildingBlockInputException(String message, Throwable cause) { + super(message, cause); + } - public MalformedBuildingBlockInputException(Throwable cause) { - super(cause); - } + public MalformedBuildingBlockInputException(Throwable cause) { + super(cause); + } - protected MalformedBuildingBlockInputException(String message, Throwable cause, - boolean enableSuppression, - boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } + protected MalformedBuildingBlockInputException(String message, Throwable cause, boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MissingBuildingBlockInputException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MissingBuildingBlockInputException.java index 5ad28a5ba0..fdae8f64f8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MissingBuildingBlockInputException.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MissingBuildingBlockInputException.java @@ -21,27 +21,26 @@ package org.onap.so.bpmn.common.exceptions; public class MissingBuildingBlockInputException extends RuntimeException { - private static final long serialVersionUID = 7098084383189271401L; + private static final long serialVersionUID = 7098084383189271401L; - public MissingBuildingBlockInputException() { - super(); - } + public MissingBuildingBlockInputException() { + super(); + } - public MissingBuildingBlockInputException(String message) { - super(message); - } + public MissingBuildingBlockInputException(String message) { + super(message); + } - public MissingBuildingBlockInputException(String message, Throwable cause) { - super(message, cause); - } + public MissingBuildingBlockInputException(String message, Throwable cause) { + super(message, cause); + } - public MissingBuildingBlockInputException(Throwable cause) { - super(cause); - } + public MissingBuildingBlockInputException(Throwable cause) { + super(cause); + } - protected MissingBuildingBlockInputException(String message, Throwable cause, - boolean enableSuppression, - boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } + protected MissingBuildingBlockInputException(String message, Throwable cause, boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/RequiredExecutionVariableExeception.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/RequiredExecutionVariableExeception.java index 8c77bb445e..558ab27764 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/RequiredExecutionVariableExeception.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/RequiredExecutionVariableExeception.java @@ -22,17 +22,17 @@ package org.onap.so.bpmn.common.exceptions; public class RequiredExecutionVariableExeception extends Exception { - private static final long serialVersionUID = 5135274986874563746L; + private static final long serialVersionUID = 5135274986874563746L; - public RequiredExecutionVariableExeception(String message) { - super(message); - } - - public RequiredExecutionVariableExeception(String message, Throwable t) { - super(message, t); - } - - public RequiredExecutionVariableExeception(Throwable t) { - super(t); - } + public RequiredExecutionVariableExeception(String message) { + super(message); + } + + public RequiredExecutionVariableExeception(String message, Throwable t) { + super(message, t); + } + + public RequiredExecutionVariableExeception(Throwable t) { + super(t); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnIntegerParam.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnIntegerParam.java index 80479e19c0..8281fd9974 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnIntegerParam.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnIntegerParam.java @@ -23,26 +23,25 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class BpmnIntegerParam { - @JsonProperty("value") - private int value; - @JsonProperty("type") - private final String type = "Integer"; + @JsonProperty("value") + private int value; + @JsonProperty("type") + private final String type = "Integer"; - public BpmnIntegerParam() { - } + public BpmnIntegerParam() {} - @JsonProperty("value") - public int getValue() { - return value; - } + @JsonProperty("value") + public int getValue() { + return value; + } - @JsonProperty("type") - public void setValue(int value) { - this.value = value; - } + @JsonProperty("type") + public void setValue(int value) { + this.value = value; + } - @Override - public String toString() { - return "CamundaInput [value=" + Integer.toString(value) + ", type=" + type + "]"; - } + @Override + public String toString() { + return "CamundaInput [value=" + Integer.toString(value) + ", type=" + type + "]"; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnParam.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnParam.java index 01285cd5ec..79b0f415ff 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnParam.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnParam.java @@ -19,36 +19,37 @@ */ package org.onap.so.bpmn.common.recipe; + import com.fasterxml.jackson.annotation.JsonProperty; /** - * The bpmn workflow input param object + * The bpmn workflow input param object */ public class BpmnParam { - - @JsonProperty("value") - private String value; - @JsonProperty("type") - private String type = "String"; - - - public BpmnParam() { - /* Empty constructor */ - } - - @JsonProperty("value") - public String getValue() { - return value; - } - - @JsonProperty("value") - public void setValue(String value) { - this.value = value; - } - - @Override - public String toString() { - return "CamundaInput [value=" + value + ", type=" + type + "]"; - } - + + @JsonProperty("value") + private String value; + @JsonProperty("type") + private String type = "String"; + + + public BpmnParam() { + /* Empty constructor */ + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @JsonProperty("value") + public void setValue(String value) { + this.value = value; + } + + @Override + public String toString() { + return "CamundaInput [value=" + value + ", type=" + type + "]"; + } + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java index 526f5d5288..b9200e0640 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java @@ -24,9 +24,7 @@ package org.onap.so.bpmn.common.recipe; import java.io.IOException; import java.security.GeneralSecurityException; - import javax.xml.bind.DatatypeConverter; - import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; @@ -44,9 +42,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** - * Support to call resource recipes from the BPMN workflow. - * Such as call resource recipe in service workflow. - * <br> + * Support to call resource recipes from the BPMN workflow. Such as call resource recipe in service workflow. <br> * <p> * </p> * @@ -66,13 +62,13 @@ public class BpmnRestClient { public static final String CAMUNDA_AUTH = "mso.camundaAuth"; - private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; + private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; @Autowired private UrnPropertiesReader urnPropertiesReader; private static boolean noProperties = true; - //because for NS it will take a long time the time out of the resouce will be 2 hours. + // because for NS it will take a long time the time out of the resouce will be 2 hours. private static final String DEFAULT_TIME_OUT = "7200"; public synchronized final boolean getNoPropertiesState() { @@ -80,8 +76,7 @@ public class BpmnRestClient { } /** - * post the recipe Uri - * <br> + * post the recipe Uri <br> * * @param recipeUri The request recipe uri * @param requestId the request id @@ -96,36 +91,39 @@ public class BpmnRestClient { * @throws IOException * @since ONAP Beijing Release */ - public HttpResponse post(String recipeUri, String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType, - String requestDetails, String recipeParamXsd) throws ClientProtocolException, IOException { + public HttpResponse post(String recipeUri, String requestId, int recipeTimeout, String requestAction, + String serviceInstanceId, String serviceType, String requestDetails, String recipeParamXsd) + throws ClientProtocolException, IOException { HttpClient client = HttpClientBuilder.create().build(); HttpPost post = new HttpPost(recipeUri); - RequestConfig requestConfig = - RequestConfig.custom().setSocketTimeout(recipeTimeout).setConnectTimeout(recipeTimeout).setConnectionRequestTimeout(recipeTimeout).build(); + RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(recipeTimeout) + .setConnectTimeout(recipeTimeout).setConnectionRequestTimeout(recipeTimeout).build(); post.setConfig(requestConfig); logger.debug("call the bpmn, url: {}", recipeUri); - String jsonReq = wrapResourceRequest(requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, requestDetails, recipeParamXsd); + String jsonReq = wrapResourceRequest(requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, + requestDetails, recipeParamXsd); StringEntity input = new StringEntity(jsonReq); input.setContentType(CONTENT_TYPE_JSON); String encryptedCredentials; encryptedCredentials = urnPropertiesReader.getVariable(CAMUNDA_AUTH); - if(encryptedCredentials != null) { - String userCredentials = getEncryptedPropValue(encryptedCredentials, DEFAULT_BPEL_AUTH, ENCRYPTION_KEY_PROP); - if(userCredentials != null) { - post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes())); + if (encryptedCredentials != null) { + String userCredentials = + getEncryptedPropValue(encryptedCredentials, DEFAULT_BPEL_AUTH, ENCRYPTION_KEY_PROP); + if (userCredentials != null) { + post.addHeader("Authorization", + "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes())); } } - + post.setEntity(input); return client.execute(post); } /** - * prepare the resource recipe bpmn request. - * <br> + * prepare the resource recipe bpmn request. <br> * * @param requestId * @param recipeTimeout @@ -137,20 +135,20 @@ public class BpmnRestClient { * @return * @since ONAP Beijing Release */ - private String wrapResourceRequest(String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType, - String requestDetails, String recipeParams) { + private String wrapResourceRequest(String requestId, int recipeTimeout, String requestAction, + String serviceInstanceId, String serviceType, String requestDetails, String recipeParams) { String jsonReq = null; - if(requestId == null) { + if (requestId == null) { requestId = ""; } - if(requestAction == null) { + if (requestAction == null) { requestAction = ""; } - if(serviceInstanceId == null) { + if (serviceInstanceId == null) { serviceInstanceId = ""; } - if(requestDetails == null) { + if (requestDetails == null) { requestDetails = ""; } @@ -182,9 +180,9 @@ public class BpmnRestClient { recipeRequest.setRecipeTimeout(recipeTimeoutInput); jsonReq = recipeRequest.toString(); logger.trace("request body is {}", jsonReq); - } catch(Exception e) { + } catch (Exception e) { logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest", - ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); + ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); } return jsonReq; } @@ -201,7 +199,7 @@ public class BpmnRestClient { protected String getEncryptedPropValue(String prop, String defaultValue, String encryptionKey) { try { return CryptoUtils.decrypt(prop, urnPropertiesReader.getVariable(encryptionKey)); - } catch(GeneralSecurityException e) { + } catch (GeneralSecurityException e) { logger.debug("Security exception", e); } return defaultValue; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java index 2119b2dfa8..2bb024897c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java @@ -22,7 +22,6 @@ package org.onap.so.bpmn.common.recipe; import org.onap.so.bpmn.core.domain.ModelInfo; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonRootName; @@ -33,57 +32,58 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * the inputs for the resource recipe - * <br> + * the inputs for the resource recipe <br> * <p> * </p> * * @author - * @version ONAP Beijing Release 2018-03-08 + * @version ONAP Beijing Release 2018-03-08 */ -@JsonPropertyOrder({"resourceInstanceName", "resourceInstanceDes", "globalSubscriberId", "serviceType", "serviceId", "operationId", "serviceModelInfo","resourceModelInfo", "resourceInstancenUuid","resourceParameters","operationType"}) +@JsonPropertyOrder({"resourceInstanceName", "resourceInstanceDes", "globalSubscriberId", "serviceType", "serviceId", + "operationId", "serviceModelInfo", "resourceModelInfo", "resourceInstancenUuid", "resourceParameters", + "operationType"}) @JsonRootName("variables") public class ResourceInput { - private static Logger logger = LoggerFactory.getLogger(ResourceInput.class); - + private static Logger logger = LoggerFactory.getLogger(ResourceInput.class); + @JsonProperty("resourceInstanceName") private String resourceInstanceName; - + @JsonProperty("resourceInstanceDes") private String resourceInstanceDes; - + @JsonProperty("globalSubscriberId") private String globalSubscriberId; - + @JsonProperty("serviceType") private String serviceType; - + @JsonProperty("serviceInstanceId") private String serviceInstanceId; - + @JsonProperty("operationId") private String operationId; - + @JsonProperty("serviceModelInfo") private ModelInfo serviceModelInfo; - + @JsonProperty("resourceModelInfo") private ModelInfo resourceModelInfo; - - //for delete resource + + // for delete resource @JsonProperty("resourceInstancenUuid") private String resourceInstancenUuid; - + @JsonProperty("resourceParameters") private String resourceParameters; - + @JsonProperty("requestsInputs") private String requestsInputs; - + @JsonProperty("operationType") private String operationType; - + /** * @return Returns the requestsInputs. */ @@ -92,7 +92,7 @@ public class ResourceInput { return requestsInputs; } - + /** * @param requestsInputs The requestsInputs to set. */ @@ -101,7 +101,7 @@ public class ResourceInput { this.requestsInputs = requestsInputs; } - + /** * @return Returns the resourceInstanceName. */ @@ -110,7 +110,7 @@ public class ResourceInput { return resourceInstanceName; } - + /** * @param resourceInstanceName The resourceInstanceName to set. */ @@ -119,7 +119,7 @@ public class ResourceInput { this.resourceInstanceName = resourceInstanceName; } - + /** * @return Returns the resourceInstanceDes. */ @@ -128,7 +128,7 @@ public class ResourceInput { return resourceInstanceDes; } - + /** * @param resourceInstanceDes The resourceInstanceDes to set. */ @@ -137,7 +137,7 @@ public class ResourceInput { this.resourceInstanceDes = resourceInstanceDes; } - + /** * @return Returns the globalSubscriberId. */ @@ -146,7 +146,7 @@ public class ResourceInput { return globalSubscriberId; } - + /** * @param globalSubscriberId The globalSubscriberId to set. */ @@ -155,7 +155,7 @@ public class ResourceInput { this.globalSubscriberId = globalSubscriberId; } - + /** * @return Returns the serviceType. */ @@ -164,7 +164,7 @@ public class ResourceInput { return serviceType; } - + /** * @param serviceType The serviceType to set. */ @@ -173,7 +173,7 @@ public class ResourceInput { this.serviceType = serviceType; } - + /** * @return Returns the serviceId. */ @@ -182,7 +182,7 @@ public class ResourceInput { return serviceInstanceId; } - + /** * @param serviceId The serviceId to set. */ @@ -191,7 +191,7 @@ public class ResourceInput { this.serviceInstanceId = serviceId; } - + /** * @return Returns the operationId. */ @@ -200,7 +200,7 @@ public class ResourceInput { return operationId; } - + /** * @param operationId The operationId to set. */ @@ -208,7 +208,7 @@ public class ResourceInput { public void setOperationId(String operationId) { this.operationId = operationId; } - + /** * @return Returns the serviceModelInfo. */ @@ -218,7 +218,7 @@ public class ResourceInput { } - + /** * @param serviceModelInfo The serviceModelInfo to set. */ @@ -228,7 +228,7 @@ public class ResourceInput { } - + /** * @return Returns the resourceModelInfo. */ @@ -238,7 +238,7 @@ public class ResourceInput { } - + /** * @param resourceModelInfo The resourceModelInfo to set. */ @@ -256,7 +256,7 @@ public class ResourceInput { return resourceParameters; } - + /** * @param resourceParameters The resourceParameters to set. */ @@ -265,7 +265,7 @@ public class ResourceInput { this.resourceParameters = resourceParameters; } - + /** * @return Returns the operationType. */ @@ -274,7 +274,7 @@ public class ResourceInput { return operationType; } - + /** * @param operationType The operationType to set. */ @@ -284,7 +284,7 @@ public class ResourceInput { } - + /** * @return Returns the resourceInstancenUuid. */ @@ -294,7 +294,7 @@ public class ResourceInput { } - + /** * @param resourceInstancenUuid The resourceInstancenUuid to set. */ @@ -302,7 +302,7 @@ public class ResourceInput { public void setResourceInstancenUuid(String resourceInstancenUuid) { this.resourceInstancenUuid = resourceInstancenUuid; } - + @Override public String toString() { ObjectMapper mapper = new ObjectMapper(); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java index d1e26582a3..729793893b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java @@ -32,15 +32,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * java object of the resource recipe , it - * will be passed to the Camunda process + * java object of the resource recipe , it will be passed to the Camunda process */ -@JsonPropertyOrder({"resourceInput", "host", "requestId", "requestAction", "serviceInstanceId", "serviceType", "recipeParams"}) +@JsonPropertyOrder({"resourceInput", "host", "requestId", "requestAction", "serviceInstanceId", "serviceType", + "recipeParams"}) @JsonRootName("variables") public class ResourceRecipeRequest { - private static Logger logger = LoggerFactory.getLogger(ResourceRecipeRequest.class); - + private static Logger logger = LoggerFactory.getLogger(ResourceRecipeRequest.class); + @JsonProperty("resourceInput") private BpmnParam resourceInput; @@ -64,7 +64,7 @@ public class ResourceRecipeRequest { @JsonProperty("mso-service-request-timeout") private BpmnIntegerParam recipeTimeout; - + @JsonProperty("resourceInput") public BpmnParam getResourceInput() { return resourceInput; @@ -137,24 +137,24 @@ public class ResourceRecipeRequest { @JsonProperty("mso-service-request-timeout") public BpmnIntegerParam getRecipeTimeout() { - return recipeTimeout; - } - + return recipeTimeout; + } + @JsonProperty("mso-service-request-timeout") - public void setRecipeTimeout(BpmnIntegerParam recipeTimeout) { - this.recipeTimeout = recipeTimeout; - } + public void setRecipeTimeout(BpmnIntegerParam recipeTimeout) { + this.recipeTimeout = recipeTimeout; + } - @Override + @Override public String toString() { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - String jsonStr = "ResourceRecipeRequest"; - try { - jsonStr = mapper.writeValueAsString(this); - } catch (JsonProcessingException e) { - logger.error("JsonProcessingException", e); - } + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + String jsonStr = "ResourceRecipeRequest"; + try { + jsonStr = mapper.writeValueAsString(this); + } catch (JsonProcessingException e) { + logger.error("JsonProcessingException", e); + } return jsonStr; } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index 03f56b31f6..e7ab6e4606 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -29,17 +29,14 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; - import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; - import org.camunda.bpm.engine.runtime.Execution; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; import org.onap.so.utils.TargetEntity; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -58,7 +55,7 @@ public class ResourceRequestBuilder { static JsonUtils jsonUtil = new JsonUtils(); - public static List<String> getResourceSequence(String serviceUuid) { + public static List<String> getResourceSequence(String serviceUuid) { List<String> resourceSequence = new ArrayList(); try { @@ -69,7 +66,7 @@ public class ResourceRequestBuilder { if (serviceResources.containsKey("resourceOrder")) { String resourceOrder = (String) serviceResources.get("resourceOrder"); - if (resourceOrder!= null) { + if (resourceOrder != null) { resourceSequence.addAll(Arrays.asList(resourceOrder.split(","))); } } @@ -78,32 +75,35 @@ public class ResourceRequestBuilder { logger.error("not able to retrieve service order."); } return resourceSequence; - } - - /* build the resource Parameters detail. - * It's a json string for resource instantiant - * { - * "locationConstraints":[...] - * "requestInputs":{K,V} - * } - * <br> + } + + /* + * build the resource Parameters detail. It's a json string for resource instantiant { "locationConstraints":[...] + * "requestInputs":{K,V} } <br> * * @param execution Execution context + * * @param serviceUuid The service template uuid + * * @param resourceCustomizationUuid The resource customization uuid + * * @param serviceParameters the service parameters passed from the API + * * @return the resource instantiate parameters + * * @since ONAP Beijing Release */ @SuppressWarnings("unchecked") - public static String buildResourceRequestParameters(Execution execution, String serviceUuid, String resourceCustomizationUuid, String serviceParameters) { - List<String> resourceList = jsonUtil.StringArrayToList(execution, (String)JsonUtils.getJsonValue(serviceParameters, "resources")); - //Get the right location str for resource. default is an empty array. - String locationConstraints ="[]"; + public static String buildResourceRequestParameters(Execution execution, String serviceUuid, + String resourceCustomizationUuid, String serviceParameters) { + List<String> resourceList = + jsonUtil.StringArrayToList(execution, (String) JsonUtils.getJsonValue(serviceParameters, "resources")); + // Get the right location str for resource. default is an empty array. + String locationConstraints = "[]"; String resourceInputsFromUui = ""; - for(String resource: resourceList){ - String resCusUuid = (String)JsonUtils.getJsonValue(resource, "resourceCustomizationUuid"); - if(resourceCustomizationUuid.equals(resCusUuid)){ + for (String resource : resourceList) { + String resCusUuid = (String) JsonUtils.getJsonValue(resource, "resourceCustomizationUuid"); + if (resourceCustomizationUuid.equals(resCusUuid)) { String resourceParameters = JsonUtils.getJsonValue(resource, "parameters"); locationConstraints = JsonUtils.getJsonValue(resourceParameters, "locationConstraints"); resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs"); @@ -111,7 +111,8 @@ public class ResourceRequestBuilder { } Map<String, Object> serviceInput = null; if (JsonUtils.getJsonValue(serviceParameters, "requestInputs") != null) { - serviceInput = getJsonObject((String)JsonUtils.getJsonValue(serviceParameters, "requestInputs"), Map.class); + serviceInput = + getJsonObject((String) JsonUtils.getJsonValue(serviceParameters, "requestInputs"), Map.class); } Map<String, Object> resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class); @@ -124,42 +125,45 @@ public class ResourceRequestBuilder { resourceInputsFromUuiMap = new HashMap(); } - Map<String, Object> resourceInputsFromServiceDeclaredLevel = buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput); + Map<String, Object> resourceInputsFromServiceDeclaredLevel = + buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput); resourceInputsFromUuiMap.putAll(resourceInputsFromServiceDeclaredLevel); String resourceInputsStr = getJsonString(resourceInputsFromUuiMap); - String result = "{\n" - + "\"locationConstraints\":" + locationConstraints +",\n" - + "\"requestInputs\":" + resourceInputsStr +"\n" - +"}"; + String result = "{\n" + "\"locationConstraints\":" + locationConstraints + ",\n" + "\"requestInputs\":" + + resourceInputsStr + "\n" + "}"; return result; } @SuppressWarnings("unchecked") - public static Map<String, Object> buildResouceRequest(String serviceUuid, String resourceCustomizationUuid, Map<String, Object> serviceInputs) { + public static Map<String, Object> buildResouceRequest(String serviceUuid, String resourceCustomizationUuid, + Map<String, Object> serviceInputs) { try { Map<String, Object> serviceInstnace = getServiceInstnace(serviceUuid); // find match of customization uuid in vnf - Map<String, Map<String, Object>> serviceResources = (Map<String, Map<String, Object>>) serviceInstnace.get("serviceResources"); + Map<String, Map<String, Object>> serviceResources = + (Map<String, Map<String, Object>>) serviceInstnace.get("serviceResources"); List<Map<String, Object>> serviceVnfCust = (List<Map<String, Object>>) serviceResources.get("serviceVnfs"); String resourceInputStr = getResourceInputStr(serviceVnfCust, resourceCustomizationUuid); // find match in network resource if (resourceInputStr == null) { - List<Map<String, Object>> serviceNetworkCust = (List<Map<String, Object>>) serviceResources.get("serviceNetworks"); + List<Map<String, Object>> serviceNetworkCust = + (List<Map<String, Object>>) serviceResources.get("serviceNetworks"); resourceInputStr = getResourceInputStr(serviceNetworkCust, resourceCustomizationUuid); // find match in AR resource if (resourceInputStr == null) { - List<Map<String, Object>> serviceArCust = (List<Map<String, Object>>) serviceResources.get("serviceAllottedResources"); + List<Map<String, Object>> serviceArCust = + (List<Map<String, Object>>) serviceResources.get("serviceAllottedResources"); resourceInputStr = getResourceInputStr(serviceArCust, resourceCustomizationUuid); } } - if (resourceInputStr != null && !resourceInputStr.isEmpty()) { + if (resourceInputStr != null && !resourceInputStr.isEmpty()) { return getResourceInput(resourceInputStr, serviceInputs); - } + } } catch (Exception e) { logger.error("not able to retrieve service instance"); @@ -182,11 +186,11 @@ public class ResourceRequestBuilder { // this method combines resource input with service input private static Map<String, Object> getResourceInput(String resourceInputStr, Map<String, Object> serviceInputs) { Gson gson = new Gson(); - Type type = new TypeToken<Map<String, String>>(){}.getType(); + Type type = new TypeToken<Map<String, String>>() {}.getType(); Map<String, Object> resourceInput = gson.fromJson(resourceInputStr, type); // replace value if key is available in service input - for (String key: resourceInput.keySet()) { + for (String key : resourceInput.keySet()) { String value = (String) resourceInput.get(key); if (value.contains("|")) { @@ -199,7 +203,7 @@ public class ResourceRequestBuilder { value = split[1]; } } - resourceInput.put(key,value); + resourceInput.put(key, value); } return resourceInput; } @@ -207,8 +211,8 @@ public class ResourceRequestBuilder { public static Map<String, Object> getServiceInstnace(String uuid) throws Exception { String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint"); - HttpClient client = new HttpClientFactory().newJsonClient( - UriBuilder.fromUri(catalogEndPoint).path(SERVICE_URL_SERVICE_INSTANCE).queryParam("serviceModelUuid", uuid).build().toURL(), + HttpClient client = new HttpClientFactory().newJsonClient(UriBuilder.fromUri(catalogEndPoint) + .path(SERVICE_URL_SERVICE_INSTANCE).queryParam("serviceModelUuid", uuid).build().toURL(), TargetEntity.CATALOG_DB); client.addAdditionalHeader("Accept", "application/json"); @@ -234,7 +238,7 @@ public class ResourceRequestBuilder { return null; } - public static String getJsonString(Object srcObj) { + public static String getJsonString(Object srcObj) { ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); String jsonStr = null; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java index 0fd0d9297d..dc2b3be073 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java @@ -22,50 +22,50 @@ */ package org.onap.so.bpmn.common.util; + import java.io.IOException; import java.security.GeneralSecurityException; import java.util.Properties; import org.onap.so.utils.CryptoUtils; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class CryptoHandler implements ICryptoHandler { - private static final Logger logger = LoggerFactory.getLogger(CryptoHandler.class); - private static final String GENERAL_SECURITY_EXCEPTION_PREFIX = "GeneralSecurityException :"; - private static final String MSO_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; - private static final String PROPERTY_KEY = "mso.AaiEncrypted.Pwd"; + private static final Logger logger = LoggerFactory.getLogger(CryptoHandler.class); + private static final String GENERAL_SECURITY_EXCEPTION_PREFIX = "GeneralSecurityException :"; + private static final String MSO_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + private static final String PROPERTY_KEY = "mso.AaiEncrypted.Pwd"; @Override - public String getMsoAaiPassword() { - Properties keyProp = new Properties (); - try { - keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("urn.properties")); - return CryptoUtils.decrypt((String) keyProp.get(PROPERTY_KEY), MSO_KEY); - } catch (GeneralSecurityException | IOException e) { - logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); - return null; - } - } + public String getMsoAaiPassword() { + Properties keyProp = new Properties(); + try { + keyProp.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("urn.properties")); + return CryptoUtils.decrypt((String) keyProp.get(PROPERTY_KEY), MSO_KEY); + } catch (GeneralSecurityException | IOException e) { + logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); + return null; + } + } - @Override - public String encryptMsoPassword(String plainMsoPwd) { - try { - return CryptoUtils.encrypt(plainMsoPwd, MSO_KEY); - } catch (GeneralSecurityException e) { - logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); - return null; - } - } + @Override + public String encryptMsoPassword(String plainMsoPwd) { + try { + return CryptoUtils.encrypt(plainMsoPwd, MSO_KEY); + } catch (GeneralSecurityException e) { + logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); + return null; + } + } - @Override - public String decryptMsoPassword(String encryptedPwd) { - try { - return CryptoUtils.decrypt(encryptedPwd, MSO_KEY); - } catch (GeneralSecurityException e) { - logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); - return null; - } - } + @Override + public String decryptMsoPassword(String encryptedPwd) { + try { + return CryptoUtils.decrypt(encryptedPwd, MSO_KEY); + } catch (GeneralSecurityException e) { + logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e); + return null; + } + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java index 6314a849d2..479d2e82bd 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java @@ -21,7 +21,9 @@ package org.onap.so.bpmn.common.util; public interface ICryptoHandler { - public String getMsoAaiPassword(); - public String encryptMsoPassword(String plainPwd); - public String decryptMsoPassword(String encryptedPwd); + public String getMsoAaiPassword(); + + public String encryptMsoPassword(String plainPwd); + + public String decryptMsoPassword(String encryptedPwd); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java index 6b178bd215..f25d4b440a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java @@ -28,7 +28,6 @@ import org.onap.so.db.catalog.beans.HomingInstance; import org.onap.so.db.catalog.client.CatalogDbClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import java.util.Optional; public class OofInfraUtils { @@ -50,13 +49,13 @@ public class OofInfraUtils { CatalogDbClient client = new CatalogDbClient(endpoint, auth); - getCloudsite = Optional.ofNullable(client.getCloudSite(cloudSite.getId(), endpoint + "/cloudSite/")).orElse(new CloudSite()); + getCloudsite = Optional.ofNullable(client.getCloudSite(cloudSite.getId(), endpoint + "/cloudSite/")) + .orElse(new CloudSite()); if (!cloudSite.getId().equals(getCloudsite.getId())) { client.postCloudSite(cloudSite); logger.debug("Did not findd cloudsite : {}", cloudSite.getId()); logger.debug("Will create cloudSite: {}", cloudSite.toString()); - } - else { + } else { logger.debug("Found cloudsite : {}", cloudSite.getId()); logger.debug("Will not create cloudSite: {}", cloudSite.toString()); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java index a5d871eeef..a8e43c51e5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java @@ -27,10 +27,8 @@ import java.util.HashMap; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; - import javax.annotation.PostConstruct; import javax.annotation.Priority; - import org.camunda.bpm.engine.delegate.BpmnError; import org.javatuples.Pair; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -46,29 +44,31 @@ import org.springframework.stereotype.Component; /** * Controls running all pre and post validation for building blocks. * - * To define a validation you must make it a spring bean and implement either {@link org.onap.so.bpmn.common.validation.PreBuildingBlockValidator} or - * {@link org.onap.so.bpmn.common.validation.PostBuildingBlockValidator} your validation will automatically be - * run by this class. + * To define a validation you must make it a spring bean and implement either + * {@link org.onap.so.bpmn.common.validation.PreBuildingBlockValidator} or + * {@link org.onap.so.bpmn.common.validation.PostBuildingBlockValidator} your validation will automatically be run by + * this class. * */ @Component -public class BuildingBlockValidatorRunner extends FlowValidatorRunner<PreBuildingBlockValidator, PostBuildingBlockValidator> { - - @PostConstruct - protected void init() { - - preFlowValidators = new ArrayList<>( - Optional.ofNullable(context.getBeansOfType(PreBuildingBlockValidator.class)).orElse(new HashMap<>()).values()); - postFlowValidators = new ArrayList<>( - Optional.ofNullable(context.getBeansOfType(PostBuildingBlockValidator.class)).orElse(new HashMap<>()).values()); - } - - protected List<PreBuildingBlockValidator> getPreFlowValidators() { - return this.preFlowValidators; - } - - protected List<PostBuildingBlockValidator> getPostFlowValidators() { - return this.postFlowValidators; - } - +public class BuildingBlockValidatorRunner + extends FlowValidatorRunner<PreBuildingBlockValidator, PostBuildingBlockValidator> { + + @PostConstruct + protected void init() { + + preFlowValidators = new ArrayList<>(Optional.ofNullable(context.getBeansOfType(PreBuildingBlockValidator.class)) + .orElse(new HashMap<>()).values()); + postFlowValidators = new ArrayList<>(Optional + .ofNullable(context.getBeansOfType(PostBuildingBlockValidator.class)).orElse(new HashMap<>()).values()); + } + + protected List<PreBuildingBlockValidator> getPreFlowValidators() { + return this.preFlowValidators; + } + + protected List<PostBuildingBlockValidator> getPostFlowValidators() { + return this.postFlowValidators; + } + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java index c457a349c2..66a8de9f8b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java @@ -22,24 +22,24 @@ package org.onap.so.bpmn.common.validation; import java.util.Optional; import java.util.Set; - import org.onap.so.bpmn.common.BuildingBlockExecution; public interface FlowValidator { - /** - * Should this validator run for given bb - * @return - */ - public boolean shouldRunFor(String bbName); - - /** - * Determines whether or not the workflow should be executed + /** + * Should this validator run for given bb + * + * @return + */ + public boolean shouldRunFor(String bbName); + + /** + * Determines whether or not the workflow should be executed + * + * + * @param execution + * @return + */ + public Optional<String> validate(BuildingBlockExecution execution); - * - * @param execution - * @return - */ - public Optional<String> validate(BuildingBlockExecution execution); - } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java index 2cc6415a50..0bdf4e35a2 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java @@ -26,9 +26,7 @@ import java.util.Comparator; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; - import javax.annotation.Priority; - import org.camunda.bpm.engine.delegate.DelegateExecution; import org.javatuples.Pair; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -45,116 +43,119 @@ import org.springframework.stereotype.Component; /** * Controls running all pre and post validation for flows. * - * To define a validation you must make it a spring bean and implement either {@link org.onap.so.bpmn.common.validation.PreFlowValidator} or - * {@link org.onap.so.bpmn.common.validation.PostFlowValidator} your validation will automatically be - * run by this class. + * To define a validation you must make it a spring bean and implement either + * {@link org.onap.so.bpmn.common.validation.PreFlowValidator} or + * {@link org.onap.so.bpmn.common.validation.PostFlowValidator} your validation will automatically be run by this class. * */ @Component public abstract class FlowValidatorRunner<S extends FlowValidator, E extends FlowValidator> { - private static Logger logger = LoggerFactory.getLogger(FlowValidatorRunner.class); - @Autowired - protected ApplicationContext context; - - @Autowired - protected ExceptionBuilder exceptionBuilder; - - protected List<S> preFlowValidators; - protected List<E> postFlowValidators; - - - - /** - * Changed to object because JUEL does not support overloaded methods - * - * @param bbName - * @param execution - * @return - */ - public boolean preValidate(String bbName, Object execution) { - return validateHelper(bbName, preFlowValidators, execution); - } - - /** - * Changed to object because JUEL does not support overloaded methods - * - * @param bbName - * @param execution - * @return - */ - public boolean postValidate(String bbName, Object execution) { - return validateHelper(bbName, postFlowValidators, execution); - } - - protected boolean validateHelper(String bbName, List<? extends FlowValidator> validators, Object obj) { - - if (obj instanceof DelegateExecution) { - return validate(validators, bbName, new DelegateExecutionImpl((DelegateExecution)obj)); - } else if (obj instanceof BuildingBlockExecution) { - return validate(validators, bbName, (BuildingBlockExecution)obj); - } else { - return false; - } - } - - protected boolean validate(List<? extends FlowValidator> validators, String bbName, BuildingBlockExecution execution) { - List<Pair<String, Optional<String>>> results = runValidations(validators, bbName, execution); - - if (!results.isEmpty()) { - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, - "Failed Validations:\n" + results.stream().map(item -> String.format("%s: %s", item.getValue0(), item.getValue1().get())).collect(Collectors.joining("\n"))); - } - - return true; - - } - protected List<Pair<String, Optional<String>>> runValidations(List<? extends FlowValidator> validators, String bbName, BuildingBlockExecution execution) { - - List<FlowValidator> filtered = filterValidators(validators, bbName); - - List<Pair<String,Optional<String>>> results = new ArrayList<>(); - filtered.forEach(item -> results.add(new Pair<>(item.getClass().getName(), item.validate(execution)))); - - return results.stream().filter(item -> item.getValue1().isPresent()).collect(Collectors.toList()); - } - - protected List<FlowValidator> filterValidators(List<? extends FlowValidator> validators, String bbName) { - return validators.stream() - .filter(item -> { - return !item.getClass().isAnnotationPresent(Skip.class) && item.shouldRunFor(bbName); - }) - .sorted(Comparator.comparing(item -> { - Priority p = Optional.ofNullable(item.getClass().getAnnotation(Priority.class)).orElse(new Priority() { - public int value() { - return 1000; - } - - @Override - public Class<? extends Annotation> annotationType() { - return Priority.class; - } - }); - return p.value(); - })).collect(Collectors.toList()); - } - - protected <T> List<T> buildalidatorList(Reflections reflections, Class<T> clazz) { - List<T> result = new ArrayList<>(); - try { - for (Class<? extends T> klass : reflections.getSubTypesOf(clazz)) { - result.add(klass.newInstance()); - } - } catch (InstantiationException | IllegalAccessException e) { - logger.error("failed to build validator list for {}", clazz.getName(), e); - throw new RuntimeException(e); - } - - return result; - } - - protected abstract List<S> getPreFlowValidators(); - - protected abstract List<E> getPostFlowValidators(); - + private static Logger logger = LoggerFactory.getLogger(FlowValidatorRunner.class); + @Autowired + protected ApplicationContext context; + + @Autowired + protected ExceptionBuilder exceptionBuilder; + + protected List<S> preFlowValidators; + protected List<E> postFlowValidators; + + + + /** + * Changed to object because JUEL does not support overloaded methods + * + * @param bbName + * @param execution + * @return + */ + public boolean preValidate(String bbName, Object execution) { + return validateHelper(bbName, preFlowValidators, execution); + } + + /** + * Changed to object because JUEL does not support overloaded methods + * + * @param bbName + * @param execution + * @return + */ + public boolean postValidate(String bbName, Object execution) { + return validateHelper(bbName, postFlowValidators, execution); + } + + protected boolean validateHelper(String bbName, List<? extends FlowValidator> validators, Object obj) { + + if (obj instanceof DelegateExecution) { + return validate(validators, bbName, new DelegateExecutionImpl((DelegateExecution) obj)); + } else if (obj instanceof BuildingBlockExecution) { + return validate(validators, bbName, (BuildingBlockExecution) obj); + } else { + return false; + } + } + + protected boolean validate(List<? extends FlowValidator> validators, String bbName, + BuildingBlockExecution execution) { + List<Pair<String, Optional<String>>> results = runValidations(validators, bbName, execution); + + if (!results.isEmpty()) { + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, + "Failed Validations:\n" + results.stream() + .map(item -> String.format("%s: %s", item.getValue0(), item.getValue1().get())) + .collect(Collectors.joining("\n"))); + } + + return true; + + } + + protected List<Pair<String, Optional<String>>> runValidations(List<? extends FlowValidator> validators, + String bbName, BuildingBlockExecution execution) { + + List<FlowValidator> filtered = filterValidators(validators, bbName); + + List<Pair<String, Optional<String>>> results = new ArrayList<>(); + filtered.forEach(item -> results.add(new Pair<>(item.getClass().getName(), item.validate(execution)))); + + return results.stream().filter(item -> item.getValue1().isPresent()).collect(Collectors.toList()); + } + + protected List<FlowValidator> filterValidators(List<? extends FlowValidator> validators, String bbName) { + return validators.stream().filter(item -> { + return !item.getClass().isAnnotationPresent(Skip.class) && item.shouldRunFor(bbName); + }).sorted(Comparator.comparing(item -> { + Priority p = Optional.ofNullable(item.getClass().getAnnotation(Priority.class)).orElse(new Priority() { + public int value() { + return 1000; + } + + @Override + public Class<? extends Annotation> annotationType() { + return Priority.class; + } + }); + return p.value(); + })).collect(Collectors.toList()); + } + + protected <T> List<T> buildalidatorList(Reflections reflections, Class<T> clazz) { + List<T> result = new ArrayList<>(); + try { + for (Class<? extends T> klass : reflections.getSubTypesOf(clazz)) { + result.add(klass.newInstance()); + } + } catch (InstantiationException | IllegalAccessException e) { + logger.error("failed to build validator list for {}", clazz.getName(), e); + throw new RuntimeException(e); + } + + return result; + } + + protected abstract List<S> getPreFlowValidators(); + + protected abstract List<E> getPostFlowValidators(); + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java index d8c8601865..6950618953 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java @@ -27,10 +27,8 @@ import java.util.HashMap; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; - import javax.annotation.PostConstruct; import javax.annotation.Priority; - import org.camunda.bpm.engine.delegate.DelegateExecution; import org.javatuples.Pair; import org.onap.so.client.exception.ExceptionBuilder; @@ -45,29 +43,30 @@ import org.springframework.stereotype.Component; /** * Controls running all pre and post validation for workflows. * - * To define a validation you must make it a spring bean and implement either {@link org.onap.so.bpmn.common.validation.PreWorkflowValidator} or - * {@link org.onap.so.bpmn.common.validation.PostWorkflowValidator} your validation will automatically be - * run by this class. + * To define a validation you must make it a spring bean and implement either + * {@link org.onap.so.bpmn.common.validation.PreWorkflowValidator} or + * {@link org.onap.so.bpmn.common.validation.PostWorkflowValidator} your validation will automatically be run by this + * class. * */ @Component public class WorkflowValidatorRunner extends FlowValidatorRunner<PreWorkflowValidator, PostWorkflowValidator> { - @PostConstruct - protected void init() { - - preFlowValidators = new ArrayList<>( - Optional.ofNullable(context.getBeansOfType(PreWorkflowValidator.class)).orElse(new HashMap<>()).values()); - postFlowValidators = new ArrayList<>( - Optional.ofNullable(context.getBeansOfType(PostWorkflowValidator.class)).orElse(new HashMap<>()).values()); - } + @PostConstruct + protected void init() { + + preFlowValidators = new ArrayList<>(Optional.ofNullable(context.getBeansOfType(PreWorkflowValidator.class)) + .orElse(new HashMap<>()).values()); + postFlowValidators = new ArrayList<>(Optional.ofNullable(context.getBeansOfType(PostWorkflowValidator.class)) + .orElse(new HashMap<>()).values()); + } + + protected List<PreWorkflowValidator> getPreFlowValidators() { + return this.preFlowValidators; + } + + protected List<PostWorkflowValidator> getPostFlowValidators() { + return this.postFlowValidators; + } - protected List<PreWorkflowValidator> getPreFlowValidators() { - return this.preFlowValidators; - } - - protected List<PostWorkflowValidator> getPostFlowValidators() { - return this.postFlowValidators; - } - } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowCallbackResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowCallbackResponse.java index 13d2126805..2a64b1ad2f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowCallbackResponse.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowCallbackResponse.java @@ -21,32 +21,36 @@ package org.onap.so.bpmn.common.workflow.context; /** - * @version 1.0 - * Workflow Response bean to generate workflow response in JSON format + * @version 1.0 Workflow Response bean to generate workflow response in JSON format */ public class WorkflowCallbackResponse { - - private String response; - private int statusCode; - private String message; - - public String getResponse() { - return response; - } - public void setResponse(String response) { - this.response = response; - } - public int getStatusCode() { - return statusCode; - } - public void setStatusCode(int statusCode) { - this.statusCode = statusCode; - } - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } + + private String response; + private int statusCode; + private String message; + + public String getResponse() { + return response; + } + + public void setResponse(String response) { + this.response = response; + } + + public int getStatusCode() { + return statusCode; + } + + public void setStatusCode(int statusCode) { + this.statusCode = statusCode; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContext.java index 3ec7773791..2a10271e67 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContext.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContext.java @@ -26,73 +26,72 @@ import java.util.concurrent.TimeUnit; /** - * @version 1.0 - * Workflow context object used to send timeout response, if workflow instance does not write the response in time + * @version 1.0 Workflow context object used to send timeout response, if workflow instance does not write the response + * in time */ public class WorkflowContext implements Delayed { - private final String processKey; - private final String requestId; - - private final long startTime; - private final long timeout; - - private final WorkflowResponse workflowResponse; - - public WorkflowContext(String processKey, String requestId, long timeout, WorkflowResponse workflowResponse) { - this.processKey = processKey; - this.requestId = requestId; - this.timeout = timeout; - this.startTime = System.currentTimeMillis(); - this.workflowResponse = workflowResponse; - } - - public String getRequestId() { - return requestId; - } - - public String getProcessKey() { - return processKey; - } - - - public long getTimeout() { - return timeout; - } - - public long getStartTime() { - return startTime; - } - - public WorkflowResponse getWorkflowResponse() { - return workflowResponse; - } - - /** - * Required implementation by Delay queue - * Returns the elapsed time for this context - */ - @Override - public long getDelay(TimeUnit unit) { - // 0 or negative means this object is considered to be expired - return unit.convert(startTime + timeout - System.currentTimeMillis(), unit); - } - - /** - * Required implementation by Delay queue - * Compares the object to determine whether the object can be marked as expired - */ - @Override - public int compareTo(Delayed object) { - WorkflowContext that = (WorkflowContext) object; - long thisEndTime = startTime + timeout; - long thatEndTime = that.startTime + that.timeout; - - if (thisEndTime < thatEndTime) { - return -1; - } else if (thisEndTime > thatEndTime) { - return 1; - } else { - return 0; - } - } + private final String processKey; + private final String requestId; + + private final long startTime; + private final long timeout; + + private final WorkflowResponse workflowResponse; + + public WorkflowContext(String processKey, String requestId, long timeout, WorkflowResponse workflowResponse) { + this.processKey = processKey; + this.requestId = requestId; + this.timeout = timeout; + this.startTime = System.currentTimeMillis(); + this.workflowResponse = workflowResponse; + } + + public String getRequestId() { + return requestId; + } + + public String getProcessKey() { + return processKey; + } + + + public long getTimeout() { + return timeout; + } + + public long getStartTime() { + return startTime; + } + + public WorkflowResponse getWorkflowResponse() { + return workflowResponse; + } + + /** + * Required implementation by Delay queue Returns the elapsed time for this context + */ + @Override + public long getDelay(TimeUnit unit) { + // 0 or negative means this object is considered to be expired + return unit.convert(startTime + timeout - System.currentTimeMillis(), unit); + } + + /** + * Required implementation by Delay queue Compares the object to determine whether the object can be marked as + * expired + */ + @Override + public int compareTo(Delayed object) { + WorkflowContext that = (WorkflowContext) object; + long thisEndTime = startTime + timeout; + long thatEndTime = that.startTime + that.timeout; + + if (thisEndTime < thatEndTime) { + return -1; + } else if (thisEndTime > thatEndTime) { + return 1; + } else { + return 0; + } + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java index 0de3414381..33fb78b306 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java @@ -25,7 +25,6 @@ package org.onap.so.bpmn.common.workflow.context; import java.util.concurrent.DelayQueue; import java.util.concurrent.TimeUnit; - import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -34,6 +33,7 @@ import org.springframework.stereotype.Component; /** * Workflow Context Holder instance which can be accessed elsewhere either in groovy scripts or Java + * * @version 1.0 * */ @@ -41,100 +41,100 @@ import org.springframework.stereotype.Component; @Component public class WorkflowContextHolder { - private static Logger logger = LoggerFactory.getLogger(WorkflowContextHolder.class); - private static final String logMarker = "[WORKFLOW-CONTEXT-HOLDER]"; - private static WorkflowContextHolder instance = null; - - - private long defaultContextTimeout=60000; - - /** - * Delay Queue which holds workflow context holder objects - */ - private final DelayQueue<WorkflowContext> responseQueue = new DelayQueue<>(); - private final TimeoutThread timeoutThread = new TimeoutThread(); - - private WorkflowContextHolder() { - timeoutThread.start(); - } - - /** - * Singleton holder which eliminates hot lock - * Since the JVM synchronizes static method there is no synchronization needed for this method - * @return - */ - public static synchronized WorkflowContextHolder getInstance() { - if (instance == null) { - instance = new WorkflowContextHolder(); - } - return instance; - } - - public void put(WorkflowContext context) { - logger.debug("{} Adding context to the queue: {}", logMarker, context.getRequestId()); - responseQueue.put(context); - } - - public void remove(WorkflowContext context) { - logger.debug("{} Removing context from the queue: {}", logMarker, context.getRequestId()); - responseQueue.remove(context); - } - - public WorkflowContext getWorkflowContext(String requestId) { - // Note: DelayQueue interator is threadsafe - for (WorkflowContext context : responseQueue) { - if (requestId.equals(context.getRequestId())) { - return context; - } - } - return null; - } - - /** - * Builds the callback response object to respond to client - * @param processKey - * @param processInstanceId - * @param requestId - * @param callbackResponse - * @return - */ - public void processCallback(String processKey, String processInstanceId, - String requestId, WorkflowCallbackResponse callbackResponse) { - WorkflowResponse workflowResponse = new WorkflowResponse(); - workflowResponse.setResponse(callbackResponse.getResponse()); - workflowResponse.setProcessInstanceID(processInstanceId); - workflowResponse.setMessageCode(callbackResponse.getStatusCode()); - workflowResponse.setMessage(callbackResponse.getMessage()); - WorkflowContext context = new WorkflowContext(processKey, requestId, defaultContextTimeout,workflowResponse); - put(context); - } - - - /** - * Timeout thread which monitors the delay queue for expired context and send timeout response - * to client - * - * */ - private class TimeoutThread extends Thread { - @Override - public void run() { - while (!isInterrupted()) { - try { - WorkflowContext requestObject = responseQueue.take(); - logger.debug("Time remaining for request id: {}:{}", requestObject.getRequestId(), requestObject - .getDelay - (TimeUnit.MILLISECONDS)); - logger.debug("Preparing timeout response for {}:{}", requestObject.getProcessKey(), requestObject - .getRequestId()); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } catch (Exception e) { - logger.debug("WorkflowContextHolder timeout thread caught exception: ", e); - logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", - ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread"); - } - } - logger.debug("WorkflowContextHolder timeout thread interrupted, quitting"); - } - } + private static Logger logger = LoggerFactory.getLogger(WorkflowContextHolder.class); + private static final String logMarker = "[WORKFLOW-CONTEXT-HOLDER]"; + private static WorkflowContextHolder instance = null; + + + private long defaultContextTimeout = 60000; + + /** + * Delay Queue which holds workflow context holder objects + */ + private final DelayQueue<WorkflowContext> responseQueue = new DelayQueue<>(); + private final TimeoutThread timeoutThread = new TimeoutThread(); + + private WorkflowContextHolder() { + timeoutThread.start(); + } + + /** + * Singleton holder which eliminates hot lock Since the JVM synchronizes static method there is no synchronization + * needed for this method + * + * @return + */ + public static synchronized WorkflowContextHolder getInstance() { + if (instance == null) { + instance = new WorkflowContextHolder(); + } + return instance; + } + + public void put(WorkflowContext context) { + logger.debug("{} Adding context to the queue: {}", logMarker, context.getRequestId()); + responseQueue.put(context); + } + + public void remove(WorkflowContext context) { + logger.debug("{} Removing context from the queue: {}", logMarker, context.getRequestId()); + responseQueue.remove(context); + } + + public WorkflowContext getWorkflowContext(String requestId) { + // Note: DelayQueue interator is threadsafe + for (WorkflowContext context : responseQueue) { + if (requestId.equals(context.getRequestId())) { + return context; + } + } + return null; + } + + /** + * Builds the callback response object to respond to client + * + * @param processKey + * @param processInstanceId + * @param requestId + * @param callbackResponse + * @return + */ + public void processCallback(String processKey, String processInstanceId, String requestId, + WorkflowCallbackResponse callbackResponse) { + WorkflowResponse workflowResponse = new WorkflowResponse(); + workflowResponse.setResponse(callbackResponse.getResponse()); + workflowResponse.setProcessInstanceID(processInstanceId); + workflowResponse.setMessageCode(callbackResponse.getStatusCode()); + workflowResponse.setMessage(callbackResponse.getMessage()); + WorkflowContext context = new WorkflowContext(processKey, requestId, defaultContextTimeout, workflowResponse); + put(context); + } + + + /** + * Timeout thread which monitors the delay queue for expired context and send timeout response to client + * + */ + private class TimeoutThread extends Thread { + @Override + public void run() { + while (!isInterrupted()) { + try { + WorkflowContext requestObject = responseQueue.take(); + logger.debug("Time remaining for request id: {}:{}", requestObject.getRequestId(), + requestObject.getDelay(TimeUnit.MILLISECONDS)); + logger.debug("Preparing timeout response for {}:{}", requestObject.getProcessKey(), + requestObject.getRequestId()); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } catch (Exception e) { + logger.debug("WorkflowContextHolder timeout thread caught exception: ", e); + logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", + ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread"); + } + } + logger.debug("WorkflowContextHolder timeout thread interrupted, quitting"); + } + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowResponse.java index f5aa0b33c6..22595a8b04 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowResponse.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowResponse.java @@ -23,56 +23,63 @@ package org.onap.so.bpmn.common.workflow.context; import java.util.Map; /** - * @version 1.0 - * Synchronous workflow response bean + * @version 1.0 Synchronous workflow response bean * */ public class WorkflowResponse { - private String response; - private String message; - private String processInstanceID; - private Map<String,String> variables; - private int messageCode; - - public String getResponse() { - return response; - } - public void setResponse(String response) { - this.response = response; - } - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } - public String getProcessInstanceID() { - return processInstanceID; - } - public void setProcessInstanceID(String pID) { - this.processInstanceID = pID; - } - public Map<String, String> getVariables() { - return variables; - } - public void setVariables(Map<String, String> variables) { - this.variables = variables; - } - public void setMessageCode(int messageCode) { - this.messageCode = messageCode; - } - - public int getMessageCode() { - return messageCode; - } - - @Override - public String toString() { - return "WorkflowResponse [response=" + response + ", message=" + message + ", processInstanceID=" - + processInstanceID + ", variables=" + variables + ", messageCode=" + messageCode + "]"; - } - - + private String response; + private String message; + private String processInstanceID; + private Map<String, String> variables; + private int messageCode; + + public String getResponse() { + return response; + } + + public void setResponse(String response) { + this.response = response; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getProcessInstanceID() { + return processInstanceID; + } + + public void setProcessInstanceID(String pID) { + this.processInstanceID = pID; + } + + public Map<String, String> getVariables() { + return variables; + } + + public void setVariables(Map<String, String> variables) { + this.variables = variables; + } + + public void setMessageCode(int messageCode) { + this.messageCode = messageCode; + } + + public int getMessageCode() { + return messageCode; + } + + @Override + public String toString() { + return "WorkflowResponse [response=" + response + ", message=" + message + ", processInstanceID=" + + processInstanceID + ", variables=" + variables + ", messageCode=" + messageCode + "]"; + } + + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java index 1f83c3135e..f56fad3bcf 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java @@ -23,18 +23,17 @@ package org.onap.so.bpmn.servicedecomposition; import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import org.onap.so.bpmn.servicedecomposition.bbobjects.Metadatum; -public class Metadata implements Serializable{ - - private static final long serialVersionUID = 4981393122007858950L; - - @JsonProperty("metadatum") - private List<Metadatum> metadatum = new ArrayList<Metadatum>(); +public class Metadata implements Serializable { + + private static final long serialVersionUID = 4981393122007858950L; + + @JsonProperty("metadatum") + private List<Metadatum> metadatum = new ArrayList<Metadatum>(); - public List<Metadatum> getMetadatum() { - return metadatum; - } + public List<Metadatum> getMetadatum() { + return metadatum; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java index 1263e7ba7c..3fc0808741 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java @@ -21,28 +21,27 @@ package org.onap.so.bpmn.servicedecomposition; import com.fasterxml.jackson.databind.ObjectMapper; - import javax.persistence.Id; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public interface ShallowCopy<T> { - default T shallowCopyId() { - try { - T obj = (T) this.getClass().newInstance(); - for (Field field : this.getClass().getDeclaredFields()) { - if (field.isAnnotationPresent(Id.class)) { - String fieldName = Character.toUpperCase(field.getName().charAt(0)) + field.getName().substring(1); - Method setter = this.getClass().getMethod("set" + fieldName, field.getType()); - Method getter = this.getClass().getMethod("get" + fieldName, null); - setter.invoke(obj, getter.invoke(this, null)); - } - } - return obj; - }catch(Exception e){ - throw new RuntimeException(e); - } + default T shallowCopyId() { + try { + T obj = (T) this.getClass().newInstance(); + for (Field field : this.getClass().getDeclaredFields()) { + if (field.isAnnotationPresent(Id.class)) { + String fieldName = Character.toUpperCase(field.getName().charAt(0)) + field.getName().substring(1); + Method setter = this.getClass().getMethod("set" + fieldName, field.getType()); + Method getter = this.getClass().getMethod("get" + fieldName, null); + setter.invoke(obj, getter.invoke(this, null)); + } + } + return obj; + } catch (Exception e) { + throw new RuntimeException(e); + } - } + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java index cb9c681fd5..a5eb9d86a7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java @@ -21,87 +21,84 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import javax.persistence.Id; - import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.EqualsBuilder; @JsonRootName("aggregate-route") -public class AggregateRoute implements Serializable, ShallowCopy<AggregateRoute>{ - - private static final long serialVersionUID = -1059128545462701696L; - - @Id - @JsonProperty("route-id") - private String routeId; - @JsonProperty("route-name") - private String routeName; - @JsonProperty("network-start-address") - private String networkStartAddress; - @JsonProperty("cidr-mask") - private String cidrMask; - @JsonProperty("ip-version") - private String ipVersion; - - - public String getRouteId(){ - return routeId; - } - - public void setRouteId(String routeId){ - this.routeId = routeId; - } - - public String getRouteName(){ - return routeName; - } - - public void setRouteName(String routeName){ - this.routeName = routeName; - } - - public String getNetworkStartAddress(){ - return networkStartAddress; - } - - public void setNetworkStartAddress(String networkStartAddress){ - this.networkStartAddress = networkStartAddress; - } - - public String getCidrMask(){ - return cidrMask; - } - - public void setCidrMask(String cidrMask){ - this.cidrMask = cidrMask; - } - - public String getIpVersion(){ - return ipVersion; - } - - public void setIpVersion(String ipVersion){ - this.ipVersion = ipVersion; - } - - @Override - public boolean equals(final Object other){ - if(!(other instanceof AggregateRoute)){ - return false; - } - AggregateRoute castOther = (AggregateRoute) other; - return new EqualsBuilder().append(routeId, castOther.routeId).isEquals(); - } - - @Override - public int hashCode(){ - return new HashCodeBuilder().append(routeId).toHashCode(); - } +public class AggregateRoute implements Serializable, ShallowCopy<AggregateRoute> { + + private static final long serialVersionUID = -1059128545462701696L; + + @Id + @JsonProperty("route-id") + private String routeId; + @JsonProperty("route-name") + private String routeName; + @JsonProperty("network-start-address") + private String networkStartAddress; + @JsonProperty("cidr-mask") + private String cidrMask; + @JsonProperty("ip-version") + private String ipVersion; + + + public String getRouteId() { + return routeId; + } + + public void setRouteId(String routeId) { + this.routeId = routeId; + } + + public String getRouteName() { + return routeName; + } + + public void setRouteName(String routeName) { + this.routeName = routeName; + } + + public String getNetworkStartAddress() { + return networkStartAddress; + } + + public void setNetworkStartAddress(String networkStartAddress) { + this.networkStartAddress = networkStartAddress; + } + + public String getCidrMask() { + return cidrMask; + } + + public void setCidrMask(String cidrMask) { + this.cidrMask = cidrMask; + } + + public String getIpVersion() { + return ipVersion; + } + + public void setIpVersion(String ipVersion) { + this.ipVersion = ipVersion; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof AggregateRoute)) { + return false; + } + AggregateRoute castOther = (AggregateRoute) other; + return new EqualsBuilder().append(routeId, castOther.routeId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(routeId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AllottedResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AllottedResource.java index 775d80db75..00f41ef1e3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AllottedResource.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AllottedResource.java @@ -21,14 +21,11 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import javax.persistence.Id; - import org.onap.so.bpmn.servicedecomposition.ShallowCopy; import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionCandidates; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoAllottedResource; import org.onap.so.db.catalog.beans.OrchestrationStatus; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.HashCodeBuilder; @@ -37,93 +34,112 @@ import org.apache.commons.lang3.builder.EqualsBuilder; @JsonRootName("allotted-resource") public class AllottedResource extends SolutionCandidates implements Serializable, ShallowCopy<AllottedResource> { - private static final long serialVersionUID = 8674239064804424306L; - - @Id - @JsonProperty("id") - private String id; - @JsonProperty("target-network-role") - private String targetNetworkRole; - @JsonProperty("self-link") - private String selflink; - @JsonProperty("orchestration-status") - private OrchestrationStatus orchestrationStatus; - @JsonProperty("operational-status") - private String operationalStatus; - @JsonProperty("type") + private static final long serialVersionUID = 8674239064804424306L; + + @Id + @JsonProperty("id") + private String id; + @JsonProperty("target-network-role") + private String targetNetworkRole; + @JsonProperty("self-link") + private String selflink; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("operational-status") + private String operationalStatus; + @JsonProperty("type") private String type; - @JsonProperty("role") + @JsonProperty("role") private String role; @JsonProperty("model-info-allotted-resource") private ModelInfoAllottedResource modelInfoAllottedResource; @JsonProperty("service-instance") private ServiceInstance parentServiceInstance; - public ModelInfoAllottedResource getModelInfoAllottedResource() { - return modelInfoAllottedResource; - } - public void setModelInfoAllottedResource(ModelInfoAllottedResource modelInfoAllottedResource) { - this.modelInfoAllottedResource = modelInfoAllottedResource; - } - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - public String getTargetNetworkRole() { - return targetNetworkRole; - } - public void setTargetNetworkRole(String targetNetworkRole) { - this.targetNetworkRole = targetNetworkRole; - } - public String getSelflink() { - return selflink; - } - public void setSelflink(String selflink) { - this.selflink = selflink; - } - public String getOperationalStatus() { - return operationalStatus; - } - public void setOperationalStatus(String operationalStatus) { - this.operationalStatus = operationalStatus; - } - public OrchestrationStatus getOrchestrationStatus() { - return orchestrationStatus; - } - public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - public String getRole() { - return role; - } - public void setRole(String role) { - this.role = role; - } - public ServiceInstance getParentServiceInstance() { - return parentServiceInstance; - } - public void setParentServiceInstance(ServiceInstance parentServiceInstance) { - this.parentServiceInstance = parentServiceInstance; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof AllottedResource)) { - return false; - } - AllottedResource castOther = (AllottedResource) other; - return new EqualsBuilder().append(id, castOther.id).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(id).toHashCode(); - } + public ModelInfoAllottedResource getModelInfoAllottedResource() { + return modelInfoAllottedResource; + } + + public void setModelInfoAllottedResource(ModelInfoAllottedResource modelInfoAllottedResource) { + this.modelInfoAllottedResource = modelInfoAllottedResource; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getTargetNetworkRole() { + return targetNetworkRole; + } + + public void setTargetNetworkRole(String targetNetworkRole) { + this.targetNetworkRole = targetNetworkRole; + } + + public String getSelflink() { + return selflink; + } + + public void setSelflink(String selflink) { + this.selflink = selflink; + } + + public String getOperationalStatus() { + return operationalStatus; + } + + public void setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public ServiceInstance getParentServiceInstance() { + return parentServiceInstance; + } + + public void setParentServiceInstance(ServiceInstance parentServiceInstance) { + this.parentServiceInstance = parentServiceInstance; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof AllottedResource)) { + return false; + } + AllottedResource castOther = (AllottedResource) other; + return new EqualsBuilder().append(id, castOther.id).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(id).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CloudRegion.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CloudRegion.java index df1eeae1b6..6439b5a65f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CloudRegion.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CloudRegion.java @@ -21,9 +21,7 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import javax.persistence.Id; - import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; @@ -31,82 +29,95 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy; public class CloudRegion implements Serializable, ShallowCopy<CloudRegion> { - private static final long serialVersionUID = 680593168655326021L; - - @Id - @JsonProperty("lcp-cloud-region-id") - private String lcpCloudRegionId; - @Id - @JsonProperty("cloud-owner") - private String cloudOwner; - @JsonProperty("tenant-id") - private String tenantId; - @JsonProperty("complex") - private String complex; - @JsonProperty("cloud-region-version") - private String cloudRegionVersion; - @JsonProperty("orchestration-disabled") - private Boolean orchestrationDisabled; - - public String getLcpCloudRegionId() { - return lcpCloudRegionId; - } - public void setLcpCloudRegionId(String lcpCloudRegionId) { - this.lcpCloudRegionId = lcpCloudRegionId; - } - public String getTenantId() { - return tenantId; - } - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - public String getCloudOwner() { - return cloudOwner; - } - public void setCloudOwner(String cloudOwner) { - this.cloudOwner = cloudOwner; - } - /** - * i.e. aic version - */ - public String getCloudRegionVersion() { - return cloudRegionVersion; - } - /** - * i.e. aic version - */ - public void setCloudRegionVersion(String cloudRegionVersion) { - this.cloudRegionVersion = cloudRegionVersion; - } - /** - * i.e. aic clli, physical location id, site id - */ - public String getComplex() { - return complex; - } - /** - * i.e. aic clli, physical location id, site id - */ - public void setComplex(String complex) { - this.complex = complex; - } - public Boolean getOrchestrationDisabled() { - return orchestrationDisabled; - } - public void setOrchestrationDisabled(Boolean orchestrationDisabled) { - this.orchestrationDisabled = orchestrationDisabled; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof CloudRegion)) { - return false; - } - CloudRegion castOther = (CloudRegion) other; - return new EqualsBuilder().append(lcpCloudRegionId, castOther.lcpCloudRegionId) - .append(cloudOwner, castOther.cloudOwner).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(lcpCloudRegionId).append(cloudOwner).toHashCode(); - } + private static final long serialVersionUID = 680593168655326021L; + + @Id + @JsonProperty("lcp-cloud-region-id") + private String lcpCloudRegionId; + @Id + @JsonProperty("cloud-owner") + private String cloudOwner; + @JsonProperty("tenant-id") + private String tenantId; + @JsonProperty("complex") + private String complex; + @JsonProperty("cloud-region-version") + private String cloudRegionVersion; + @JsonProperty("orchestration-disabled") + private Boolean orchestrationDisabled; + + public String getLcpCloudRegionId() { + return lcpCloudRegionId; + } + + public void setLcpCloudRegionId(String lcpCloudRegionId) { + this.lcpCloudRegionId = lcpCloudRegionId; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getCloudOwner() { + return cloudOwner; + } + + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + + /** + * i.e. aic version + */ + public String getCloudRegionVersion() { + return cloudRegionVersion; + } + + /** + * i.e. aic version + */ + public void setCloudRegionVersion(String cloudRegionVersion) { + this.cloudRegionVersion = cloudRegionVersion; + } + + /** + * i.e. aic clli, physical location id, site id + */ + public String getComplex() { + return complex; + } + + /** + * i.e. aic clli, physical location id, site id + */ + public void setComplex(String complex) { + this.complex = complex; + } + + public Boolean getOrchestrationDisabled() { + return orchestrationDisabled; + } + + public void setOrchestrationDisabled(Boolean orchestrationDisabled) { + this.orchestrationDisabled = orchestrationDisabled; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof CloudRegion)) { + return false; + } + CloudRegion castOther = (CloudRegion) other; + return new EqualsBuilder().append(lcpCloudRegionId, castOther.lcpCloudRegionId) + .append(cloudOwner, castOther.cloudOwner).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(lcpCloudRegionId).append(cloudOwner).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Collection.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Collection.java index 6bbdb1ed67..1d6f9272de 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Collection.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Collection.java @@ -22,12 +22,10 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; import javax.persistence.Id; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection; import org.onap.so.db.catalog.beans.OrchestrationStatus; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @@ -35,63 +33,74 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @JsonRootName("collection") public class Collection implements Serializable, ShallowCopy<Collection> { - - private static final long serialVersionUID = 6389915895863066288L; - - @Id - @JsonProperty("id") - private String id; - @JsonProperty("model-info-collection") - private ModelInfoCollection modelInfoCollection; - @JsonProperty("instance-group") - private InstanceGroup instanceGroup; - @JsonProperty("orchestration-status") + + private static final long serialVersionUID = 6389915895863066288L; + + @Id + @JsonProperty("id") + private String id; + @JsonProperty("model-info-collection") + private ModelInfoCollection modelInfoCollection; + @JsonProperty("instance-group") + private InstanceGroup instanceGroup; + @JsonProperty("orchestration-status") private OrchestrationStatus orchestrationStatus; - @JsonProperty("name") - private String name; - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - public ModelInfoCollection getModelInfoCollection() { - return modelInfoCollection; - } - public void setModelInfoCollection(ModelInfoCollection modelInfoCollection) { - this.modelInfoCollection = modelInfoCollection; - } - public InstanceGroup getInstanceGroup() { - return instanceGroup; - } - public void setInstanceGroup(InstanceGroup instanceGroup) { - this.instanceGroup = instanceGroup; - } - public OrchestrationStatus getOrchestrationStatus() { - return orchestrationStatus; - } - public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof Collection)) { - return false; - } - Collection castOther = (Collection) other; - return new EqualsBuilder().append(id, castOther.id).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(id).toHashCode(); - } + @JsonProperty("name") + private String name; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ModelInfoCollection getModelInfoCollection() { + return modelInfoCollection; + } + + public void setModelInfoCollection(ModelInfoCollection modelInfoCollection) { + this.modelInfoCollection = modelInfoCollection; + } + + public InstanceGroup getInstanceGroup() { + return instanceGroup; + } + + public void setInstanceGroup(InstanceGroup instanceGroup) { + this.instanceGroup = instanceGroup; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Collection)) { + return false; + } + Collection castOther = (Collection) other; + return new EqualsBuilder().append(id, castOther.id).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(id).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java index 748d37d6e4..dff5a57040 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java @@ -27,7 +27,6 @@ import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.Metadata; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; import org.onap.so.db.catalog.beans.OrchestrationStatus; - import javax.persistence.Id; import java.io.Serializable; import java.util.ArrayList; @@ -36,205 +35,205 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @JsonRootName("configuration") public class Configuration implements Serializable, ShallowCopy<Configuration> { - private static final long serialVersionUID = 4525487672816730299L; - - @Id - @JsonProperty("configuration-id") - private String configurationId; - @JsonProperty("orchestration-status") - private OrchestrationStatus orchestrationStatus; - @JsonProperty("tunnel-bandwidth") - private String tunnelBandwidth; - @JsonProperty("vendor-allowed-max-bandwidth") - private String vendorAllowedMaxBandwidth; - @JsonProperty("management-option") - private String managementOption; - @JsonProperty("configuration-name") - private String configurationName; - @JsonProperty("configuration-type") - private String configurationType; - @JsonProperty("configuration-sub-type") - private String configurationSubType; - @JsonProperty("operational-status") - private String operationalStatus; - @JsonProperty("configuration-selflink") - private String configurationSelflink; - @JsonProperty("metadata") - private Metadata metadata; - @JsonProperty("forwarder-evcs") - private List<ForwarderEvc> forwarderEvcs = new ArrayList<>(); - @JsonProperty("evcs") - private List<Evc> evcs = new ArrayList<>(); - @JsonProperty("vnfc") - private Vnfc vnfc = new Vnfc(); - @JsonProperty("model-info-configuration") - private ModelInfoConfiguration modelInfoConfiguration; - - @JsonProperty("related-configuration") - private Configuration relatedConfiguration; - - @JsonProperty("l3-network") - private L3Network network; - - @JsonProperty("l-interface") - private LInterface lInterface; - - public ModelInfoConfiguration getModelInfoConfiguration() { - return modelInfoConfiguration; - } - - public void setModelInfoConfiguration(ModelInfoConfiguration modelInfoConfiguration) { - this.modelInfoConfiguration = modelInfoConfiguration; - } - - public List<ForwarderEvc> getForwarderEvcs() { - return forwarderEvcs; - } - - public Vnfc getVnfc() { - return vnfc; - } - - public void setVnfc(Vnfc vnfc) { - this.vnfc = vnfc; - } - - public List<Evc> getEvcs() { - return evcs; - } - - public String getConfigurationId() { - return configurationId; - } - - public void setConfigurationId(String configurationId) { - this.configurationId = configurationId; - } - - public String getManagementOption() { - return managementOption; - } - - public void setManagementOption(String managementOption) { - this.managementOption = managementOption; - } - - public String getConfigurationName() { - return configurationName; - } - - public void setConfigurationName(String configurationName) { - this.configurationName = configurationName; - } - - public String getConfigurationType() { - return configurationType; - } - - public void setConfigurationType(String configurationType) { - this.configurationType = configurationType; - } - - public String getConfigurationSubType() { - return configurationSubType; - } - - public void setConfigurationSubType(String configurationSubType) { - this.configurationSubType = configurationSubType; - } - - public String getOperationalStatus() { - return operationalStatus; - } - - public void setOperationalStatus(String operationalStatus) { - this.operationalStatus = operationalStatus; - } - - public String getConfigurationSelflink() { - return configurationSelflink; - } - - public void setConfigurationSelflink(String configurationSelflink) { - this.configurationSelflink = configurationSelflink; - } - - public OrchestrationStatus getOrchestrationStatus() { - return orchestrationStatus; - } - - public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - - public String getTunnelBandwidth() { - return tunnelBandwidth; - } - - public void setTunnelBandwidth(String tunnelBandwidth) { - this.tunnelBandwidth = tunnelBandwidth; - } - - public String getVendorAllowedMaxBandwidth() { - return vendorAllowedMaxBandwidth; - } - - public void setVendorAllowedMaxBandwidth(String vendorAllowedMaxBandwidth) { - this.vendorAllowedMaxBandwidth = vendorAllowedMaxBandwidth; - } - - public Metadata getMetadata() { - return metadata; - } - - public void setMetadata(Metadata metadata) { - this.metadata = metadata; - } - - public Configuration getRelatedConfiguration() { - return relatedConfiguration; - } - - public void setRelatedConfiguration(Configuration relatedConfiguration) { - this.relatedConfiguration = relatedConfiguration; - } - - public void setForwarderEvcs(List<ForwarderEvc> forwarderEvcs) { - this.forwarderEvcs = forwarderEvcs; - } - - public void setEvcs(List<Evc> evcs) { - this.evcs = evcs; - } - - public L3Network getNetwork() { - return network; - } - - public void setNetwork(L3Network network) { - this.network = network; - } - - public LInterface getlInterface() { - return lInterface; - } - - public void setlInterface(LInterface lInterface) { - this.lInterface = lInterface; - } - - @Override - public boolean equals(final Object other) { - if (!(other instanceof Configuration)) { - return false; - } - Configuration castOther = (Configuration) other; - return new EqualsBuilder().append(configurationId, castOther.configurationId).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(configurationId).toHashCode(); - } - + private static final long serialVersionUID = 4525487672816730299L; + + @Id + @JsonProperty("configuration-id") + private String configurationId; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("tunnel-bandwidth") + private String tunnelBandwidth; + @JsonProperty("vendor-allowed-max-bandwidth") + private String vendorAllowedMaxBandwidth; + @JsonProperty("management-option") + private String managementOption; + @JsonProperty("configuration-name") + private String configurationName; + @JsonProperty("configuration-type") + private String configurationType; + @JsonProperty("configuration-sub-type") + private String configurationSubType; + @JsonProperty("operational-status") + private String operationalStatus; + @JsonProperty("configuration-selflink") + private String configurationSelflink; + @JsonProperty("metadata") + private Metadata metadata; + @JsonProperty("forwarder-evcs") + private List<ForwarderEvc> forwarderEvcs = new ArrayList<>(); + @JsonProperty("evcs") + private List<Evc> evcs = new ArrayList<>(); + @JsonProperty("vnfc") + private Vnfc vnfc = new Vnfc(); + @JsonProperty("model-info-configuration") + private ModelInfoConfiguration modelInfoConfiguration; + + @JsonProperty("related-configuration") + private Configuration relatedConfiguration; + + @JsonProperty("l3-network") + private L3Network network; + + @JsonProperty("l-interface") + private LInterface lInterface; + + public ModelInfoConfiguration getModelInfoConfiguration() { + return modelInfoConfiguration; + } + + public void setModelInfoConfiguration(ModelInfoConfiguration modelInfoConfiguration) { + this.modelInfoConfiguration = modelInfoConfiguration; + } + + public List<ForwarderEvc> getForwarderEvcs() { + return forwarderEvcs; + } + + public Vnfc getVnfc() { + return vnfc; + } + + public void setVnfc(Vnfc vnfc) { + this.vnfc = vnfc; + } + + public List<Evc> getEvcs() { + return evcs; + } + + public String getConfigurationId() { + return configurationId; + } + + public void setConfigurationId(String configurationId) { + this.configurationId = configurationId; + } + + public String getManagementOption() { + return managementOption; + } + + public void setManagementOption(String managementOption) { + this.managementOption = managementOption; + } + + public String getConfigurationName() { + return configurationName; + } + + public void setConfigurationName(String configurationName) { + this.configurationName = configurationName; + } + + public String getConfigurationType() { + return configurationType; + } + + public void setConfigurationType(String configurationType) { + this.configurationType = configurationType; + } + + public String getConfigurationSubType() { + return configurationSubType; + } + + public void setConfigurationSubType(String configurationSubType) { + this.configurationSubType = configurationSubType; + } + + public String getOperationalStatus() { + return operationalStatus; + } + + public void setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + } + + public String getConfigurationSelflink() { + return configurationSelflink; + } + + public void setConfigurationSelflink(String configurationSelflink) { + this.configurationSelflink = configurationSelflink; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public String getTunnelBandwidth() { + return tunnelBandwidth; + } + + public void setTunnelBandwidth(String tunnelBandwidth) { + this.tunnelBandwidth = tunnelBandwidth; + } + + public String getVendorAllowedMaxBandwidth() { + return vendorAllowedMaxBandwidth; + } + + public void setVendorAllowedMaxBandwidth(String vendorAllowedMaxBandwidth) { + this.vendorAllowedMaxBandwidth = vendorAllowedMaxBandwidth; + } + + public Metadata getMetadata() { + return metadata; + } + + public void setMetadata(Metadata metadata) { + this.metadata = metadata; + } + + public Configuration getRelatedConfiguration() { + return relatedConfiguration; + } + + public void setRelatedConfiguration(Configuration relatedConfiguration) { + this.relatedConfiguration = relatedConfiguration; + } + + public void setForwarderEvcs(List<ForwarderEvc> forwarderEvcs) { + this.forwarderEvcs = forwarderEvcs; + } + + public void setEvcs(List<Evc> evcs) { + this.evcs = evcs; + } + + public L3Network getNetwork() { + return network; + } + + public void setNetwork(L3Network network) { + this.network = network; + } + + public LInterface getlInterface() { + return lInterface; + } + + public void setlInterface(LInterface lInterface) { + this.lInterface = lInterface; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Configuration)) { + return false; + } + Configuration castOther = (Configuration) other; + return new EqualsBuilder().append(configurationId, castOther.configurationId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(configurationId).toHashCode(); + } + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java index 978f1e9324..8194485d2b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java @@ -21,45 +21,43 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("ctag-assignment") public class CtagAssignment implements Serializable, ShallowCopy<CtagAssignment> { - - private static final long serialVersionUID = 2314290576523243571L; - @Id - @JsonProperty("vlan-id-inner") - private Long vlanIdInner; - - public Long getVlanIdInner() { - return vlanIdInner; - } + private static final long serialVersionUID = 2314290576523243571L; + + @Id + @JsonProperty("vlan-id-inner") + private Long vlanIdInner; + + public Long getVlanIdInner() { + return vlanIdInner; + } + + public void setVlanIdInner(Long vlanIdInner) { + this.vlanIdInner = vlanIdInner; + } - public void setVlanIdInner(Long vlanIdInner) { - this.vlanIdInner = vlanIdInner; - } + @Override + public boolean equals(final Object other) { + if (!(other instanceof CtagAssignment)) { + return false; + } + CtagAssignment castOther = (CtagAssignment) other; + return new EqualsBuilder().append(vlanIdInner, castOther.vlanIdInner).isEquals(); + } - @Override - public boolean equals(final Object other) { - if (!(other instanceof CtagAssignment)) { - return false; - } - CtagAssignment castOther = (CtagAssignment) other; - return new EqualsBuilder().append(vlanIdInner, castOther.vlanIdInner).isEquals(); - } + @Override + public int hashCode() { + return new HashCodeBuilder().append(vlanIdInner).toHashCode(); + } - @Override - public int hashCode() { - return new HashCodeBuilder().append(vlanIdInner).toHashCode(); - } - } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Customer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Customer.java index 985f51035c..30492ddf61 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Customer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Customer.java @@ -23,9 +23,7 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import javax.persistence.Id; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; @@ -35,65 +33,77 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @JsonRootName("customer") public class Customer implements Serializable, ShallowCopy<Customer> { - private static final long serialVersionUID = 2006599484099139618L; - - @Id - @JsonProperty("global-customer-id") - private String globalCustomerId; - @JsonProperty("subscriber-name") - private String subscriberName; - @JsonProperty("subscriber-type") - private String subscriberType; - @JsonProperty("subscriber-common-site-id") - private String subscriberCommonSiteId; - @JsonProperty("service-subscription") + private static final long serialVersionUID = 2006599484099139618L; + + @Id + @JsonProperty("global-customer-id") + private String globalCustomerId; + @JsonProperty("subscriber-name") + private String subscriberName; + @JsonProperty("subscriber-type") + private String subscriberType; + @JsonProperty("subscriber-common-site-id") + private String subscriberCommonSiteId; + @JsonProperty("service-subscription") private ServiceSubscription serviceSubscription; @JsonProperty("vpn-bindings") - private List<VpnBinding> vpnBindings = new ArrayList<>(); - - public String getGlobalCustomerId() { - return globalCustomerId; - } - public void setGlobalCustomerId(String globalCustomerId) { - this.globalCustomerId = globalCustomerId; - } - public String getSubscriberName() { - return subscriberName; - } - public void setSubscriberName(String subscriberName) { - this.subscriberName = subscriberName; - } - public String getSubscriberType() { - return subscriberType; - } - public void setSubscriberType(String subscriberType) { - this.subscriberType = subscriberType; - } - public String getSubscriberCommonSiteId() { - return subscriberCommonSiteId; - } - public void setSubscriberCommonSiteId(String subscriberCommonSiteId) { - this.subscriberCommonSiteId = subscriberCommonSiteId; - } - public ServiceSubscription getServiceSubscription() { - return serviceSubscription; - } - public void setServiceSubscription(ServiceSubscription serviceSubscription) { - this.serviceSubscription = serviceSubscription; - } - public List<VpnBinding> getVpnBindings() { - return vpnBindings; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof Customer)) { - return false; - } - Customer castOther = (Customer) other; - return new EqualsBuilder().append(globalCustomerId, castOther.globalCustomerId).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(globalCustomerId).toHashCode(); - } + private List<VpnBinding> vpnBindings = new ArrayList<>(); + + public String getGlobalCustomerId() { + return globalCustomerId; + } + + public void setGlobalCustomerId(String globalCustomerId) { + this.globalCustomerId = globalCustomerId; + } + + public String getSubscriberName() { + return subscriberName; + } + + public void setSubscriberName(String subscriberName) { + this.subscriberName = subscriberName; + } + + public String getSubscriberType() { + return subscriberType; + } + + public void setSubscriberType(String subscriberType) { + this.subscriberType = subscriberType; + } + + public String getSubscriberCommonSiteId() { + return subscriberCommonSiteId; + } + + public void setSubscriberCommonSiteId(String subscriberCommonSiteId) { + this.subscriberCommonSiteId = subscriberCommonSiteId; + } + + public ServiceSubscription getServiceSubscription() { + return serviceSubscription; + } + + public void setServiceSubscription(ServiceSubscription serviceSubscription) { + this.serviceSubscription = serviceSubscription; + } + + public List<VpnBinding> getVpnBindings() { + return vpnBindings; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Customer)) { + return false; + } + Customer castOther = (Customer) other; + return new EqualsBuilder().append(globalCustomerId, castOther.globalCustomerId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(globalCustomerId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Entitlement.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Entitlement.java index fdcb59d3c3..dd97aa55ad 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Entitlement.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Entitlement.java @@ -21,50 +21,53 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("entitlement") -public class Entitlement implements Serializable, ShallowCopy<Entitlement>{ - - private static final long serialVersionUID = 5186878328988717088L; +public class Entitlement implements Serializable, ShallowCopy<Entitlement> { - @Id - @JsonProperty("group-uuid") + private static final long serialVersionUID = 5186878328988717088L; + + @Id + @JsonProperty("group-uuid") private String groupUuid; - @Id - @JsonProperty("resource-uuid") + @Id + @JsonProperty("resource-uuid") private String resourceUuid; - public String getGroupUuid() { - return groupUuid; - } - public void setGroupUuid(String groupUuid) { - this.groupUuid = groupUuid; - } - public String getResourceUuid() { - return resourceUuid; - } - public void setResourceUuid(String resourceUuid) { - this.resourceUuid = resourceUuid; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof Entitlement)) { - return false; - } - Entitlement castOther = (Entitlement) other; - return new EqualsBuilder().append(groupUuid, castOther.groupUuid).append(resourceUuid, castOther.resourceUuid) - .isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(groupUuid).append(resourceUuid).toHashCode(); - } + public String getGroupUuid() { + return groupUuid; + } + + public void setGroupUuid(String groupUuid) { + this.groupUuid = groupUuid; + } + + public String getResourceUuid() { + return resourceUuid; + } + + public void setResourceUuid(String resourceUuid) { + this.resourceUuid = resourceUuid; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Entitlement)) { + return false; + } + Entitlement castOther = (Entitlement) other; + return new EqualsBuilder().append(groupUuid, castOther.groupUuid).append(resourceUuid, castOther.resourceUuid) + .isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(groupUuid).append(resourceUuid).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Evc.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Evc.java index 3ef0f71386..c7e6ebc9a7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Evc.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Evc.java @@ -21,40 +21,38 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("evc") public class Evc implements Serializable, ShallowCopy<Evc> { - private static final long serialVersionUID = -3556506672371317659L; + private static final long serialVersionUID = -3556506672371317659L; - @Id - @JsonProperty("evc-id") + @Id + @JsonProperty("evc-id") private String evcId; - @JsonProperty("forwarding-path-topology") + @JsonProperty("forwarding-path-topology") private String forwardingPathTopology; - @JsonProperty("cir-value") + @JsonProperty("cir-value") private String cirValue; - @JsonProperty("cir-units") + @JsonProperty("cir-units") private String cirUnits; - @JsonProperty("connection-diversity-group-id") + @JsonProperty("connection-diversity-group-id") private String connectionDiversityGroupId; - @JsonProperty("service-hours") + @JsonProperty("service-hours") private String serviceHours; - @JsonProperty("esp-evc-circuit-id") + @JsonProperty("esp-evc-circuit-id") private String espEvcCircuitId; - @JsonProperty("esp-evc-cir-value") + @JsonProperty("esp-evc-cir-value") private String espEvcCirValue; - @JsonProperty("esp-evc-cir-units") + @JsonProperty("esp-evc-cir-units") private String espEvcCirUnits; - @JsonProperty("esp-itu-code") + @JsonProperty("esp-itu-code") private String espItuCode; @JsonProperty("collector-pop-clli") private String collectorPopClli; @@ -65,100 +63,129 @@ public class Evc implements Serializable, ShallowCopy<Evc> { @JsonProperty("tagmode-access-egress") private String tagmodeAccessEgress; - public String getEvcId() { - return evcId; - } - public void setEvcId(String evcId) { - this.evcId = evcId; - } - public String getForwardingPathTopology() { - return forwardingPathTopology; - } - public void setForwardingPathTopology(String forwardingPathTopology) { - this.forwardingPathTopology = forwardingPathTopology; - } - public String getCirValue() { - return cirValue; - } - public void setCirValue(String cirValue) { - this.cirValue = cirValue; - } - public String getCirUnits() { - return cirUnits; - } - public void setCirUnits(String cirUnits) { - this.cirUnits = cirUnits; - } - public String getConnectionDiversityGroupId() { - return connectionDiversityGroupId; - } - public void setConnectionDiversityGroupId(String connectionDiversityGroupId) { - this.connectionDiversityGroupId = connectionDiversityGroupId; - } - public String getServiceHours() { - return serviceHours; - } - public void setServiceHours(String serviceHours) { - this.serviceHours = serviceHours; - } - public String getEspEvcCircuitId() { - return espEvcCircuitId; - } - public void setEspEvcCircuitId(String espEvcCircuitId) { - this.espEvcCircuitId = espEvcCircuitId; - } - public String getEspEvcCirValue() { - return espEvcCirValue; - } - public void setEspEvcCirValue(String espEvcCirValue) { - this.espEvcCirValue = espEvcCirValue; - } - public String getEspEvcCirUnits() { - return espEvcCirUnits; - } - public void setEspEvcCirUnits(String espEvcCirUnits) { - this.espEvcCirUnits = espEvcCirUnits; - } - public String getEspItuCode() { - return espItuCode; - } - public void setEspItuCode(String espItuCode) { - this.espItuCode = espItuCode; - } - public String getCollectorPopClli() { - return collectorPopClli; - } - public void setCollectorPopClli(String collectorPopClli) { - this.collectorPopClli = collectorPopClli; - } - public String getInterConnectTypeIngress() { - return interConnectTypeIngress; - } - public void setInterConnectTypeIngress(String interConnectTypeIngress) { - this.interConnectTypeIngress = interConnectTypeIngress; - } - public String getTagmodeAccessIngress() { - return tagmodeAccessIngress; - } - public void setTagmodeAccessIngress(String tagmodeAccessIngress) { - this.tagmodeAccessIngress = tagmodeAccessIngress; - } - public String getTagmodeAccessEgress() { - return tagmodeAccessEgress; - } - public void setTagmodeAccessEgress(String tagmodeAccessEgress) { - this.tagmodeAccessEgress = tagmodeAccessEgress; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof Evc)) { - return false; - } - Evc castOther = (Evc) other; - return new EqualsBuilder().append(evcId, castOther.evcId).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(evcId).toHashCode(); - } + public String getEvcId() { + return evcId; + } + + public void setEvcId(String evcId) { + this.evcId = evcId; + } + + public String getForwardingPathTopology() { + return forwardingPathTopology; + } + + public void setForwardingPathTopology(String forwardingPathTopology) { + this.forwardingPathTopology = forwardingPathTopology; + } + + public String getCirValue() { + return cirValue; + } + + public void setCirValue(String cirValue) { + this.cirValue = cirValue; + } + + public String getCirUnits() { + return cirUnits; + } + + public void setCirUnits(String cirUnits) { + this.cirUnits = cirUnits; + } + + public String getConnectionDiversityGroupId() { + return connectionDiversityGroupId; + } + + public void setConnectionDiversityGroupId(String connectionDiversityGroupId) { + this.connectionDiversityGroupId = connectionDiversityGroupId; + } + + public String getServiceHours() { + return serviceHours; + } + + public void setServiceHours(String serviceHours) { + this.serviceHours = serviceHours; + } + + public String getEspEvcCircuitId() { + return espEvcCircuitId; + } + + public void setEspEvcCircuitId(String espEvcCircuitId) { + this.espEvcCircuitId = espEvcCircuitId; + } + + public String getEspEvcCirValue() { + return espEvcCirValue; + } + + public void setEspEvcCirValue(String espEvcCirValue) { + this.espEvcCirValue = espEvcCirValue; + } + + public String getEspEvcCirUnits() { + return espEvcCirUnits; + } + + public void setEspEvcCirUnits(String espEvcCirUnits) { + this.espEvcCirUnits = espEvcCirUnits; + } + + public String getEspItuCode() { + return espItuCode; + } + + public void setEspItuCode(String espItuCode) { + this.espItuCode = espItuCode; + } + + public String getCollectorPopClli() { + return collectorPopClli; + } + + public void setCollectorPopClli(String collectorPopClli) { + this.collectorPopClli = collectorPopClli; + } + + public String getInterConnectTypeIngress() { + return interConnectTypeIngress; + } + + public void setInterConnectTypeIngress(String interConnectTypeIngress) { + this.interConnectTypeIngress = interConnectTypeIngress; + } + + public String getTagmodeAccessIngress() { + return tagmodeAccessIngress; + } + + public void setTagmodeAccessIngress(String tagmodeAccessIngress) { + this.tagmodeAccessIngress = tagmodeAccessIngress; + } + + public String getTagmodeAccessEgress() { + return tagmodeAccessEgress; + } + + public void setTagmodeAccessEgress(String tagmodeAccessEgress) { + this.tagmodeAccessEgress = tagmodeAccessEgress; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Evc)) { + return false; + } + Evc castOther = (Evc) other; + return new EqualsBuilder().append(evcId, castOther.evcId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(evcId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ForwarderEvc.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ForwarderEvc.java index 70f7d5af42..716dd1a57b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ForwarderEvc.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ForwarderEvc.java @@ -21,83 +21,81 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("forwarder-evc") public class ForwarderEvc implements Serializable, ShallowCopy<ForwarderEvc> { - private static final long serialVersionUID = 3822241337439817708L; - - @Id - @JsonProperty("forwarder-evc-id") - private String forwarderEvcId; - @JsonProperty("circuit-id") - private String circuitId; - @JsonProperty("ivlan") - private String ivlan; - @JsonProperty("svlan") - private String svlan; - @JsonProperty("cvlan") - private String cvlan; - - public String getForwarderEvcId() { - return forwarderEvcId; - } - - public void setForwarderEvcId(String forwarderEvcId) { - this.forwarderEvcId = forwarderEvcId; - } - - public String getCircuitId() { - return circuitId; - } - - public void setCircuitId(String circuitId) { - this.circuitId = circuitId; - } - - public String getIvlan() { - return ivlan; - } - - public void setIvlan(String ivlan) { - this.ivlan = ivlan; - } - - public String getSvlan() { - return svlan; - } - - public void setSvlan(String svlan) { - this.svlan = svlan; - } - - public String getCvlan() { - return cvlan; - } - - public void setCvlan(String cvlan) { - this.cvlan = cvlan; - } - - @Override - public boolean equals(final Object other) { - if (!(other instanceof ForwarderEvc)) { - return false; - } - ForwarderEvc castOther = (ForwarderEvc) other; - return new EqualsBuilder().append(forwarderEvcId, castOther.forwarderEvcId).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(forwarderEvcId).toHashCode(); - } + private static final long serialVersionUID = 3822241337439817708L; + + @Id + @JsonProperty("forwarder-evc-id") + private String forwarderEvcId; + @JsonProperty("circuit-id") + private String circuitId; + @JsonProperty("ivlan") + private String ivlan; + @JsonProperty("svlan") + private String svlan; + @JsonProperty("cvlan") + private String cvlan; + + public String getForwarderEvcId() { + return forwarderEvcId; + } + + public void setForwarderEvcId(String forwarderEvcId) { + this.forwarderEvcId = forwarderEvcId; + } + + public String getCircuitId() { + return circuitId; + } + + public void setCircuitId(String circuitId) { + this.circuitId = circuitId; + } + + public String getIvlan() { + return ivlan; + } + + public void setIvlan(String ivlan) { + this.ivlan = ivlan; + } + + public String getSvlan() { + return svlan; + } + + public void setSvlan(String svlan) { + this.svlan = svlan; + } + + public String getCvlan() { + return cvlan; + } + + public void setCvlan(String cvlan) { + this.cvlan = cvlan; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof ForwarderEvc)) { + return false; + } + ForwarderEvc castOther = (ForwarderEvc) other; + return new EqualsBuilder().append(forwarderEvcId, castOther.forwarderEvcId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(forwarderEvcId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java index c6e7668f22..841546b3b1 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java @@ -25,9 +25,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - import javax.persistence.Id; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @@ -35,516 +33,515 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.License; import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionInfo; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; import org.onap.so.db.catalog.beans.OrchestrationStatus; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("generic-vnf") public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> { - private static final long serialVersionUID = -5107610336831330403L; - - @Id - @JsonProperty("vnf-id") - private String vnfId; - @JsonProperty("vnf-name") - private String vnfName; - @JsonProperty("vnf-type") - private String vnfType; - @JsonProperty("orchestration-status") - private OrchestrationStatus orchestrationStatus; - @JsonProperty("vf-modules") - private List<VfModule> vfModules = new ArrayList<>(); - @JsonProperty("volume-groups") - private List<VolumeGroup> volumeGroups = new ArrayList<>(); - @JsonProperty("line-of-business") - private LineOfBusiness lineOfBusiness; - @JsonProperty("platform") - private Platform platform; - @JsonProperty("cascaded") - private Boolean cascaded; - @JsonProperty("cloud-params") - private Map<String, String> cloudParams = new HashMap<>(); - @JsonProperty("cloud-context") - private CloudRegion cloudRegion; - @JsonProperty("solution") - private SolutionInfo solution; - @JsonProperty("vnf-name-2") - private String vnfName2; - @JsonProperty("service-id") - private String serviceId; - @JsonProperty("regional-resource-zone") - private String regionalResourceZone; - @JsonProperty("prov-status") - private String provStatus; - @JsonProperty("operational-status") - private String operationalStatus; - @JsonProperty("equipment-role") - private String equipmentRole; - @JsonProperty("management-option") - private String managementOption; - @JsonProperty("ipv4-oam-address") - private String ipv4OamAddress; - @JsonProperty("ipv4-loopback0-address") - private String ipv4Loopback0Address; - @JsonProperty("nm-lan-v6-address") - private String nmLanV6Address; - @JsonProperty("management-v6-address") - private String managementV6Address; - @JsonProperty("vcpu") - private Long vcpu; - @JsonProperty("vcpu-units") - private String vcpuUnits; - @JsonProperty("vmemory") - private Long vmemory; - @JsonProperty("vmemory-units") - private String vmemoryUnits; - @JsonProperty("vdisk") - private Long vdisk; - @JsonProperty("vdisk-units") - private String vdiskUnits; - @JsonProperty("in-maint") - private Boolean inMaint; - @JsonProperty("is-closed-loop-disabled") - private Boolean isClosedLoopDisabled; - @JsonProperty("summary-status") - private String summaryStatus; - @JsonProperty("encrypted-access-flag") - private Boolean encryptedAccessFlag; - @JsonProperty("as-number") - private String asNumber; - @JsonProperty("regional-resource-subzone") - private String regionalResourceSubzone; - @JsonProperty("self-link") - private String selflink; - @JsonProperty("ipv4-oam-gateway-address") - private String ipv4OamGatewayAddress; - @JsonProperty("ipv4-oam-gateway-address-prefix-length") - private Integer ipv4OamGatewayAddressPrefixLength; - @JsonProperty("vlan-id-outer") - private Long vlanIdOuter; - @JsonProperty("nm-profile-name") - private String nmProfileName; - @JsonProperty("l-interfaces") - private List<LInterface> lInterfaces = new ArrayList<>(); - @JsonProperty("lag-interfaces") - private List<LagInterface> lagInterfaces = new ArrayList<>(); - @JsonProperty("license") - private License license; - @JsonProperty("entitlements") //TODO remove, duplicated - private List<Entitlement> entitlements = new ArrayList<>(); - @JsonProperty("model-info-generic-vnf") - private ModelInfoGenericVnf modelInfoGenericVnf; - @JsonProperty("instance-groups") + private static final long serialVersionUID = -5107610336831330403L; + + @Id + @JsonProperty("vnf-id") + private String vnfId; + @JsonProperty("vnf-name") + private String vnfName; + @JsonProperty("vnf-type") + private String vnfType; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("vf-modules") + private List<VfModule> vfModules = new ArrayList<>(); + @JsonProperty("volume-groups") + private List<VolumeGroup> volumeGroups = new ArrayList<>(); + @JsonProperty("line-of-business") + private LineOfBusiness lineOfBusiness; + @JsonProperty("platform") + private Platform platform; + @JsonProperty("cascaded") + private Boolean cascaded; + @JsonProperty("cloud-params") + private Map<String, String> cloudParams = new HashMap<>(); + @JsonProperty("cloud-context") + private CloudRegion cloudRegion; + @JsonProperty("solution") + private SolutionInfo solution; + @JsonProperty("vnf-name-2") + private String vnfName2; + @JsonProperty("service-id") + private String serviceId; + @JsonProperty("regional-resource-zone") + private String regionalResourceZone; + @JsonProperty("prov-status") + private String provStatus; + @JsonProperty("operational-status") + private String operationalStatus; + @JsonProperty("equipment-role") + private String equipmentRole; + @JsonProperty("management-option") + private String managementOption; + @JsonProperty("ipv4-oam-address") + private String ipv4OamAddress; + @JsonProperty("ipv4-loopback0-address") + private String ipv4Loopback0Address; + @JsonProperty("nm-lan-v6-address") + private String nmLanV6Address; + @JsonProperty("management-v6-address") + private String managementV6Address; + @JsonProperty("vcpu") + private Long vcpu; + @JsonProperty("vcpu-units") + private String vcpuUnits; + @JsonProperty("vmemory") + private Long vmemory; + @JsonProperty("vmemory-units") + private String vmemoryUnits; + @JsonProperty("vdisk") + private Long vdisk; + @JsonProperty("vdisk-units") + private String vdiskUnits; + @JsonProperty("in-maint") + private Boolean inMaint; + @JsonProperty("is-closed-loop-disabled") + private Boolean isClosedLoopDisabled; + @JsonProperty("summary-status") + private String summaryStatus; + @JsonProperty("encrypted-access-flag") + private Boolean encryptedAccessFlag; + @JsonProperty("as-number") + private String asNumber; + @JsonProperty("regional-resource-subzone") + private String regionalResourceSubzone; + @JsonProperty("self-link") + private String selflink; + @JsonProperty("ipv4-oam-gateway-address") + private String ipv4OamGatewayAddress; + @JsonProperty("ipv4-oam-gateway-address-prefix-length") + private Integer ipv4OamGatewayAddressPrefixLength; + @JsonProperty("vlan-id-outer") + private Long vlanIdOuter; + @JsonProperty("nm-profile-name") + private String nmProfileName; + @JsonProperty("l-interfaces") + private List<LInterface> lInterfaces = new ArrayList<>(); + @JsonProperty("lag-interfaces") + private List<LagInterface> lagInterfaces = new ArrayList<>(); + @JsonProperty("license") + private License license; + @JsonProperty("entitlements") // TODO remove, duplicated + private List<Entitlement> entitlements = new ArrayList<>(); + @JsonProperty("model-info-generic-vnf") + private ModelInfoGenericVnf modelInfoGenericVnf; + @JsonProperty("instance-groups") private List<InstanceGroup> instanceGroups = new ArrayList<InstanceGroup>(); - @JsonProperty("call-homing") - private Boolean callHoming; - @JsonProperty("nf-function") - private String nfFunction; - @JsonProperty("nf-role") - private String nfRole; - @JsonProperty("CDS_BLUEPRINT_NAME") - private String blueprintName; - @JsonProperty("CDS_BLUEPRINT_VERSION") - private String blueprintVersion; - - - public String getBlueprintName() { - return blueprintName; - } - - public void setBlueprintName(String blueprintName) { - this.blueprintName = blueprintName; - } - - public String getBlueprintVersion() { - return blueprintVersion; - } - - public void setBlueprintVersion(String blueprintVersion) { - this.blueprintVersion = blueprintVersion; - } - - public String getNfFunction() { - return nfFunction; - } - - public void setNfFunction(String nfFunction) { - this.nfFunction = nfFunction; - } - - public String getNfRole() { - return nfRole; - } - - public void setNfRole(String nfRole) { - this.nfRole = nfRole; - } - - public List<InstanceGroup> getInstanceGroups() { - return instanceGroups; - } - - public List<VolumeGroup> getVolumeGroups() { - return volumeGroups; - } - - public ModelInfoGenericVnf getModelInfoGenericVnf() { - return modelInfoGenericVnf; - } - - public void setModelInfoGenericVnf(ModelInfoGenericVnf modelInfoGenericVnf) { - this.modelInfoGenericVnf = modelInfoGenericVnf; - } - - public String getVnfName2() { - return vnfName2; - } - - public void setVnfName2(String vnfName2) { - this.vnfName2 = vnfName2; - } - - public String getServiceId() { - return serviceId; - } - - public void setServiceId(String serviceId) { - this.serviceId = serviceId; - } - - public String getRegionalResourceZone() { - return regionalResourceZone; - } - - public void setRegionalResourceZone(String regionalResourceZone) { - this.regionalResourceZone = regionalResourceZone; - } - - public String getProvStatus() { - return provStatus; - } - - public void setProvStatus(String provStatus) { - this.provStatus = provStatus; - } - - public String getOperationalStatus() { - return operationalStatus; - } - - public void setOperationalStatus(String operationalStatus) { - this.operationalStatus = operationalStatus; - } - - public String getEquipmentRole() { - return equipmentRole; - } + @JsonProperty("call-homing") + private Boolean callHoming; + @JsonProperty("nf-function") + private String nfFunction; + @JsonProperty("nf-role") + private String nfRole; + @JsonProperty("CDS_BLUEPRINT_NAME") + private String blueprintName; + @JsonProperty("CDS_BLUEPRINT_VERSION") + private String blueprintVersion; + + + public String getBlueprintName() { + return blueprintName; + } + + public void setBlueprintName(String blueprintName) { + this.blueprintName = blueprintName; + } + + public String getBlueprintVersion() { + return blueprintVersion; + } + + public void setBlueprintVersion(String blueprintVersion) { + this.blueprintVersion = blueprintVersion; + } + + public String getNfFunction() { + return nfFunction; + } + + public void setNfFunction(String nfFunction) { + this.nfFunction = nfFunction; + } + + public String getNfRole() { + return nfRole; + } + + public void setNfRole(String nfRole) { + this.nfRole = nfRole; + } + + public List<InstanceGroup> getInstanceGroups() { + return instanceGroups; + } + + public List<VolumeGroup> getVolumeGroups() { + return volumeGroups; + } + + public ModelInfoGenericVnf getModelInfoGenericVnf() { + return modelInfoGenericVnf; + } + + public void setModelInfoGenericVnf(ModelInfoGenericVnf modelInfoGenericVnf) { + this.modelInfoGenericVnf = modelInfoGenericVnf; + } + + public String getVnfName2() { + return vnfName2; + } + + public void setVnfName2(String vnfName2) { + this.vnfName2 = vnfName2; + } + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public String getRegionalResourceZone() { + return regionalResourceZone; + } + + public void setRegionalResourceZone(String regionalResourceZone) { + this.regionalResourceZone = regionalResourceZone; + } + + public String getProvStatus() { + return provStatus; + } + + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + + public String getOperationalStatus() { + return operationalStatus; + } + + public void setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + } + + public String getEquipmentRole() { + return equipmentRole; + } - public void setEquipmentRole(String equipmentRole) { - this.equipmentRole = equipmentRole; - } + public void setEquipmentRole(String equipmentRole) { + this.equipmentRole = equipmentRole; + } - public String getManagementOption() { - return managementOption; - } + public String getManagementOption() { + return managementOption; + } - public void setManagementOption(String managementOption) { - this.managementOption = managementOption; - } + public void setManagementOption(String managementOption) { + this.managementOption = managementOption; + } - public String getIpv4OamAddress() { - return ipv4OamAddress; - } + public String getIpv4OamAddress() { + return ipv4OamAddress; + } - public void setIpv4OamAddress(String ipv4OamAddress) { - this.ipv4OamAddress = ipv4OamAddress; - } + public void setIpv4OamAddress(String ipv4OamAddress) { + this.ipv4OamAddress = ipv4OamAddress; + } - public String getIpv4Loopback0Address() { - return ipv4Loopback0Address; - } + public String getIpv4Loopback0Address() { + return ipv4Loopback0Address; + } - public void setIpv4Loopback0Address(String ipv4Loopback0Address) { - this.ipv4Loopback0Address = ipv4Loopback0Address; - } + public void setIpv4Loopback0Address(String ipv4Loopback0Address) { + this.ipv4Loopback0Address = ipv4Loopback0Address; + } - public String getNmLanV6Address() { - return nmLanV6Address; - } + public String getNmLanV6Address() { + return nmLanV6Address; + } - public void setNmLanV6Address(String nmLanV6Address) { - this.nmLanV6Address = nmLanV6Address; - } + public void setNmLanV6Address(String nmLanV6Address) { + this.nmLanV6Address = nmLanV6Address; + } - public String getManagementV6Address() { - return managementV6Address; - } + public String getManagementV6Address() { + return managementV6Address; + } - public void setManagementV6Address(String managementV6Address) { - this.managementV6Address = managementV6Address; - } + public void setManagementV6Address(String managementV6Address) { + this.managementV6Address = managementV6Address; + } - public Long getVcpu() { - return vcpu; - } + public Long getVcpu() { + return vcpu; + } - public void setVcpu(Long vcpu) { - this.vcpu = vcpu; - } + public void setVcpu(Long vcpu) { + this.vcpu = vcpu; + } - public String getVcpuUnits() { - return vcpuUnits; - } + public String getVcpuUnits() { + return vcpuUnits; + } - public void setVcpuUnits(String vcpuUnits) { - this.vcpuUnits = vcpuUnits; - } + public void setVcpuUnits(String vcpuUnits) { + this.vcpuUnits = vcpuUnits; + } - public List<LInterface> getlInterfaces() { - return lInterfaces; - } + public List<LInterface> getlInterfaces() { + return lInterfaces; + } - public List<LagInterface> getLagInterfaces() { - return lagInterfaces; - } + public List<LagInterface> getLagInterfaces() { + return lagInterfaces; + } - public List<Entitlement> getEntitlements() { - return entitlements; - } + public List<Entitlement> getEntitlements() { + return entitlements; + } - public List<VfModule> getVfModules() { - return vfModules; - } + public List<VfModule> getVfModules() { + return vfModules; + } - public Long getVmemory() { - return vmemory; - } + public Long getVmemory() { + return vmemory; + } - public void setVmemory(Long vmemory) { - this.vmemory = vmemory; - } + public void setVmemory(Long vmemory) { + this.vmemory = vmemory; + } - public String getVmemoryUnits() { - return vmemoryUnits; - } + public String getVmemoryUnits() { + return vmemoryUnits; + } - public void setVmemoryUnits(String vmemoryUnits) { - this.vmemoryUnits = vmemoryUnits; - } + public void setVmemoryUnits(String vmemoryUnits) { + this.vmemoryUnits = vmemoryUnits; + } - public Long getVdisk() { - return vdisk; - } + public Long getVdisk() { + return vdisk; + } - public void setVdisk(Long vdisk) { - this.vdisk = vdisk; - } + public void setVdisk(Long vdisk) { + this.vdisk = vdisk; + } - public String getVdiskUnits() { - return vdiskUnits; - } + public String getVdiskUnits() { + return vdiskUnits; + } - public void setVdiskUnits(String vdiskUnits) { - this.vdiskUnits = vdiskUnits; - } + public void setVdiskUnits(String vdiskUnits) { + this.vdiskUnits = vdiskUnits; + } - public Boolean isInMaint() { - return inMaint; - } + public Boolean isInMaint() { + return inMaint; + } - public void setInMaint(Boolean inMaint) { - this.inMaint = inMaint; - } + public void setInMaint(Boolean inMaint) { + this.inMaint = inMaint; + } - public Boolean isIsClosedLoopDisabled() { - return isClosedLoopDisabled; - } + public Boolean isIsClosedLoopDisabled() { + return isClosedLoopDisabled; + } - public void setClosedLoopDisabled(Boolean isClosedLoopDisabled) { - this.isClosedLoopDisabled = isClosedLoopDisabled; - } + public void setClosedLoopDisabled(Boolean isClosedLoopDisabled) { + this.isClosedLoopDisabled = isClosedLoopDisabled; + } - public String getSummaryStatus() { - return summaryStatus; - } + public String getSummaryStatus() { + return summaryStatus; + } - public void setSummaryStatus(String summaryStatus) { - this.summaryStatus = summaryStatus; - } + public void setSummaryStatus(String summaryStatus) { + this.summaryStatus = summaryStatus; + } - public Boolean getEncryptedAccessFlag() { - return encryptedAccessFlag; - } + public Boolean getEncryptedAccessFlag() { + return encryptedAccessFlag; + } - public void setEncryptedAccessFlag(Boolean encryptedAccessFlag) { - this.encryptedAccessFlag = encryptedAccessFlag; - } + public void setEncryptedAccessFlag(Boolean encryptedAccessFlag) { + this.encryptedAccessFlag = encryptedAccessFlag; + } - public String getAsNumber() { - return asNumber; - } + public String getAsNumber() { + return asNumber; + } - public void setAsNumber(String asNumber) { - this.asNumber = asNumber; - } + public void setAsNumber(String asNumber) { + this.asNumber = asNumber; + } - public String getRegionalResourceSubzone() { - return regionalResourceSubzone; - } + public String getRegionalResourceSubzone() { + return regionalResourceSubzone; + } - public void setRegionalResourceSubzone(String regionalResourceSubzone) { - this.regionalResourceSubzone = regionalResourceSubzone; - } + public void setRegionalResourceSubzone(String regionalResourceSubzone) { + this.regionalResourceSubzone = regionalResourceSubzone; + } - public License getLicense() { - return license; - } + public License getLicense() { + return license; + } - public void setLicense(License license) { - this.license = license; - } + public void setLicense(License license) { + this.license = license; + } - public String getSelflink() { - return selflink; - } + public String getSelflink() { + return selflink; + } - public void setSelflink(String selflink) { - this.selflink = selflink; - } + public void setSelflink(String selflink) { + this.selflink = selflink; + } - public String getIpv4OamGatewayAddress() { - return ipv4OamGatewayAddress; - } + public String getIpv4OamGatewayAddress() { + return ipv4OamGatewayAddress; + } - public void setIpv4OamGatewayAddress(String ipv4OamGatewayAddress) { - this.ipv4OamGatewayAddress = ipv4OamGatewayAddress; - } + public void setIpv4OamGatewayAddress(String ipv4OamGatewayAddress) { + this.ipv4OamGatewayAddress = ipv4OamGatewayAddress; + } - public Integer getIpv4OamGatewayAddressPrefixLength() { - return ipv4OamGatewayAddressPrefixLength; - } + public Integer getIpv4OamGatewayAddressPrefixLength() { + return ipv4OamGatewayAddressPrefixLength; + } - public void setIpv4OamGatewayAddressPrefixLength(Integer ipv4OamGatewayAddressPrefixLength) { - this.ipv4OamGatewayAddressPrefixLength = ipv4OamGatewayAddressPrefixLength; - } + public void setIpv4OamGatewayAddressPrefixLength(Integer ipv4OamGatewayAddressPrefixLength) { + this.ipv4OamGatewayAddressPrefixLength = ipv4OamGatewayAddressPrefixLength; + } - public Long getVlanIdOuter() { - return vlanIdOuter; - } + public Long getVlanIdOuter() { + return vlanIdOuter; + } - public void setVlanIdOuter(Long vlanIdOuter) { - this.vlanIdOuter = vlanIdOuter; - } + public void setVlanIdOuter(Long vlanIdOuter) { + this.vlanIdOuter = vlanIdOuter; + } - public String getNmProfileName() { - return nmProfileName; - } - - public void setNmProfileName(String nmProfileName) { - this.nmProfileName = nmProfileName; - } - - public String getVnfId() { - return vnfId; - } - - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } - - public String getVnfName() { - return vnfName; - } - - public void setVnfName(String vnfName) { - this.vnfName = vnfName; - } - - public String getVnfType() { - return vnfType; - } - - public void setVnfType(String vnfType) { - this.vnfType = vnfType; - } - - public OrchestrationStatus getOrchestrationStatus() { - return orchestrationStatus; - } - - public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - - public LineOfBusiness getLineOfBusiness() { - return lineOfBusiness; - } - - public void setLineOfBusiness(LineOfBusiness lineOfBusiness) { - this.lineOfBusiness = lineOfBusiness; - } - - public Platform getPlatform() { - return platform; - } - - public void setPlatform(Platform platform) { - this.platform = platform; - } - - public Boolean isCascaded() { - return cascaded; - } - - public void setCascaded(Boolean cascaded) { - this.cascaded = cascaded; - } - - public Map<String, String> getCloudParams() { - return cloudParams; - } - - public void setCloudParams(Map<String, String> cloudParams) { - this.cloudParams = cloudParams; - } - - public SolutionInfo getSolution() { - return solution; - } - - public void setSolution(SolutionInfo solution) { - this.solution = solution; - } - - public CloudRegion getCloudRegion() { - return cloudRegion; - } - - public void setCloudRegion(CloudRegion cloudRegion) { - this.cloudRegion = cloudRegion; - } - - public Boolean isCallHoming() { - return callHoming; - } - - public void setCallHoming(Boolean callHoming) { - this.callHoming = callHoming; - } - - @Override - public boolean equals(final Object other) { - if (!(other instanceof GenericVnf)) { - return false; - } - GenericVnf castOther = (GenericVnf) other; - return new EqualsBuilder().append(vnfId, castOther.vnfId).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(vnfId).toHashCode(); - } + public String getNmProfileName() { + return nmProfileName; + } + + public void setNmProfileName(String nmProfileName) { + this.nmProfileName = nmProfileName; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getVnfName() { + return vnfName; + } + + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } + + public String getVnfType() { + return vnfType; + } + + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public LineOfBusiness getLineOfBusiness() { + return lineOfBusiness; + } + + public void setLineOfBusiness(LineOfBusiness lineOfBusiness) { + this.lineOfBusiness = lineOfBusiness; + } + + public Platform getPlatform() { + return platform; + } + + public void setPlatform(Platform platform) { + this.platform = platform; + } + + public Boolean isCascaded() { + return cascaded; + } + + public void setCascaded(Boolean cascaded) { + this.cascaded = cascaded; + } + + public Map<String, String> getCloudParams() { + return cloudParams; + } + + public void setCloudParams(Map<String, String> cloudParams) { + this.cloudParams = cloudParams; + } + + public SolutionInfo getSolution() { + return solution; + } + + public void setSolution(SolutionInfo solution) { + this.solution = solution; + } + + public CloudRegion getCloudRegion() { + return cloudRegion; + } + + public void setCloudRegion(CloudRegion cloudRegion) { + this.cloudRegion = cloudRegion; + } + + public Boolean isCallHoming() { + return callHoming; + } + + public void setCallHoming(Boolean callHoming) { + this.callHoming = callHoming; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof GenericVnf)) { + return false; + } + GenericVnf castOther = (GenericVnf) other; + return new EqualsBuilder().append(vnfId, castOther.vnfId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(vnfId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/HostRoute.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/HostRoute.java index 75356ac9db..f8cc594d11 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/HostRoute.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/HostRoute.java @@ -21,64 +21,71 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("host-route") -public class HostRoute implements Serializable, ShallowCopy<HostRoute>{ +public class HostRoute implements Serializable, ShallowCopy<HostRoute> { - private static final long serialVersionUID = -2468793257174064133L; + private static final long serialVersionUID = -2468793257174064133L; - @Id - @JsonProperty("host-route-id") + @Id + @JsonProperty("host-route-id") private String hostRouteId; - @JsonProperty("route-prefix") + @JsonProperty("route-prefix") private String routePrefix; - @JsonProperty("next-hop") + @JsonProperty("next-hop") private String nextHop; - @JsonProperty("next-hop-type") + @JsonProperty("next-hop-type") private String nextHopType; - public String getHostRouteId() { - return hostRouteId; - } - public void setHostRouteId(String hostRouteId) { - this.hostRouteId = hostRouteId; - } - public String getRoutePrefix() { - return routePrefix; - } - public void setRoutePrefix(String routePrefix) { - this.routePrefix = routePrefix; - } - public String getNextHop() { - return nextHop; - } - public void setNextHop(String nextHop) { - this.nextHop = nextHop; - } - public String getNextHopType() { - return nextHopType; - } - public void setNextHopType(String nextHopType) { - this.nextHopType = nextHopType; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof HostRoute)) { - return false; - } - HostRoute castOther = (HostRoute) other; - return new EqualsBuilder().append(hostRouteId, castOther.hostRouteId).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(hostRouteId).toHashCode(); - } + public String getHostRouteId() { + return hostRouteId; + } + + public void setHostRouteId(String hostRouteId) { + this.hostRouteId = hostRouteId; + } + + public String getRoutePrefix() { + return routePrefix; + } + + public void setRoutePrefix(String routePrefix) { + this.routePrefix = routePrefix; + } + + public String getNextHop() { + return nextHop; + } + + public void setNextHop(String nextHop) { + this.nextHop = nextHop; + } + + public String getNextHopType() { + return nextHopType; + } + + public void setNextHopType(String nextHopType) { + this.nextHopType = nextHopType; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof HostRoute)) { + return false; + } + HostRoute castOther = (HostRoute) other; + return new EqualsBuilder().append(hostRouteId, castOther.hostRouteId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(hostRouteId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java index 7a58f6db6b..4edaecdbca 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java @@ -23,99 +23,113 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import javax.persistence.Id; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; import org.onap.so.db.catalog.beans.OrchestrationStatus; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("instance-group") -public class InstanceGroup implements Serializable, ShallowCopy<InstanceGroup> { - - private static final long serialVersionUID = -2330859693128099141L; - - @Id - @JsonProperty("id") - private String id; - @JsonProperty("description") - private String description; - @JsonProperty("resource-version") - private String resourceVersion; - @JsonProperty("instance-group-name") - private String instanceGroupName; - @JsonProperty("orchestration-status") - private OrchestrationStatus orchestrationStatus = OrchestrationStatus.PRECREATED; - @JsonProperty("model-info-instance-group") - private ModelInfoInstanceGroup modelInfoInstanceGroup; - @JsonProperty("instance-group-function") - private String instanceGroupFunction; - @JsonProperty("vnfs") - private List<GenericVnf> vnfs = new ArrayList<>(); - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - public String getResourceVersion() { - return resourceVersion; - } - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - public String getInstanceGroupName() { - return instanceGroupName; - } - public void setInstanceGroupName(String instanceGroupName) { - this.instanceGroupName = instanceGroupName; - } - public OrchestrationStatus getOrchestrationStatus() { - return orchestrationStatus; - } - public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - public ModelInfoInstanceGroup getModelInfoInstanceGroup() { - return modelInfoInstanceGroup; - } - public void setModelInfoInstanceGroup(ModelInfoInstanceGroup modelInfoInstanceGroup) { - this.modelInfoInstanceGroup = modelInfoInstanceGroup; - } - public String getInstanceGroupFunction() { - return instanceGroupFunction; - } - public void setInstanceGroupFunction(String instanceGroupFunction) { - this.instanceGroupFunction = instanceGroupFunction; - } - public List<GenericVnf> getVnfs() { - return vnfs; - } - public void setVnfs(List<GenericVnf> vnfs) { - this.vnfs = vnfs; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof InstanceGroup)) { - return false; - } - InstanceGroup castOther = (InstanceGroup) other; - return new EqualsBuilder().append(id, castOther.id).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(id).toHashCode(); - } +public class InstanceGroup implements Serializable, ShallowCopy<InstanceGroup> { + + private static final long serialVersionUID = -2330859693128099141L; + + @Id + @JsonProperty("id") + private String id; + @JsonProperty("description") + private String description; + @JsonProperty("resource-version") + private String resourceVersion; + @JsonProperty("instance-group-name") + private String instanceGroupName; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus = OrchestrationStatus.PRECREATED; + @JsonProperty("model-info-instance-group") + private ModelInfoInstanceGroup modelInfoInstanceGroup; + @JsonProperty("instance-group-function") + private String instanceGroupFunction; + @JsonProperty("vnfs") + private List<GenericVnf> vnfs = new ArrayList<>(); + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + public String getInstanceGroupName() { + return instanceGroupName; + } + + public void setInstanceGroupName(String instanceGroupName) { + this.instanceGroupName = instanceGroupName; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public ModelInfoInstanceGroup getModelInfoInstanceGroup() { + return modelInfoInstanceGroup; + } + + public void setModelInfoInstanceGroup(ModelInfoInstanceGroup modelInfoInstanceGroup) { + this.modelInfoInstanceGroup = modelInfoInstanceGroup; + } + + public String getInstanceGroupFunction() { + return instanceGroupFunction; + } + + public void setInstanceGroupFunction(String instanceGroupFunction) { + this.instanceGroupFunction = instanceGroupFunction; + } + + public List<GenericVnf> getVnfs() { + return vnfs; + } + + public void setVnfs(List<GenericVnf> vnfs) { + this.vnfs = vnfs; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof InstanceGroup)) { + return false; + } + InstanceGroup castOther = (InstanceGroup) other; + return new EqualsBuilder().append(id, castOther.id).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(id).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv4AddressList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv4AddressList.java index 55b8a752b6..b064d53945 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv4AddressList.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv4AddressList.java @@ -21,88 +21,101 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("l3-interface-ipv4-address-list") -public class L3InterfaceIpv4AddressList implements Serializable, ShallowCopy<L3InterfaceIpv4AddressList>{ +public class L3InterfaceIpv4AddressList implements Serializable, ShallowCopy<L3InterfaceIpv4AddressList> { - private static final long serialVersionUID = -1566884527411610879L; + private static final long serialVersionUID = -1566884527411610879L; - @Id - @JsonProperty("l3-interface-ipv4-address") + @Id + @JsonProperty("l3-interface-ipv4-address") private String l3InterfaceIpv4Address; - @JsonProperty("l3-interface-ipv4-prefix-length") + @JsonProperty("l3-interface-ipv4-prefix-length") private Long l3InterfaceIpv4PrefixLength; - @JsonProperty("vlan-id-inner") + @JsonProperty("vlan-id-inner") private Long vlanIdInner; - @JsonProperty("vlan-id-outer") + @JsonProperty("vlan-id-outer") private Long vlanIdOuter; - @JsonProperty("is-floating") + @JsonProperty("is-floating") private Boolean isFloating; - @JsonProperty("neutron-network-id") + @JsonProperty("neutron-network-id") private String neutronNetworkId; - @JsonProperty("neutron-subnet-id") + @JsonProperty("neutron-subnet-id") private String neutronSubnetId; - public String getL3InterfaceIpv4Address() { - return l3InterfaceIpv4Address; - } - public void setL3InterfaceIpv4Address(String l3InterfaceIpv4Address) { - this.l3InterfaceIpv4Address = l3InterfaceIpv4Address; - } - public Long getL3InterfaceIpv4PrefixLength() { - return l3InterfaceIpv4PrefixLength; - } - public void setL3InterfaceIpv4PrefixLength(Long l3InterfaceIpv4PrefixLength) { - this.l3InterfaceIpv4PrefixLength = l3InterfaceIpv4PrefixLength; - } - public Long getVlanIdInner() { - return vlanIdInner; - } - public void setVlanIdInner(Long vlanIdInner) { - this.vlanIdInner = vlanIdInner; - } - public Long getVlanIdOuter() { - return vlanIdOuter; - } - public void setVlanIdOuter(Long vlanIdOuter) { - this.vlanIdOuter = vlanIdOuter; - } - public Boolean getIsFloating() { - return isFloating; - } - public void setIsFloating(Boolean isFloating) { - this.isFloating = isFloating; - } - public String getNeutronNetworkId() { - return neutronNetworkId; - } - public void setNeutronNetworkId(String neutronNetworkId) { - this.neutronNetworkId = neutronNetworkId; - } - public String getNeutronSubnetId() { - return neutronSubnetId; - } - public void setNeutronSubnetId(String neutronSubnetId) { - this.neutronSubnetId = neutronSubnetId; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof L3InterfaceIpv4AddressList)) { - return false; - } - L3InterfaceIpv4AddressList castOther = (L3InterfaceIpv4AddressList) other; - return new EqualsBuilder().append(l3InterfaceIpv4Address, castOther.l3InterfaceIpv4Address).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(l3InterfaceIpv4Address).toHashCode(); - } + public String getL3InterfaceIpv4Address() { + return l3InterfaceIpv4Address; + } + + public void setL3InterfaceIpv4Address(String l3InterfaceIpv4Address) { + this.l3InterfaceIpv4Address = l3InterfaceIpv4Address; + } + + public Long getL3InterfaceIpv4PrefixLength() { + return l3InterfaceIpv4PrefixLength; + } + + public void setL3InterfaceIpv4PrefixLength(Long l3InterfaceIpv4PrefixLength) { + this.l3InterfaceIpv4PrefixLength = l3InterfaceIpv4PrefixLength; + } + + public Long getVlanIdInner() { + return vlanIdInner; + } + + public void setVlanIdInner(Long vlanIdInner) { + this.vlanIdInner = vlanIdInner; + } + + public Long getVlanIdOuter() { + return vlanIdOuter; + } + + public void setVlanIdOuter(Long vlanIdOuter) { + this.vlanIdOuter = vlanIdOuter; + } + + public Boolean getIsFloating() { + return isFloating; + } + + public void setIsFloating(Boolean isFloating) { + this.isFloating = isFloating; + } + + public String getNeutronNetworkId() { + return neutronNetworkId; + } + + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + + public String getNeutronSubnetId() { + return neutronSubnetId; + } + + public void setNeutronSubnetId(String neutronSubnetId) { + this.neutronSubnetId = neutronSubnetId; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof L3InterfaceIpv4AddressList)) { + return false; + } + L3InterfaceIpv4AddressList castOther = (L3InterfaceIpv4AddressList) other; + return new EqualsBuilder().append(l3InterfaceIpv4Address, castOther.l3InterfaceIpv4Address).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(l3InterfaceIpv4Address).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv6AddressList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv6AddressList.java index 209c64762f..ffdcad5a13 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv6AddressList.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv6AddressList.java @@ -21,103 +21,101 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("l3-interface-ipv6-address-list") public class L3InterfaceIpv6AddressList implements Serializable, ShallowCopy<L3InterfaceIpv6AddressList> { - private static final long serialVersionUID = -414901751774739052L; - - @Id - @JsonProperty("l3-interface-ipv6-address") - private String l3InterfaceIpv6Address; - @JsonProperty("l3-interface-ipv6-prefix-length") - private Long l3InterfaceIpv6PrefixLength; - @JsonProperty("vlan-id-inner") - private Long vlanIdInner; - @JsonProperty("vlan-id-outer") - private Long vlanIdOuter; - @JsonProperty("is-floating") - private Boolean isFloating; - @JsonProperty("neutron-network-id") - private String neutronNetworkId; - @JsonProperty("neutron-subnet-id") - private String neutronSubnetId; - - public String getL3InterfaceIpv6Address() { - return l3InterfaceIpv6Address; - } - - public void setL3InterfaceIpv6Address(String l3InterfaceIpv6Address) { - this.l3InterfaceIpv6Address = l3InterfaceIpv6Address; - } - - public Long getL3InterfaceIpv6PrefixLength() { - return l3InterfaceIpv6PrefixLength; - } - - public void setL3InterfaceIpv6PrefixLength(Long l3InterfaceIpv6PrefixLength) { - this.l3InterfaceIpv6PrefixLength = l3InterfaceIpv6PrefixLength; - } - - public Long getVlanIdInner() { - return vlanIdInner; - } - - public void setVlanIdInner(Long vlanIdInner) { - this.vlanIdInner = vlanIdInner; - } - - public Long getVlanIdOuter() { - return vlanIdOuter; - } - - public void setVlanIdOuter(Long vlanIdOuter) { - this.vlanIdOuter = vlanIdOuter; - } - - public Boolean getIsFloating() { - return isFloating; - } - - public void setIsFloating(Boolean isFloating) { - this.isFloating = isFloating; - } - - public String getNeutronNetworkId() { - return neutronNetworkId; - } - - public void setNeutronNetworkId(String neutronNetworkId) { - this.neutronNetworkId = neutronNetworkId; - } - - public String getNeutronSubnetId() { - return neutronSubnetId; - } - - public void setNeutronSubnetId(String neutronSubnetId) { - this.neutronSubnetId = neutronSubnetId; - } - - @Override - public boolean equals(final Object other) { - if (!(other instanceof L3InterfaceIpv6AddressList)) { - return false; - } - L3InterfaceIpv6AddressList castOther = (L3InterfaceIpv6AddressList) other; - return new EqualsBuilder().append(l3InterfaceIpv6Address, castOther.l3InterfaceIpv6Address).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(l3InterfaceIpv6Address).toHashCode(); - } + private static final long serialVersionUID = -414901751774739052L; + + @Id + @JsonProperty("l3-interface-ipv6-address") + private String l3InterfaceIpv6Address; + @JsonProperty("l3-interface-ipv6-prefix-length") + private Long l3InterfaceIpv6PrefixLength; + @JsonProperty("vlan-id-inner") + private Long vlanIdInner; + @JsonProperty("vlan-id-outer") + private Long vlanIdOuter; + @JsonProperty("is-floating") + private Boolean isFloating; + @JsonProperty("neutron-network-id") + private String neutronNetworkId; + @JsonProperty("neutron-subnet-id") + private String neutronSubnetId; + + public String getL3InterfaceIpv6Address() { + return l3InterfaceIpv6Address; + } + + public void setL3InterfaceIpv6Address(String l3InterfaceIpv6Address) { + this.l3InterfaceIpv6Address = l3InterfaceIpv6Address; + } + + public Long getL3InterfaceIpv6PrefixLength() { + return l3InterfaceIpv6PrefixLength; + } + + public void setL3InterfaceIpv6PrefixLength(Long l3InterfaceIpv6PrefixLength) { + this.l3InterfaceIpv6PrefixLength = l3InterfaceIpv6PrefixLength; + } + + public Long getVlanIdInner() { + return vlanIdInner; + } + + public void setVlanIdInner(Long vlanIdInner) { + this.vlanIdInner = vlanIdInner; + } + + public Long getVlanIdOuter() { + return vlanIdOuter; + } + + public void setVlanIdOuter(Long vlanIdOuter) { + this.vlanIdOuter = vlanIdOuter; + } + + public Boolean getIsFloating() { + return isFloating; + } + + public void setIsFloating(Boolean isFloating) { + this.isFloating = isFloating; + } + + public String getNeutronNetworkId() { + return neutronNetworkId; + } + + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + + public String getNeutronSubnetId() { + return neutronSubnetId; + } + + public void setNeutronSubnetId(String neutronSubnetId) { + this.neutronSubnetId = neutronSubnetId; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof L3InterfaceIpv6AddressList)) { + return false; + } + L3InterfaceIpv6AddressList castOther = (L3InterfaceIpv6AddressList) other; + return new EqualsBuilder().append(l3InterfaceIpv6Address, castOther.l3InterfaceIpv6Address).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(l3InterfaceIpv6Address).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java index 781eba3332..6b3ad1d528 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java @@ -25,258 +25,305 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - import javax.persistence.Id; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; import org.onap.so.db.catalog.beans.OrchestrationStatus; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("l3Network") public class L3Network implements Serializable, ShallowCopy<L3Network> { - private static final long serialVersionUID = 4434492567957111317L; + private static final long serialVersionUID = 4434492567957111317L; - @Id - @JsonProperty("network-id") - private String networkId; - @JsonProperty("cascaded") - private Boolean cascaded; - @JsonProperty("cloud-params") - private Map<String, String> cloudParams = new HashMap<>(); - @JsonProperty("network-name") + @Id + @JsonProperty("network-id") + private String networkId; + @JsonProperty("cascaded") + private Boolean cascaded; + @JsonProperty("cloud-params") + private Map<String, String> cloudParams = new HashMap<>(); + @JsonProperty("network-name") private String networkName; - @JsonProperty("neutron-network-id") - private String neutronNetworkId; - @JsonProperty("network-type") - private String networkType; - @JsonProperty("network-technology") - private String networkTechnology; - @JsonProperty("network-role") - private String networkRole; - @JsonProperty("is-bound-to-vpn") + @JsonProperty("neutron-network-id") + private String neutronNetworkId; + @JsonProperty("network-type") + private String networkType; + @JsonProperty("network-technology") + private String networkTechnology; + @JsonProperty("network-role") + private String networkRole; + @JsonProperty("is-bound-to-vpn") private Boolean isBoundToVpn; - @JsonProperty("service-id") + @JsonProperty("service-id") private String serviceId; - @JsonProperty("network-role-instance") + @JsonProperty("network-role-instance") private Long networkRoleInstance; - @JsonProperty("orchestration-status") + @JsonProperty("orchestration-status") private OrchestrationStatus orchestrationStatus; - @JsonProperty("heat-stack-id") + @JsonProperty("heat-stack-id") private String heatStackId; - @JsonProperty("contrail-network-fqdn") + @JsonProperty("contrail-network-fqdn") private String contrailNetworkFqdn; - @JsonProperty("network-policies") - private List<NetworkPolicy> networkPolicies = new ArrayList<>(); - @JsonProperty("contrail-network-route-table-references") - private List<RouteTableReference> contrailNetworkRouteTableReferences = new ArrayList<>(); - @JsonProperty("widget-model-id") + @JsonProperty("network-policies") + private List<NetworkPolicy> networkPolicies = new ArrayList<>(); + @JsonProperty("contrail-network-route-table-references") + private List<RouteTableReference> contrailNetworkRouteTableReferences = new ArrayList<>(); + @JsonProperty("widget-model-id") private String widgetModelId; - @JsonProperty("widget-model-version") + @JsonProperty("widget-model-version") private String widgetModelVersion; - @JsonProperty("physical-network-name") + @JsonProperty("physical-network-name") private String physicalNetworkName; - @JsonProperty("is-provider-network") + @JsonProperty("is-provider-network") private Boolean isProviderNetwork; - @JsonProperty("is-shared-network") + @JsonProperty("is-shared-network") private Boolean isSharedNetwork; - @JsonProperty("is-external-network") + @JsonProperty("is-external-network") private Boolean isExternalNetwork; - @JsonProperty("self-link") + @JsonProperty("self-link") private String selflink; - @JsonProperty("operational-status") + @JsonProperty("operational-status") private String operationalStatus; - @JsonProperty("subnets") + @JsonProperty("subnets") private List<Subnet> subnets = new ArrayList<>(); - @JsonProperty("ctag-assignments") + @JsonProperty("ctag-assignments") private List<CtagAssignment> ctagAssignments = new ArrayList<>(); - @JsonProperty("segmentation-assignments") + @JsonProperty("segmentation-assignments") private List<SegmentationAssignment> segmentationAssignments = new ArrayList<>(); - @JsonProperty("model-info-network") - private ModelInfoNetwork modelInfoNetwork; - @JsonProperty("aggregate-routes") + @JsonProperty("model-info-network") + private ModelInfoNetwork modelInfoNetwork; + @JsonProperty("aggregate-routes") private List<AggregateRoute> aggregateRoutes = new ArrayList<>(); - @JsonProperty("vpn-binding") + @JsonProperty("vpn-binding") private List<VpnBinding> vpnBindings = new ArrayList<>(); - public ModelInfoNetwork getModelInfoNetwork() { - return modelInfoNetwork; - } - public void setModelInfoNetwork(ModelInfoNetwork modelInfoNetwork) { - this.modelInfoNetwork = modelInfoNetwork; - } - public String getNeutronNetworkId() { - return neutronNetworkId; - } - public void setNeutronNetworkId(String neutronNetworkId) { - this.neutronNetworkId = neutronNetworkId; - } - public String getNetworkId() { - return networkId; - } - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - public String getNetworkName() { - return networkName; - } - public void setNetworkName(String networkName) { - this.networkName = networkName; - } - public String getNetworkType() { - return networkType; - } - public void setNetworkType(String networkType) { - this.networkType = networkType; - } - public String getNetworkTechnology() { - return networkTechnology; - } - public void setNetworkTechnology(String networkTechnology) { - this.networkTechnology = networkTechnology; - } - public String getNetworkRole() { - return networkRole; - } - public void setNetworkRole(String networkRole) { - this.networkRole = networkRole; - } - public Boolean isIsBoundToVpn() { - return isBoundToVpn; - } - public void setIsBoundToVpn(Boolean isBoundToVpn) { - this.isBoundToVpn = isBoundToVpn; - } - public String getServiceId() { - return serviceId; - } - public void setServiceId(String serviceId) { - this.serviceId = serviceId; - } - public Long getNetworkRoleInstance() { - return networkRoleInstance; - } - public void setNetworkRoleInstance(Long networkRoleInstance) { - this.networkRoleInstance = networkRoleInstance; - } - public OrchestrationStatus getOrchestrationStatus() { - return orchestrationStatus; - } - public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - public String getHeatStackId() { - return heatStackId; - } - public void setHeatStackId(String heatStackId) { - this.heatStackId = heatStackId; - } - public String getContrailNetworkFqdn() { - return contrailNetworkFqdn; - } - public void setContrailNetworkFqdn(String contrailNetworkFqdn) { - this.contrailNetworkFqdn = contrailNetworkFqdn; - } - public List<NetworkPolicy> getNetworkPolicies() { - return networkPolicies; - } - public List<RouteTableReference> getContrailNetworkRouteTableReferences() { - return contrailNetworkRouteTableReferences; - } - public String getWidgetModelId() { - return widgetModelId; - } - public void setWidgetModelId(String widgetModelId) { - this.widgetModelId = widgetModelId; - } - public String getWidgetModelVersion() { - return widgetModelVersion; - } - public void setWidgetModelVersion(String widgetModelVersion) { - this.widgetModelVersion = widgetModelVersion; - } - public String getPhysicalNetworkName() { - return physicalNetworkName; - } - public void setPhysicalNetworkName(String physicalNetworkName) { - this.physicalNetworkName = physicalNetworkName; - } - public Boolean isIsProviderNetwork() { - return isProviderNetwork; - } - public void setIsProviderNetwork(Boolean isProviderNetwork) { - this.isProviderNetwork = isProviderNetwork; - } - public Boolean isIsSharedNetwork() { - return isSharedNetwork; - } - public void setIsSharedNetwork(Boolean isSharedNetwork) { - this.isSharedNetwork = isSharedNetwork; - } - public Boolean isIsExternalNetwork() { - return isExternalNetwork; - } - public void setIsExternalNetwork(Boolean isExternalNetwork) { - this.isExternalNetwork = isExternalNetwork; - } - public String getSelflink() { - return selflink; - } - public void setSelflink(String selflink) { - this.selflink = selflink; - } - public String getOperationalStatus() { - return operationalStatus; - } - public void setOperationalStatus(String operationalStatus) { - this.operationalStatus = operationalStatus; - } - - public List<Subnet> getSubnets() { - return subnets; - } - public List<CtagAssignment> getCtagAssignments() { - return ctagAssignments; - } - public List<SegmentationAssignment> getSegmentationAssignments() { - return segmentationAssignments; - } - public Boolean isCascaded() { - return cascaded; - } - public void setIsCascaded(Boolean cascaded) { - this.cascaded = cascaded; - } - public Map<String, String> getCloudParams() { - return cloudParams; - } - public void setCloudParams(Map<String, String> cloudParams) { - this.cloudParams = cloudParams; - } - - public List<AggregateRoute> getAggregateRoutes(){ - return aggregateRoutes; - } - - public List<VpnBinding> getVpnBindings(){ - return vpnBindings; - } - - @Override - public boolean equals(final Object other) { - if (!(other instanceof L3Network)) { - return false; - } - L3Network castOther = (L3Network) other; - return new EqualsBuilder().append(networkId, castOther.networkId).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(networkId).toHashCode(); - } + public ModelInfoNetwork getModelInfoNetwork() { + return modelInfoNetwork; + } + + public void setModelInfoNetwork(ModelInfoNetwork modelInfoNetwork) { + this.modelInfoNetwork = modelInfoNetwork; + } + + public String getNeutronNetworkId() { + return neutronNetworkId; + } + + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNetworkName() { + return networkName; + } + + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + + public String getNetworkType() { + return networkType; + } + + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + + public String getNetworkTechnology() { + return networkTechnology; + } + + public void setNetworkTechnology(String networkTechnology) { + this.networkTechnology = networkTechnology; + } + + public String getNetworkRole() { + return networkRole; + } + + public void setNetworkRole(String networkRole) { + this.networkRole = networkRole; + } + + public Boolean isIsBoundToVpn() { + return isBoundToVpn; + } + + public void setIsBoundToVpn(Boolean isBoundToVpn) { + this.isBoundToVpn = isBoundToVpn; + } + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public Long getNetworkRoleInstance() { + return networkRoleInstance; + } + + public void setNetworkRoleInstance(Long networkRoleInstance) { + this.networkRoleInstance = networkRoleInstance; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public String getHeatStackId() { + return heatStackId; + } + + public void setHeatStackId(String heatStackId) { + this.heatStackId = heatStackId; + } + + public String getContrailNetworkFqdn() { + return contrailNetworkFqdn; + } + + public void setContrailNetworkFqdn(String contrailNetworkFqdn) { + this.contrailNetworkFqdn = contrailNetworkFqdn; + } + + public List<NetworkPolicy> getNetworkPolicies() { + return networkPolicies; + } + + public List<RouteTableReference> getContrailNetworkRouteTableReferences() { + return contrailNetworkRouteTableReferences; + } + + public String getWidgetModelId() { + return widgetModelId; + } + + public void setWidgetModelId(String widgetModelId) { + this.widgetModelId = widgetModelId; + } + + public String getWidgetModelVersion() { + return widgetModelVersion; + } + + public void setWidgetModelVersion(String widgetModelVersion) { + this.widgetModelVersion = widgetModelVersion; + } + + public String getPhysicalNetworkName() { + return physicalNetworkName; + } + + public void setPhysicalNetworkName(String physicalNetworkName) { + this.physicalNetworkName = physicalNetworkName; + } + + public Boolean isIsProviderNetwork() { + return isProviderNetwork; + } + + public void setIsProviderNetwork(Boolean isProviderNetwork) { + this.isProviderNetwork = isProviderNetwork; + } + + public Boolean isIsSharedNetwork() { + return isSharedNetwork; + } + + public void setIsSharedNetwork(Boolean isSharedNetwork) { + this.isSharedNetwork = isSharedNetwork; + } + + public Boolean isIsExternalNetwork() { + return isExternalNetwork; + } + + public void setIsExternalNetwork(Boolean isExternalNetwork) { + this.isExternalNetwork = isExternalNetwork; + } + + public String getSelflink() { + return selflink; + } + + public void setSelflink(String selflink) { + this.selflink = selflink; + } + + public String getOperationalStatus() { + return operationalStatus; + } + + public void setOperationalStatus(String operationalStatus) { + this.operationalStatus = operationalStatus; + } + + public List<Subnet> getSubnets() { + return subnets; + } + + public List<CtagAssignment> getCtagAssignments() { + return ctagAssignments; + } + + public List<SegmentationAssignment> getSegmentationAssignments() { + return segmentationAssignments; + } + + public Boolean isCascaded() { + return cascaded; + } + + public void setIsCascaded(Boolean cascaded) { + this.cascaded = cascaded; + } + + public Map<String, String> getCloudParams() { + return cloudParams; + } + + public void setCloudParams(Map<String, String> cloudParams) { + this.cloudParams = cloudParams; + } + + public List<AggregateRoute> getAggregateRoutes() { + return aggregateRoutes; + } + + public List<VpnBinding> getVpnBindings() { + return vpnBindings; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof L3Network)) { + return false; + } + L3Network castOther = (L3Network) other; + return new EqualsBuilder().append(networkId, castOther.networkId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(networkId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java index f102c15062..387d191409 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java @@ -23,169 +23,201 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("l-interface") -public class LInterface implements Serializable, ShallowCopy<LInterface>{ +public class LInterface implements Serializable, ShallowCopy<LInterface> { - private static final long serialVersionUID = 5629921809747079453L; + private static final long serialVersionUID = 5629921809747079453L; - @Id - @JsonProperty("interface-name") + @Id + @JsonProperty("interface-name") private String interfaceName; - @JsonProperty("interface-role") + @JsonProperty("interface-role") private String interfaceRole; - @JsonProperty("v6-wan-link-ip") + @JsonProperty("v6-wan-link-ip") private String v6WanLinkIp; - @JsonProperty("self-link") + @JsonProperty("self-link") private String selflink; - @JsonProperty("interface-id") + @JsonProperty("interface-id") private String interfaceId; - @JsonProperty("macaddr") + @JsonProperty("macaddr") private String macaddr; - @JsonProperty("network-name") + @JsonProperty("network-name") private String networkName; - @JsonProperty("management-option") + @JsonProperty("management-option") private String managementOption; - @JsonProperty("interface-description") + @JsonProperty("interface-description") private String interfaceDescription; - @JsonProperty("is-port-mirrored") + @JsonProperty("is-port-mirrored") private Boolean isPortMirrored; - @JsonProperty("in-maint") + @JsonProperty("in-maint") private Boolean inMaint; - @JsonProperty("prov-status") + @JsonProperty("prov-status") private String provStatus; - @JsonProperty("is-ip-unnumbered") + @JsonProperty("is-ip-unnumbered") private Boolean isIpUnnumbered; - @JsonProperty("allowed-address-pairs") + @JsonProperty("allowed-address-pairs") private String allowedAddressPairs; - @JsonProperty("vlans") + @JsonProperty("vlans") private List<Vlan> vlans = new ArrayList<Vlan>(); - @JsonProperty("sriov-vfs") + @JsonProperty("sriov-vfs") private List<SriovVf> sriovVfs = new ArrayList<SriovVf>(); - @JsonProperty("l-interfaces") + @JsonProperty("l-interfaces") private List<LInterface> lInterfaces = new ArrayList<LInterface>(); - @JsonProperty("l3-interface-ipv4-address-list") + @JsonProperty("l3-interface-ipv4-address-list") private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>(); - @JsonProperty("l3-interface-ipv6-address-list") + @JsonProperty("l3-interface-ipv6-address-list") private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<L3InterfaceIpv6AddressList>(); - public String getInterfaceName() { - return interfaceName; - } - public void setInterfaceName(String interfaceName) { - this.interfaceName = interfaceName; - } - public String getInterfaceRole() { - return interfaceRole; - } - public void setInterfaceRole(String interfaceRole) { - this.interfaceRole = interfaceRole; - } - public String getV6WanLinkIp() { - return v6WanLinkIp; - } - public void setV6WanLinkIp(String v6WanLinkIp) { - this.v6WanLinkIp = v6WanLinkIp; - } - public String getSelflink() { - return selflink; - } - public void setSelflink(String selflink) { - this.selflink = selflink; - } - public String getInterfaceId() { - return interfaceId; - } - public void setInterfaceId(String interfaceId) { - this.interfaceId = interfaceId; - } - public String getMacaddr() { - return macaddr; - } - public void setMacaddr(String macaddr) { - this.macaddr = macaddr; - } - public String getNetworkName() { - return networkName; - } - public void setNetworkName(String networkName) { - this.networkName = networkName; - } - public String getManagementOption() { - return managementOption; - } - public void setManagementOption(String managementOption) { - this.managementOption = managementOption; - } - public String getInterfaceDescription() { - return interfaceDescription; - } - public void setInterfaceDescription(String interfaceDescription) { - this.interfaceDescription = interfaceDescription; - } - public Boolean isIsPortMirrored() { - return isPortMirrored; - } - public void setPortMirrored(Boolean isPortMirrored) { - this.isPortMirrored = isPortMirrored; - } - public Boolean isInMaint() { - return inMaint; - } - public void setInMaint(boolean inMaint) { - this.inMaint = inMaint; - } - public String getProvStatus() { - return provStatus; - } - public void setProvStatus(String provStatus) { - this.provStatus = provStatus; - } - public Boolean isIsIpUnnumbered() { - return isIpUnnumbered; - } - public void setIpUnnumbered(Boolean isIpUnnumbered) { - this.isIpUnnumbered = isIpUnnumbered; - } - public String getAllowedAddressPairs() { - return allowedAddressPairs; - } - public void setAllowedAddressPairs(String allowedAddressPairs) { - this.allowedAddressPairs = allowedAddressPairs; - } - public List<Vlan> getVlans() { - return vlans; - } - public List<SriovVf> getSriovVfs() { - return sriovVfs; - } - public List<LInterface> getlInterfaces() { - return lInterfaces; - } - public List<L3InterfaceIpv4AddressList> getL3InterfaceIpv4AddressList() { - return l3InterfaceIpv4AddressList; - } - public List<L3InterfaceIpv6AddressList> getL3InterfaceIpv6AddressList() { - return l3InterfaceIpv6AddressList; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof LInterface)) { - return false; - } - LInterface castOther = (LInterface) other; - return new EqualsBuilder().append(interfaceName, castOther.interfaceName).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(interfaceName).toHashCode(); - } + public String getInterfaceName() { + return interfaceName; + } + + public void setInterfaceName(String interfaceName) { + this.interfaceName = interfaceName; + } + + public String getInterfaceRole() { + return interfaceRole; + } + + public void setInterfaceRole(String interfaceRole) { + this.interfaceRole = interfaceRole; + } + + public String getV6WanLinkIp() { + return v6WanLinkIp; + } + + public void setV6WanLinkIp(String v6WanLinkIp) { + this.v6WanLinkIp = v6WanLinkIp; + } + + public String getSelflink() { + return selflink; + } + + public void setSelflink(String selflink) { + this.selflink = selflink; + } + + public String getInterfaceId() { + return interfaceId; + } + + public void setInterfaceId(String interfaceId) { + this.interfaceId = interfaceId; + } + + public String getMacaddr() { + return macaddr; + } + + public void setMacaddr(String macaddr) { + this.macaddr = macaddr; + } + + public String getNetworkName() { + return networkName; + } + + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + + public String getManagementOption() { + return managementOption; + } + + public void setManagementOption(String managementOption) { + this.managementOption = managementOption; + } + + public String getInterfaceDescription() { + return interfaceDescription; + } + + public void setInterfaceDescription(String interfaceDescription) { + this.interfaceDescription = interfaceDescription; + } + + public Boolean isIsPortMirrored() { + return isPortMirrored; + } + + public void setPortMirrored(Boolean isPortMirrored) { + this.isPortMirrored = isPortMirrored; + } + + public Boolean isInMaint() { + return inMaint; + } + + public void setInMaint(boolean inMaint) { + this.inMaint = inMaint; + } + + public String getProvStatus() { + return provStatus; + } + + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + + public Boolean isIsIpUnnumbered() { + return isIpUnnumbered; + } + + public void setIpUnnumbered(Boolean isIpUnnumbered) { + this.isIpUnnumbered = isIpUnnumbered; + } + + public String getAllowedAddressPairs() { + return allowedAddressPairs; + } + + public void setAllowedAddressPairs(String allowedAddressPairs) { + this.allowedAddressPairs = allowedAddressPairs; + } + + public List<Vlan> getVlans() { + return vlans; + } + + public List<SriovVf> getSriovVfs() { + return sriovVfs; + } + + public List<LInterface> getlInterfaces() { + return lInterfaces; + } + + public List<L3InterfaceIpv4AddressList> getL3InterfaceIpv4AddressList() { + return l3InterfaceIpv4AddressList; + } + + public List<L3InterfaceIpv6AddressList> getL3InterfaceIpv6AddressList() { + return l3InterfaceIpv6AddressList; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof LInterface)) { + return false; + } + LInterface castOther = (LInterface) other; + return new EqualsBuilder().append(interfaceName, castOther.interfaceName).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(interfaceName).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java index f69f4628fa..8fbee5f399 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java @@ -23,101 +23,117 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("lag-interface") -public class LagInterface implements Serializable, ShallowCopy<LagInterface>{ +public class LagInterface implements Serializable, ShallowCopy<LagInterface> { - private static final long serialVersionUID = -7493461787172382640L; + private static final long serialVersionUID = -7493461787172382640L; - @Id - @JsonProperty("interface-name") + @Id + @JsonProperty("interface-name") private String interfaceName; - @JsonProperty("interface-description") + @JsonProperty("interface-description") private String interfaceDescription; - @JsonProperty("speed-value") + @JsonProperty("speed-value") private String speedValue; - @JsonProperty("speed-units") + @JsonProperty("speed-units") private String speedUnits; - @JsonProperty("interface-id") + @JsonProperty("interface-id") private String interfaceId; - @JsonProperty("interface-role") + @JsonProperty("interface-role") private String interfaceRole; - @JsonProperty("prov-status") + @JsonProperty("prov-status") private String provStatus; - @JsonProperty("in-maint") + @JsonProperty("in-maint") private Boolean inMaint; - @JsonProperty("l-interfaces") + @JsonProperty("l-interfaces") private List<LInterface> lInterfaces = new ArrayList<>(); - public String getInterfaceName() { - return interfaceName; - } - public void setInterfaceName(String interfaceName) { - this.interfaceName = interfaceName; - } - public String getInterfaceDescription() { - return interfaceDescription; - } - public void setInterfaceDescription(String interfaceDescription) { - this.interfaceDescription = interfaceDescription; - } - public String getSpeedValue() { - return speedValue; - } - public void setSpeedValue(String speedValue) { - this.speedValue = speedValue; - } - public String getSpeedUnits() { - return speedUnits; - } - public void setSpeedUnits(String speedUnits) { - this.speedUnits = speedUnits; - } - public String getInterfaceId() { - return interfaceId; - } - public void setInterfaceId(String interfaceId) { - this.interfaceId = interfaceId; - } - public String getInterfaceRole() { - return interfaceRole; - } - public void setInterfaceRole(String interfaceRole) { - this.interfaceRole = interfaceRole; - } - public String getProvStatus() { - return provStatus; - } - public void setProvStatus(String provStatus) { - this.provStatus = provStatus; - } - public Boolean isInMaint() { - return inMaint; - } - public void setInMaint(boolean inMaint) { - this.inMaint = inMaint; - } - public List<LInterface> getlInterfaces() { - return lInterfaces; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof LagInterface)) { - return false; - } - LagInterface castOther = (LagInterface) other; - return new EqualsBuilder().append(interfaceName, castOther.interfaceName).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(interfaceName).toHashCode(); - } + public String getInterfaceName() { + return interfaceName; + } + + public void setInterfaceName(String interfaceName) { + this.interfaceName = interfaceName; + } + + public String getInterfaceDescription() { + return interfaceDescription; + } + + public void setInterfaceDescription(String interfaceDescription) { + this.interfaceDescription = interfaceDescription; + } + + public String getSpeedValue() { + return speedValue; + } + + public void setSpeedValue(String speedValue) { + this.speedValue = speedValue; + } + + public String getSpeedUnits() { + return speedUnits; + } + + public void setSpeedUnits(String speedUnits) { + this.speedUnits = speedUnits; + } + + public String getInterfaceId() { + return interfaceId; + } + + public void setInterfaceId(String interfaceId) { + this.interfaceId = interfaceId; + } + + public String getInterfaceRole() { + return interfaceRole; + } + + public void setInterfaceRole(String interfaceRole) { + this.interfaceRole = interfaceRole; + } + + public String getProvStatus() { + return provStatus; + } + + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + + public Boolean isInMaint() { + return inMaint; + } + + public void setInMaint(boolean inMaint) { + this.inMaint = inMaint; + } + + public List<LInterface> getlInterfaces() { + return lInterfaces; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof LagInterface)) { + return false; + } + LagInterface castOther = (LagInterface) other; + return new EqualsBuilder().append(interfaceName, castOther.interfaceName).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(interfaceName).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java index d2651e6055..1105572e3a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java @@ -22,51 +22,48 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("line-of-business") public class LineOfBusiness implements Serializable, ShallowCopy<LineOfBusiness> { - private static final long serialVersionUID = -7697815326894443926L; + private static final long serialVersionUID = -7697815326894443926L; + + @Id + @JsonProperty("line-of-business-name") + private String lineOfBusinessName; - @Id - @JsonProperty("line-of-business-name") - private String lineOfBusinessName; + public LineOfBusiness() {} - public LineOfBusiness() { - } - - public LineOfBusiness(String lineOfBusinessName) { - this.lineOfBusinessName = lineOfBusinessName; - } + public LineOfBusiness(String lineOfBusinessName) { + this.lineOfBusinessName = lineOfBusinessName; + } - public String getLineOfBusinessName() { - return lineOfBusinessName; - } + public String getLineOfBusinessName() { + return lineOfBusinessName; + } - public void setLineOfBusinessName(String lineOfBusinessName) { - this.lineOfBusinessName = lineOfBusinessName; - } + public void setLineOfBusinessName(String lineOfBusinessName) { + this.lineOfBusinessName = lineOfBusinessName; + } - @Override - public boolean equals(final Object other) { - if (!(other instanceof LineOfBusiness)) { - return false; - } - LineOfBusiness castOther = (LineOfBusiness) other; - return new EqualsBuilder().append(lineOfBusinessName, castOther.lineOfBusinessName).isEquals(); - } + @Override + public boolean equals(final Object other) { + if (!(other instanceof LineOfBusiness)) { + return false; + } + LineOfBusiness castOther = (LineOfBusiness) other; + return new EqualsBuilder().append(lineOfBusinessName, castOther.lineOfBusinessName).isEquals(); + } - @Override - public int hashCode() { - return new HashCodeBuilder().append(lineOfBusinessName).toHashCode(); - } + @Override + public int hashCode() { + return new HashCodeBuilder().append(lineOfBusinessName).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Metadatum.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Metadatum.java index 2e7d278901..46bc9eef8a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Metadatum.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Metadatum.java @@ -21,46 +21,49 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; -public class Metadatum implements Serializable, ShallowCopy<Metadatum>{ - - private static final long serialVersionUID = -2259570072414712965L; +public class Metadatum implements Serializable, ShallowCopy<Metadatum> { + + private static final long serialVersionUID = -2259570072414712965L; + + @Id + @JsonProperty("metaname") + private String metaname; + @JsonProperty("metaval") + private String metaval; + + public String getMetaname() { + return metaname; + } + + public void setMetaname(String metaname) { + this.metaname = metaname; + } + + public String getMetaval() { + return metaval; + } + + public void setMetaval(String metaval) { + this.metaval = metaval; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Metadatum)) { + return false; + } + Metadatum castOther = (Metadatum) other; + return new EqualsBuilder().append(metaname, castOther.metaname).isEquals(); + } - @Id - @JsonProperty("metaname") - private String metaname; - @JsonProperty("metaval") - private String metaval; - - public String getMetaname() { - return metaname; - } - public void setMetaname(String metaname) { - this.metaname = metaname; - } - public String getMetaval() { - return metaval; - } - public void setMetaval(String metaval) { - this.metaval = metaval; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof Metadatum)) { - return false; - } - Metadatum castOther = (Metadatum) other; - return new EqualsBuilder().append(metaname, castOther.metaname).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(metaname).toHashCode(); - } + @Override + public int hashCode() { + return new HashCodeBuilder().append(metaname).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/NetworkPolicy.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/NetworkPolicy.java index a920a585cb..7b29e58393 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/NetworkPolicy.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/NetworkPolicy.java @@ -21,71 +21,69 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import javax.persistence.Id; - import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; -public class NetworkPolicy implements Serializable, ShallowCopy<NetworkPolicy>{ +public class NetworkPolicy implements Serializable, ShallowCopy<NetworkPolicy> { + + private static final long serialVersionUID = 8925599588239522447L; + + @Id + @JsonProperty("network-policy-id") + private String networkPolicyId; + @JsonProperty("network-policy-fqdn") + private String networkPolicyFqdn; + @JsonProperty("heat-stack-id") + private String heatStackId; + @JsonProperty("resource-version") + private String resourceVersion; + + public String getNetworkPolicyId() { + return this.networkPolicyId; + } + + public void setNetworkPolicyId(String networkPolicyId) { + this.networkPolicyId = networkPolicyId; + } + + public String getNetworkPolicyFqdn() { + return this.networkPolicyFqdn; + } + + public void setNetworkPolicyFqdn(String networkPolicyFqdn) { + this.networkPolicyFqdn = networkPolicyFqdn; + } + + public String getHeatStackId() { + return this.heatStackId; + } + + public void setHeatStackId(String heatStackId) { + this.heatStackId = heatStackId; + } + + public String getResourceVersion() { + return this.resourceVersion; + } - private static final long serialVersionUID = 8925599588239522447L; - - @Id - @JsonProperty("network-policy-id") - private String networkPolicyId; - @JsonProperty("network-policy-fqdn") - private String networkPolicyFqdn; - @JsonProperty("heat-stack-id") - private String heatStackId; - @JsonProperty("resource-version") - private String resourceVersion; - - public String getNetworkPolicyId() { - return this.networkPolicyId; - } - - public void setNetworkPolicyId(String networkPolicyId) { - this.networkPolicyId = networkPolicyId; - } - - public String getNetworkPolicyFqdn() { - return this.networkPolicyFqdn; - } - - public void setNetworkPolicyFqdn(String networkPolicyFqdn) { - this.networkPolicyFqdn = networkPolicyFqdn; - } - - public String getHeatStackId() { - return this.heatStackId; - } - - public void setHeatStackId(String heatStackId) { - this.heatStackId = heatStackId; - } - - public String getResourceVersion() { - return this.resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } - @Override - public boolean equals(final Object other) { - if (!(other instanceof NetworkPolicy)) { - return false; - } - NetworkPolicy castOther = (NetworkPolicy) other; - return new EqualsBuilder().append(networkPolicyId, castOther.networkPolicyId).isEquals(); - } + @Override + public boolean equals(final Object other) { + if (!(other instanceof NetworkPolicy)) { + return false; + } + NetworkPolicy castOther = (NetworkPolicy) other; + return new EqualsBuilder().append(networkPolicyId, castOther.networkPolicyId).isEquals(); + } - @Override - public int hashCode() { - return new HashCodeBuilder().append(networkPolicyId).toHashCode(); - } + @Override + public int hashCode() { + return new HashCodeBuilder().append(networkPolicyId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/OwningEntity.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/OwningEntity.java index e28e41ed46..efba0d4959 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/OwningEntity.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/OwningEntity.java @@ -21,9 +21,7 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import javax.persistence.Id; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; @@ -33,36 +31,41 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @JsonRootName("owning-entity") public class OwningEntity implements Serializable, ShallowCopy<OwningEntity> { - private static final long serialVersionUID = -6565917570694869603L; - - @Id - @JsonProperty("owning-entity-id") - private String owningEntityId; - @JsonProperty("owning-entity-name") - private String owningEntityName; + private static final long serialVersionUID = -6565917570694869603L; + + @Id + @JsonProperty("owning-entity-id") + private String owningEntityId; + @JsonProperty("owning-entity-name") + private String owningEntityName; + + public String getOwningEntityId() { + return owningEntityId; + } + + public void setOwningEntityId(String owningEntityId) { + this.owningEntityId = owningEntityId; + } + + public String getOwningEntityName() { + return owningEntityName; + } + + public void setOwningEntityName(String owningEntityName) { + this.owningEntityName = owningEntityName; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof OwningEntity)) { + return false; + } + OwningEntity castOther = (OwningEntity) other; + return new EqualsBuilder().append(owningEntityId, castOther.owningEntityId).isEquals(); + } - public String getOwningEntityId() { - return owningEntityId; - } - public void setOwningEntityId(String owningEntityId) { - this.owningEntityId = owningEntityId; - } - public String getOwningEntityName() { - return owningEntityName; - } - public void setOwningEntityName(String owningEntityName) { - this.owningEntityName = owningEntityName; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof OwningEntity)) { - return false; - } - OwningEntity castOther = (OwningEntity) other; - return new EqualsBuilder().append(owningEntityId, castOther.owningEntityId).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(owningEntityId).toHashCode(); - } + @Override + public int hashCode() { + return new HashCodeBuilder().append(owningEntityId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java index 498d096e65..d0bf1f588b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java @@ -24,60 +24,59 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import javax.persistence.Id; - import org.apache.commons.lang3.builder.EqualsBuilder; public class PServer implements Serializable, ShallowCopy<PServer> { - private static final long serialVersionUID = 1378547515775540874L; + private static final long serialVersionUID = 1378547515775540874L; - @Id + @Id @JsonProperty("pserver-id") - private String pserverId; + private String pserverId; @JsonProperty("hostname") - private String hostname; + private String hostname; @JsonProperty("physical-links") - private List<PhysicalLink> physicalLinks = new ArrayList<PhysicalLink>(); //TODO techincally there is a pInterface between (pserver <--> physical-link) but dont really need that pojo - - public String getPserverId(){ - return pserverId; - } - - public void setPserverId(String pserverId){ - this.pserverId = pserverId; - } - - public String getHostname(){ - return hostname; - } - - public void setHostname(String hostname){ - this.hostname = hostname; - } - - public List<PhysicalLink> getPhysicalLinks(){ - return physicalLinks; - } - - @Override - public boolean equals(final Object other){ - if(!(other instanceof PServer)){ - return false; - } - PServer castOther = (PServer) other; - return new EqualsBuilder().append(pserverId, castOther.pserverId).isEquals(); - } - - @Override - public int hashCode(){ - return new HashCodeBuilder().append(pserverId).toHashCode(); - } + private List<PhysicalLink> physicalLinks = new ArrayList<PhysicalLink>(); // TODO techincally there is a pInterface + // between (pserver <--> physical-link) + // but dont really need that pojo + + public String getPserverId() { + return pserverId; + } + + public void setPserverId(String pserverId) { + this.pserverId = pserverId; + } + + public String getHostname() { + return hostname; + } + + public void setHostname(String hostname) { + this.hostname = hostname; + } + + public List<PhysicalLink> getPhysicalLinks() { + return physicalLinks; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof PServer)) { + return false; + } + PServer castOther = (PServer) other; + return new EqualsBuilder().append(pserverId, castOther.pserverId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(pserverId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java index 742a541352..c669ce497a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java @@ -21,129 +21,126 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import javax.persistence.Id; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("physical-link") public class PhysicalLink implements Serializable, ShallowCopy<PhysicalLink> { - private static final long serialVersionUID = -6378347998443741227L; + private static final long serialVersionUID = -6378347998443741227L; - @Id + @Id @JsonProperty("link-name") - private String linkName; + private String linkName; @JsonProperty("interface-name") - private String interfaceName; + private String interfaceName; @JsonProperty("service-provider-name") - private String serviceProviderName; + private String serviceProviderName; @JsonProperty("circuit-id") - private String circuitId; + private String circuitId; @JsonProperty("management-option") - private String managementOption; + private String managementOption; @JsonProperty("bandwidth-up") - private Integer bandwidthUp; + private Integer bandwidthUp; @JsonProperty("bandwidth-down") - private Integer bandwidthDown; + private Integer bandwidthDown; @JsonProperty("bandwidth-units") - private String bandwidthUnits; + private String bandwidthUnits; @JsonProperty("wan-port") - private String wanPort; + private String wanPort; - public String getLinkName(){ - return linkName; - } + public String getLinkName() { + return linkName; + } - public void setLinkName(String linkName){ - this.linkName = linkName; - } + public void setLinkName(String linkName) { + this.linkName = linkName; + } - public String getInterfaceName(){ - return interfaceName; - } + public String getInterfaceName() { + return interfaceName; + } - public void setInterfaceName(String interfaceName){ - this.interfaceName = interfaceName; - } + public void setInterfaceName(String interfaceName) { + this.interfaceName = interfaceName; + } - public String getServiceProviderName(){ - return serviceProviderName; - } + public String getServiceProviderName() { + return serviceProviderName; + } - public void setServiceProviderName(String serviceProviderName){ - this.serviceProviderName = serviceProviderName; - } + public void setServiceProviderName(String serviceProviderName) { + this.serviceProviderName = serviceProviderName; + } - public String getCircuitId(){ - return circuitId; - } + public String getCircuitId() { + return circuitId; + } - public void setCircuitId(String circuitId){ - this.circuitId = circuitId; - } + public void setCircuitId(String circuitId) { + this.circuitId = circuitId; + } - public String getManagementOption(){ - return managementOption; - } + public String getManagementOption() { + return managementOption; + } - public void setManagementOption(String managementOption){ - this.managementOption = managementOption; - } + public void setManagementOption(String managementOption) { + this.managementOption = managementOption; + } - public Integer getBandwidthUp(){ - return bandwidthUp; - } + public Integer getBandwidthUp() { + return bandwidthUp; + } - public void setBandwidthUp(Integer bandwidthUp){ - this.bandwidthUp = bandwidthUp; - } + public void setBandwidthUp(Integer bandwidthUp) { + this.bandwidthUp = bandwidthUp; + } - public Integer getBandwidthDown(){ - return bandwidthDown; - } + public Integer getBandwidthDown() { + return bandwidthDown; + } - public void setBandwidthDown(Integer bandwidthDown){ - this.bandwidthDown = bandwidthDown; - } + public void setBandwidthDown(Integer bandwidthDown) { + this.bandwidthDown = bandwidthDown; + } - public String getBandwidthUnits(){ - return bandwidthUnits; - } + public String getBandwidthUnits() { + return bandwidthUnits; + } - public void setBandwidthUnits(String bandwidthUnits){ - this.bandwidthUnits = bandwidthUnits; - } + public void setBandwidthUnits(String bandwidthUnits) { + this.bandwidthUnits = bandwidthUnits; + } - public String getWanPort(){ - return wanPort; - } + public String getWanPort() { + return wanPort; + } - public void setWanPort(String wanPort){ - this.wanPort = wanPort; - } + public void setWanPort(String wanPort) { + this.wanPort = wanPort; + } - @Override - public boolean equals(final Object other){ - if(!(other instanceof PhysicalLink)){ - return false; - } - PhysicalLink castOther = (PhysicalLink) other; - return new EqualsBuilder().append(linkName, castOther.linkName).isEquals(); - } + @Override + public boolean equals(final Object other) { + if (!(other instanceof PhysicalLink)) { + return false; + } + PhysicalLink castOther = (PhysicalLink) other; + return new EqualsBuilder().append(linkName, castOther.linkName).isEquals(); + } - @Override - public int hashCode(){ - return new HashCodeBuilder().append(linkName).toHashCode(); - } + @Override + public int hashCode() { + return new HashCodeBuilder().append(linkName).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java index d13707deb4..08cf97bcf9 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java @@ -21,51 +21,48 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("platform") public class Platform implements Serializable, ShallowCopy<Platform> { - private static final long serialVersionUID = -9127507763010448699L; + private static final long serialVersionUID = -9127507763010448699L; + + @Id + @JsonProperty("platform-name") + private String platformName; - @Id - @JsonProperty("platform-name") - private String platformName; - - public Platform() { - } + public Platform() {} - public Platform(String platformName) { - this.platformName = platformName; - } + public Platform(String platformName) { + this.platformName = platformName; + } - public String getPlatformName() { - return platformName; - } + public String getPlatformName() { + return platformName; + } - public void setPlatformName(String platformName) { - this.platformName = platformName; - } + public void setPlatformName(String platformName) { + this.platformName = platformName; + } - @Override - public boolean equals(final Object other) { - if (!(other instanceof Platform)) { - return false; - } - Platform castOther = (Platform) other; - return new EqualsBuilder().append(platformName, castOther.platformName).isEquals(); - } + @Override + public boolean equals(final Object other) { + if (!(other instanceof Platform)) { + return false; + } + Platform castOther = (Platform) other; + return new EqualsBuilder().append(platformName, castOther.platformName).isEquals(); + } - @Override - public int hashCode() { - return new HashCodeBuilder().append(platformName).toHashCode(); - } + @Override + public int hashCode() { + return new HashCodeBuilder().append(platformName).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java index 2ec4108343..772c61e48b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java @@ -21,13 +21,10 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import javax.persistence.Id; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.db.catalog.beans.OrchestrationStatus; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @@ -35,9 +32,9 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @JsonRootName("pnf") public class Pnf implements Serializable, ShallowCopy<Pnf> { - private static final long serialVersionUID = -2544848120774529501L; + private static final long serialVersionUID = -2544848120774529501L; - @Id + @Id @JsonProperty("pnf-id") private String pnfId; @@ -47,70 +44,70 @@ public class Pnf implements Serializable, ShallowCopy<Pnf> { @JsonProperty("role") private String role; - @JsonProperty("orchestration-status") - private OrchestrationStatus orchestrationStatus; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; @JsonProperty("cloud-region") private CloudRegion cloudRegion; - public String getPnfId() { - return pnfId; - } - - public void setPnfId(String pnfId) { - this.pnfId = pnfId; - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - - /** - * Distinguishes Primary or Secondary - */ - public String getRole() { - return role; - } - - /** - * Distinguishes Primary or Secondary - */ - public void setRole(String role) { - this.role = role; - } - - public OrchestrationStatus getOrchestrationStatus() { - return orchestrationStatus; - } - - public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - - public CloudRegion getCloudRegion() { - return cloudRegion; - } - - public void setCloudRegion(CloudRegion cloudRegion) { - this.cloudRegion = cloudRegion; - } - - @Override - public boolean equals(final Object other) { - if (!(other instanceof Pnf)) { - return false; - } - Pnf castOther = (Pnf) other; - return new EqualsBuilder().append(pnfId, castOther.pnfId).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(pnfId).toHashCode(); - } + public String getPnfId() { + return pnfId; + } + + public void setPnfId(String pnfId) { + this.pnfId = pnfId; + } + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } + + /** + * Distinguishes Primary or Secondary + */ + public String getRole() { + return role; + } + + /** + * Distinguishes Primary or Secondary + */ + public void setRole(String role) { + this.role = role; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public CloudRegion getCloudRegion() { + return cloudRegion; + } + + public void setCloudRegion(CloudRegion cloudRegion) { + this.cloudRegion = cloudRegion; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Pnf)) { + return false; + } + Pnf castOther = (Pnf) other; + return new EqualsBuilder().append(pnfId, castOther.pnfId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(pnfId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Project.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Project.java index a815f6af1a..52636a678f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Project.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Project.java @@ -21,9 +21,7 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import javax.persistence.Id; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; @@ -33,31 +31,31 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @JsonRootName("project") public class Project implements Serializable, ShallowCopy<Project> { - private static final long serialVersionUID = 2449880559554533585L; - - @Id - @JsonProperty("project-name") - private String projectName; - - public String getProjectName() { - return projectName; - } - - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - @Override - public boolean equals(final Object other) { - if (!(other instanceof Project)) { - return false; - } - Project castOther = (Project) other; - return new EqualsBuilder().append(projectName, castOther.projectName).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(projectName).toHashCode(); - } + private static final long serialVersionUID = 2449880559554533585L; + + @Id + @JsonProperty("project-name") + private String projectName; + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Project)) { + return false; + } + Project castOther = (Project) other; + return new EqualsBuilder().append(projectName, castOther.projectName).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(projectName).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTableReference.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTableReference.java index 0d8c3201bc..a2f96e18ad 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTableReference.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTableReference.java @@ -21,9 +21,7 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import javax.persistence.Id; - import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; @@ -31,44 +29,51 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy; public class RouteTableReference implements Serializable, ShallowCopy<RouteTableReference> { - private static final long serialVersionUID = -698474994443040491L; - - @Id - @JsonProperty("route-table-reference-id") - private String routeTableReferenceId; - @JsonProperty("route-table-reference-fqdn") - private String routeTableReferenceFqdn; - @JsonProperty("resource-version") - private String resourceVersion; - - public String getRouteTableReferenceId() { - return routeTableReferenceId; - } - public void setRouteTableReferenceId(String routeTableReferenceId) { - this.routeTableReferenceId = routeTableReferenceId; - } - public String getRouteTableReferenceFqdn() { - return routeTableReferenceFqdn; - } - public void setRouteTableReferenceFqdn(String routeTableReferenceFqdn) { - this.routeTableReferenceFqdn = routeTableReferenceFqdn; - } - public String getResourceVersion() { - return resourceVersion; - } - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof RouteTableReference)) { - return false; - } - RouteTableReference castOther = (RouteTableReference) other; - return new EqualsBuilder().append(routeTableReferenceId, castOther.routeTableReferenceId).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(routeTableReferenceId).toHashCode(); - } + private static final long serialVersionUID = -698474994443040491L; + + @Id + @JsonProperty("route-table-reference-id") + private String routeTableReferenceId; + @JsonProperty("route-table-reference-fqdn") + private String routeTableReferenceFqdn; + @JsonProperty("resource-version") + private String resourceVersion; + + public String getRouteTableReferenceId() { + return routeTableReferenceId; + } + + public void setRouteTableReferenceId(String routeTableReferenceId) { + this.routeTableReferenceId = routeTableReferenceId; + } + + public String getRouteTableReferenceFqdn() { + return routeTableReferenceFqdn; + } + + public void setRouteTableReferenceFqdn(String routeTableReferenceFqdn) { + this.routeTableReferenceFqdn = routeTableReferenceFqdn; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof RouteTableReference)) { + return false; + } + RouteTableReference castOther = (RouteTableReference) other; + return new EqualsBuilder().append(routeTableReferenceId, castOther.routeTableReferenceId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(routeTableReferenceId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTarget.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTarget.java index fc97306cfe..d58825c77f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTarget.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTarget.java @@ -21,9 +21,7 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import javax.persistence.Id; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; @@ -32,12 +30,12 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @JsonRootName("route-target") public class RouteTarget implements Serializable, ShallowCopy<RouteTarget> { - private static final long serialVersionUID = -4635525992843470461L; - - @Id - @JsonProperty("global-route-target") + private static final long serialVersionUID = -4635525992843470461L; + + @Id + @JsonProperty("global-route-target") protected String globalRouteTarget; - @Id + @Id @JsonProperty("route-target-role") protected String routeTargetRole; @JsonProperty("resource-version") @@ -67,18 +65,18 @@ public class RouteTarget implements Serializable, ShallowCopy<RouteTarget> { this.resourceVersion = value; } - @Override - public boolean equals(final Object other) { - if (!(other instanceof RouteTarget)) { - return false; - } - RouteTarget castOther = (RouteTarget) other; - return new EqualsBuilder().append(globalRouteTarget, castOther.globalRouteTarget) - .append(routeTargetRole, castOther.routeTargetRole).isEquals(); - } + @Override + public boolean equals(final Object other) { + if (!(other instanceof RouteTarget)) { + return false; + } + RouteTarget castOther = (RouteTarget) other; + return new EqualsBuilder().append(globalRouteTarget, castOther.globalRouteTarget) + .append(routeTargetRole, castOther.routeTargetRole).isEquals(); + } - @Override - public int hashCode() { - return new HashCodeBuilder().append(globalRouteTarget).append(routeTargetRole).toHashCode(); - } + @Override + public int hashCode() { + return new HashCodeBuilder().append(globalRouteTarget).append(routeTargetRole).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SegmentationAssignment.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SegmentationAssignment.java index a299f1ef42..c8136b2ac9 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SegmentationAssignment.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SegmentationAssignment.java @@ -21,40 +21,41 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("segmentation-assignment") -public class SegmentationAssignment implements Serializable, ShallowCopy<SegmentationAssignment>{ +public class SegmentationAssignment implements Serializable, ShallowCopy<SegmentationAssignment> { - private static final long serialVersionUID = 5751570091375657521L; + private static final long serialVersionUID = 5751570091375657521L; - @Id - @JsonProperty("segmentation-id") + @Id + @JsonProperty("segmentation-id") private String segmentationId; - public String getSegmentationId() { - return segmentationId; - } - public void setSegmentationId(String segmentationId) { - this.segmentationId = segmentationId; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof SegmentationAssignment)) { - return false; - } - SegmentationAssignment castOther = (SegmentationAssignment) other; - return new EqualsBuilder().append(segmentationId, castOther.segmentationId).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(segmentationId).toHashCode(); - } + public String getSegmentationId() { + return segmentationId; + } + + public void setSegmentationId(String segmentationId) { + this.segmentationId = segmentationId; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof SegmentationAssignment)) { + return false; + } + SegmentationAssignment castOther = (SegmentationAssignment) other; + return new EqualsBuilder().append(segmentationId, castOther.segmentationId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(segmentationId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java index e2a8688395..6c3a0c43ed 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java @@ -23,15 +23,12 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import javax.persistence.Id; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.Metadata; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; import org.onap.so.db.catalog.beans.OrchestrationStatus; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @@ -40,175 +37,191 @@ import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionInfo; @JsonRootName("service-instance") public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstance> { - private static final long serialVersionUID = -1843348234891739356L; - - @Id - @JsonProperty("service-instance-id") - private String serviceInstanceId; - @JsonProperty("service-instance-name") - private String serviceInstanceName; - @JsonProperty("orchestration-status") - private OrchestrationStatus orchestrationStatus; - @JsonProperty("owning-entity") - private OwningEntity owningEntity; - @JsonProperty("project") - private Project project; - @JsonProperty("collection") - private Collection collection; - @JsonProperty("vnfs") - private List<GenericVnf> vnfs = new ArrayList<>(); - @JsonProperty("pnfs") - private List<Pnf> pnfs = new ArrayList<>(); - @JsonProperty("allotted-resources") - private List<AllottedResource> allottedResources = new ArrayList<>(); - @JsonProperty("networks") - private List<L3Network> networks = new ArrayList<>(); - @JsonProperty("vpn-bonding-links") - private List<VpnBondingLink> vpnBondingLinks = new ArrayList<>(); - @JsonProperty("vhn-portal-url") + private static final long serialVersionUID = -1843348234891739356L; + + @Id + @JsonProperty("service-instance-id") + private String serviceInstanceId; + @JsonProperty("service-instance-name") + private String serviceInstanceName; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("owning-entity") + private OwningEntity owningEntity; + @JsonProperty("project") + private Project project; + @JsonProperty("collection") + private Collection collection; + @JsonProperty("vnfs") + private List<GenericVnf> vnfs = new ArrayList<>(); + @JsonProperty("pnfs") + private List<Pnf> pnfs = new ArrayList<>(); + @JsonProperty("allotted-resources") + private List<AllottedResource> allottedResources = new ArrayList<>(); + @JsonProperty("networks") + private List<L3Network> networks = new ArrayList<>(); + @JsonProperty("vpn-bonding-links") + private List<VpnBondingLink> vpnBondingLinks = new ArrayList<>(); + @JsonProperty("vhn-portal-url") private String vhnPortalUrl; - @JsonProperty("service-instance-location-id") + @JsonProperty("service-instance-location-id") private String serviceInstanceLocationId; - @JsonProperty("selflink") + @JsonProperty("selflink") private String selflink; - @JsonProperty("metadata") + @JsonProperty("metadata") private Metadata metadata; - @JsonProperty("configurations") - private List<Configuration> configurations = new ArrayList<>(); - @JsonProperty("solution-info") - private SolutionInfo solutionInfo; - @JsonProperty("model-info-service-instance") - private ModelInfoServiceInstance modelInfoServiceInstance; - @JsonProperty("instance-groups") - private List<InstanceGroup> instanceGroups = new ArrayList<>(); - - public List<GenericVnf> getVnfs() { - return vnfs; - } - public List<AllottedResource> getAllottedResources() { - return allottedResources; - } - public List<L3Network> getNetworks() { - return networks; - } - public ModelInfoServiceInstance getModelInfoServiceInstance() { - return modelInfoServiceInstance; - } - public void setModelInfoServiceInstance(ModelInfoServiceInstance modelInfoServiceInstance) { - this.modelInfoServiceInstance = modelInfoServiceInstance; - } - public List<Configuration> getConfigurations() { - return configurations; - } - public void setConfigurations(List<Configuration> configurations) { - this.configurations = configurations; - } - public String getVhnPortalUrl() { - return vhnPortalUrl; - } - - public void setVhnPortalUrl(String vhnPortalUrl) { - this.vhnPortalUrl = vhnPortalUrl; - } - - public String getServiceInstanceLocationId() { - return serviceInstanceLocationId; - } - - public void setServiceInstanceLocationId(String serviceInstanceLocationId) { - this.serviceInstanceLocationId = serviceInstanceLocationId; - } - - public String getSelflink() { - return selflink; - } - - public void setSelflink(String selflink) { - this.selflink = selflink; - } - - public Metadata getMetadata() { - return metadata; - } - - public void setMetadata(Metadata metadata) { - this.metadata = metadata; - } - - public String getServiceInstanceId() { - return serviceInstanceId; - } - - public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - - public String getServiceInstanceName() { - return serviceInstanceName; - } - - public void setServiceInstanceName(String serviceInstanceName) { - this.serviceInstanceName = serviceInstanceName; - } - - public OrchestrationStatus getOrchestrationStatus() { - return orchestrationStatus; - } - - public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - - public OwningEntity getOwningEntity() { - return owningEntity; - } - - public void setOwningEntity(OwningEntity owningEntity) { - this.owningEntity = owningEntity; - } - - public Project getProject() { - return project; - } - - public void setProject(Project project) { - this.project = project; - } - - public Collection getCollection() { - return collection; - } - public void setCollection(Collection collection) { - this.collection = collection; - } - public List<VpnBondingLink> getVpnBondingLinks() { - return vpnBondingLinks; - } - public List<Pnf> getPnfs() { - return pnfs; - } - public SolutionInfo getSolutionInfo() { - return solutionInfo; - } - public void setSolutionInfo(SolutionInfo solutionInfo) { - this.solutionInfo = solutionInfo; - } - public List<InstanceGroup> getInstanceGroups() { - return instanceGroups; - } - public void setInstanceGroups(List<InstanceGroup> instanceGroups) { - this.instanceGroups = instanceGroups; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof ServiceInstance)) { - return false; - } - ServiceInstance castOther = (ServiceInstance) other; - return new EqualsBuilder().append(serviceInstanceId, castOther.serviceInstanceId).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(serviceInstanceId).toHashCode(); - } + @JsonProperty("configurations") + private List<Configuration> configurations = new ArrayList<>(); + @JsonProperty("solution-info") + private SolutionInfo solutionInfo; + @JsonProperty("model-info-service-instance") + private ModelInfoServiceInstance modelInfoServiceInstance; + @JsonProperty("instance-groups") + private List<InstanceGroup> instanceGroups = new ArrayList<>(); + + public List<GenericVnf> getVnfs() { + return vnfs; + } + + public List<AllottedResource> getAllottedResources() { + return allottedResources; + } + + public List<L3Network> getNetworks() { + return networks; + } + + public ModelInfoServiceInstance getModelInfoServiceInstance() { + return modelInfoServiceInstance; + } + + public void setModelInfoServiceInstance(ModelInfoServiceInstance modelInfoServiceInstance) { + this.modelInfoServiceInstance = modelInfoServiceInstance; + } + + public List<Configuration> getConfigurations() { + return configurations; + } + + public void setConfigurations(List<Configuration> configurations) { + this.configurations = configurations; + } + + public String getVhnPortalUrl() { + return vhnPortalUrl; + } + + public void setVhnPortalUrl(String vhnPortalUrl) { + this.vhnPortalUrl = vhnPortalUrl; + } + + public String getServiceInstanceLocationId() { + return serviceInstanceLocationId; + } + + public void setServiceInstanceLocationId(String serviceInstanceLocationId) { + this.serviceInstanceLocationId = serviceInstanceLocationId; + } + + public String getSelflink() { + return selflink; + } + + public void setSelflink(String selflink) { + this.selflink = selflink; + } + + public Metadata getMetadata() { + return metadata; + } + + public void setMetadata(Metadata metadata) { + this.metadata = metadata; + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + public String getServiceInstanceName() { + return serviceInstanceName; + } + + public void setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public OwningEntity getOwningEntity() { + return owningEntity; + } + + public void setOwningEntity(OwningEntity owningEntity) { + this.owningEntity = owningEntity; + } + + public Project getProject() { + return project; + } + + public void setProject(Project project) { + this.project = project; + } + + public Collection getCollection() { + return collection; + } + + public void setCollection(Collection collection) { + this.collection = collection; + } + + public List<VpnBondingLink> getVpnBondingLinks() { + return vpnBondingLinks; + } + + public List<Pnf> getPnfs() { + return pnfs; + } + + public SolutionInfo getSolutionInfo() { + return solutionInfo; + } + + public void setSolutionInfo(SolutionInfo solutionInfo) { + this.solutionInfo = solutionInfo; + } + + public List<InstanceGroup> getInstanceGroups() { + return instanceGroups; + } + + public void setInstanceGroups(List<InstanceGroup> instanceGroups) { + this.instanceGroups = instanceGroups; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof ServiceInstance)) { + return false; + } + ServiceInstance castOther = (ServiceInstance) other; + return new EqualsBuilder().append(serviceInstanceId, castOther.serviceInstanceId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(serviceInstanceId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceProxy.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceProxy.java index fa076770d7..6d6444f69c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceProxy.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceProxy.java @@ -22,14 +22,11 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; - import org.onap.so.bpmn.servicedecomposition.ShallowCopy; import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionCandidates; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy; - import java.io.Serializable; import javax.persistence.Id; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; @@ -51,58 +48,56 @@ public class ServiceProxy extends SolutionCandidates implements Serializable, Sh private ModelInfoServiceProxy modelInfoServiceProxy; - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - /** - * Way to identify the type of proxy - * i.e. "infrastructure", "transport", etc. - */ - public String getType() { - return type; - } - - /** - * Way to identify the type of proxy - * i.e. "infrastructure", "transport", etc. - */ - public void setType(String type) { - this.type = type; - } - - public ServiceInstance getServiceInstance() { - return serviceInstance; - } - - public void setServiceInstance(ServiceInstance serviceInstance) { - this.serviceInstance = serviceInstance; - } - - public ModelInfoServiceProxy getModelInfoServiceProxy() { - return modelInfoServiceProxy; - } - - public void setModelInfoServiceProxy(ModelInfoServiceProxy modelInfoServiceProxy) { - this.modelInfoServiceProxy = modelInfoServiceProxy; - } - - @Override - public boolean equals(final Object other){ - if(!(other instanceof ServiceProxy)){ - return false; - } - ServiceProxy castOther = (ServiceProxy) other; - return new EqualsBuilder().append(id, castOther.id).isEquals(); - } - - @Override - public int hashCode(){ - return new HashCodeBuilder().append(id).toHashCode(); - } + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * Way to identify the type of proxy i.e. "infrastructure", "transport", etc. + */ + public String getType() { + return type; + } + + /** + * Way to identify the type of proxy i.e. "infrastructure", "transport", etc. + */ + public void setType(String type) { + this.type = type; + } + + public ServiceInstance getServiceInstance() { + return serviceInstance; + } + + public void setServiceInstance(ServiceInstance serviceInstance) { + this.serviceInstance = serviceInstance; + } + + public ModelInfoServiceProxy getModelInfoServiceProxy() { + return modelInfoServiceProxy; + } + + public void setModelInfoServiceProxy(ModelInfoServiceProxy modelInfoServiceProxy) { + this.modelInfoServiceProxy = modelInfoServiceProxy; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof ServiceProxy)) { + return false; + } + ServiceProxy castOther = (ServiceProxy) other; + return new EqualsBuilder().append(id, castOther.id).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(id).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java index 56f95516b1..05199b7f37 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java @@ -23,54 +23,57 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("service-subscription") -public class ServiceSubscription implements Serializable, ShallowCopy<ServiceSubscription>{ +public class ServiceSubscription implements Serializable, ShallowCopy<ServiceSubscription> { + + private static final long serialVersionUID = 9064449329296611436L; + + @Id + @JsonProperty("service-type") + private String serviceType; + @JsonProperty("temp-ub-sub-account-id") + private String tempUbSubAccountId; + @JsonProperty("service-instances") + private List<ServiceInstance> serviceInstances = new ArrayList<ServiceInstance>(); + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getTempUbSubAccountId() { + return tempUbSubAccountId; + } - private static final long serialVersionUID = 9064449329296611436L; + public void setTempUbSubAccountId(String tempUbSubAccountId) { + this.tempUbSubAccountId = tempUbSubAccountId; + } - @Id - @JsonProperty("service-type") - private String serviceType; - @JsonProperty("temp-ub-sub-account-id") - private String tempUbSubAccountId; - @JsonProperty("service-instances") - private List<ServiceInstance> serviceInstances = new ArrayList<ServiceInstance>(); + public List<ServiceInstance> getServiceInstances() { + return serviceInstances; + } - public String getServiceType() { - return serviceType; - } - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - public String getTempUbSubAccountId() { - return tempUbSubAccountId; - } - public void setTempUbSubAccountId(String tempUbSubAccountId) { - this.tempUbSubAccountId = tempUbSubAccountId; - } - public List<ServiceInstance> getServiceInstances() { - return serviceInstances; - } + @Override + public boolean equals(final Object other) { + if (!(other instanceof ServiceSubscription)) { + return false; + } + ServiceSubscription castOther = (ServiceSubscription) other; + return new EqualsBuilder().append(serviceType, castOther.serviceType).isEquals(); + } - @Override - public boolean equals(final Object other) { - if (!(other instanceof ServiceSubscription)) { - return false; - } - ServiceSubscription castOther = (ServiceSubscription) other; - return new EqualsBuilder().append(serviceType, castOther.serviceType).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(serviceType).toHashCode(); - } + @Override + public int hashCode() { + return new HashCodeBuilder().append(serviceType).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SriovVf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SriovVf.java index fcea22819e..71d55311f3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SriovVf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SriovVf.java @@ -21,136 +21,161 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("sriov-vf") -public class SriovVf implements Serializable, ShallowCopy<SriovVf>{ +public class SriovVf implements Serializable, ShallowCopy<SriovVf> { - private static final long serialVersionUID = -7790331637399859914L; + private static final long serialVersionUID = -7790331637399859914L; - @Id - @JsonProperty("pci-id") + @Id + @JsonProperty("pci-id") private String pciId; - @JsonProperty("vf-vlan-filter") + @JsonProperty("vf-vlan-filter") private String vfVlanFilter; - @JsonProperty("vf-mac-filter") + @JsonProperty("vf-mac-filter") private String vfMacFilter; - @JsonProperty("vf-vlan-strip") + @JsonProperty("vf-vlan-strip") private Boolean vfVlanStrip; - @JsonProperty("vf-vlan-anti-spoof-check") + @JsonProperty("vf-vlan-anti-spoof-check") private Boolean vfVlanAntiSpoofCheck; - @JsonProperty("vf-mac-anti-spoof-check") + @JsonProperty("vf-mac-anti-spoof-check") private Boolean vfMacAntiSpoofCheck; - @JsonProperty("vf-mirrors") + @JsonProperty("vf-mirrors") private String vfMirrors; - @JsonProperty("vf-broadcast-allow") + @JsonProperty("vf-broadcast-allow") private Boolean vfBroadcastAllow; - @JsonProperty("vf-unknown-multicast-allow") + @JsonProperty("vf-unknown-multicast-allow") private Boolean vfUnknownMulticastAllow; - @JsonProperty("vf-unknown-unicast-allow") + @JsonProperty("vf-unknown-unicast-allow") private Boolean vfUnknownUnicastAllow; - @JsonProperty("vf-insert-stag") + @JsonProperty("vf-insert-stag") private Boolean vfInsertStag; - @JsonProperty("vf-link-status") + @JsonProperty("vf-link-status") private String vfLinkStatus; - @JsonProperty("neutron-network-id") + @JsonProperty("neutron-network-id") private String neutronNetworkId; - public String getPciId() { - return pciId; - } - public void setPciId(String pciId) { - this.pciId = pciId; - } - public String getVfVlanFilter() { - return vfVlanFilter; - } - public void setVfVlanFilter(String vfVlanFilter) { - this.vfVlanFilter = vfVlanFilter; - } - public String getVfMacFilter() { - return vfMacFilter; - } - public void setVfMacFilter(String vfMacFilter) { - this.vfMacFilter = vfMacFilter; - } - public Boolean getVfVlanStrip() { - return vfVlanStrip; - } - public void setVfVlanStrip(Boolean vfVlanStrip) { - this.vfVlanStrip = vfVlanStrip; - } - public Boolean getVfVlanAntiSpoofCheck() { - return vfVlanAntiSpoofCheck; - } - public void setVfVlanAntiSpoofCheck(Boolean vfVlanAntiSpoofCheck) { - this.vfVlanAntiSpoofCheck = vfVlanAntiSpoofCheck; - } - public Boolean getVfMacAntiSpoofCheck() { - return vfMacAntiSpoofCheck; - } - public void setVfMacAntiSpoofCheck(Boolean vfMacAntiSpoofCheck) { - this.vfMacAntiSpoofCheck = vfMacAntiSpoofCheck; - } - public String getVfMirrors() { - return vfMirrors; - } - public void setVfMirrors(String vfMirrors) { - this.vfMirrors = vfMirrors; - } - public Boolean getVfBroadcastAllow() { - return vfBroadcastAllow; - } - public void setVfBroadcastAllow(Boolean vfBroadcastAllow) { - this.vfBroadcastAllow = vfBroadcastAllow; - } - public Boolean getVfUnknownMulticastAllow() { - return vfUnknownMulticastAllow; - } - public void setVfUnknownMulticastAllow(Boolean vfUnknownMulticastAllow) { - this.vfUnknownMulticastAllow = vfUnknownMulticastAllow; - } - public Boolean getVfUnknownUnicastAllow() { - return vfUnknownUnicastAllow; - } - public void setVfUnknownUnicastAllow(Boolean vfUnknownUnicastAllow) { - this.vfUnknownUnicastAllow = vfUnknownUnicastAllow; - } - public Boolean getVfInsertStag() { - return vfInsertStag; - } - public void setVfInsertStag(Boolean vfInsertStag) { - this.vfInsertStag = vfInsertStag; - } - public String getVfLinkStatus() { - return vfLinkStatus; - } - public void setVfLinkStatus(String vfLinkStatus) { - this.vfLinkStatus = vfLinkStatus; - } - public String getNeutronNetworkId() { - return neutronNetworkId; - } - public void setNeutronNetworkId(String neutronNetworkId) { - this.neutronNetworkId = neutronNetworkId; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof SriovVf)) { - return false; - } - SriovVf castOther = (SriovVf) other; - return new EqualsBuilder().append(pciId, castOther.pciId).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(pciId).toHashCode(); - } + public String getPciId() { + return pciId; + } + + public void setPciId(String pciId) { + this.pciId = pciId; + } + + public String getVfVlanFilter() { + return vfVlanFilter; + } + + public void setVfVlanFilter(String vfVlanFilter) { + this.vfVlanFilter = vfVlanFilter; + } + + public String getVfMacFilter() { + return vfMacFilter; + } + + public void setVfMacFilter(String vfMacFilter) { + this.vfMacFilter = vfMacFilter; + } + + public Boolean getVfVlanStrip() { + return vfVlanStrip; + } + + public void setVfVlanStrip(Boolean vfVlanStrip) { + this.vfVlanStrip = vfVlanStrip; + } + + public Boolean getVfVlanAntiSpoofCheck() { + return vfVlanAntiSpoofCheck; + } + + public void setVfVlanAntiSpoofCheck(Boolean vfVlanAntiSpoofCheck) { + this.vfVlanAntiSpoofCheck = vfVlanAntiSpoofCheck; + } + + public Boolean getVfMacAntiSpoofCheck() { + return vfMacAntiSpoofCheck; + } + + public void setVfMacAntiSpoofCheck(Boolean vfMacAntiSpoofCheck) { + this.vfMacAntiSpoofCheck = vfMacAntiSpoofCheck; + } + + public String getVfMirrors() { + return vfMirrors; + } + + public void setVfMirrors(String vfMirrors) { + this.vfMirrors = vfMirrors; + } + + public Boolean getVfBroadcastAllow() { + return vfBroadcastAllow; + } + + public void setVfBroadcastAllow(Boolean vfBroadcastAllow) { + this.vfBroadcastAllow = vfBroadcastAllow; + } + + public Boolean getVfUnknownMulticastAllow() { + return vfUnknownMulticastAllow; + } + + public void setVfUnknownMulticastAllow(Boolean vfUnknownMulticastAllow) { + this.vfUnknownMulticastAllow = vfUnknownMulticastAllow; + } + + public Boolean getVfUnknownUnicastAllow() { + return vfUnknownUnicastAllow; + } + + public void setVfUnknownUnicastAllow(Boolean vfUnknownUnicastAllow) { + this.vfUnknownUnicastAllow = vfUnknownUnicastAllow; + } + + public Boolean getVfInsertStag() { + return vfInsertStag; + } + + public void setVfInsertStag(Boolean vfInsertStag) { + this.vfInsertStag = vfInsertStag; + } + + public String getVfLinkStatus() { + return vfLinkStatus; + } + + public void setVfLinkStatus(String vfLinkStatus) { + this.vfLinkStatus = vfLinkStatus; + } + + public String getNeutronNetworkId() { + return neutronNetworkId; + } + + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof SriovVf)) { + return false; + } + SriovVf castOther = (SriovVf) other; + return new EqualsBuilder().append(pciId, castOther.pciId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(pciId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java index 7277438102..8b01246067 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java @@ -23,151 +23,178 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.db.catalog.beans.OrchestrationStatus; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("subnet") -public class Subnet implements Serializable, ShallowCopy<Subnet>{ +public class Subnet implements Serializable, ShallowCopy<Subnet> { - private static final long serialVersionUID = -6789344717555598319L; + private static final long serialVersionUID = -6789344717555598319L; - @Id - @JsonProperty("subnet-id") + @Id + @JsonProperty("subnet-id") private String subnetId; - @JsonProperty("subnet-name") + @JsonProperty("subnet-name") private String subnetName; - @JsonProperty("neutron-subnet-id") + @JsonProperty("neutron-subnet-id") private String neutronSubnetId; - @JsonProperty("gateway-address") + @JsonProperty("gateway-address") private String gatewayAddress; - @JsonProperty("network-start-address") + @JsonProperty("network-start-address") private String networkStartAddress; - @JsonProperty("cidr-mask") + @JsonProperty("cidr-mask") private String cidrMask; - @JsonProperty("ip-version") + @JsonProperty("ip-version") private String ipVersion; - @JsonProperty("orchestration-status") + @JsonProperty("orchestration-status") private OrchestrationStatus orchestrationStatus; - @JsonProperty("dhcp-enabled") + @JsonProperty("dhcp-enabled") private Boolean dhcpEnabled; - @JsonProperty("dhcp-start") + @JsonProperty("dhcp-start") private String dhcpStart; - @JsonProperty("dhcp-end") + @JsonProperty("dhcp-end") private String dhcpEnd; - @JsonProperty("subnet-role") + @JsonProperty("subnet-role") private String subnetRole; - @JsonProperty("ip-assignment-direction") + @JsonProperty("ip-assignment-direction") private String ipAssignmentDirection; - @JsonProperty("subnet-sequence") + @JsonProperty("subnet-sequence") private Integer subnetSequence; - @JsonProperty("host-routes") + @JsonProperty("host-routes") private List<HostRoute> hostRoutes = new ArrayList<>(); - public String getSubnetId() { - return subnetId; - } - public void setSubnetId(String subnetId) { - this.subnetId = subnetId; - } - public String getSubnetName() { - return subnetName; - } - public void setSubnetName(String subnetName) { - this.subnetName = subnetName; - } - public String getNeutronSubnetId() { - return neutronSubnetId; - } - public void setNeutronSubnetId(String neutronSubnetId) { - this.neutronSubnetId = neutronSubnetId; - } - public String getGatewayAddress() { - return gatewayAddress; - } - public void setGatewayAddress(String gatewayAddress) { - this.gatewayAddress = gatewayAddress; - } - public String getNetworkStartAddress() { - return networkStartAddress; - } - public void setNetworkStartAddress(String networkStartAddress) { - this.networkStartAddress = networkStartAddress; - } - public String getCidrMask() { - return cidrMask; - } - public void setCidrMask(String cidrMask) { - this.cidrMask = cidrMask; - } - public String getIpVersion() { - return ipVersion; - } - public void setIpVersion(String ipVersion) { - this.ipVersion = ipVersion; - } - public OrchestrationStatus getOrchestrationStatus() { - return orchestrationStatus; - } - public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - public Boolean isDhcpEnabled() { - return dhcpEnabled; - } - public void setDhcpEnabled(Boolean dhcpEnabled) { - this.dhcpEnabled = dhcpEnabled; - } - public String getDhcpStart() { - return dhcpStart; - } - public void setDhcpStart(String dhcpStart) { - this.dhcpStart = dhcpStart; - } - public String getDhcpEnd() { - return dhcpEnd; - } - public void setDhcpEnd(String dhcpEnd) { - this.dhcpEnd = dhcpEnd; - } - public String getSubnetRole() { - return subnetRole; - } - public void setSubnetRole(String subnetRole) { - this.subnetRole = subnetRole; - } - public String getIpAssignmentDirection() { - return ipAssignmentDirection; - } - public void setIpAssignmentDirection(String ipAssignmentDirection) { - this.ipAssignmentDirection = ipAssignmentDirection; - } - public Integer getSubnetSequence() { - return subnetSequence; - } - public void setSubnetSequence(Integer subnetSequence) { - this.subnetSequence = subnetSequence; - } - public List<HostRoute> getHostRoutes() { - return hostRoutes; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof Subnet)) { - return false; - } - Subnet castOther = (Subnet) other; - return new EqualsBuilder().append(subnetId, castOther.subnetId).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(subnetId).toHashCode(); - } + public String getSubnetId() { + return subnetId; + } + + public void setSubnetId(String subnetId) { + this.subnetId = subnetId; + } + + public String getSubnetName() { + return subnetName; + } + + public void setSubnetName(String subnetName) { + this.subnetName = subnetName; + } + + public String getNeutronSubnetId() { + return neutronSubnetId; + } + + public void setNeutronSubnetId(String neutronSubnetId) { + this.neutronSubnetId = neutronSubnetId; + } + + public String getGatewayAddress() { + return gatewayAddress; + } + + public void setGatewayAddress(String gatewayAddress) { + this.gatewayAddress = gatewayAddress; + } + + public String getNetworkStartAddress() { + return networkStartAddress; + } + + public void setNetworkStartAddress(String networkStartAddress) { + this.networkStartAddress = networkStartAddress; + } + + public String getCidrMask() { + return cidrMask; + } + + public void setCidrMask(String cidrMask) { + this.cidrMask = cidrMask; + } + + public String getIpVersion() { + return ipVersion; + } + + public void setIpVersion(String ipVersion) { + this.ipVersion = ipVersion; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public Boolean isDhcpEnabled() { + return dhcpEnabled; + } + + public void setDhcpEnabled(Boolean dhcpEnabled) { + this.dhcpEnabled = dhcpEnabled; + } + + public String getDhcpStart() { + return dhcpStart; + } + + public void setDhcpStart(String dhcpStart) { + this.dhcpStart = dhcpStart; + } + + public String getDhcpEnd() { + return dhcpEnd; + } + + public void setDhcpEnd(String dhcpEnd) { + this.dhcpEnd = dhcpEnd; + } + + public String getSubnetRole() { + return subnetRole; + } + + public void setSubnetRole(String subnetRole) { + this.subnetRole = subnetRole; + } + + public String getIpAssignmentDirection() { + return ipAssignmentDirection; + } + + public void setIpAssignmentDirection(String ipAssignmentDirection) { + this.ipAssignmentDirection = ipAssignmentDirection; + } + + public Integer getSubnetSequence() { + return subnetSequence; + } + + public void setSubnetSequence(Integer subnetSequence) { + this.subnetSequence = subnetSequence; + } + + public List<HostRoute> getHostRoutes() { + return hostRoutes; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Subnet)) { + return false; + } + Subnet castOther = (Subnet) other; + return new EqualsBuilder().append(subnetId, castOther.subnetId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(subnetId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java index d3f3dcd359..c5cc1b7dbd 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java @@ -21,58 +21,62 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import javax.persistence.Id; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; - import com.fasterxml.jackson.annotation.JsonProperty; public class Tenant implements Serializable { - /** - * - */ - private static final long serialVersionUID = -8704478668505531590L; - @Id - @JsonProperty("tenant-id") - private String tenantId; - @JsonProperty("tenant-name") - private String tenantName; - @JsonProperty("tenant-context") - private String tenantContext; - - @Override - public boolean equals(final Object other) { - if (!(other instanceof Tenant)) { - return false; - } - Tenant castOther = (Tenant) other; - return new EqualsBuilder().append(tenantId, castOther.tenantId).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(tenantId).toHashCode(); - } - public String getTenantId() { - return tenantId; - } - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - public String getTenantName() { - return tenantName; - } - public void setTenantName(String tenantName) { - this.tenantName = tenantName; - } - public String getTenantContext() { - return tenantContext; - } - public void setTenantContext(String tenantContext) { - this.tenantContext = tenantContext; - } + /** + * + */ + private static final long serialVersionUID = -8704478668505531590L; + @Id + @JsonProperty("tenant-id") + private String tenantId; + @JsonProperty("tenant-name") + private String tenantName; + @JsonProperty("tenant-context") + private String tenantContext; + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Tenant)) { + return false; + } + Tenant castOther = (Tenant) other; + return new EqualsBuilder().append(tenantId, castOther.tenantId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(tenantId).toHashCode(); + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getTenantName() { + return tenantName; + } + + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + + public String getTenantContext() { + return tenantContext; + } + + public void setTenantContext(String tenantContext) { + this.tenantContext = tenantContext; + } + - } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java index ceca929806..ec6253be70 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java @@ -25,120 +25,139 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - import javax.persistence.Id; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.db.catalog.beans.OrchestrationStatus; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("vf-module") public class VfModule implements Serializable, ShallowCopy<VfModule> { - - private static final long serialVersionUID = 6570087672008609773L; - - @Id - @JsonProperty("vf-module-id") - private String vfModuleId; - @JsonProperty("vf-module-name") - private String vfModuleName; - @JsonProperty("orchestration-status") - private OrchestrationStatus orchestrationStatus; - @JsonProperty("cloud-params") - private Map<String, String> cloudParams = new HashMap<>(); - @JsonProperty("cascaded") - private Boolean cascaded; - @JsonProperty("heat-stack-id") + + private static final long serialVersionUID = 6570087672008609773L; + + @Id + @JsonProperty("vf-module-id") + private String vfModuleId; + @JsonProperty("vf-module-name") + private String vfModuleName; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("cloud-params") + private Map<String, String> cloudParams = new HashMap<>(); + @JsonProperty("cascaded") + private Boolean cascaded; + @JsonProperty("heat-stack-id") private String heatStackId; - @JsonProperty("contrail-service-instance-fqdn") + @JsonProperty("contrail-service-instance-fqdn") private String contrailServiceInstanceFqdn; - @JsonProperty("module-index") + @JsonProperty("module-index") private Integer moduleIndex; - @JsonProperty("selflink") + @JsonProperty("selflink") private String selflink; - @JsonProperty("vnfcs") - private List<Vnfc> vnfcs = new ArrayList<>(); - @JsonProperty("model-info-vf-module") - private ModelInfoVfModule modelInfoVfModule; - - public ModelInfoVfModule getModelInfoVfModule() { - return modelInfoVfModule; - } - public void setModelInfoVfModule(ModelInfoVfModule modelInfoVfModule) { - this.modelInfoVfModule = modelInfoVfModule; - } - public String getHeatStackId() { - return heatStackId; - } - public void setHeatStackId(String heatStackId) { - this.heatStackId = heatStackId; - } - public String getContrailServiceInstanceFqdn() { - return contrailServiceInstanceFqdn; - } - public void setContrailServiceInstanceFqdn(String contrailServiceInstanceFqdn) { - this.contrailServiceInstanceFqdn = contrailServiceInstanceFqdn; - } - public Integer getModuleIndex() { - return moduleIndex; - } - public void setModuleIndex(Integer moduleIndex) { - this.moduleIndex = moduleIndex; - } - public String getSelflink() { - return selflink; - } - public void setSelflink(String selflink) { - this.selflink = selflink; - } - public String getVfModuleId() { - return vfModuleId; - } - public void setVfModuleId(String vfModuleId) { - this.vfModuleId = vfModuleId; - } - public String getVfModuleName() { - return vfModuleName; - } - public void setVfModuleName(String vfModuleName) { - this.vfModuleName = vfModuleName; - } - public OrchestrationStatus getOrchestrationStatus() { - return orchestrationStatus; - } - public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - public Map<String, String> getCloudParams() { - return cloudParams; - } - public void setCloudParams(Map<String, String> cloudParams) { - this.cloudParams = cloudParams; - } - public Boolean isCascaded() { - return cascaded; - } - public void setCascaded(boolean cascaded) { - this.cascaded = cascaded; - } - public List<Vnfc> getVnfcs() { - return vnfcs; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof VfModule)) { - return false; - } - VfModule castOther = (VfModule) other; - return new EqualsBuilder().append(vfModuleId, castOther.vfModuleId).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(vfModuleId).toHashCode(); - } + @JsonProperty("vnfcs") + private List<Vnfc> vnfcs = new ArrayList<>(); + @JsonProperty("model-info-vf-module") + private ModelInfoVfModule modelInfoVfModule; + + public ModelInfoVfModule getModelInfoVfModule() { + return modelInfoVfModule; + } + + public void setModelInfoVfModule(ModelInfoVfModule modelInfoVfModule) { + this.modelInfoVfModule = modelInfoVfModule; + } + + public String getHeatStackId() { + return heatStackId; + } + + public void setHeatStackId(String heatStackId) { + this.heatStackId = heatStackId; + } + + public String getContrailServiceInstanceFqdn() { + return contrailServiceInstanceFqdn; + } + + public void setContrailServiceInstanceFqdn(String contrailServiceInstanceFqdn) { + this.contrailServiceInstanceFqdn = contrailServiceInstanceFqdn; + } + + public Integer getModuleIndex() { + return moduleIndex; + } + + public void setModuleIndex(Integer moduleIndex) { + this.moduleIndex = moduleIndex; + } + + public String getSelflink() { + return selflink; + } + + public void setSelflink(String selflink) { + this.selflink = selflink; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public String getVfModuleName() { + return vfModuleName; + } + + public void setVfModuleName(String vfModuleName) { + this.vfModuleName = vfModuleName; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public Map<String, String> getCloudParams() { + return cloudParams; + } + + public void setCloudParams(Map<String, String> cloudParams) { + this.cloudParams = cloudParams; + } + + public Boolean isCascaded() { + return cascaded; + } + + public void setCascaded(boolean cascaded) { + this.cascaded = cascaded; + } + + public List<Vnfc> getVnfcs() { + return vnfcs; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VfModule)) { + return false; + } + VfModule castOther = (VfModule) other; + return new EqualsBuilder().append(vfModuleId, castOther.vfModuleId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(vfModuleId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java index a0788d4b0d..6951a23630 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java @@ -23,140 +23,164 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.db.catalog.beans.OrchestrationStatus; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; - import javax.persistence.Id; @JsonRootName("vlan") -public class Vlan implements Serializable, ShallowCopy<Vlan>{ +public class Vlan implements Serializable, ShallowCopy<Vlan> { - private static final long serialVersionUID = 1260512753640402946L; + private static final long serialVersionUID = 1260512753640402946L; - @Id - @JsonProperty("vlan-interface") + @Id + @JsonProperty("vlan-interface") private String vlanInterface; - @JsonProperty("vlan-id-inner") + @JsonProperty("vlan-id-inner") private Long vlanIdInner; - @JsonProperty("vlan-id-outer") + @JsonProperty("vlan-id-outer") private Long vlanIdOuter; - @JsonProperty("speed-value") + @JsonProperty("speed-value") private String speedValue; - @JsonProperty("speed-units") + @JsonProperty("speed-units") private String speedUnits; - @JsonProperty("vlan-description") + @JsonProperty("vlan-description") private String vlanDescription; - @JsonProperty("backdoor-connection") + @JsonProperty("backdoor-connection") private String backdoorConnection; - @JsonProperty("vpn-key") + @JsonProperty("vpn-key") private String vpnKey; - @JsonProperty("orchestration-status") + @JsonProperty("orchestration-status") private OrchestrationStatus orchestrationStatus; - @JsonProperty("in-maint") + @JsonProperty("in-maint") private Boolean inMaint; - @JsonProperty("prov-status") + @JsonProperty("prov-status") private String provStatus; - @JsonProperty("is-ip-unnumbered") + @JsonProperty("is-ip-unnumbered") private Boolean isIpUnnumbered; - @JsonProperty("l3-interface-ipv4-address-list") + @JsonProperty("l3-interface-ipv4-address-list") private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>(); - @JsonProperty("l3-interface-ipv6-address-list") + @JsonProperty("l3-interface-ipv6-address-list") private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<L3InterfaceIpv6AddressList>(); - public String getVlanInterface() { - return vlanInterface; - } - public void setVlanInterface(String vlanInterface) { - this.vlanInterface = vlanInterface; - } - public Long getVlanIdInner() { - return vlanIdInner; - } - public void setVlanIdInner(Long vlanIdInner) { - this.vlanIdInner = vlanIdInner; - } - public Long getVlanIdOuter() { - return vlanIdOuter; - } - public void setVlanIdOuter(Long vlanIdOuter) { - this.vlanIdOuter = vlanIdOuter; - } - public String getSpeedValue() { - return speedValue; - } - public void setSpeedValue(String speedValue) { - this.speedValue = speedValue; - } - public String getSpeedUnits() { - return speedUnits; - } - public void setSpeedUnits(String speedUnits) { - this.speedUnits = speedUnits; - } - public String getVlanDescription() { - return vlanDescription; - } - public void setVlanDescription(String vlanDescription) { - this.vlanDescription = vlanDescription; - } - public String getBackdoorConnection() { - return backdoorConnection; - } - public void setBackdoorConnection(String backdoorConnection) { - this.backdoorConnection = backdoorConnection; - } - public String getVpnKey() { - return vpnKey; - } - public void setVpnKey(String vpnKey) { - this.vpnKey = vpnKey; - } - public OrchestrationStatus getOrchestrationStatus() { - return orchestrationStatus; - } - public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - public Boolean isInMaint() { - return inMaint; - } - public void setInMaint(boolean inMaint) { - this.inMaint = inMaint; - } - public String getProvStatus() { - return provStatus; - } - public void setProvStatus(String provStatus) { - this.provStatus = provStatus; - } - public Boolean isIsIpUnnumbered() { - return isIpUnnumbered; - } - public void setIpUnnumbered(Boolean isIpUnnumbered) { - this.isIpUnnumbered = isIpUnnumbered; - } - public List<L3InterfaceIpv4AddressList> getL3InterfaceIpv4AddressList() { - return l3InterfaceIpv4AddressList; - } - public List<L3InterfaceIpv6AddressList> getL3InterfaceIpv6AddressList() { - return l3InterfaceIpv6AddressList; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof Vlan)) { - return false; - } - Vlan castOther = (Vlan) other; - return new EqualsBuilder().append(vlanInterface, castOther.vlanInterface).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(vlanInterface).toHashCode(); - } + public String getVlanInterface() { + return vlanInterface; + } + + public void setVlanInterface(String vlanInterface) { + this.vlanInterface = vlanInterface; + } + + public Long getVlanIdInner() { + return vlanIdInner; + } + + public void setVlanIdInner(Long vlanIdInner) { + this.vlanIdInner = vlanIdInner; + } + + public Long getVlanIdOuter() { + return vlanIdOuter; + } + + public void setVlanIdOuter(Long vlanIdOuter) { + this.vlanIdOuter = vlanIdOuter; + } + + public String getSpeedValue() { + return speedValue; + } + + public void setSpeedValue(String speedValue) { + this.speedValue = speedValue; + } + + public String getSpeedUnits() { + return speedUnits; + } + + public void setSpeedUnits(String speedUnits) { + this.speedUnits = speedUnits; + } + + public String getVlanDescription() { + return vlanDescription; + } + + public void setVlanDescription(String vlanDescription) { + this.vlanDescription = vlanDescription; + } + + public String getBackdoorConnection() { + return backdoorConnection; + } + + public void setBackdoorConnection(String backdoorConnection) { + this.backdoorConnection = backdoorConnection; + } + + public String getVpnKey() { + return vpnKey; + } + + public void setVpnKey(String vpnKey) { + this.vpnKey = vpnKey; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public Boolean isInMaint() { + return inMaint; + } + + public void setInMaint(boolean inMaint) { + this.inMaint = inMaint; + } + + public String getProvStatus() { + return provStatus; + } + + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + + public Boolean isIsIpUnnumbered() { + return isIpUnnumbered; + } + + public void setIpUnnumbered(Boolean isIpUnnumbered) { + this.isIpUnnumbered = isIpUnnumbered; + } + + public List<L3InterfaceIpv4AddressList> getL3InterfaceIpv4AddressList() { + return l3InterfaceIpv4AddressList; + } + + public List<L3InterfaceIpv6AddressList> getL3InterfaceIpv6AddressList() { + return l3InterfaceIpv6AddressList; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Vlan)) { + return false; + } + Vlan castOther = (Vlan) other; + return new EqualsBuilder().append(vlanInterface, castOther.vlanInterface).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(vlanInterface).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java index b432fe10b7..087edff7c0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java @@ -1,131 +1,153 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; - import javax.persistence.Id; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("vnfc") public class Vnfc implements Serializable { - - - /** - * - */ - private static final long serialVersionUID = -9170269565756850796L; - @Id - @JsonProperty("vnfc-name") - private String vnfcName; - @JsonProperty("nfc-naming-code") - private String nfcNamingCode; - @JsonProperty("nfc-function") - private String nfcFunction; - @JsonProperty("prov-status") - private String provStatus; - @JsonProperty("orchestration-status") - private String orchestrationStatus; - @JsonProperty("ipaddress-v4-oam-vip") - private String ipaddressV4OamVip; - @JsonProperty("in-maint") - private String inMaint; - @JsonProperty("is-closed-loop-disabled") - private String isClosedLoopDisabled; - @JsonProperty("group-notation") - private String groupNotation; - @JsonProperty("model-invariant-id") - private String modelInvariantId; - @JsonProperty("model-version-id") - private String modelVersionId; - @JsonProperty("model-customization-id") - private String modelCustomizationId; - - @Override - public boolean equals(final Object other) { - if (!(other instanceof Vnfc)) { - return false; - } - Vnfc castOther = (Vnfc) other; - return new EqualsBuilder().append(vnfcName, castOther.vnfcName).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(vnfcName).toHashCode(); - } - public String getVnfcName() { - return vnfcName; - } - public void setVnfcName(String vnfcName) { - this.vnfcName = vnfcName; - } - public String getNfcNamingCode() { - return nfcNamingCode; - } - public void setNfcNamingCode(String nfcNamingCode) { - this.nfcNamingCode = nfcNamingCode; - } - public String getNfcFunction() { - return nfcFunction; - } - public void setNfcFunction(String nfcFunction) { - this.nfcFunction = nfcFunction; - } - public String getProvStatus() { - return provStatus; - } - public void setProvStatus(String provStatus) { - this.provStatus = provStatus; - } - public String getOrchestrationStatus() { - return orchestrationStatus; - } - public void setOrchestrationStatus(String orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - public String getIpaddressV4OamVip() { - return ipaddressV4OamVip; - } - public void setIpaddressV4OamVip(String ipaddressV4OamVip) { - this.ipaddressV4OamVip = ipaddressV4OamVip; - } - public String getInMaint() { - return inMaint; - } - public void setInMaint(String inMaint) { - this.inMaint = inMaint; - } - public String getIsClosedLoopDisabled() { - return isClosedLoopDisabled; - } - public void setIsClosedLoopDisabled(String isClosedLoopDisabled) { - this.isClosedLoopDisabled = isClosedLoopDisabled; - } - public String getGroupNotation() { - return groupNotation; - } - public void setGroupNotation(String groupNotation) { - this.groupNotation = groupNotation; - } - public String getModelInvariantId() { - return modelInvariantId; - } - public void setModelInvariantId(String modelInvariantId) { - this.modelInvariantId = modelInvariantId; - } - public String getModelVersionId() { - return modelVersionId; - } - public void setModelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - } - public String getModelCustomizationId() { - return modelCustomizationId; - } - public void setModelCustomizationId(String modelCustomizationId) { - this.modelCustomizationId = modelCustomizationId; - } + + + /** + * + */ + private static final long serialVersionUID = -9170269565756850796L; + @Id + @JsonProperty("vnfc-name") + private String vnfcName; + @JsonProperty("nfc-naming-code") + private String nfcNamingCode; + @JsonProperty("nfc-function") + private String nfcFunction; + @JsonProperty("prov-status") + private String provStatus; + @JsonProperty("orchestration-status") + private String orchestrationStatus; + @JsonProperty("ipaddress-v4-oam-vip") + private String ipaddressV4OamVip; + @JsonProperty("in-maint") + private String inMaint; + @JsonProperty("is-closed-loop-disabled") + private String isClosedLoopDisabled; + @JsonProperty("group-notation") + private String groupNotation; + @JsonProperty("model-invariant-id") + private String modelInvariantId; + @JsonProperty("model-version-id") + private String modelVersionId; + @JsonProperty("model-customization-id") + private String modelCustomizationId; + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Vnfc)) { + return false; + } + Vnfc castOther = (Vnfc) other; + return new EqualsBuilder().append(vnfcName, castOther.vnfcName).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(vnfcName).toHashCode(); + } + + public String getVnfcName() { + return vnfcName; + } + + public void setVnfcName(String vnfcName) { + this.vnfcName = vnfcName; + } + + public String getNfcNamingCode() { + return nfcNamingCode; + } + + public void setNfcNamingCode(String nfcNamingCode) { + this.nfcNamingCode = nfcNamingCode; + } + + public String getNfcFunction() { + return nfcFunction; + } + + public void setNfcFunction(String nfcFunction) { + this.nfcFunction = nfcFunction; + } + + public String getProvStatus() { + return provStatus; + } + + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + + public String getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(String orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public String getIpaddressV4OamVip() { + return ipaddressV4OamVip; + } + + public void setIpaddressV4OamVip(String ipaddressV4OamVip) { + this.ipaddressV4OamVip = ipaddressV4OamVip; + } + + public String getInMaint() { + return inMaint; + } + + public void setInMaint(String inMaint) { + this.inMaint = inMaint; + } + + public String getIsClosedLoopDisabled() { + return isClosedLoopDisabled; + } + + public void setIsClosedLoopDisabled(String isClosedLoopDisabled) { + this.isClosedLoopDisabled = isClosedLoopDisabled; + } + + public String getGroupNotation() { + return groupNotation; + } + + public void setGroupNotation(String groupNotation) { + this.groupNotation = groupNotation; + } + + public String getModelInvariantId() { + return modelInvariantId; + } + + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + public String getModelVersionId() { + return modelVersionId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + public String getModelCustomizationId() { + return modelCustomizationId; + } + + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java index 99a643a129..82afe5fcfe 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java @@ -23,14 +23,11 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; import java.util.HashMap; import java.util.Map; - import javax.persistence.Id; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.db.catalog.beans.OrchestrationStatus; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @@ -38,84 +35,101 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @JsonRootName("volume-group") public class VolumeGroup implements Serializable, ShallowCopy<VolumeGroup> { - private static final long serialVersionUID = 870124265764370922L; - - @Id - @JsonProperty("volume-group-id") - private String volumeGroupId; - @JsonProperty("volume-group-name") - private String volumeGroupName; - @JsonProperty("vnf-type") - private String vnfType; - @JsonProperty("orchestration-status") - private OrchestrationStatus orchestrationStatus; - @JsonProperty("cloud-params") - private Map<String, String> cloudParams = new HashMap<>(); - @JsonProperty("cascaded") - private Boolean cascaded; - @JsonProperty("heat-stack-id") - private String heatStackId; - @JsonProperty("model-info-vf-module") - private ModelInfoVfModule modelInfoVfModule; - - public ModelInfoVfModule getModelInfoVfModule() { - return modelInfoVfModule; - } - public void setModelInfoVfModule(ModelInfoVfModule modelInfoVfModule) { - this.modelInfoVfModule = modelInfoVfModule; - } - public String getHeatStackId() { - return heatStackId; - } - public void setHeatStackId(String heatStackId) { - this.heatStackId = heatStackId; - } - public String getVolumeGroupId() { - return volumeGroupId; - } - public void setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - public String getVolumeGroupName() { - return volumeGroupName; - } - public void setVolumeGroupName(String volumeGroupName) { - this.volumeGroupName = volumeGroupName; - } - public String getVnfType() { - return vnfType; - } - public void setVnfType(String vnfType) { - this.vnfType = vnfType; - } - public OrchestrationStatus getOrchestrationStatus() { - return orchestrationStatus; - } - public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - public Map<String, String> getCloudParams() { - return cloudParams; - } - public void setCloudParams(Map<String, String> cloudParams) { - this.cloudParams = cloudParams; - } - public Boolean isCascaded() { - return cascaded; - } - public void setCascaded(boolean cascaded) { - this.cascaded = cascaded; - } - @Override - public boolean equals(final Object other) { - if (!(other instanceof VolumeGroup)) { - return false; - } - VolumeGroup castOther = (VolumeGroup) other; - return new EqualsBuilder().append(volumeGroupId, castOther.volumeGroupId).isEquals(); - } - @Override - public int hashCode() { - return new HashCodeBuilder().append(volumeGroupId).toHashCode(); - } + private static final long serialVersionUID = 870124265764370922L; + + @Id + @JsonProperty("volume-group-id") + private String volumeGroupId; + @JsonProperty("volume-group-name") + private String volumeGroupName; + @JsonProperty("vnf-type") + private String vnfType; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("cloud-params") + private Map<String, String> cloudParams = new HashMap<>(); + @JsonProperty("cascaded") + private Boolean cascaded; + @JsonProperty("heat-stack-id") + private String heatStackId; + @JsonProperty("model-info-vf-module") + private ModelInfoVfModule modelInfoVfModule; + + public ModelInfoVfModule getModelInfoVfModule() { + return modelInfoVfModule; + } + + public void setModelInfoVfModule(ModelInfoVfModule modelInfoVfModule) { + this.modelInfoVfModule = modelInfoVfModule; + } + + public String getHeatStackId() { + return heatStackId; + } + + public void setHeatStackId(String heatStackId) { + this.heatStackId = heatStackId; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + + public String getVolumeGroupName() { + return volumeGroupName; + } + + public void setVolumeGroupName(String volumeGroupName) { + this.volumeGroupName = volumeGroupName; + } + + public String getVnfType() { + return vnfType; + } + + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public Map<String, String> getCloudParams() { + return cloudParams; + } + + public void setCloudParams(Map<String, String> cloudParams) { + this.cloudParams = cloudParams; + } + + public Boolean isCascaded() { + return cascaded; + } + + public void setCascaded(boolean cascaded) { + this.cascaded = cascaded; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VolumeGroup)) { + return false; + } + VolumeGroup castOther = (VolumeGroup) other; + return new EqualsBuilder().append(volumeGroupId, castOther.volumeGroupId).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(volumeGroupId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBinding.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBinding.java index 36e1af443c..6ae44dc676 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBinding.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBinding.java @@ -23,9 +23,7 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import javax.persistence.Id; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; @@ -35,10 +33,10 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @JsonRootName("vpn-binding") public class VpnBinding implements Serializable, ShallowCopy<VpnBinding> { - private static final long serialVersionUID = 3283413795353486924L; + private static final long serialVersionUID = 3283413795353486924L; - @Id - @JsonProperty("vpn-id") + @Id + @JsonProperty("vpn-id") private String vpnId; @JsonProperty("vpn-name") private String vpnName; @@ -125,17 +123,17 @@ public class VpnBinding implements Serializable, ShallowCopy<VpnBinding> { return routeTargets; } - @Override - public boolean equals(final Object other) { - if (!(other instanceof VpnBinding)) { - return false; - } - VpnBinding castOther = (VpnBinding) other; - return new EqualsBuilder().append(vpnId, castOther.vpnId).isEquals(); - } + @Override + public boolean equals(final Object other) { + if (!(other instanceof VpnBinding)) { + return false; + } + VpnBinding castOther = (VpnBinding) other; + return new EqualsBuilder().append(vpnId, castOther.vpnId).isEquals(); + } - @Override - public int hashCode() { - return new HashCodeBuilder().append(vpnId).toHashCode(); - } + @Override + public int hashCode() { + return new HashCodeBuilder().append(vpnId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java index dec3d48203..4ee8213e59 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java @@ -22,15 +22,11 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; - import javax.persistence.Id; - import static org.apache.commons.lang3.StringUtils.*; - import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @@ -58,109 +54,110 @@ public class VpnBondingLink implements Serializable, ShallowCopy<VpnBondingLink> this.vpnBondingLinkId = vpnBondingLinkId; } - public List<Configuration> getConfigurations() { - return configurations; - } - - public List<ServiceProxy> getServiceProxies() { - return serviceProxies; - } - - public ServiceProxy getServiceProxy(String id) { - ServiceProxy serviceProxy = null; - for(ServiceProxy s : serviceProxies){ - if(s.getId().equals(id)){ - serviceProxy = s; - } - } - return serviceProxy; - } - - //TODO temp solution until references are updated to use getConfigurationByType + public List<Configuration> getConfigurations() { + return configurations; + } + + public List<ServiceProxy> getServiceProxies() { + return serviceProxies; + } + + public ServiceProxy getServiceProxy(String id) { + ServiceProxy serviceProxy = null; + for (ServiceProxy s : serviceProxies) { + if (s.getId().equals(id)) { + serviceProxy = s; + } + } + return serviceProxy; + } + + // TODO temp solution until references are updated to use getConfigurationByType public Configuration getVnrConfiguration() { - Configuration configuration = null; - for(Configuration c:configurations){ - if(containsIgnoreCase(c.getConfigurationType(), "vlan") || containsIgnoreCase(c.getConfigurationType(), "vnr")){ - configuration = c; - } - } + Configuration configuration = null; + for (Configuration c : configurations) { + if (containsIgnoreCase(c.getConfigurationType(), "vlan") + || containsIgnoreCase(c.getConfigurationType(), "vnr")) { + configuration = c; + } + } return configuration; } - //TODO temp solution until references are updatedd + // TODO temp solution until references are updatedd public void setVnrConfiguration(Configuration vnrConfiguration) { - if(vnrConfiguration.getConfigurationType() == null){ - vnrConfiguration.setConfigurationType("vlan"); - } - configurations.add(vnrConfiguration); + if (vnrConfiguration.getConfigurationType() == null) { + vnrConfiguration.setConfigurationType("vlan"); + } + configurations.add(vnrConfiguration); } - //TODO temp solution until references are updated to use getConfigurationByType + // TODO temp solution until references are updated to use getConfigurationByType public Configuration getVrfConfiguration() { - Configuration configuration = null; - for(Configuration c:configurations){ - if(containsIgnoreCase(c.getConfigurationType(), "vrf")){ - configuration = c; - } - } - return configuration; - } - - //TODO temp solution until references are updated + Configuration configuration = null; + for (Configuration c : configurations) { + if (containsIgnoreCase(c.getConfigurationType(), "vrf")) { + configuration = c; + } + } + return configuration; + } + + // TODO temp solution until references are updated public void setVrfConfiguration(Configuration vrfConfiguration) { - if(vrfConfiguration.getConfigurationType() == null){ - vrfConfiguration.setConfigurationType("vrf"); - } - configurations.add(vrfConfiguration); + if (vrfConfiguration.getConfigurationType() == null) { + vrfConfiguration.setConfigurationType("vrf"); + } + configurations.add(vrfConfiguration); } - //TODO temp solution until references are updated to use getServiceProxyByType + // TODO temp solution until references are updated to use getServiceProxyByType public ServiceProxy getInfrastructureServiceProxy() { - ServiceProxy serviceProxy = null; - for(ServiceProxy sp:serviceProxies){ - if(sp.getType().equals("infrastructure")){ - serviceProxy = sp; - } - } + ServiceProxy serviceProxy = null; + for (ServiceProxy sp : serviceProxies) { + if (sp.getType().equals("infrastructure")) { + serviceProxy = sp; + } + } return serviceProxy; } - //TODO temp solution until references are updated + // TODO temp solution until references are updated public void setInfrastructureServiceProxy(ServiceProxy infrastructureServiceProxy) { - infrastructureServiceProxy.setType("infrastructure"); - serviceProxies.add(infrastructureServiceProxy); + infrastructureServiceProxy.setType("infrastructure"); + serviceProxies.add(infrastructureServiceProxy); } - //TODO temp solution until references are updated to use getServiceProxyByType + // TODO temp solution until references are updated to use getServiceProxyByType public ServiceProxy getTransportServiceProxy() { - ServiceProxy serviceProxy = null; - for(ServiceProxy sp:serviceProxies){ - if(sp != null){ - if(sp.getType().equals("transport")){ - serviceProxy = sp; - } - } - } - return serviceProxy; + ServiceProxy serviceProxy = null; + for (ServiceProxy sp : serviceProxies) { + if (sp != null) { + if (sp.getType().equals("transport")) { + serviceProxy = sp; + } + } + } + return serviceProxy; } - //TODO temp solution until references are updated + // TODO temp solution until references are updated public void setTransportServiceProxy(ServiceProxy transportServiceProxy) { - transportServiceProxy.setType("transport"); - serviceProxies.add(transportServiceProxy); + transportServiceProxy.setType("transport"); + serviceProxies.add(transportServiceProxy); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VpnBondingLink)) { + return false; + } + VpnBondingLink castOther = (VpnBondingLink) other; + return new EqualsBuilder().append(vpnBondingLinkId, castOther.vpnBondingLinkId).isEquals(); } - @Override - public boolean equals(final Object other) { - if (!(other instanceof VpnBondingLink)) { - return false; - } - VpnBondingLink castOther = (VpnBondingLink) other; - return new EqualsBuilder().append(vpnBondingLinkId, castOther.vpnBondingLinkId).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(vpnBondingLinkId).toHashCode(); - } + @Override + public int hashCode() { + return new HashCodeBuilder().append(vpnBondingLinkId).toHashCode(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java index 7b11e9f68e..1f689e97e3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java @@ -21,54 +21,62 @@ package org.onap.so.bpmn.servicedecomposition.entities; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("buildingBlock") -public class BuildingBlock implements Serializable{ - - private static final long serialVersionUID = -1144315411128866052L; - - @JsonProperty("mso-id") - private String msoId; - @JsonProperty("bpmn-flow-name") - private String bpmnFlowName; - @JsonProperty("key") - private String key; - @JsonProperty("is-virtual-link") - private Boolean isVirtualLink; - @JsonProperty("virtual-link-key") - private String virtualLinkKey; +public class BuildingBlock implements Serializable { + + private static final long serialVersionUID = -1144315411128866052L; + + @JsonProperty("mso-id") + private String msoId; + @JsonProperty("bpmn-flow-name") + private String bpmnFlowName; + @JsonProperty("key") + private String key; + @JsonProperty("is-virtual-link") + private Boolean isVirtualLink; + @JsonProperty("virtual-link-key") + private String virtualLinkKey; + + public String getBpmnFlowName() { + return bpmnFlowName; + } + + public void setBpmnFlowName(String bpmnFlowName) { + this.bpmnFlowName = bpmnFlowName; + } + + public String getMsoId() { + return msoId; + } + + public void setMsoId(String msoId) { + this.msoId = msoId; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public Boolean getIsVirtualLink() { + return isVirtualLink; + } + + public void setIsVirtualLink(Boolean isVirtualLink) { + this.isVirtualLink = isVirtualLink; + } + + public String getVirtualLinkKey() { + return virtualLinkKey; + } - public String getBpmnFlowName() { - return bpmnFlowName; - } - public void setBpmnFlowName(String bpmnFlowName) { - this.bpmnFlowName = bpmnFlowName; - } - public String getMsoId() { - return msoId; - } - public void setMsoId(String msoId) { - this.msoId = msoId; - } - public String getKey() { - return key; - } - public void setKey(String key) { - this.key = key; - } - public Boolean getIsVirtualLink() { - return isVirtualLink; - } - public void setIsVirtualLink(Boolean isVirtualLink) { - this.isVirtualLink = isVirtualLink; - } - public String getVirtualLinkKey() { - return virtualLinkKey; - } - public void setVirtualLinkKey(String virtualLinkKey) { - this.virtualLinkKey = virtualLinkKey; - } + public void setVirtualLinkKey(String virtualLinkKey) { + this.virtualLinkKey = virtualLinkKey; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java index 00903ab782..40e0dd9654 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java @@ -22,41 +22,48 @@ package org.onap.so.bpmn.servicedecomposition.entities; import java.io.Serializable; -public class ConfigurationResourceKeys implements Serializable{ - - /** - * - */ - private static final long serialVersionUID = 1L; - private String vfModuleCustomizationUUID; - private String vnfResourceCustomizationUUID; - private String cvnfcCustomizationUUID; - private String vnfcName; - - public String getVfModuleCustomizationUUID() { - return vfModuleCustomizationUUID; - } - public void setVfModuleCustomizationUUID(String vfModuleCustomizationUUID) { - this.vfModuleCustomizationUUID = vfModuleCustomizationUUID; - } - public String getVnfResourceCustomizationUUID() { - return vnfResourceCustomizationUUID; - } - public void setVnfResourceCustomizationUUID(String vnfResourceCustomizationUUID) { - this.vnfResourceCustomizationUUID = vnfResourceCustomizationUUID; - } - public String getCvnfcCustomizationUUID() { - return cvnfcCustomizationUUID; - } - public void setCvnfcCustomizationUUID(String cvnfcCustomizationUUID) { - this.cvnfcCustomizationUUID = cvnfcCustomizationUUID; - } - public String getVnfcName() { - return vnfcName; - } - public void setVnfcName(String vnfcName) { - this.vnfcName = vnfcName; - } - - +public class ConfigurationResourceKeys implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + private String vfModuleCustomizationUUID; + private String vnfResourceCustomizationUUID; + private String cvnfcCustomizationUUID; + private String vnfcName; + + public String getVfModuleCustomizationUUID() { + return vfModuleCustomizationUUID; + } + + public void setVfModuleCustomizationUUID(String vfModuleCustomizationUUID) { + this.vfModuleCustomizationUUID = vfModuleCustomizationUUID; + } + + public String getVnfResourceCustomizationUUID() { + return vnfResourceCustomizationUUID; + } + + public void setVnfResourceCustomizationUUID(String vnfResourceCustomizationUUID) { + this.vnfResourceCustomizationUUID = vnfResourceCustomizationUUID; + } + + public String getCvnfcCustomizationUUID() { + return cvnfcCustomizationUUID; + } + + public void setCvnfcCustomizationUUID(String cvnfcCustomizationUUID) { + this.cvnfcCustomizationUUID = cvnfcCustomizationUUID; + } + + public String getVnfcName() { + return vnfcName; + } + + public void setVnfcName(String vnfcName) { + this.vnfcName = vnfcName; + } + + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java index be73b37f85..af9eb525aa 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java @@ -21,90 +21,110 @@ package org.onap.so.bpmn.servicedecomposition.entities; import java.io.Serializable; - import org.onap.so.serviceinstancebeans.RequestDetails; -public class ExecuteBuildingBlock implements Serializable{ - /** - * - */ - private static final long serialVersionUID = 1L; - private BuildingBlock buildingBlock; - private String requestId; - private String apiVersion; - private String resourceId; - private String requestAction; - private String vnfType; - private Boolean aLaCarte; - private Boolean homing; - private WorkflowResourceIds workflowResourceIds; - private RequestDetails requestDetails; - private ConfigurationResourceKeys configurationResourceKeys; - - public BuildingBlock getBuildingBlock() { - return buildingBlock; - } - public void setBuildingBlock(BuildingBlock buildingBlock) { - this.buildingBlock = buildingBlock; - } - public String getRequestId() { - return requestId; - } - public void setRequestId(String requestId) { - this.requestId = requestId; - } - public String getApiVersion() { - return apiVersion; - } - public void setApiVersion(String apiVersion) { - this.apiVersion = apiVersion; - } - public String getResourceId() { - return resourceId; - } - public void setResourceId(String resourceId) { - this.resourceId = resourceId; - } - public String getRequestAction() { - return requestAction; - } - public void setRequestAction(String requestAction) { - this.requestAction = requestAction; - } - public Boolean isaLaCarte() { - return aLaCarte; - } - public void setaLaCarte(Boolean aLaCarte) { - this.aLaCarte = aLaCarte; - } - public String getVnfType() { - return vnfType; - } - public void setVnfType(String vnfType) { - this.vnfType = vnfType; - } - public Boolean isHoming() { - return homing; - } - public void setHoming(Boolean homing) { - this.homing = homing; - } - public WorkflowResourceIds getWorkflowResourceIds() { - return workflowResourceIds; - } - public void setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) { - this.workflowResourceIds = workflowResourceIds; - } - public RequestDetails getRequestDetails() { - return requestDetails; - } - public void setRequestDetails(RequestDetails requestDetails) { - this.requestDetails = requestDetails; - } - public ConfigurationResourceKeys getConfigurationResourceKeys() { - return configurationResourceKeys; - } - public void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) { - this.configurationResourceKeys = configurationResourceKeys; - } +public class ExecuteBuildingBlock implements Serializable { + /** + * + */ + private static final long serialVersionUID = 1L; + private BuildingBlock buildingBlock; + private String requestId; + private String apiVersion; + private String resourceId; + private String requestAction; + private String vnfType; + private Boolean aLaCarte; + private Boolean homing; + private WorkflowResourceIds workflowResourceIds; + private RequestDetails requestDetails; + private ConfigurationResourceKeys configurationResourceKeys; + + public BuildingBlock getBuildingBlock() { + return buildingBlock; + } + + public void setBuildingBlock(BuildingBlock buildingBlock) { + this.buildingBlock = buildingBlock; + } + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public String getApiVersion() { + return apiVersion; + } + + public void setApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + } + + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public String getRequestAction() { + return requestAction; + } + + public void setRequestAction(String requestAction) { + this.requestAction = requestAction; + } + + public Boolean isaLaCarte() { + return aLaCarte; + } + + public void setaLaCarte(Boolean aLaCarte) { + this.aLaCarte = aLaCarte; + } + + public String getVnfType() { + return vnfType; + } + + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public Boolean isHoming() { + return homing; + } + + public void setHoming(Boolean homing) { + this.homing = homing; + } + + public WorkflowResourceIds getWorkflowResourceIds() { + return workflowResourceIds; + } + + public void setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) { + this.workflowResourceIds = workflowResourceIds; + } + + public RequestDetails getRequestDetails() { + return requestDetails; + } + + public void setRequestDetails(RequestDetails requestDetails) { + this.requestDetails = requestDetails; + } + + public ConfigurationResourceKeys getConfigurationResourceKeys() { + return configurationResourceKeys; + } + + public void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) { + this.configurationResourceKeys = configurationResourceKeys; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java index 6d3be0f822..870c740c1f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java @@ -22,7 +22,6 @@ package org.onap.so.bpmn.servicedecomposition.entities; import java.io.Serializable; import java.util.Map; - import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -31,74 +30,76 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; public class GeneralBuildingBlock implements Serializable { - private static final String INVALID_INPUT_MISSING = "Expected building block input of \"%s\" not found in decomposition"; - private static final String INVALID_INPUT_CLASS_CAST = "Expected building block input of \"%s\" was the wrong object type in the decomposition"; + private static final String INVALID_INPUT_MISSING = + "Expected building block input of \"%s\" not found in decomposition"; + private static final String INVALID_INPUT_CLASS_CAST = + "Expected building block input of \"%s\" was the wrong object type in the decomposition"; + + private static final long serialVersionUID = -429247436428110843L; - private static final long serialVersionUID = -429247436428110843L; + private RequestContext requestContext; + private OrchestrationContext orchContext; + private Map<String, String> userInput; + private CloudRegion cloudRegion; + private Tenant tenant; - private RequestContext requestContext; - private OrchestrationContext orchContext; - private Map<String, String> userInput; - private CloudRegion cloudRegion; - private Tenant tenant; + private Customer customer; + private ServiceInstance serviceInstance; - private Customer customer; - private ServiceInstance serviceInstance; - - public Tenant getTenant() { - return tenant; - } + public Tenant getTenant() { + return tenant; + } - public void setTenant(Tenant tenant) { - this.tenant = tenant; - } + public void setTenant(Tenant tenant) { + this.tenant = tenant; + } - public CloudRegion getCloudRegion() { - return cloudRegion; - } + public CloudRegion getCloudRegion() { + return cloudRegion; + } - public void setCloudRegion(CloudRegion cloudRegion) { - this.cloudRegion = cloudRegion; - } + public void setCloudRegion(CloudRegion cloudRegion) { + this.cloudRegion = cloudRegion; + } - public RequestContext getRequestContext() { - return requestContext; - } + public RequestContext getRequestContext() { + return requestContext; + } - public void setRequestContext(RequestContext requestContext) { - this.requestContext = requestContext; - } + public void setRequestContext(RequestContext requestContext) { + this.requestContext = requestContext; + } - public OrchestrationContext getOrchContext() { - return orchContext; - } + public OrchestrationContext getOrchContext() { + return orchContext; + } - public void setOrchContext(OrchestrationContext orchContext) { - this.orchContext = orchContext; - } + public void setOrchContext(OrchestrationContext orchContext) { + this.orchContext = orchContext; + } - public Map<String, String> getUserInput() { - return userInput; - } + public Map<String, String> getUserInput() { + return userInput; + } - public void setUserInput(Map<String, String> userInput) { - this.userInput = userInput; - } + public void setUserInput(Map<String, String> userInput) { + this.userInput = userInput; + } - public Customer getCustomer() { - return customer; - } + public Customer getCustomer() { + return customer; + } - public void setCustomer(Customer customer) { - this.customer = customer; - } + public void setCustomer(Customer customer) { + this.customer = customer; + } - public ServiceInstance getServiceInstance() { - return serviceInstance; - } + public ServiceInstance getServiceInstance() { + return serviceInstance; + } - public void setServiceInstance(ServiceInstance serviceInstance) { - this.serviceInstance = serviceInstance; - } + public void setServiceInstance(ServiceInstance serviceInstance) { + this.serviceInstance = serviceInstance; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java index 9709ccece0..9e95e79b70 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java @@ -21,15 +21,5 @@ package org.onap.so.bpmn.servicedecomposition.entities; public enum ResourceKey { - SERVICE_INSTANCE_ID, - GENERIC_VNF_ID, - NETWORK_ID, - VOLUME_GROUP_ID, - VF_MODULE_ID, - ALLOTTED_RESOURCE_ID, - CONFIGURATION_ID, - NETWORK_COLLECTION_ID, - VPN_ID, - VPN_BONDING_LINK_ID, - INSTANCE_GROUP_ID; + SERVICE_INSTANCE_ID, GENERIC_VNF_ID, NETWORK_ID, VOLUME_GROUP_ID, VF_MODULE_ID, ALLOTTED_RESOURCE_ID, CONFIGURATION_ID, NETWORK_COLLECTION_ID, VPN_ID, VPN_BONDING_LINK_ID, INSTANCE_GROUP_ID; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java index 15dfe85c1a..dc07d13acb 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java @@ -25,88 +25,88 @@ import org.apache.commons.lang3.builder.ToStringBuilder; public class WorkflowResourceIds implements Serializable { - /** - * - */ - private static final long serialVersionUID = 8591599114353940105L; - private String serviceInstanceId; - private String vnfId; - private String networkId; - private String volumeGroupId; - private String vfModuleId; - private String networkCollectionId; - private String configurationId; - private String instanceGroupId; - - @Override - public String toString() { - return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId).append("vnfId", vnfId) - .append("networkId", networkId).append("volumeGroupId", volumeGroupId).append("vfModuleId", vfModuleId) - .append("networkCollectionId", networkCollectionId).append("configurationId", configurationId) - .toString(); - } - - public String getServiceInstanceId() { - return serviceInstanceId; - } - - public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - - public String getVnfId() { - return vnfId; - } - - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } - - public String getNetworkId() { - return networkId; - } - - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - public String getVolumeGroupId() { - return volumeGroupId; - } - - public void setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - - public String getVfModuleId() { - return vfModuleId; - } - - public void setVfModuleId(String vfModuleId) { - this.vfModuleId = vfModuleId; - } - - public String getNetworkCollectionId() { - return networkCollectionId; - } - - public void setNetworkCollectionId(String networkCollectionId) { - this.networkCollectionId = networkCollectionId; - } - - public String getConfigurationId() { - return configurationId; - } - - public void setConfigurationId(String configurationId) { - this.configurationId = configurationId; - } - - public String getInstanceGroupId() { - return instanceGroupId; - } - - public void setInstanceGroupId(String instanceGroupId) { - this.instanceGroupId = instanceGroupId; - } + /** + * + */ + private static final long serialVersionUID = 8591599114353940105L; + private String serviceInstanceId; + private String vnfId; + private String networkId; + private String volumeGroupId; + private String vfModuleId; + private String networkCollectionId; + private String configurationId; + private String instanceGroupId; + + @Override + public String toString() { + return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId).append("vnfId", vnfId) + .append("networkId", networkId).append("volumeGroupId", volumeGroupId).append("vfModuleId", vfModuleId) + .append("networkCollectionId", networkCollectionId).append("configurationId", configurationId) + .toString(); + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public String getNetworkCollectionId() { + return networkCollectionId; + } + + public void setNetworkCollectionId(String networkCollectionId) { + this.networkCollectionId = networkCollectionId; + } + + public String getConfigurationId() { + return configurationId; + } + + public void setConfigurationId(String configurationId) { + this.configurationId = configurationId; + } + + public String getInstanceGroupId() { + return instanceGroupId; + } + + public void setInstanceGroupId(String instanceGroupId) { + this.instanceGroupId = instanceGroupId; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputException.java index 21828871db..50e43d247c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputException.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputException.java @@ -21,8 +21,8 @@ package org.onap.so.bpmn.servicedecomposition.entities.exceptions; public class InvalidBuildingBlockInputException extends Exception { - private static final long serialVersionUID = 221404474263656742L; - + private static final long serialVersionUID = 221404474263656742L; + public InvalidBuildingBlockInputException() { super(); } @@ -39,9 +39,8 @@ public class InvalidBuildingBlockInputException extends Exception { super(cause); } - protected InvalidBuildingBlockInputException(String message, Throwable cause, - boolean enableSuppression, - boolean writableStackTrace) { + protected InvalidBuildingBlockInputException(String message, Throwable cause, boolean enableSuppression, + boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java index e1a12bbad9..c9f7e5e948 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.servicedecomposition.generalobjects; import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -32,25 +31,28 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; @JsonRootName("license") public class License implements Serializable { - private static final long serialVersionUID = 2345786874755685318L; - - @JsonProperty("entitlement-pool-uuids") - private List<String> entitlementPoolUuids = new ArrayList<String>(); - @JsonProperty("license-key-group-uuids") - private List<String> licenseKeyGroupUuids = new ArrayList<String>(); - - - public List<String> getEntitlementPoolUuids() { - return entitlementPoolUuids; - } - public void setEntitlementPoolUuids(List<String> entitlementPoolUuids) { - this.entitlementPoolUuids = entitlementPoolUuids; - } - public List<String> getLicenseKeyGroupUuids() { - return licenseKeyGroupUuids; - } - public void setLicenseKeyGroupUuids(List<String> licenseKeyGroupUuids) { - this.licenseKeyGroupUuids = licenseKeyGroupUuids; - } + private static final long serialVersionUID = 2345786874755685318L; + + @JsonProperty("entitlement-pool-uuids") + private List<String> entitlementPoolUuids = new ArrayList<String>(); + @JsonProperty("license-key-group-uuids") + private List<String> licenseKeyGroupUuids = new ArrayList<String>(); + + + public List<String> getEntitlementPoolUuids() { + return entitlementPoolUuids; + } + + public void setEntitlementPoolUuids(List<String> entitlementPoolUuids) { + this.entitlementPoolUuids = entitlementPoolUuids; + } + + public List<String> getLicenseKeyGroupUuids() { + return licenseKeyGroupUuids; + } + + public void setLicenseKeyGroupUuids(List<String> licenseKeyGroupUuids) { + this.licenseKeyGroupUuids = licenseKeyGroupUuids; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java index 8f1262f70e..a98cdc712d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.servicedecomposition.generalobjects; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @@ -29,16 +28,16 @@ import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @JsonRootName("orchestration-context") public class OrchestrationContext implements Serializable { - private static final long serialVersionUID = 6843015923244810369L; - - @JsonProperty("is-rollback-enabled") - private Boolean isRollbackEnabled; + private static final long serialVersionUID = 6843015923244810369L; + + @JsonProperty("is-rollback-enabled") + private Boolean isRollbackEnabled; - public Boolean getIsRollbackEnabled() { - return this.isRollbackEnabled; - } + public Boolean getIsRollbackEnabled() { + return this.isRollbackEnabled; + } - public void setIsRollbackEnabled(Boolean isRollbackEnabled) { - this.isRollbackEnabled = isRollbackEnabled; - } + public void setIsRollbackEnabled(Boolean isRollbackEnabled) { + this.isRollbackEnabled = isRollbackEnabled; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java index cd66e512a5..632e61b85c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java @@ -25,102 +25,122 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("request-context") -public class RequestContext implements Serializable{ - - private static final long serialVersionUID = -6482733428879732822L; - - @JsonProperty("product-family-id") - private String productFamilyId; - @JsonProperty("source") - private String source; - @JsonProperty("requestor-id") - private String requestorId; - @JsonProperty("subscription-service-type") - private String subscriptionServiceType; - @JsonProperty("user-params") - private Map<String, Object> userParams = new HashMap<>(); - @JsonProperty("action") - private String action; - @JsonProperty("callback-url") - private String callbackURL; - @JsonProperty("service-uri") - private String serviceURI; - @JsonProperty("mso-request-id") - private String msoRequestId; - @JsonProperty("requestParameters") - private RequestParameters requestParameters; - @JsonProperty("configurationParameters") - private List<Map<String, String>> configurationParameters = new ArrayList<>(); - - public String getServiceURI() { - return serviceURI; - } - public void setServiceURI(String serviceURI) { - this.serviceURI = serviceURI; - } - public String getProductFamilyId() { - return productFamilyId; - } - public void setProductFamilyId(String productFamilyId) { - this.productFamilyId = productFamilyId; - } - public String getSource() { - return source; - } - public void setSource(String source) { - this.source = source; - } - public String getRequestorId() { - return requestorId; - } - public void setRequestorId(String requestorId) { - this.requestorId = requestorId; - } - public String getSubscriptionServiceType() { - return subscriptionServiceType; - } - public void setSubscriptionServiceType(String subscriptionServiceType) { - this.subscriptionServiceType = subscriptionServiceType; - } - public Map<String, Object> getUserParams() { - return userParams; - } - public void setUserParams(Map<String, Object> userParams) { - this.userParams = userParams; - } - public String getAction() { - return action; - } - public void setAction(String action) { - this.action = action; - } - public String getCallbackURL() { - return callbackURL; - } - public void setCallbackURL(String callbackURL) { - this.callbackURL = callbackURL; - } - public String getMsoRequestId() { - return msoRequestId; - } - public void setMsoRequestId(String msoRequestId) { - this.msoRequestId = msoRequestId; - } - public RequestParameters getRequestParameters() { - return requestParameters; - } - public void setRequestParameters(RequestParameters requestParameters) { - this.requestParameters = requestParameters; - } - public List<Map<String, String>> getConfigurationParameters() { - return configurationParameters; - } - public void setConfigurationParameters(List<Map<String, String>> configurationParameters) { - this.configurationParameters = configurationParameters; - } +public class RequestContext implements Serializable { + + private static final long serialVersionUID = -6482733428879732822L; + + @JsonProperty("product-family-id") + private String productFamilyId; + @JsonProperty("source") + private String source; + @JsonProperty("requestor-id") + private String requestorId; + @JsonProperty("subscription-service-type") + private String subscriptionServiceType; + @JsonProperty("user-params") + private Map<String, Object> userParams = new HashMap<>(); + @JsonProperty("action") + private String action; + @JsonProperty("callback-url") + private String callbackURL; + @JsonProperty("service-uri") + private String serviceURI; + @JsonProperty("mso-request-id") + private String msoRequestId; + @JsonProperty("requestParameters") + private RequestParameters requestParameters; + @JsonProperty("configurationParameters") + private List<Map<String, String>> configurationParameters = new ArrayList<>(); + + public String getServiceURI() { + return serviceURI; + } + + public void setServiceURI(String serviceURI) { + this.serviceURI = serviceURI; + } + + public String getProductFamilyId() { + return productFamilyId; + } + + public void setProductFamilyId(String productFamilyId) { + this.productFamilyId = productFamilyId; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getRequestorId() { + return requestorId; + } + + public void setRequestorId(String requestorId) { + this.requestorId = requestorId; + } + + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + + public Map<String, Object> getUserParams() { + return userParams; + } + + public void setUserParams(Map<String, Object> userParams) { + this.userParams = userParams; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getCallbackURL() { + return callbackURL; + } + + public void setCallbackURL(String callbackURL) { + this.callbackURL = callbackURL; + } + + public String getMsoRequestId() { + return msoRequestId; + } + + public void setMsoRequestId(String msoRequestId) { + this.msoRequestId = msoRequestId; + } + + public RequestParameters getRequestParameters() { + return requestParameters; + } + + public void setRequestParameters(RequestParameters requestParameters) { + this.requestParameters = requestParameters; + } + + public List<Map<String, String>> getConfigurationParameters() { + return configurationParameters; + } + + public void setConfigurationParameters(List<Map<String, String>> configurationParameters) { + this.configurationParameters = configurationParameters; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java index 3761d26d0b..ca3f73a176 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java @@ -26,7 +26,6 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.ObjectMapper; @@ -40,99 +39,101 @@ import org.slf4j.LoggerFactory; @JsonInclude(Include.NON_DEFAULT) public class RequestParameters implements Serializable { - private static final Logger logger = LoggerFactory.getLogger(RequestParameters.class); - - private static final long serialVersionUID = -5979049912538894930L; - @JsonProperty("subscriptionServiceType") - private String subscriptionServiceType; - @JsonProperty("userParams") - private List<Map<String, Object>> userParams = new ArrayList<>(); - @JsonProperty("aLaCarte") - private Boolean aLaCarte; - @JsonProperty("payload") - private String payload; - @JsonProperty("usePreload") - private Boolean usePreload; - - public String getSubscriptionServiceType() { - return subscriptionServiceType; - } - - public void setSubscriptionServiceType(String subscriptionServiceType) { - this.subscriptionServiceType = subscriptionServiceType; - } - @JsonProperty("aLaCarte") - public Boolean getALaCarte() { - return aLaCarte; - } - @JsonProperty("aLaCarte") - public void setaLaCarte(Boolean aLaCarte) { - this.aLaCarte = aLaCarte; - } - - public Boolean isaLaCarte() { - return aLaCarte; - } - - public String getPayload(){ - return payload; - } - public void setPayload(String value){ - this.payload = value; - } - - public List<Map<String, Object>> getUserParams() { - return userParams; - } - - public void setUserParams(List<Map<String, Object>> userParams) { - this.userParams = userParams; - } - - public Object getUserParamValue(String name) { - if (userParams != null) { - for (Map<String, Object> param : userParams) { - if (param.get(name) != null) { - return param.get(name); - } - } - } - return null; - } - - public Boolean isUsePreload() { - return usePreload; - } - - @JsonProperty("usePreload") - public Boolean getUsePreload() { - return usePreload; - } - - @JsonProperty("usePreload") - public void setUsePreload(Boolean usePreload) { - this.usePreload = usePreload; - } - - - @JsonInclude(Include.NON_NULL) - public String toJsonString(){ - String json = ""; - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - ObjectWriter ow = mapper.writer(); - try{ - json = ow.writeValueAsString(this); - }catch (Exception e){ - logger.error("Unable to convert Sniro Manager Request to string", e); - } - return json; - } - - @Override - public String toString() { - return "RequestParameters [subscriptionServiceType=" - + subscriptionServiceType + ", userParams=" + userParams - + ", aLaCarte=" + aLaCarte + "]"; - } + private static final Logger logger = LoggerFactory.getLogger(RequestParameters.class); + + private static final long serialVersionUID = -5979049912538894930L; + @JsonProperty("subscriptionServiceType") + private String subscriptionServiceType; + @JsonProperty("userParams") + private List<Map<String, Object>> userParams = new ArrayList<>(); + @JsonProperty("aLaCarte") + private Boolean aLaCarte; + @JsonProperty("payload") + private String payload; + @JsonProperty("usePreload") + private Boolean usePreload; + + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + + @JsonProperty("aLaCarte") + public Boolean getALaCarte() { + return aLaCarte; + } + + @JsonProperty("aLaCarte") + public void setaLaCarte(Boolean aLaCarte) { + this.aLaCarte = aLaCarte; + } + + public Boolean isaLaCarte() { + return aLaCarte; + } + + public String getPayload() { + return payload; + } + + public void setPayload(String value) { + this.payload = value; + } + + public List<Map<String, Object>> getUserParams() { + return userParams; + } + + public void setUserParams(List<Map<String, Object>> userParams) { + this.userParams = userParams; + } + + public Object getUserParamValue(String name) { + if (userParams != null) { + for (Map<String, Object> param : userParams) { + if (param.get(name) != null) { + return param.get(name); + } + } + } + return null; + } + + public Boolean isUsePreload() { + return usePreload; + } + + @JsonProperty("usePreload") + public Boolean getUsePreload() { + return usePreload; + } + + @JsonProperty("usePreload") + public void setUsePreload(Boolean usePreload) { + this.usePreload = usePreload; + } + + + @JsonInclude(Include.NON_NULL) + public String toJsonString() { + String json = ""; + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + ObjectWriter ow = mapper.writer(); + try { + json = ow.writeValueAsString(this); + } catch (Exception e) { + logger.error("Unable to convert Sniro Manager Request to string", e); + } + return json; + } + + @Override + public String toString() { + return "RequestParameters [subscriptionServiceType=" + subscriptionServiceType + ", userParams=" + userParams + + ", aLaCarte=" + aLaCarte + "]"; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java index a727162415..ed94c5380e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java @@ -22,67 +22,62 @@ package org.onap.so.bpmn.servicedecomposition.homingobjects; import java.io.Serializable; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Candidate implements Serializable { - private static final long serialVersionUID = -3959572501582849328L; - - @JsonProperty("identifierType") - private CandidateType identifierType; - @JsonProperty("identifiers") - private List<String> identifiers; - @JsonProperty("cloudOwner") - private String cloudOwner; - - /** - * list of candidates - * i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc. - */ - public List<String> getIdentifiers() { - return identifiers; - } - - /** - * list of candidates - * i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc. - */ - public void setIdentifiers(List<String> identifiers) { - this.identifiers = identifiers; - } - - /** - * Way to identify the type of candidate - * i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc. - */ - public CandidateType getIdentifierType(){ - return identifierType; - } - - /** - * Way to identify the type of candidate - * i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc. - */ - public void setIdentifierType(CandidateType identifierType){ - this.identifierType = identifierType; - } - - /** - * The name of the cloud owner. Required if candidateType is cloudRegionId - */ - public String getCloudOwner(){ - return cloudOwner; - } - - /** - * The name of the cloud owner. Required if candidateType is cloudRegionId - */ - public void setCloudOwner(String cloudOwner){ - this.cloudOwner = cloudOwner; - } + private static final long serialVersionUID = -3959572501582849328L; + + @JsonProperty("identifierType") + private CandidateType identifierType; + @JsonProperty("identifiers") + private List<String> identifiers; + @JsonProperty("cloudOwner") + private String cloudOwner; + + /** + * list of candidates i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc. + */ + public List<String> getIdentifiers() { + return identifiers; + } + + /** + * list of candidates i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc. + */ + public void setIdentifiers(List<String> identifiers) { + this.identifiers = identifiers; + } + + /** + * Way to identify the type of candidate i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc. + */ + public CandidateType getIdentifierType() { + return identifierType; + } + + /** + * Way to identify the type of candidate i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc. + */ + public void setIdentifierType(CandidateType identifierType) { + this.identifierType = identifierType; + } + + /** + * The name of the cloud owner. Required if candidateType is cloudRegionId + */ + public String getCloudOwner() { + return cloudOwner; + } + + /** + * The name of the cloud owner. Required if candidateType is cloudRegionId + */ + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java index 6a4fa50020..ee97c054dd 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java @@ -22,23 +22,20 @@ package org.onap.so.bpmn.servicedecomposition.homingobjects; import com.fasterxml.jackson.annotation.JsonValue; -public enum CandidateType{ +public enum CandidateType { - SERVICE_INSTANCE_ID("serviceInstanceId"), - CLOUD_REGION_ID("cloudRegionId"), - VNF_ID("vnfId"), - VNF_NAME("vnfName"); + SERVICE_INSTANCE_ID("serviceInstanceId"), CLOUD_REGION_ID("cloudRegionId"), VNF_ID("vnfId"), VNF_NAME("vnfName"); - private final String name; + private final String name; - private CandidateType(String name) { - this.name = name; - } + private CandidateType(String name) { + this.name = name; + } - @Override - @JsonValue - public String toString() { - return name; - } + @Override + @JsonValue + public String toString() { + return name; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java index 0cbd88b665..db5c11a954 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java @@ -23,43 +23,41 @@ package org.onap.so.bpmn.servicedecomposition.homingobjects; import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import org.onap.so.bpmn.servicedecomposition.homingobjects.Candidate; - import com.fasterxml.jackson.annotation.JsonProperty; -public class SolutionCandidates implements Serializable{ +public class SolutionCandidates implements Serializable { - private static final long serialVersionUID = 2188754118148819627L; + private static final long serialVersionUID = 2188754118148819627L; - @JsonProperty("requiredCandidates") - private List<Candidate> requiredCandidates = new ArrayList<Candidate>(); - @JsonProperty("excludedCandidates") - private List<Candidate> excludedCandidates = new ArrayList<Candidate>(); - //TODO figure out best way to do this - @JsonProperty("existingCandidates") - private List<Candidate> existingCandidates = new ArrayList<Candidate>(); + @JsonProperty("requiredCandidates") + private List<Candidate> requiredCandidates = new ArrayList<Candidate>(); + @JsonProperty("excludedCandidates") + private List<Candidate> excludedCandidates = new ArrayList<Candidate>(); + // TODO figure out best way to do this + @JsonProperty("existingCandidates") + private List<Candidate> existingCandidates = new ArrayList<Candidate>(); - public List<Candidate> getRequiredCandidates() { - return requiredCandidates; - } - public void addRequiredCandidates(Candidate requiredCandidate) { - this.requiredCandidates.add(requiredCandidate); - } - public List<Candidate> getExcludedCandidates() { - return excludedCandidates; - } - public void addExcludedCandidates(Candidate excludedCandidate) { - this.excludedCandidates.add(excludedCandidate); - } + public List<Candidate> getRequiredCandidates() { + return requiredCandidates; + } - public List<Candidate> getExistingCandidates(){ - return existingCandidates; - } + public void addRequiredCandidates(Candidate requiredCandidate) { + this.requiredCandidates.add(requiredCandidate); + } + public List<Candidate> getExcludedCandidates() { + return excludedCandidates; + } + public void addExcludedCandidates(Candidate excludedCandidate) { + this.excludedCandidates.add(excludedCandidate); + } + public List<Candidate> getExistingCandidates() { + return existingCandidates; + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java index 3c8f0e933f..643113573e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.servicedecomposition.homingobjects; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @@ -30,69 +29,63 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @JsonRootName("solution") public class SolutionInfo implements Serializable { - private static final long serialVersionUID = 6903399488466840832L; - - @JsonProperty("solution-id") //identifies which solution - private Integer solutionId; - @JsonProperty("homed") - private Boolean homed; - @JsonProperty("is-rehome") - private Boolean isRehome; - @JsonProperty("targeted-cloud") - private CloudRegion targetedCloudRegion; - - - public Boolean isHomed() { - return homed; - } - - public void setHomed(Boolean homed) { - this.homed = homed; - } - - public Boolean isRehome() { - return isRehome; - } - - public void setRehome(Boolean isRehome) { - this.isRehome = isRehome; - } - - /** - * Identifies which solution when multiple solutions exist for a - * given resource or resource pair. - * i.e. 1, 2, 3.... - */ - public Integer getSolutionId() { - return solutionId; - } - - /** - * Identifies which solution when multiple solutions exist for a - * given resource or resource pair. - * i.e. 1, 2, 3.... - */ - public void setSolutionId(Integer solutionId) { - this.solutionId = solutionId; - } - - /** - * Identifies where the resource should be created for - * homed equals false scenarios. Will return null if resource - * was homed. - */ - public CloudRegion getTargetedCloudRegion() { - return targetedCloudRegion; - } - - /** - * Identifies where the resource should be created for - * homed equals false scenarios. Will return null if resource - * was homed. - */ - public void setTargetedCloudRegion(CloudRegion targetedCloudRegion) { - this.targetedCloudRegion = targetedCloudRegion; - } + private static final long serialVersionUID = 6903399488466840832L; + + @JsonProperty("solution-id") // identifies which solution + private Integer solutionId; + @JsonProperty("homed") + private Boolean homed; + @JsonProperty("is-rehome") + private Boolean isRehome; + @JsonProperty("targeted-cloud") + private CloudRegion targetedCloudRegion; + + + public Boolean isHomed() { + return homed; + } + + public void setHomed(Boolean homed) { + this.homed = homed; + } + + public Boolean isRehome() { + return isRehome; + } + + public void setRehome(Boolean isRehome) { + this.isRehome = isRehome; + } + + /** + * Identifies which solution when multiple solutions exist for a given resource or resource pair. i.e. 1, 2, 3.... + */ + public Integer getSolutionId() { + return solutionId; + } + + /** + * Identifies which solution when multiple solutions exist for a given resource or resource pair. i.e. 1, 2, 3.... + */ + public void setSolutionId(Integer solutionId) { + this.solutionId = solutionId; + } + + /** + * Identifies where the resource should be created for homed equals false scenarios. Will return null if resource + * was homed. + */ + public CloudRegion getTargetedCloudRegion() { + return targetedCloudRegion; + } + + /** + * Identifies where the resource should be created for homed equals false scenarios. Will return null if resource + * was homed. + */ + public void setTargetedCloudRegion(CloudRegion targetedCloudRegion) { + this.targetedCloudRegion = targetedCloudRegion; + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoAllottedResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoAllottedResource.java index b4f2e85e55..a0a8408cfc 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoAllottedResource.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoAllottedResource.java @@ -21,126 +21,152 @@ package org.onap.so.bpmn.servicedecomposition.modelinfo; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; -public class ModelInfoAllottedResource extends ModelInfoMetadata implements Serializable{ - - private static final long serialVersionUID = -5240932898637922018L; - - @JsonProperty("max-instances") - private String MaxInstances; - @JsonProperty("min-instances") - private String MinInstances; - @JsonProperty("nf-naming-code") - private String NfNamingCode; - @JsonProperty("nf-role") - private String NfRole; - @JsonProperty("nf-type") - private String NfType; - @JsonProperty("nf-function") - private String NfFunction; - @JsonProperty("target-network-role") - private String TarNetworkRole; - @JsonProperty("providing-service-model-invariant-uuid") - private String ProvidingServiceModelInvariantUUID; - @JsonProperty("providing-service-model-name") - private String ProvidingServiceModelName; - @JsonProperty("providing-service-model-uuid") - private String ProvidingServiceModelUUID; - @JsonProperty("description") - private String Description; - @JsonProperty("created") - private String Created; - @JsonProperty("tosca-node-type") - private String ToscaNodeType; - @JsonProperty("subcategory") - private String Subcategory; -// private ModelInfoMetadata modelInfoMetadata; - - - public String getMaxInstances() { - return MaxInstances; - } - public void setMaxInstances(String maxInstances) { - MaxInstances = maxInstances; - } - public String getMinInstances() { - return MinInstances; - } - public void setMinInstances(String minInstances) { - MinInstances = minInstances; - } - public String getNfNamingCode() { - return NfNamingCode; - } - public void setNfNamingCode(String nfNamingCode) { - NfNamingCode = nfNamingCode; - } - public String getNfRole() { - return NfRole; - } - public void setNfRole(String nfRole) { - NfRole = nfRole; - } - public String getNfType() { - return NfType; - } - public void setNfType(String nfType) { - NfType = nfType; - } - public String getNfFunction() { - return NfFunction; - } - public void setNfFunction(String nfFunction) { - NfFunction = nfFunction; - } - public String getTarNetworkRole() { - return TarNetworkRole; - } - public void setTarNetworkRole(String tarNetworkRole) { - TarNetworkRole = tarNetworkRole; - } - public String getProvidingServiceModelInvariantUUID() { - return ProvidingServiceModelInvariantUUID; - } - public void setProvidingServiceModelInvariantUUID(String providingServiceModelInvariantUUID) { - ProvidingServiceModelInvariantUUID = providingServiceModelInvariantUUID; - } - public String getProvidingServiceModelName() { - return ProvidingServiceModelName; - } - public void setProvidingServiceModelName(String providingServiceModelName) { - ProvidingServiceModelName = providingServiceModelName; - } - public String getProvidingServiceModelUUID() { - return ProvidingServiceModelUUID; - } - public void setProvidingServiceModelUUID(String providingServiceModelUUID) { - ProvidingServiceModelUUID = providingServiceModelUUID; - } - public String getDescription() { - return Description; - } - public void setDescription(String description) { - Description = description; - } - public String getCreated() { - return Created; - } - public void setCreated(String created) { - Created = created; - } - public String getToscaNodeType() { - return ToscaNodeType; - } - public void setToscaNodeType(String toscaNodeType) { - ToscaNodeType = toscaNodeType; - } - public String getSubcategory() { - return Subcategory; - } - public void setSubcategory(String subcategory) { - Subcategory = subcategory; - } +public class ModelInfoAllottedResource extends ModelInfoMetadata implements Serializable { + + private static final long serialVersionUID = -5240932898637922018L; + + @JsonProperty("max-instances") + private String MaxInstances; + @JsonProperty("min-instances") + private String MinInstances; + @JsonProperty("nf-naming-code") + private String NfNamingCode; + @JsonProperty("nf-role") + private String NfRole; + @JsonProperty("nf-type") + private String NfType; + @JsonProperty("nf-function") + private String NfFunction; + @JsonProperty("target-network-role") + private String TarNetworkRole; + @JsonProperty("providing-service-model-invariant-uuid") + private String ProvidingServiceModelInvariantUUID; + @JsonProperty("providing-service-model-name") + private String ProvidingServiceModelName; + @JsonProperty("providing-service-model-uuid") + private String ProvidingServiceModelUUID; + @JsonProperty("description") + private String Description; + @JsonProperty("created") + private String Created; + @JsonProperty("tosca-node-type") + private String ToscaNodeType; + @JsonProperty("subcategory") + private String Subcategory; + // private ModelInfoMetadata modelInfoMetadata; + + + public String getMaxInstances() { + return MaxInstances; + } + + public void setMaxInstances(String maxInstances) { + MaxInstances = maxInstances; + } + + public String getMinInstances() { + return MinInstances; + } + + public void setMinInstances(String minInstances) { + MinInstances = minInstances; + } + + public String getNfNamingCode() { + return NfNamingCode; + } + + public void setNfNamingCode(String nfNamingCode) { + NfNamingCode = nfNamingCode; + } + + public String getNfRole() { + return NfRole; + } + + public void setNfRole(String nfRole) { + NfRole = nfRole; + } + + public String getNfType() { + return NfType; + } + + public void setNfType(String nfType) { + NfType = nfType; + } + + public String getNfFunction() { + return NfFunction; + } + + public void setNfFunction(String nfFunction) { + NfFunction = nfFunction; + } + + public String getTarNetworkRole() { + return TarNetworkRole; + } + + public void setTarNetworkRole(String tarNetworkRole) { + TarNetworkRole = tarNetworkRole; + } + + public String getProvidingServiceModelInvariantUUID() { + return ProvidingServiceModelInvariantUUID; + } + + public void setProvidingServiceModelInvariantUUID(String providingServiceModelInvariantUUID) { + ProvidingServiceModelInvariantUUID = providingServiceModelInvariantUUID; + } + + public String getProvidingServiceModelName() { + return ProvidingServiceModelName; + } + + public void setProvidingServiceModelName(String providingServiceModelName) { + ProvidingServiceModelName = providingServiceModelName; + } + + public String getProvidingServiceModelUUID() { + return ProvidingServiceModelUUID; + } + + public void setProvidingServiceModelUUID(String providingServiceModelUUID) { + ProvidingServiceModelUUID = providingServiceModelUUID; + } + + public String getDescription() { + return Description; + } + + public void setDescription(String description) { + Description = description; + } + + public String getCreated() { + return Created; + } + + public void setCreated(String created) { + Created = created; + } + + public String getToscaNodeType() { + return ToscaNodeType; + } + + public void setToscaNodeType(String toscaNodeType) { + ToscaNodeType = toscaNodeType; + } + + public String getSubcategory() { + return Subcategory; + } + + public void setSubcategory(String subcategory) { + Subcategory = subcategory; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java index cb6fabde30..d31d84807d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java @@ -21,79 +21,93 @@ package org.onap.so.bpmn.servicedecomposition.modelinfo; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; -public class ModelInfoCollection implements Serializable { - - private static final long serialVersionUID = 8380534468706675508L; - - @JsonProperty("model-customization-uuid") - private String modelCustomizationUUID; - @JsonProperty("model-version-id") - private String modelVersionId; - @JsonProperty("model-invariant-uuid") - private String modelInvariantUUID; - @JsonProperty("collection-function") - private String collectionFunction; - @JsonProperty("collection-role") - private String collectionRole; - @JsonProperty("collection-type") - private String collectionType; - @JsonProperty("description") - private String description; - @JsonProperty("quantity") - private Integer quantity; - - public String getModelCustomizationUUID() { - return modelCustomizationUUID; - } - public void setModelCustomizationUUID(String modelCustomizationUUID) { - this.modelCustomizationUUID = modelCustomizationUUID; - } - public String getModelVersionId() { - return modelVersionId; - } - public void setModelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - } - public String getModelInvariantUUID() { - return this.modelInvariantUUID; - } - public void setModelInvariantUUID(String modelInvariantUUID) { - this.modelInvariantUUID = modelInvariantUUID; - } - public String getCollectionFunction() { - return collectionFunction; - } - public void setCollectionFunction(String collectionFunction) { - this.collectionFunction = collectionFunction; - } - public String getCollectionRole() { - return collectionRole; - } - public void setCollectionRole(String collectionRole) { - this.collectionRole = collectionRole; - } - public String getCollectionType() { - return collectionType; - } - public void setCollectionType(String collectionType) { - this.collectionType = collectionType; - } - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - public Integer getQuantity() { - return quantity; - } - public void setQuantity(Integer quantity) { - this.quantity = quantity; - } - - - +public class ModelInfoCollection implements Serializable { + + private static final long serialVersionUID = 8380534468706675508L; + + @JsonProperty("model-customization-uuid") + private String modelCustomizationUUID; + @JsonProperty("model-version-id") + private String modelVersionId; + @JsonProperty("model-invariant-uuid") + private String modelInvariantUUID; + @JsonProperty("collection-function") + private String collectionFunction; + @JsonProperty("collection-role") + private String collectionRole; + @JsonProperty("collection-type") + private String collectionType; + @JsonProperty("description") + private String description; + @JsonProperty("quantity") + private Integer quantity; + + public String getModelCustomizationUUID() { + return modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + public String getModelVersionId() { + return modelVersionId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + public String getModelInvariantUUID() { + return this.modelInvariantUUID; + } + + public void setModelInvariantUUID(String modelInvariantUUID) { + this.modelInvariantUUID = modelInvariantUUID; + } + + public String getCollectionFunction() { + return collectionFunction; + } + + public void setCollectionFunction(String collectionFunction) { + this.collectionFunction = collectionFunction; + } + + public String getCollectionRole() { + return collectionRole; + } + + public void setCollectionRole(String collectionRole) { + this.collectionRole = collectionRole; + } + + public String getCollectionType() { + return collectionType; + } + + public void setCollectionType(String collectionType) { + this.collectionType = collectionType; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java index 462664c612..21b8c74967 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java @@ -21,60 +21,70 @@ package org.onap.so.bpmn.servicedecomposition.modelinfo; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; -public class ModelInfoConfiguration implements Serializable{ - - private static final long serialVersionUID = -387242776138157250L; - - @JsonProperty("model-invariant-id") - private String modelInvariantId; - @JsonProperty("model-version-id") - private String modelVersionId; - @JsonProperty("model-customization-id") - private String modelCustomizationId; - @JsonProperty("configuration-type") - private String configurationType; - @JsonProperty("configuration-role") - private String configurationRole; - @JsonProperty("policy-name") - private String policyName; - - public String getConfigurationRole() { - return configurationRole; - } - public void setConfigurationRole(String configurationRole) { - this.configurationRole = configurationRole; - } - public String getConfigurationType() { - return configurationType; - } - public void setConfigurationType(String configurationType) { - this.configurationType = configurationType; - } - public String getModelInvariantId() { - return modelInvariantId; - } - public void setModelInvariantId(String modelInvariantId) { - this.modelInvariantId = modelInvariantId; - } - public String getModelVersionId() { - return modelVersionId; - } - public void setModelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - } - public String getModelCustomizationId() { - return modelCustomizationId; - } - public void setModelCustomizationId(String modelCustomizationId) { - this.modelCustomizationId = modelCustomizationId; - } - public String getPolicyName() { - return policyName; - } - public void setPolicyName(String policyName) { - this.policyName = policyName; - } +public class ModelInfoConfiguration implements Serializable { + + private static final long serialVersionUID = -387242776138157250L; + + @JsonProperty("model-invariant-id") + private String modelInvariantId; + @JsonProperty("model-version-id") + private String modelVersionId; + @JsonProperty("model-customization-id") + private String modelCustomizationId; + @JsonProperty("configuration-type") + private String configurationType; + @JsonProperty("configuration-role") + private String configurationRole; + @JsonProperty("policy-name") + private String policyName; + + public String getConfigurationRole() { + return configurationRole; + } + + public void setConfigurationRole(String configurationRole) { + this.configurationRole = configurationRole; + } + + public String getConfigurationType() { + return configurationType; + } + + public void setConfigurationType(String configurationType) { + this.configurationType = configurationType; + } + + public String getModelInvariantId() { + return modelInvariantId; + } + + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + public String getModelVersionId() { + return modelVersionId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + public String getModelCustomizationId() { + return modelCustomizationId; + } + + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + + public String getPolicyName() { + return policyName; + } + + public void setPolicyName(String policyName) { + this.policyName = policyName; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java index 6b53272a75..14327a3583 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java @@ -21,125 +21,151 @@ package org.onap.so.bpmn.servicedecomposition.modelinfo; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; -public class ModelInfoGenericVnf extends ModelInfoMetadata implements Serializable{ - - private static final long serialVersionUID = -5963022750248280669L; - - @JsonProperty("tosca-node-type") - private String ToscaNodeType; - @JsonProperty("description") - private String Description; - @JsonProperty("orchestration-mode") - private String OrchestrationMode; - @JsonProperty("aic-version-min") - private String AicVersionMin; - @JsonProperty("aic-version-max") - private String AicVersionMax; - @JsonProperty("min-instances") - private String MinInstances; - @JsonProperty("max-instances") - private String MaxInstances; - @JsonProperty("availability-zone-max-count") - private String AvailabilityZoneMaxCount; - @JsonProperty("nf-function") - private String NfFunction; - @JsonProperty("nf-type") - private String NfType; - @JsonProperty("nf-role") - private String NfRole; - @JsonProperty("nf-naming-code") - private String NfNamingCode; - @JsonProperty("multi-stage-design") - private String MultiStageDesign; - @JsonProperty("created") - private String Created; - - - public String getToscaNodeType() { - return ToscaNodeType; - } - public void setToscaNodeType(String toscaNodeType) { - ToscaNodeType = toscaNodeType; - } - public String getDescription() { - return Description; - } - public void setDescription(String description) { - Description = description; - } - public String getOrchestrationMode() { - return OrchestrationMode; - } - public void setOrchestrationMode(String orchestrationMode) { - OrchestrationMode = orchestrationMode; - } - public String getAicVersionMin() { - return AicVersionMin; - } - public void setAicVersionMin(String aicVersionMin) { - AicVersionMin = aicVersionMin; - } - public String getAicVersionMax() { - return AicVersionMax; - } - public void setAicVersionMax(String aicVersionMax) { - AicVersionMax = aicVersionMax; - } - public String getMinInstances() { - return MinInstances; - } - public void setMinInstances(String minInstances) { - MinInstances = minInstances; - } - public String getMaxInstances() { - return MaxInstances; - } - public void setMaxInstances(String maxInstances) { - MaxInstances = maxInstances; - } - public String getAvailabilityZoneMaxCount() { - return AvailabilityZoneMaxCount; - } - public void setAvailabilityZoneMaxCount(String availabilityZoneMaxCount) { - AvailabilityZoneMaxCount = availabilityZoneMaxCount; - } - public String getNfFunction() { - return NfFunction; - } - public void setNfFunction(String nfFunction) { - NfFunction = nfFunction; - } - public String getNfType() { - return NfType; - } - public void setNfType(String nfType) { - NfType = nfType; - } - public String getNfRole() { - return NfRole; - } - public void setNfRole(String nfRole) { - NfRole = nfRole; - } - public String getNfNamingCode() { - return NfNamingCode; - } - public void setNfNamingCode(String nfNamingCode) { - NfNamingCode = nfNamingCode; - } - public String getMultiStageDesign() { - return MultiStageDesign; - } - public void setMultiStageDesign(String multiStageDesign) { - MultiStageDesign = multiStageDesign; - } - public String getCreated() { - return Created; - } - public void setCreated(String created) { - Created = created; - } +public class ModelInfoGenericVnf extends ModelInfoMetadata implements Serializable { + + private static final long serialVersionUID = -5963022750248280669L; + + @JsonProperty("tosca-node-type") + private String ToscaNodeType; + @JsonProperty("description") + private String Description; + @JsonProperty("orchestration-mode") + private String OrchestrationMode; + @JsonProperty("aic-version-min") + private String AicVersionMin; + @JsonProperty("aic-version-max") + private String AicVersionMax; + @JsonProperty("min-instances") + private String MinInstances; + @JsonProperty("max-instances") + private String MaxInstances; + @JsonProperty("availability-zone-max-count") + private String AvailabilityZoneMaxCount; + @JsonProperty("nf-function") + private String NfFunction; + @JsonProperty("nf-type") + private String NfType; + @JsonProperty("nf-role") + private String NfRole; + @JsonProperty("nf-naming-code") + private String NfNamingCode; + @JsonProperty("multi-stage-design") + private String MultiStageDesign; + @JsonProperty("created") + private String Created; + + + public String getToscaNodeType() { + return ToscaNodeType; + } + + public void setToscaNodeType(String toscaNodeType) { + ToscaNodeType = toscaNodeType; + } + + public String getDescription() { + return Description; + } + + public void setDescription(String description) { + Description = description; + } + + public String getOrchestrationMode() { + return OrchestrationMode; + } + + public void setOrchestrationMode(String orchestrationMode) { + OrchestrationMode = orchestrationMode; + } + + public String getAicVersionMin() { + return AicVersionMin; + } + + public void setAicVersionMin(String aicVersionMin) { + AicVersionMin = aicVersionMin; + } + + public String getAicVersionMax() { + return AicVersionMax; + } + + public void setAicVersionMax(String aicVersionMax) { + AicVersionMax = aicVersionMax; + } + + public String getMinInstances() { + return MinInstances; + } + + public void setMinInstances(String minInstances) { + MinInstances = minInstances; + } + + public String getMaxInstances() { + return MaxInstances; + } + + public void setMaxInstances(String maxInstances) { + MaxInstances = maxInstances; + } + + public String getAvailabilityZoneMaxCount() { + return AvailabilityZoneMaxCount; + } + + public void setAvailabilityZoneMaxCount(String availabilityZoneMaxCount) { + AvailabilityZoneMaxCount = availabilityZoneMaxCount; + } + + public String getNfFunction() { + return NfFunction; + } + + public void setNfFunction(String nfFunction) { + NfFunction = nfFunction; + } + + public String getNfType() { + return NfType; + } + + public void setNfType(String nfType) { + NfType = nfType; + } + + public String getNfRole() { + return NfRole; + } + + public void setNfRole(String nfRole) { + NfRole = nfRole; + } + + public String getNfNamingCode() { + return NfNamingCode; + } + + public void setNfNamingCode(String nfNamingCode) { + NfNamingCode = nfNamingCode; + } + + public String getMultiStageDesign() { + return MultiStageDesign; + } + + public void setMultiStageDesign(String multiStageDesign) { + MultiStageDesign = multiStageDesign; + } + + public String getCreated() { + return Created; + } + + public void setCreated(String created) { + Created = created; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java index e03ee358f3..7b30858b25 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java @@ -23,60 +23,71 @@ package org.onap.so.bpmn.servicedecomposition.modelinfo; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonProperty; -public class ModelInfoInstanceGroup implements Serializable { - - private static final long serialVersionUID = -8279040393230356226L; - - public static final String TYPE_L3_NETWORK = "L3-NETWORK"; - public static final String TYPE_VNFC = "VNFC"; - - @JsonProperty("model-uuid") - private String ModelUUID; - @JsonProperty("model-invariant-uuid") - private String ModelInvariantUUID; - @JsonProperty("type") - private String type; - @JsonProperty("instance-group-role") - private String instanceGroupRole; - @JsonProperty("function") - private String function; - @JsonProperty("description") - private String description; - - public String getModelUUID() { - return ModelUUID; - } - public void setModelUUID(String modelUUID) { - ModelUUID = modelUUID; - } - public String getModelInvariantUUID() { - return ModelInvariantUUID; - } - public void setModelInvariantUUID(String modelInvariantUUID) { - ModelInvariantUUID = modelInvariantUUID; - } - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - public String getInstanceGroupRole() { - return instanceGroupRole; - } - public void setInstanceGroupRole(String instanceGroupRole) { - this.instanceGroupRole = instanceGroupRole; - } - public String getFunction() { - return function; - } - public void setFunction(String function) { - this.function = function; - } - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } +public class ModelInfoInstanceGroup implements Serializable { + + private static final long serialVersionUID = -8279040393230356226L; + + public static final String TYPE_L3_NETWORK = "L3-NETWORK"; + public static final String TYPE_VNFC = "VNFC"; + + @JsonProperty("model-uuid") + private String ModelUUID; + @JsonProperty("model-invariant-uuid") + private String ModelInvariantUUID; + @JsonProperty("type") + private String type; + @JsonProperty("instance-group-role") + private String instanceGroupRole; + @JsonProperty("function") + private String function; + @JsonProperty("description") + private String description; + + public String getModelUUID() { + return ModelUUID; + } + + public void setModelUUID(String modelUUID) { + ModelUUID = modelUUID; + } + + public String getModelInvariantUUID() { + return ModelInvariantUUID; + } + + public void setModelInvariantUUID(String modelInvariantUUID) { + ModelInvariantUUID = modelInvariantUUID; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getInstanceGroupRole() { + return instanceGroupRole; + } + + public void setInstanceGroupRole(String instanceGroupRole) { + this.instanceGroupRole = instanceGroupRole; + } + + public String getFunction() { + return function; + } + + public void setFunction(String function) { + this.function = function; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoMetadata.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoMetadata.java index c873912922..7fc29a8fc1 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoMetadata.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoMetadata.java @@ -21,63 +21,73 @@ package org.onap.so.bpmn.servicedecomposition.modelinfo; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; -public class ModelInfoMetadata implements Serializable{ - - private static final long serialVersionUID = -2182850364281359289L; - - @JsonProperty("model-customization-uuid") - private String modelCustomizationUuid; - @JsonProperty("model-invariant-uuid") - private String modelInvariantUuid; - @JsonProperty("model-uuid") - private String modelUuid; - @JsonProperty("model-version") - private String modelVersion; - @JsonProperty("model-instance-name") - private String modelInstanceName; - @JsonProperty("model-name") - private String modelName; - - - public String getModelCustomizationUuid() { - return modelCustomizationUuid; - } - public void setModelCustomizationUuid(String modelCustomizationUuid) { - this.modelCustomizationUuid = modelCustomizationUuid; - } - public String getModelInvariantUuid() { - return modelInvariantUuid; - } - public void setModelInvariantUuid(String modelInvariantUuid) { - this.modelInvariantUuid = modelInvariantUuid; - } - public String getModelUuid() { - return modelUuid; - } - public void setModelUuid(String modelUuid) { - this.modelUuid = modelUuid; - } - public String getModelVersion() { - return modelVersion; - } - public void setModelVersion(String modelVersion) { - this.modelVersion = modelVersion; - } - public String getModelInstanceName() { - return modelInstanceName; - } - public void setModelInstanceName(String modelInstanceName) { - this.modelInstanceName = modelInstanceName; - } - public String getModelName() { - return modelName; - } - public void setModelName(String modelName) { - this.modelName = modelName; - } +public class ModelInfoMetadata implements Serializable { + + private static final long serialVersionUID = -2182850364281359289L; + + @JsonProperty("model-customization-uuid") + private String modelCustomizationUuid; + @JsonProperty("model-invariant-uuid") + private String modelInvariantUuid; + @JsonProperty("model-uuid") + private String modelUuid; + @JsonProperty("model-version") + private String modelVersion; + @JsonProperty("model-instance-name") + private String modelInstanceName; + @JsonProperty("model-name") + private String modelName; + + + public String getModelCustomizationUuid() { + return modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public String getModelInvariantUuid() { + return modelInvariantUuid; + } + + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + + public String getModelUuid() { + return modelUuid; + } + + public void setModelUuid(String modelUuid) { + this.modelUuid = modelUuid; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getModelInstanceName() { + return modelInstanceName; + } + + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoNetwork.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoNetwork.java index 22233e94a5..955ad86561 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoNetwork.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoNetwork.java @@ -22,148 +22,180 @@ package org.onap.so.bpmn.servicedecomposition.modelinfo; import java.io.Serializable; import java.sql.Timestamp; - import com.fasterxml.jackson.annotation.JsonProperty; -public class ModelInfoNetwork implements Serializable{ - - private static final long serialVersionUID = -3612850497900637132L; - - @JsonProperty("model-customization-uuid") - private String ModelCustomizationUUID; - @JsonProperty("model-instance-name") - private String ModelInstanceName; - @JsonProperty("network-technology") - private String NetworkTechnology; - @JsonProperty("network-type") - private String NetworkType; - @JsonProperty("network-scope") - private String NetworkScope; - @JsonProperty("network-role") - private String NetworkRole; - @JsonProperty("description") - private String Description; - @JsonProperty("created") - private Timestamp Created; - @JsonProperty("model-version") - private String ModelVersion; - @JsonProperty("model-invariant-uuid") - private String ModelInvariantUUID; - @JsonProperty("model-name") - private String ModelName; - @JsonProperty("model-uuid") - private String ModelUUID; - @JsonProperty("neutron-network-type") - private String NeutronNetworkType; - @JsonProperty("aic-version-min") - private String AicVersionMin; - @JsonProperty("aic-version-max") - private String AicVersionMax; - @JsonProperty("orchestration-mode") - private String OrchestrationMode; - @JsonProperty("tosca-node-type") - private String ToscaNodeType; - - public String getModelCustomizationUUID() { - return ModelCustomizationUUID; - } - public void setModelCustomizationUUID(String modelCustomizationUUID) { - ModelCustomizationUUID = modelCustomizationUUID; - } - public String getModelInstanceName() { - return ModelInstanceName; - } - public void setModelInstanceName(String modelInstanceName) { - ModelInstanceName = modelInstanceName; - } - public String getNetworkTechnology() { - return NetworkTechnology; - } - public void setNetworkTechnology(String networkTechnology) { - NetworkTechnology = networkTechnology; - } - public String getNetworkType() { - return NetworkType; - } - public void setNetworkType(String networkType) { - NetworkType = networkType; - } - public String getNetworkScope() { - return NetworkScope; - } - public void setNetworkScope(String networkScope) { - NetworkScope = networkScope; - } - public String getNetworkRole() { - return NetworkRole; - } - public void setNetworkRole(String networkRole) { - NetworkRole = networkRole; - } - public String getDescription() { - return Description; - } - public void setDescription(String description) { - Description = description; - } - public Timestamp getCreated() { - return Created; - } - public void setCreated(Timestamp created) { - Created = created; - } - public String getModelVersion() { - return ModelVersion; - } - public void setModelVersion(String modelVersion) { - ModelVersion = modelVersion; - } - public String getModelInvariantUUID() { - return ModelInvariantUUID; - } - public void setModelInvariantUUID(String modelInvariantUUID) { - ModelInvariantUUID = modelInvariantUUID; - } - public String getModelName() { - return ModelName; - } - public void setModelName(String modelName) { - ModelName = modelName; - } - public String getModelUUID() { - return ModelUUID; - } - public void setModelUUID(String modelUUID) { - ModelUUID = modelUUID; - } - public String getNeutronNetworkType() { - return NeutronNetworkType; - } - public void setNeutronNetworkType(String neutronNetworkType) { - NeutronNetworkType = neutronNetworkType; - } - public String getAicVersionMin() { - return AicVersionMin; - } - public void setAicVersionMin(String aicVersionMin) { - AicVersionMin = aicVersionMin; - } - public String getAicVersionMax() { - return AicVersionMax; - } - public void setAicVersionMax(String aicVersionMax) { - AicVersionMax = aicVersionMax; - } - public String getOrchestrationMode() { - return OrchestrationMode; - } - public void setOrchestrationMode(String orchestrationMode) { - OrchestrationMode = orchestrationMode; - } - public String getToscaNodeType() { - return ToscaNodeType; - } - public void setToscaNodeType(String toscaNodeType) { - ToscaNodeType = toscaNodeType; - } +public class ModelInfoNetwork implements Serializable { + + private static final long serialVersionUID = -3612850497900637132L; + + @JsonProperty("model-customization-uuid") + private String ModelCustomizationUUID; + @JsonProperty("model-instance-name") + private String ModelInstanceName; + @JsonProperty("network-technology") + private String NetworkTechnology; + @JsonProperty("network-type") + private String NetworkType; + @JsonProperty("network-scope") + private String NetworkScope; + @JsonProperty("network-role") + private String NetworkRole; + @JsonProperty("description") + private String Description; + @JsonProperty("created") + private Timestamp Created; + @JsonProperty("model-version") + private String ModelVersion; + @JsonProperty("model-invariant-uuid") + private String ModelInvariantUUID; + @JsonProperty("model-name") + private String ModelName; + @JsonProperty("model-uuid") + private String ModelUUID; + @JsonProperty("neutron-network-type") + private String NeutronNetworkType; + @JsonProperty("aic-version-min") + private String AicVersionMin; + @JsonProperty("aic-version-max") + private String AicVersionMax; + @JsonProperty("orchestration-mode") + private String OrchestrationMode; + @JsonProperty("tosca-node-type") + private String ToscaNodeType; + + public String getModelCustomizationUUID() { + return ModelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + ModelCustomizationUUID = modelCustomizationUUID; + } + + public String getModelInstanceName() { + return ModelInstanceName; + } + + public void setModelInstanceName(String modelInstanceName) { + ModelInstanceName = modelInstanceName; + } + + public String getNetworkTechnology() { + return NetworkTechnology; + } + + public void setNetworkTechnology(String networkTechnology) { + NetworkTechnology = networkTechnology; + } + + public String getNetworkType() { + return NetworkType; + } + + public void setNetworkType(String networkType) { + NetworkType = networkType; + } + + public String getNetworkScope() { + return NetworkScope; + } + + public void setNetworkScope(String networkScope) { + NetworkScope = networkScope; + } + + public String getNetworkRole() { + return NetworkRole; + } + + public void setNetworkRole(String networkRole) { + NetworkRole = networkRole; + } + + public String getDescription() { + return Description; + } + + public void setDescription(String description) { + Description = description; + } + + public Timestamp getCreated() { + return Created; + } + + public void setCreated(Timestamp created) { + Created = created; + } + + public String getModelVersion() { + return ModelVersion; + } + + public void setModelVersion(String modelVersion) { + ModelVersion = modelVersion; + } + + public String getModelInvariantUUID() { + return ModelInvariantUUID; + } + + public void setModelInvariantUUID(String modelInvariantUUID) { + ModelInvariantUUID = modelInvariantUUID; + } + + public String getModelName() { + return ModelName; + } + + public void setModelName(String modelName) { + ModelName = modelName; + } + + public String getModelUUID() { + return ModelUUID; + } + + public void setModelUUID(String modelUUID) { + ModelUUID = modelUUID; + } + + public String getNeutronNetworkType() { + return NeutronNetworkType; + } + + public void setNeutronNetworkType(String neutronNetworkType) { + NeutronNetworkType = neutronNetworkType; + } + + public String getAicVersionMin() { + return AicVersionMin; + } + + public void setAicVersionMin(String aicVersionMin) { + AicVersionMin = aicVersionMin; + } + + public String getAicVersionMax() { + return AicVersionMax; + } + + public void setAicVersionMax(String aicVersionMax) { + AicVersionMax = aicVersionMax; + } + + public String getOrchestrationMode() { + return OrchestrationMode; + } + + public void setOrchestrationMode(String orchestrationMode) { + OrchestrationMode = orchestrationMode; + } + + public String getToscaNodeType() { + return ToscaNodeType; + } + + public void setToscaNodeType(String toscaNodeType) { + ToscaNodeType = toscaNodeType; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java index ac206d3dd0..05cad456d0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java @@ -21,61 +21,71 @@ package org.onap.so.bpmn.servicedecomposition.modelinfo; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; public class ModelInfoServiceInstance extends ModelInfoMetadata implements Serializable { - private static final long serialVersionUID = -1812787934683419141L; - - @JsonProperty("description") - private String description; - @JsonProperty("created") - private String created; - @JsonProperty("service-type") - private String serviceType; - @JsonProperty("service-role") - private String serviceRole; - @JsonProperty("environment-context") - private String environmentContext; - @JsonProperty("workload-context") - private String workloadContext; - - - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - public String getCreated() { - return created; - } - public void setCreated(String created) { - this.created = created; - } - public String getServiceType() { - return serviceType; - } - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - public String getServiceRole() { - return serviceRole; - } - public void setServiceRole(String serviceRole) { - this.serviceRole = serviceRole; - } - public String getEnvironmentContext() { - return environmentContext; - } - public void setEnvironmentContext(String environmentContext) { - this.environmentContext = environmentContext; - } - public String getWorkloadContext() { - return workloadContext; - } - public void setWorkloadContext(String workloadContext) { - this.workloadContext = workloadContext; - } + private static final long serialVersionUID = -1812787934683419141L; + + @JsonProperty("description") + private String description; + @JsonProperty("created") + private String created; + @JsonProperty("service-type") + private String serviceType; + @JsonProperty("service-role") + private String serviceRole; + @JsonProperty("environment-context") + private String environmentContext; + @JsonProperty("workload-context") + private String workloadContext; + + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreated() { + return created; + } + + public void setCreated(String created) { + this.created = created; + } + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getServiceRole() { + return serviceRole; + } + + public void setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + } + + public String getEnvironmentContext() { + return environmentContext; + } + + public void setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + } + + public String getWorkloadContext() { + return workloadContext; + } + + public void setWorkloadContext(String workloadContext) { + this.workloadContext = workloadContext; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVfModule.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVfModule.java index 593f8c2532..e1b7a543d8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVfModule.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVfModule.java @@ -21,116 +21,140 @@ package org.onap.so.bpmn.servicedecomposition.modelinfo; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; public class ModelInfoVfModule implements Serializable { - private static final long serialVersionUID = 636556989022688657L; - - @JsonProperty("model-customization-uuid") - private String ModelCustomizationUUID; - @JsonProperty("model-name") - private String ModelName; - @JsonProperty("model-uuid") - private String ModelUUID; - @JsonProperty("model-invariant-uuid") - private String ModelInvariantUUID; - @JsonProperty("model-version") - private String ModelVersion; - @JsonProperty("description") - private String Description; - @JsonProperty("is-base-boolean") - private Boolean IsBaseBoolean; - @JsonProperty("min-instances") - private String MinInstances; - @JsonProperty("max-instances") - private String MaxInstances; - @JsonProperty("availability-zone-count") - private String AvailabilityZoneCount; - @JsonProperty("label") - private String Label; - @JsonProperty("initial-count") - private String InitialCount; - @JsonProperty("created") - private String Created; - - public String getModelCustomizationUUID() { - return ModelCustomizationUUID; - } - public void setModelCustomizationUUID(String modelCustomizationUUID) { - ModelCustomizationUUID = modelCustomizationUUID; - } - public String getModelName() { - return ModelName; - } - public void setModelName(String modelName) { - ModelName = modelName; - } - public String getModelUUID() { - return ModelUUID; - } - public void setModelUUID(String modelUUID) { - ModelUUID = modelUUID; - } - public String getModelInvariantUUID() { - return ModelInvariantUUID; - } - public void setModelInvariantUUID(String modelInvariantUUID) { - ModelInvariantUUID = modelInvariantUUID; - } - public String getModelVersion() { - return ModelVersion; - } - public void setModelVersion(String modelVersion) { - ModelVersion = modelVersion; - } - public String getDescription() { - return Description; - } - public void setDescription(String description) { - Description = description; - } - public Boolean getIsBaseBoolean() { - return IsBaseBoolean; - } - public void setIsBaseBoolean(Boolean isBaseBoolean) { - IsBaseBoolean = isBaseBoolean; - } - public String getMinInstances() { - return MinInstances; - } - public void setMinInstances(String minInstances) { - MinInstances = minInstances; - } - public String getMaxInstances() { - return MaxInstances; - } - public void setMaxInstances(String maxInstances) { - MaxInstances = maxInstances; - } - public String getAvailabilityZoneCount() { - return AvailabilityZoneCount; - } - public void setAvailabilityZoneCount(String availabilityZoneCount) { - AvailabilityZoneCount = availabilityZoneCount; - } - public String getLabel() { - return Label; - } - public void setLabel(String label) { - Label = label; - } - public String getInitialCount() { - return InitialCount; - } - public void setInitialCount(String initialCount) { - InitialCount = initialCount; - } - public String getCreated() { - return Created; - } - public void setCreated(String created) { - Created = created; - } + private static final long serialVersionUID = 636556989022688657L; + + @JsonProperty("model-customization-uuid") + private String ModelCustomizationUUID; + @JsonProperty("model-name") + private String ModelName; + @JsonProperty("model-uuid") + private String ModelUUID; + @JsonProperty("model-invariant-uuid") + private String ModelInvariantUUID; + @JsonProperty("model-version") + private String ModelVersion; + @JsonProperty("description") + private String Description; + @JsonProperty("is-base-boolean") + private Boolean IsBaseBoolean; + @JsonProperty("min-instances") + private String MinInstances; + @JsonProperty("max-instances") + private String MaxInstances; + @JsonProperty("availability-zone-count") + private String AvailabilityZoneCount; + @JsonProperty("label") + private String Label; + @JsonProperty("initial-count") + private String InitialCount; + @JsonProperty("created") + private String Created; + + public String getModelCustomizationUUID() { + return ModelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + ModelCustomizationUUID = modelCustomizationUUID; + } + + public String getModelName() { + return ModelName; + } + + public void setModelName(String modelName) { + ModelName = modelName; + } + + public String getModelUUID() { + return ModelUUID; + } + + public void setModelUUID(String modelUUID) { + ModelUUID = modelUUID; + } + + public String getModelInvariantUUID() { + return ModelInvariantUUID; + } + + public void setModelInvariantUUID(String modelInvariantUUID) { + ModelInvariantUUID = modelInvariantUUID; + } + + public String getModelVersion() { + return ModelVersion; + } + + public void setModelVersion(String modelVersion) { + ModelVersion = modelVersion; + } + + public String getDescription() { + return Description; + } + + public void setDescription(String description) { + Description = description; + } + + public Boolean getIsBaseBoolean() { + return IsBaseBoolean; + } + + public void setIsBaseBoolean(Boolean isBaseBoolean) { + IsBaseBoolean = isBaseBoolean; + } + + public String getMinInstances() { + return MinInstances; + } + + public void setMinInstances(String minInstances) { + MinInstances = minInstances; + } + + public String getMaxInstances() { + return MaxInstances; + } + + public void setMaxInstances(String maxInstances) { + MaxInstances = maxInstances; + } + + public String getAvailabilityZoneCount() { + return AvailabilityZoneCount; + } + + public void setAvailabilityZoneCount(String availabilityZoneCount) { + AvailabilityZoneCount = availabilityZoneCount; + } + + public String getLabel() { + return Label; + } + + public void setLabel(String label) { + Label = label; + } + + public String getInitialCount() { + return InitialCount; + } + + public void setInitialCount(String initialCount) { + InitialCount = initialCount; + } + + public String getCreated() { + return Created; + } + + public void setCreated(String created) { + Created = created; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java index d3bf99ccb8..bb493f5aa9 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java @@ -21,10 +21,9 @@ package org.onap.so.bpmn.servicedecomposition.modelinfo; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; public class ModelInfoVolumeGroup extends ModelInfoVfModule implements Serializable { - private static final long serialVersionUID = -1157856848495642223L; + private static final long serialVersionUID = -1157856848495642223L; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java index ac96aceec3..7ca6076b21 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java @@ -22,23 +22,19 @@ package org.onap.so.bpmn.servicedecomposition.tasks; public enum AssignFlows { - SERVICE_INSTANCE("AssignServiceInstanceBB"), - VNF("AssignVnfBB"), - VF_MODULE("AssignVfModuleBB"), - NETWORK_A_LA_CARTE("AssignNetwork1802BB"), - NETWORK_MACRO("AssignNetworkBB"), - VOLUME_GROUP("AssignVolumeGroupBB"), - NETWORK_COLLECTION("CreateNetworkCollectionBB"), - FABRIC_CONFIGURATION("AssignFabricConfigurationBB"); - - private final String flowName; - - private AssignFlows(String flowName) { - this.flowName = flowName; - } - - @Override - public String toString() { - return this.flowName; - } + SERVICE_INSTANCE("AssignServiceInstanceBB"), VNF("AssignVnfBB"), VF_MODULE("AssignVfModuleBB"), NETWORK_A_LA_CARTE( + "AssignNetwork1802BB"), NETWORK_MACRO("AssignNetworkBB"), VOLUME_GROUP( + "AssignVolumeGroupBB"), NETWORK_COLLECTION( + "CreateNetworkCollectionBB"), FABRIC_CONFIGURATION("AssignFabricConfigurationBB"); + + private final String flowName; + + private AssignFlows(String flowName) { + this.flowName = flowName; + } + + @Override + public String toString() { + return this.flowName; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index f5b77781a4..de77ca66e7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -28,7 +28,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.UUID; - import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.javatuples.Pair; @@ -96,1715 +95,1760 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; - import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @Component("BBInputSetup") public class BBInputSetup implements JavaDelegate { - private static final Logger logger = LoggerFactory.getLogger(BBInputSetup.class); - private static final String FLOW_VAR_NAME = "flowToBeCalled"; - private static final String LOOKUP_KEY_MAP_VAR_NAME = "lookupKeyMap"; - private static final String GBB_INPUT_VAR_NAME = "gBBInput"; - private static final String EXECUTE_BB_VAR_NAME = "buildingBlock"; - private static final String VOLUME_GROUP = "VolumeGroup"; - private static final String VF_MODULE = "VfModule"; - private static final String NETWORK = "Network"; - private static final String VNF = "Vnf"; - private static final String NETWORK_COLLECTION = "NetworkCollection"; - private static final String PREPROV = "PREPROV"; - - @Autowired - private BBInputSetupUtils bbInputSetupUtils; - - @Autowired - private BBInputSetupMapperLayer mapperLayer; - - @Autowired - private CloudInfoFromAAI cloudInfoFromAAI; - - @Autowired - private ExceptionBuilder exceptionUtil; - - private ObjectMapper mapper = new ObjectMapper(); - - public BBInputSetupUtils getBbInputSetupUtils() { - return bbInputSetupUtils; - } - - public void setCloudInfoFromAAI(CloudInfoFromAAI cloudInfoFromAAI) { - this.cloudInfoFromAAI = cloudInfoFromAAI; - } - - public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) { - this.bbInputSetupUtils = bbInputSetupUtils; - } - - public BBInputSetupMapperLayer getMapperLayer() { - return mapperLayer; - } - - public void setMapperLayer(BBInputSetupMapperLayer mapperLayer) { - this.mapperLayer = mapperLayer; - } - - @Override - public void execute(DelegateExecution execution) throws Exception { - try { - GeneralBuildingBlock outputBB = null; - ExecuteBuildingBlock executeBB = this.getExecuteBBFromExecution(execution); - String resourceId = executeBB.getResourceId(); - String requestAction = executeBB.getRequestAction(); - String vnfType = executeBB.getVnfType(); - boolean aLaCarte = Boolean.TRUE.equals(executeBB.isaLaCarte()); - boolean homing = Boolean.TRUE.equals(executeBB.isHoming()); - Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); - outputBB = this.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, resourceId, vnfType); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.INDENT_OUTPUT); - logger.debug("GeneralBB: " + mapper.writeValueAsString(outputBB)); - - setHomingFlag(outputBB, homing, lookupKeyMap); - - execution.setVariable(FLOW_VAR_NAME, executeBB.getBuildingBlock().getBpmnFlowName()); - execution.setVariable(GBB_INPUT_VAR_NAME, outputBB); - execution.setVariable(LOOKUP_KEY_MAP_VAR_NAME, lookupKeyMap); - - BuildingBlockExecution gBuildingBlockExecution = new DelegateExecutionImpl(execution); - execution.setVariable("gBuildingBlockExecution", gBuildingBlockExecution); - execution.setVariable("RetryCount", 1); - execution.setVariable("handlingCode", "Success"); - } catch (Exception e) { - logger.error("Exception occurred", e); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e.getMessage()); - } - } - - protected void setHomingFlag(GeneralBuildingBlock outputBB, boolean homing, Map<ResourceKey, String> lookupKeyMap) { - - if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null && homing && outputBB != null) { - for (GenericVnf vnf : outputBB.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs()) { - if (vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { - vnf.setCallHoming(homing); - } - } - } - } - - protected ExecuteBuildingBlock getExecuteBBFromExecution(DelegateExecution execution) { - return (ExecuteBuildingBlock) execution.getVariable(EXECUTE_BB_VAR_NAME); - } - - protected GeneralBuildingBlock getGBB(ExecuteBuildingBlock executeBB, Map<ResourceKey, String> lookupKeyMap, - String requestAction, boolean aLaCarte, String resourceId, String vnfType) throws Exception { - String requestId = executeBB.getRequestId(); - this.populateLookupKeyMapWithIds(executeBB.getWorkflowResourceIds(), lookupKeyMap); - RequestDetails requestDetails = executeBB.getRequestDetails(); - if(requestDetails == null) { - requestDetails = bbInputSetupUtils.getRequestDetails(requestId); - } - if (requestDetails.getModelInfo() == null) { - return this.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId); - } - else { - ModelType modelType = requestDetails.getModelInfo().getModelType(); - if (aLaCarte && modelType.equals(ModelType.service)) { - return this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId); - } else if (aLaCarte && !modelType.equals(ModelType.service)) { - return this.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, - vnfType); - } else { - return this.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); - } - } - } - - protected void populateLookupKeyMapWithIds(WorkflowResourceIds workflowResourceIds, - Map<ResourceKey, String> lookupKeyMap) { - lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, workflowResourceIds.getServiceInstanceId()); - lookupKeyMap.put(ResourceKey.NETWORK_ID, workflowResourceIds.getNetworkId()); - lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, workflowResourceIds.getVnfId()); - lookupKeyMap.put(ResourceKey.VF_MODULE_ID, workflowResourceIds.getVfModuleId()); - lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, workflowResourceIds.getVolumeGroupId()); - lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, workflowResourceIds.getConfigurationId()); - lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, workflowResourceIds.getInstanceGroupId()); - } - - protected GeneralBuildingBlock getGBBALaCarteNonService(ExecuteBuildingBlock executeBB, - RequestDetails requestDetails, Map<ResourceKey, String> lookupKeyMap, String requestAction, - String resourceId, String vnfType) throws Exception { - String bbName = executeBB.getBuildingBlock().getBpmnFlowName(); - String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID); - org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null; - if (serviceInstanceId != null) { - aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); - } - Service service = null; - if (aaiServiceInstance != null) { - service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); - } - if (aaiServiceInstance != null && service != null) { - ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance); - serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service)); - this.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap, - resourceId, vnfType, executeBB.getBuildingBlock().getKey(), executeBB.getConfigurationResourceKeys()); - return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); - } else { - logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance); - logger.debug("Related Service Instance Model Info from AAI: {}", service); - throw new Exception("Could not find relevant information for related Service Instance"); - } - } - - protected GeneralBuildingBlock getGBBCM(ExecuteBuildingBlock executeBB, - RequestDetails requestDetails, Map<ResourceKey, String> lookupKeyMap, String requestAction, - String resourceId) throws Exception { - ServiceInstance serviceInstance = new ServiceInstance(); - String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID); - serviceInstance.setServiceInstanceId(serviceInstanceId); - Customer customer = new Customer(); - List<GenericVnf> genericVnfs = serviceInstance.getVnfs(); - - String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); - if(vnfId != null) { - org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); - GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf); - genericVnfs.add(genericVnf); - } - - String instanceGroupId = lookupKeyMap.get(ResourceKey.INSTANCE_GROUP_ID); - if(instanceGroupId != null) { - org.onap.aai.domain.yang.InstanceGroup aaiInstancegroup = bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId); - InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstancegroup); - instanceGroup.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); - - if(serviceInstanceId == null) { - Optional<org.onap.aai.domain.yang.ServiceInstance> aaiServiceInstanceOpt = bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup(instanceGroupId); - if(aaiServiceInstanceOpt.isPresent()) { - org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = aaiServiceInstanceOpt.get(); - serviceInstance = this.mapperLayer.mapAAIServiceInstanceIntoServiceInstance(aaiServiceInstance); - WorkflowResourceIds workflowResourceIds = executeBB.getWorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId(serviceInstance.getServiceInstanceId()); - lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, workflowResourceIds.getServiceInstanceId()); - } else { - throw new NoServiceInstanceFoundException("Related ServiceInstance not found in A&AI."); - } - } - RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList(); - if (relatedInstanceList != null) { - for (RelatedInstanceList relatedInstList : relatedInstanceList) { - RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); - if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { - org.onap.aai.domain.yang.GenericVnf aaiVnf = bbInputSetupUtils.getAAIGenericVnf(relatedInstance.getInstanceId()); - GenericVnf vnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiVnf); - instanceGroup.getVnfs().add(vnf); - } - } - } - - serviceInstance.getInstanceGroups().add(instanceGroup); - customer.setServiceSubscription(new ServiceSubscription()); - } - return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, customer); - } - - protected void populateObjectsOnAssignAndCreateFlows(RequestDetails requestDetails, Service service, String bbName, - ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String vnfType, - String configurationKey, ConfigurationResourceKeys configurationResourceKeys) - throws Exception { - ModelInfo modelInfo = requestDetails.getModelInfo(); - String instanceName = requestDetails.getRequestInfo().getInstanceName(); - String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId(); - ModelType modelType = modelInfo.getModelType(); - RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList(); - - org.onap.so.serviceinstancebeans.Platform platform = requestDetails.getPlatform(); - org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = requestDetails.getLineOfBusiness(); - - if (modelType.equals(ModelType.network)) { - lookupKeyMap.put(ResourceKey.NETWORK_ID, resourceId); - this.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); - } else if (modelType.equals(ModelType.vnf)) { - lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, resourceId); - this.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, - lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId); - } else if (modelType.equals(ModelType.volumeGroup)) { - lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, resourceId); - this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - relatedInstanceList, instanceName, vnfType, null); - } else if (modelType.equals(ModelType.vfModule)) { - if(bbName.contains("Configuration")) { - String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); - ModelInfo configurationModelInfo = new ModelInfo(); - configurationModelInfo.setModelCustomizationUuid(configurationKey); - populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, - lookupKeyMap, configurationId, instanceName, configurationResourceKeys); - } else { - lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId); - this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration()); - } - } else if (modelType.equals(ModelType.instanceGroup)) { - lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, resourceId); - this.populateInstanceGroup(modelInfo, service, serviceInstance, resourceId, instanceName); - } else { - return; - } - } - - protected void populateInstanceGroup(ModelInfo modelInfo, Service service, ServiceInstance serviceInstance, String instanceGroupId, String instanceName) { - InstanceGroup instanceGroup = new InstanceGroup(); - instanceGroup.setId(instanceGroupId); - instanceGroup.setInstanceGroupName(instanceName); - mapCatalogInstanceGroup(instanceGroup, modelInfo, service); - serviceInstance.getInstanceGroups().add(instanceGroup); - } - - protected void mapCatalogInstanceGroup(InstanceGroup instanceGroup, ModelInfo modelInfo, Service service) { - // @TODO: this will populate the instanceGroup model info. - // Dependent on MSO-5821 653458 US - MSO - Enhance Catalog DB Schema & Adapter to support VNF Groups - } - - protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName, - ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String instanceName, ConfigurationResourceKeys configurationResourceKeys) { - Configuration configuration = null; - for (Configuration configurationTemp : serviceInstance.getConfigurations()) { - if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null - && configurationTemp.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) { - configuration = configurationTemp; - org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()); - if(aaiConfiguration!=null){ - modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId()); - } - } - } - if (configuration == null && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) { - configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId); - serviceInstance.getConfigurations().add(configuration); - } - if(configuration != null) { - Vnfc vnfc = getVnfcToConfiguration(configurationResourceKeys.getVnfcName()); - configuration.setVnfc(vnfc); - this.mapCatalogConfiguration(configuration, modelInfo, service, configurationResourceKeys); - } - } - - protected Vnfc getVnfcToConfiguration(String vnfcName) { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName); - Optional<org.onap.aai.domain.yang.Vnfc> vnfcOp = bbInputSetupUtils.getAAIResourceDepthOne(uri).asBean(org.onap.aai.domain.yang.Vnfc.class); - if(vnfcOp.isPresent()) { - org.onap.aai.domain.yang.Vnfc vnfcAAI = vnfcOp.get(); - return this.mapperLayer.mapAAIVnfc(vnfcAAI); - } else { - return null; - } - } - - protected Configuration createConfiguration(Map<ResourceKey, String> lookupKeyMap, - String instanceName, String resourceId) { - lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, resourceId); - Configuration configuration = new Configuration(); - configuration.setConfigurationId(resourceId); - configuration.setConfigurationName(instanceName); - configuration.setOrchestrationStatus(OrchestrationStatus.PRECREATED); - return configuration; - } - - protected void mapCatalogConfiguration(Configuration configuration, ModelInfo modelInfo, Service service, ConfigurationResourceKeys configurationResourceKeys) { - ConfigurationResourceCustomization configurationResourceCustomization = findConfigurationResourceCustomization(modelInfo, service); - CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = - findVnfVfmoduleCvnfcConfigurationCustomization(service.getModelUUID(),configurationResourceKeys.getVfModuleCustomizationUUID(), - configurationResourceKeys.getVnfResourceCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID(), configurationResourceCustomization); - if (configurationResourceCustomization != null && vnfVfmoduleCvnfcConfigurationCustomization != null) { - configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization - , vnfVfmoduleCvnfcConfigurationCustomization)); - } else { - logger.debug("for Fabric configuration mapping by VF MODULE CUST UUID: " + configurationResourceKeys.getVfModuleCustomizationUUID()); - vnfVfmoduleCvnfcConfigurationCustomization = findVnfVfmoduleCvnfcConfigurationCustomization(service.getModelUUID(),configurationResourceKeys.getVnfResourceCustomizationUUID(), - configurationResourceKeys.getVfModuleCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID()); - if (vnfVfmoduleCvnfcConfigurationCustomization != null){ - configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(vnfVfmoduleCvnfcConfigurationCustomization)); - } - } - } - - protected CvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String serviceModelUUID, String vfModuleCustomizationUUID, - String vnfResourceCustomizationUUID, String cvnfcCustomizationUUID, ConfigurationResourceCustomization configurationResourceCustomization) { - return bbInputSetupUtils.getCvnfcConfigurationCustomization(serviceModelUUID, vnfResourceCustomizationUUID, vfModuleCustomizationUUID, cvnfcCustomizationUUID); - } - - protected ConfigurationResourceCustomization findConfigurationResourceCustomization(ModelInfo modelInfo, Service service) { - for (ConfigurationResourceCustomization resourceCust : service.getConfigurationCustomizations()) { - if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { - return resourceCust; - } - } - return null; - } - - protected CvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String serviceModelUUID, String vnfResourceCustomizationUUID, - String vfModuleCustomizationUUID, String cvnfcCustomizationUUID) { - return bbInputSetupUtils.getCvnfcConfigurationCustomization(serviceModelUUID, vnfResourceCustomizationUUID, vfModuleCustomizationUUID, cvnfcCustomizationUUID); - } - - protected void populateVfModule(ModelInfo modelInfo, Service service, String bbName, - ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, - RelatedInstanceList[] relatedInstanceList, String instanceName, List<Map<String, String>> instanceParams, CloudConfiguration cloudConfiguration) throws Exception { - String vnfModelCustomizationUUID = null; - if (relatedInstanceList != null) { - for (RelatedInstanceList relatedInstList : relatedInstanceList) { - RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); - if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { - vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId(); - } - if (relatedInstance.getModelInfo().getModelType().equals(ModelType.volumeGroup)) { - lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, relatedInstance.getInstanceId()); - } - } - } - GenericVnf vnf = null; - for (GenericVnf tempVnf : serviceInstance.getVnfs()) { - if (tempVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { - vnf = tempVnf; - vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) - .getModelCustomizationId(); - ModelInfo vnfModelInfo = new ModelInfo(); - vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); - this.mapCatalogVnf(tempVnf, vnfModelInfo, service); - Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(tempVnf, modelInfo, cloudConfiguration.getCloudOwner(), - cloudConfiguration.getLcpCloudRegionId(), lookupKeyMap); - if(volumeGroupIdOp.isPresent()) { - lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get()); - } - break; - } - } - if (vnf != null) { - VfModule vfModule = null; - for (VfModule vfModuleTemp : vnf.getVfModules()) { - if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null - && vfModuleTemp.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) { - vfModule = vfModuleTemp; - } - String vfModuleCustId = bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModuleTemp.getVfModuleId()).getModelCustomizationId(); - ModelInfo modelInfoVfModule = new ModelInfo(); - modelInfoVfModule.setModelCustomizationId(vfModuleCustId); - mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, service, vnfModelCustomizationUUID); - } - if (vfModule == null && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) { - vfModule = createVfModule(lookupKeyMap, - resourceId, instanceName, instanceParams); - vnf.getVfModules().add(vfModule); - mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); - } - } else { - logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); - throw new Exception("Could not find relevant information for related VNF"); - } - } - - protected Optional<String> getVolumeGroupIdRelatedToVfModule(GenericVnf vnf, ModelInfo modelInfo, - String cloudOwner, String cloudRegionId, Map<ResourceKey, String> lookupKeyMap) { - if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) == null) { - for(VolumeGroup volumeGroup : vnf.getVolumeGroups()) { - String volumeGroupCustId = - bbInputSetupUtils.getAAIVolumeGroup(cloudOwner, - cloudRegionId, volumeGroup.getVolumeGroupId()).getModelCustomizationId(); - if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) { - return Optional.of(volumeGroup.getVolumeGroupId()); - } - } - } - return Optional.empty(); - } - - protected void mapCatalogVfModule(VfModule vfModule, ModelInfo modelInfo, Service service, - String vnfModelCustomizationUUID) { - if(modelInfo.getModelCustomizationUuid() != null) { - modelInfo.setModelCustomizationId(modelInfo.getModelCustomizationUuid()); - } - VnfResourceCustomization vnfResourceCustomization = null; - for (VnfResourceCustomization resourceCust : service.getVnfCustomizations()) { - if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(vnfModelCustomizationUUID)) { - vnfResourceCustomization = resourceCust; - break; - } - } - if (vnfResourceCustomization != null) { - VfModuleCustomization vfResourceCustomization = vnfResourceCustomization.getVfModuleCustomizations() - .stream() // Convert to steam - .filter(x -> modelInfo.getModelCustomizationId().equalsIgnoreCase(x.getModelCustomizationUUID()))// find - // what - // we - // want - .findAny() // If 'findAny' then return found - .orElse(null); - if (vfResourceCustomization != null) { - vfModule.setModelInfoVfModule(this.mapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization)); - } - } - } - - protected VfModule createVfModule(Map<ResourceKey, String> lookupKeyMap, String vfModuleId, String instanceName, List<Map<String, String>> instanceParams) { - lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModuleId); - VfModule vfModule = new VfModule(); - vfModule.setVfModuleId(vfModuleId); - vfModule.setVfModuleName(instanceName); - vfModule.setOrchestrationStatus(OrchestrationStatus.PRECREATED); - if(instanceParams != null) { - for(Map<String, String> params : instanceParams) { - vfModule.getCloudParams().putAll(params); - } - } - return vfModule; - } - - protected void populateVolumeGroup(ModelInfo modelInfo, Service service, String bbName, - ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, - RelatedInstanceList[] relatedInstanceList, String instanceName, String vnfType, List<Map<String, String>> instanceParams) throws Exception { - VolumeGroup volumeGroup = null; - GenericVnf vnf = null; - String vnfModelCustomizationUUID = null; - String generatedVnfType = vnfType; - if (generatedVnfType == null || generatedVnfType.isEmpty()) { - generatedVnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); - } - if (relatedInstanceList != null) { - for (RelatedInstanceList relatedInstList : relatedInstanceList) { - RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); - if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { - vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid(); - break; - } - } - } - for (GenericVnf tempVnf : serviceInstance.getVnfs()) { - if (tempVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { - vnf = tempVnf; - vnfModelCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) - .getModelCustomizationId(); - ModelInfo vnfModelInfo = new ModelInfo(); - vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); - mapCatalogVnf(tempVnf, vnfModelInfo, service); - break; - } - } - if (vnf != null && vnfModelCustomizationUUID != null) { - for (VolumeGroup volumeGroupTemp : vnf.getVolumeGroups()) { - if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroupTemp.getVolumeGroupId() - .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID))) { - volumeGroup = volumeGroupTemp; - break; - } - } - if (volumeGroup == null && bbName.equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString())) { - volumeGroup = createVolumeGroup(lookupKeyMap, resourceId, instanceName, generatedVnfType, instanceParams); - vnf.getVolumeGroups().add(volumeGroup); - } - if(volumeGroup != null) { - mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); - } - } else { - logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); - throw new Exception("Could not find relevant information for related VNF"); - } - } - - protected VolumeGroup createVolumeGroup(Map<ResourceKey, String> lookupKeyMap, String volumeGroupId, String instanceName, String vnfType, List<Map<String, String>> instanceParams) { - lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupId); - VolumeGroup volumeGroup = new VolumeGroup(); - volumeGroup.setVolumeGroupId(volumeGroupId); - volumeGroup.setVolumeGroupName(instanceName); - volumeGroup.setVnfType(vnfType); - volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED); - if(instanceParams != null) { - for(Map<String, String> params : instanceParams) { - volumeGroup.getCloudParams().putAll(params); - } - } - return volumeGroup; - } - - protected void mapCatalogVolumeGroup(VolumeGroup volumeGroup, ModelInfo modelInfo, Service service, - String vnfModelCustomizationUUID) { - VfModuleCustomization vfResourceCustomization = getVfResourceCustomization(modelInfo, service, - vnfModelCustomizationUUID); - if (vfResourceCustomization != null) { - volumeGroup.setModelInfoVfModule(this.mapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization)); - } - } - - protected VfModuleCustomization getVfResourceCustomization(ModelInfo modelInfo, Service service, - String vnfModelCustomizationUUID) { - VnfResourceCustomization vnfResourceCustomization = null; - for (VnfResourceCustomization resourceCust : service.getVnfCustomizations()) { - if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(vnfModelCustomizationUUID)) { - vnfResourceCustomization = resourceCust; - break; - } - } - if (vnfResourceCustomization != null) { - for (VfModuleCustomization vfResourceCust : vnfResourceCustomization.getVfModuleCustomizations()) { - if (vfResourceCust.getModelCustomizationUUID() - .equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { - return vfResourceCust; - } - } - - } - return null; - } - - protected void populateGenericVnf(ModelInfo modelInfo, String instanceName, - org.onap.so.serviceinstancebeans.Platform platform, - org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, Service service, String bbName, - ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, - RelatedInstanceList[] relatedInstanceList, String resourceId, String vnfType, List<Map<String, String>> instanceParams, - String productFamilyId) { - GenericVnf vnf = null; - ModelInfo instanceGroupModelInfo = null; - String instanceGroupId = null; - String generatedVnfType = vnfType; - if (generatedVnfType == null || generatedVnfType.isEmpty()) { - generatedVnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); - } - if (relatedInstanceList != null) { - for (RelatedInstanceList relatedInstList : relatedInstanceList) { - RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); - if (relatedInstance.getModelInfo().getModelType().equals(ModelType.networkInstanceGroup)) { - instanceGroupModelInfo = relatedInstance.getModelInfo(); - instanceGroupId = relatedInstance.getInstanceId(); - } - } - } - for (GenericVnf vnfTemp : serviceInstance.getVnfs()) { - if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null - && vnfTemp.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { - String vnfModelCustId = bbInputSetupUtils.getAAIGenericVnf(vnfTemp.getVnfId()).getModelCustomizationId(); - modelInfo.setModelCustomizationUuid(vnfModelCustId); - vnf = vnfTemp; - break; - } - } - if (vnf == null && bbName.equalsIgnoreCase(AssignFlows.VNF.toString())) { - vnf = createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, - resourceId, generatedVnfType, instanceParams, productFamilyId); - serviceInstance.getVnfs().add(vnf); - mapVnfcCollectionInstanceGroup(vnf, modelInfo, service); - } - if(vnf != null) { - mapCatalogVnf(vnf, modelInfo, service); - if (instanceGroupId != null && instanceGroupModelInfo != null - && instanceGroupModelInfo.getModelType().equals(ModelType.networkInstanceGroup) - && !instanceGroupInList(vnf, instanceGroupId)) { - mapNetworkCollectionInstanceGroup(vnf, instanceGroupId); - } - } - } - - protected boolean instanceGroupInList(GenericVnf vnf, String instanceGroupId) { - for(InstanceGroup instanceGroup : vnf.getInstanceGroups()) { - if(instanceGroup.getId() != null && instanceGroup.getId().equalsIgnoreCase(instanceGroupId)) { - return true; - } - } - return false; - } - - protected void mapVnfcCollectionInstanceGroup(GenericVnf genericVnf, ModelInfo modelInfo, Service service) { - VnfResourceCustomization vnfResourceCustomization = getVnfResourceCustomizationFromService(modelInfo, service); - if(vnfResourceCustomization != null) { - List<VnfcInstanceGroupCustomization> vnfcInstanceGroups = vnfResourceCustomization - .getVnfcInstanceGroupCustomizations(); - for (VnfcInstanceGroupCustomization vnfcInstanceGroupCust : vnfcInstanceGroups) { - InstanceGroup instanceGroup = this.createInstanceGroup(); - org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = bbInputSetupUtils.getCatalogInstanceGroup(vnfcInstanceGroupCust.getInstanceGroup().getModelUUID()); - instanceGroup.setModelInfoInstanceGroup(this.mapperLayer - .mapCatalogInstanceGroupToInstanceGroup(null, catalogInstanceGroup)); - instanceGroup.getModelInfoInstanceGroup().setFunction(vnfcInstanceGroupCust.getFunction()); - instanceGroup.setDescription(vnfcInstanceGroupCust.getDescription()); - genericVnf.getInstanceGroups().add(instanceGroup); - } - } - } - - protected void mapNetworkCollectionInstanceGroup(GenericVnf genericVnf, String instanceGroupId) { - org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = bbInputSetupUtils - .getAAIInstanceGroup(instanceGroupId); - InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstanceGroup); - instanceGroup.setModelInfoInstanceGroup(this.mapperLayer.mapCatalogInstanceGroupToInstanceGroup( - null, this.bbInputSetupUtils.getCatalogInstanceGroup(aaiInstanceGroup.getModelVersionId()))); - genericVnf.getInstanceGroups().add(instanceGroup); - } - - protected GenericVnf createGenericVnf(Map<ResourceKey, String> lookupKeyMap, String instanceName, - org.onap.so.serviceinstancebeans.Platform platform, - org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, String vnfId, String vnfType, List<Map<String, String>> instanceParams, - String productFamilyId) { - lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId); - GenericVnf genericVnf = new GenericVnf(); - genericVnf.setVnfId(vnfId); - genericVnf.setVnfName(instanceName); - genericVnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED); - genericVnf.setVnfType(vnfType); - genericVnf.setProvStatus(PREPROV); - genericVnf.setServiceId(productFamilyId); - if (platform != null) { - genericVnf.setPlatform(this.mapperLayer.mapRequestPlatform(platform)); - } - if (lineOfBusiness != null) { - genericVnf.setLineOfBusiness(this.mapperLayer.mapRequestLineOfBusiness(lineOfBusiness)); - } - if(instanceParams != null) { - for(Map<String, String> params : instanceParams) { - genericVnf.getCloudParams().putAll(params); - } - } - return genericVnf; - } - - protected void mapCatalogVnf(GenericVnf genericVnf, ModelInfo modelInfo, Service service) { - VnfResourceCustomization vnfResourceCustomization = getVnfResourceCustomizationFromService(modelInfo, service); - if (vnfResourceCustomization != null) { - genericVnf.setModelInfoGenericVnf(this.mapperLayer.mapCatalogVnfToVnf(vnfResourceCustomization)); - } - } - - protected VnfResourceCustomization getVnfResourceCustomizationFromService(ModelInfo modelInfo, Service service) { - VnfResourceCustomization vnfResourceCustomization = null; - for (VnfResourceCustomization resourceCust : service.getVnfCustomizations()) { - if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { - vnfResourceCustomization = resourceCust; - break; - } - } - return vnfResourceCustomization; - } - - protected void populateL3Network(String instanceName, ModelInfo modelInfo, Service service, String bbName, - ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, List<Map<String, String>> instanceParams) { - L3Network network = null; - for (L3Network networkTemp : serviceInstance.getNetworks()) { - if (lookupKeyMap.get(ResourceKey.NETWORK_ID) != null - && networkTemp.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) { - network = networkTemp; - break; - } - } - if (network == null - && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) - || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { - network = createNetwork(lookupKeyMap, instanceName, resourceId, instanceParams); - serviceInstance.getNetworks().add(network); - } - if(network != null) { - mapCatalogNetwork(network, modelInfo, service); - } - } - - protected L3Network createNetwork(Map<ResourceKey, String> lookupKeyMap, String instanceName, - String networkId, List<Map<String, String>> instanceParams) { - lookupKeyMap.put(ResourceKey.NETWORK_ID, networkId); - L3Network network = new L3Network(); - network.setNetworkId(networkId); - network.setNetworkName(instanceName); - network.setOrchestrationStatus(OrchestrationStatus.PRECREATED); - if(instanceParams != null) { - for(Map<String, String> params : instanceParams) { - network.getCloudParams().putAll(params); - } - } - return network; - } - - protected void mapCatalogNetwork(L3Network network, ModelInfo modelInfo, Service service) { - NetworkResourceCustomization networkResourceCustomization = null; - for (NetworkResourceCustomization resourceCust : service.getNetworkCustomizations()) { - if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { - networkResourceCustomization = resourceCust; - break; - } - } - if (networkResourceCustomization != null) { - network.setModelInfoNetwork(this.mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization)); - } - } - - protected GeneralBuildingBlock getGBBALaCarteService(ExecuteBuildingBlock executeBB, RequestDetails requestDetails, - Map<ResourceKey, String> lookupKeyMap, String requestAction, String resourceId) throws Exception { - Customer customer = getCustomerAndServiceSubscription(requestDetails, resourceId); - if (customer != null) { - Project project = null; - OwningEntity owningEntity = null; - - if (requestDetails.getProject() != null) - project = mapperLayer.mapRequestProject(requestDetails.getProject()); - if (requestDetails.getOwningEntity() != null) - owningEntity = mapperLayer.mapRequestOwningEntity(requestDetails.getOwningEntity()); - - - Service service = bbInputSetupUtils - .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); - if (service == null) { - service = bbInputSetupUtils.getCatalogServiceByModelVersionAndModelInvariantUUID( - requestDetails.getModelInfo().getModelVersion(), - requestDetails.getModelInfo().getModelInvariantId()); - if(service == null) { - throw new Exception("Could not find service for model version Id: " - + requestDetails.getModelInfo().getModelVersionId() + " and for model invariant Id: " - + requestDetails.getModelInfo().getModelInvariantId()); - } - } - ServiceInstance serviceInstance = this.getALaCarteServiceInstance(service, requestDetails, customer, - project, owningEntity, lookupKeyMap, resourceId, Boolean.TRUE.equals(executeBB.isaLaCarte()), - executeBB.getBuildingBlock().getBpmnFlowName()); - return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, customer); - } else { - throw new Exception("Could not find customer"); - } - } - - protected Customer getCustomerAndServiceSubscription(RequestDetails requestDetails, String resourceId) { - Customer customer; - if (requestDetails.getSubscriberInfo() != null) { - customer = this.getCustomerFromRequest(requestDetails); - } else { - customer = this.getCustomerFromURI(resourceId); - } - if (customer != null) { - ServiceSubscription serviceSubscription = null; - serviceSubscription = getServiceSubscription(requestDetails, customer); - if (serviceSubscription == null) { - serviceSubscription = getServiceSubscriptionFromURI(resourceId, customer); - } - customer.setServiceSubscription(serviceSubscription); - return customer; - } else { - return null; - } - } - - protected ServiceSubscription getServiceSubscriptionFromURI(String resourceId, Customer customer) { - Map<String, String> uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(resourceId); - String subscriptionServiceType = uriKeys.get("service-type"); - org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionAAI = bbInputSetupUtils - .getAAIServiceSubscription(customer.getGlobalCustomerId(), subscriptionServiceType); - if (serviceSubscriptionAAI != null) { - return mapperLayer.mapAAIServiceSubscription(serviceSubscriptionAAI); - } else { - return null; - } - } - - protected Customer getCustomerFromURI(String resourceId) { - Map<String, String> uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(resourceId); - String globalCustomerId = uriKeys.get("global-customer-id"); - org.onap.aai.domain.yang.Customer customerAAI = this.bbInputSetupUtils.getAAICustomer(globalCustomerId); - if (customerAAI != null) { - return mapperLayer.mapAAICustomer(customerAAI); - } else { - return null; - } - } - - protected GeneralBuildingBlock populateGBBWithSIAndAdditionalInfo(RequestDetails requestDetails, - ServiceInstance serviceInstance, ExecuteBuildingBlock executeBB, String requestAction, Customer customer) throws Exception { - GeneralBuildingBlock outputBB = new GeneralBuildingBlock(); - OrchestrationContext orchContext = mapperLayer.mapOrchestrationContext(requestDetails); - RequestContext requestContext = mapperLayer.mapRequestContext(requestDetails); - requestContext.setAction(requestAction); - requestContext.setMsoRequestId(executeBB.getRequestId()); - org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils - .getCloudRegion(requestDetails.getCloudConfiguration()); - CloudRegion cloudRegion = mapperLayer.mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion); - Tenant tenant = getTenant(requestDetails.getCloudConfiguration(), aaiCloudRegion); - outputBB.setOrchContext(orchContext); - outputBB.setRequestContext(requestContext); - outputBB.setCloudRegion(cloudRegion); - outputBB.setTenant(tenant); - if(customer == null){ - Map<String, String> uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(serviceInstance.getServiceInstanceId()); - String globalCustomerId = uriKeys.get("global-customer-id"); - String subscriptionServiceType = uriKeys.get("service-type"); - customer = mapCustomer(globalCustomerId, subscriptionServiceType); - } - outputBB.setServiceInstance(serviceInstance); - if (customer.getServiceSubscription() != null) { - customer.getServiceSubscription().getServiceInstances().add(serviceInstance); - } - outputBB.setCustomer(customer); - return outputBB; - } - - protected Tenant getTenant(CloudConfiguration cloudConfiguration, org.onap.aai.domain.yang.CloudRegion aaiCloudRegion) throws Exception { - Tenant tenant = new Tenant(); - if(cloudConfiguration != null && cloudConfiguration.getTenantId() != null - && aaiCloudRegion != null && aaiCloudRegion.getTenants() != null) { - for(org.onap.aai.domain.yang.Tenant aaiTenant : aaiCloudRegion.getTenants().getTenant()) { - if(aaiTenant.getTenantId().equalsIgnoreCase(cloudConfiguration.getTenantId())) { - tenant = mapperLayer.mapTenant(aaiTenant); - } - } - if(tenant.getTenantId() == null || tenant.getTenantName() == null) { - throw new Exception("Invalid tenant information retrieved: tenantId = " + tenant.getTenantId() - + " tenantName = " + tenant.getTenantName()); - } - } - return tenant; - } - - protected ServiceSubscription getServiceSubscription(RequestDetails requestDetails, Customer customer) { - org.onap.aai.domain.yang.ServiceSubscription aaiServiceSubscription = bbInputSetupUtils - .getAAIServiceSubscription(customer.getGlobalCustomerId(), - requestDetails.getRequestParameters().getSubscriptionServiceType()); - if (aaiServiceSubscription != null) { - return mapperLayer.mapAAIServiceSubscription(aaiServiceSubscription); - } else { - return null; - } - } - - protected Customer getCustomerFromRequest(RequestDetails requestDetails) { - org.onap.aai.domain.yang.Customer aaiCustomer = bbInputSetupUtils - .getAAICustomer(requestDetails.getSubscriberInfo().getGlobalSubscriberId()); - if (aaiCustomer != null) { - return mapperLayer.mapAAICustomer(aaiCustomer); - } else { - return null; - } - } - - protected ServiceInstance getALaCarteServiceInstance(Service service, RequestDetails requestDetails, - Customer customer, Project project, OwningEntity owningEntity, Map<ResourceKey, String> lookupKeyMap, - String serviceInstanceId, boolean aLaCarte, String bbName) throws Exception { - ServiceInstance serviceInstance = this.getServiceInstanceHelper(requestDetails, customer, project, owningEntity, - lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); - org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = null; - if(customer != null && customer.getServiceSubscription() != null) { - serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(), - customer.getServiceSubscription().getServiceType(), serviceInstanceId); - } else { - serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); - } - if (serviceInstanceAAI != null - && !serviceInstanceAAI.getModelVersionId().equalsIgnoreCase(service.getModelUUID())) { - Service tempService = this.bbInputSetupUtils - .getCatalogServiceByModelUUID(serviceInstanceAAI.getModelVersionId()); - if (tempService != null) { - serviceInstance - .setModelInfoServiceInstance(mapperLayer.mapCatalogServiceIntoServiceInstance(tempService)); - return serviceInstance; - } else { - throw new Exception( - "Could not find model of existing SI. Service Instance in AAI already exists with different model version id: " - + serviceInstanceAAI.getModelVersionId()); - } - } - serviceInstance.setModelInfoServiceInstance(mapperLayer.mapCatalogServiceIntoServiceInstance(service)); - return serviceInstance; - } - - protected GeneralBuildingBlock getGBBMacro(ExecuteBuildingBlock executeBB, RequestDetails requestDetails, - Map<ResourceKey, String> lookupKeyMap, String requestAction, String resourceId, String vnfType) - throws Exception { - String bbName = executeBB.getBuildingBlock().getBpmnFlowName(); - String key = executeBB.getBuildingBlock().getKey(); - - if (requestAction.equalsIgnoreCase("deleteInstance") - || requestAction.equalsIgnoreCase("unassignInstance") - || requestAction.equalsIgnoreCase("activateInstance") - || requestAction.equalsIgnoreCase("activateFabricConfiguration") - || requestAction.equalsIgnoreCase("recreateInstance") - || requestAction.equalsIgnoreCase("replaceInstance")) { - return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, requestAction, - requestDetails.getCloudConfiguration()); - } - - String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID); - GeneralBuildingBlock gBB = this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, - serviceInstanceId); - RequestParameters requestParams = requestDetails.getRequestParameters(); - Service service = null; - if (gBB != null && gBB.getServiceInstance() != null - && gBB.getServiceInstance().getModelInfoServiceInstance() != null - && gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid() != null) { - service = bbInputSetupUtils.getCatalogServiceByModelUUID( - gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); - } else { - throw new Exception("Could not get service instance for macro request"); - } - if (requestParams != null && requestParams.getUserParams() != null) { - for(Map<String, Object> userParams : requestParams.getUserParams()) { - if(userParams.containsKey("service")) { - String input = mapper.writeValueAsString(userParams.get("service")); - return getGBBMacroUserParams(executeBB, requestDetails, lookupKeyMap, vnfType, bbName, key, gBB, - requestParams, service, input); - } - } - } - if (requestAction.equalsIgnoreCase("deactivateInstance")) { - return gBB; - } else if (requestAction.equalsIgnoreCase("createInstance")) { - return getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, bbName, key, gBB, service); - } else { - throw new IllegalArgumentException( - "No user params on requestAction: assignInstance. Please specify user params."); - } - } - - protected GeneralBuildingBlock getGBBMacroNoUserParamsCreate(ExecuteBuildingBlock executeBB, - Map<ResourceKey, String> lookupKeyMap, String bbName, String key, GeneralBuildingBlock gBB, Service service) - throws Exception { - ServiceInstance serviceInstance = gBB.getServiceInstance(); - if (bbName.contains(NETWORK) && !bbName.contains(NETWORK_COLLECTION)) { - String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID); - ModelInfo networkModelInfo = new ModelInfo(); - if((!Boolean.TRUE.equals(executeBB.getBuildingBlock().getIsVirtualLink()))) { - NetworkResourceCustomization networkCust = getNetworkCustomizationByKey(key, service); - if (networkCust != null) { - networkModelInfo.setModelCustomizationUuid(networkCust.getModelCustomizationUUID()); - this.populateL3Network(null, networkModelInfo, service, bbName, serviceInstance, lookupKeyMap, - networkId, null); - } else { - logger.debug("Could not find a network customization with key: {}", key); - } - } else { - logger.debug("Orchestrating on Collection Network Resource Customization"); - CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key); - L3Network l3Network = getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId, collectionNetworkResourceCust, serviceInstance); - NetworkResourceCustomization networkResourceCustomization = - mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); - if(l3Network != null) { - l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization)); - } - } - } else if(bbName.contains("Configuration")) { - String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); - ModelInfo configurationModelInfo = new ModelInfo(); - configurationModelInfo.setModelCustomizationUuid(key); - this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys()); - } - if (executeBB.getWorkflowResourceIds() != null) { - this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance, - executeBB.getWorkflowResourceIds().getNetworkCollectionId(), key); - } - return gBB; - } - - protected L3Network getVirtualLinkL3Network(Map<ResourceKey, String> lookupKeyMap, String bbName, String key, - String networkId, CollectionNetworkResourceCustomization collectionNetworkResourceCust, ServiceInstance serviceInstance) { - if(collectionNetworkResourceCust != null) { - if((bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) - || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { - L3Network network = createNetwork(lookupKeyMap, null, networkId, null); - serviceInstance.getNetworks().add(network); - return network; - } else { - for (L3Network network : serviceInstance.getNetworks()) { - if (network.getNetworkId().equalsIgnoreCase(networkId)) { - return network; - } - } - } - } - return null; - } - - protected NetworkResourceCustomization getNetworkCustomizationByKey(String key, Service service) { - for (NetworkResourceCustomization networkCust : service.getNetworkCustomizations()) { - if (networkCust.getModelCustomizationUUID().equalsIgnoreCase(key)) { - return networkCust; - } - } - return null; - } - - protected GeneralBuildingBlock getGBBMacroExistingService(ExecuteBuildingBlock executeBB, - Map<ResourceKey, String> lookupKeyMap, String bbName, String requestAction, CloudConfiguration cloudConfiguration) throws Exception { - org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null; - String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID); - RequestDetails requestDetails = executeBB.getRequestDetails(); - GeneralBuildingBlock gBB = null; - if (serviceInstanceId != null) { - aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); - } - Service service = null; - if (aaiServiceInstance != null) { - service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); - } - if (aaiServiceInstance != null && service != null) { - ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance); - serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service)); - gBB = populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); - } else { - logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance); - logger.debug("Related Service Instance Model Info from AAI: {}", service); - throw new Exception("Could not find relevant information for related Service Instance"); - } - ServiceInstance serviceInstance = gBB.getServiceInstance(); - CloudRegion cloudRegion = null; - if(cloudConfiguration == null) { - Optional<CloudRegion> cloudRegionOp = cloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance); - if(cloudRegionOp.isPresent()) { - cloudRegion = cloudRegionOp.get(); - } - } - if (cloudConfiguration != null) { - org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration); - cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); - } - gBB.setCloudRegion(cloudRegion); - if (bbName.contains(VNF)) { - for (GenericVnf genericVnf : serviceInstance.getVnfs()) { - if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null - && genericVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { - org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId()); - ModelInfo modelInfo = new ModelInfo(); - if (vnf != null) { - modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId()); - } - this.mapCatalogVnf(genericVnf, modelInfo, service); - } - } - } else if (bbName.contains(VF_MODULE)) { - for (GenericVnf vnf : serviceInstance.getVnfs()) { - for (VfModule vfModule : vnf.getVfModules()) { - if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null - && vfModule.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) { - String vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) - .getModelCustomizationId(); - ModelInfo vnfModelInfo = new ModelInfo(); - vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); - this.mapCatalogVnf(vnf, vnfModelInfo, service); - lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId()); - String vfModuleCustomizationUUID = this.bbInputSetupUtils - .getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId(); - ModelInfo vfModuleModelInfo = new ModelInfo(); - vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID); - this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID); - if(cloudRegion != null) { - Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(vnf, vfModuleModelInfo, cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), lookupKeyMap); - if(volumeGroupIdOp.isPresent()) { - lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get()); - } - } - break; - } - } - } - } else if (bbName.contains(VOLUME_GROUP)) { - for (GenericVnf vnf : serviceInstance.getVnfs()) { - for (VolumeGroup volumeGroup : vnf.getVolumeGroups()) { - if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroup.getVolumeGroupId() - .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID))) { - String vnfModelCustomizationUUID = this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()) - .getModelCustomizationId(); - ModelInfo vnfModelInfo = new ModelInfo(); - vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); - this.mapCatalogVnf(vnf, vnfModelInfo, service); - lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId()); - if (cloudRegion != null) { - String volumeGroupCustomizationUUID = this.bbInputSetupUtils.getAAIVolumeGroup(cloudRegion.getCloudOwner(), - cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()) - .getModelCustomizationId(); - ModelInfo volumeGroupModelInfo = new ModelInfo(); - volumeGroupModelInfo.setModelCustomizationId(volumeGroupCustomizationUUID); - this.mapCatalogVolumeGroup(volumeGroup, volumeGroupModelInfo, service, - vnfModelCustomizationUUID); - } - break; - } - } - } - } else if (bbName.contains(NETWORK)) { - for (L3Network network : serviceInstance.getNetworks()) { - if (lookupKeyMap.get(ResourceKey.NETWORK_ID) != null - && network.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) { - String networkCustomizationUUID = this.bbInputSetupUtils.getAAIL3Network(network.getNetworkId()) - .getModelCustomizationId(); - ModelInfo modelInfo = new ModelInfo(); - modelInfo.setModelCustomizationUuid(networkCustomizationUUID); - this.mapCatalogNetwork(network, modelInfo, service); - break; - } - } - } else if (bbName.contains("Fabric")) { - for(Configuration configuration : serviceInstance.getConfigurations()) { - if(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null - && configuration.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) { - String configurationCustUUID = this.bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()) - .getModelCustomizationId(); - ModelInfo modelInfo = new ModelInfo(); - modelInfo.setModelCustomizationUuid(configurationCustUUID); - this.mapCatalogConfiguration(configuration, modelInfo, service, executeBB.getConfigurationResourceKeys()); - break; - } - } - } - if (executeBB.getWorkflowResourceIds() != null) { - this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance, - executeBB.getWorkflowResourceIds().getNetworkCollectionId(), executeBB.getBuildingBlock().getKey()); - } - return gBB; - } - - protected GeneralBuildingBlock getGBBMacroUserParams(ExecuteBuildingBlock executeBB, RequestDetails requestDetails, - Map<ResourceKey, String> lookupKeyMap, String vnfType, String bbName, String key, GeneralBuildingBlock gBB, - RequestParameters requestParams, Service service, String input) throws Exception { - ServiceInstance serviceInstance = gBB.getServiceInstance(); - org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(input, - org.onap.so.serviceinstancebeans.Service.class); - - Resources resources = serviceMacro.getResources(); - Vnfs vnfs = null; - VfModules vfModules = null; - Networks networks = null; - CloudConfiguration cloudConfiguration = requestDetails.getCloudConfiguration(); - CloudRegion cloudRegion = getCloudRegionFromMacroRequest(cloudConfiguration, resources); - gBB.setCloudRegion(cloudRegion); - if (bbName.contains(VNF)) { - vnfs = findVnfsByKey(key, resources, vnfs); - String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); - // This stores the vnf id in request db to be retrieved later when - // working on a vf module or volume group - InfraActiveRequests request = this.bbInputSetupUtils.getInfraActiveRequest(executeBB.getRequestId()); - if (request != null) { - this.bbInputSetupUtils.updateInfraActiveRequestVnfId(request, vnfId); - } - String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId(); - this.populateGenericVnf(vnfs.getModelInfo(), vnfs.getInstanceName(), vnfs.getPlatform(), - vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null, vnfId, vnfType, vnfs.getInstanceParams(), - productFamilyId); - } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) { - Pair<Vnfs, VfModules> vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources); - vfModules = vnfsAndVfModules.getValue1(); - vnfs = vnfsAndVfModules.getValue0(); - lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, getVnfId(executeBB, lookupKeyMap)); - if (vnfs == null) { - throw new Exception("Could not find Vnf to orchestrate VfModule"); - } - ModelInfo modelInfo = vfModules.getModelInfo(); - if (bbName.contains(VOLUME_GROUP)) { - String volumeGroupId = lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID); - this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, volumeGroupId, null, - vfModules.getVolumeGroupInstanceName(), vnfType, vfModules.getInstanceParams()); - } else { - String vfModuleId = lookupKeyMap.get(ResourceKey.VF_MODULE_ID); - CloudConfiguration cloudConfig = new CloudConfiguration(); - cloudConfig.setLcpCloudRegionId(cloudRegion.getLcpCloudRegionId()); - cloudConfig.setCloudOwner(cloudRegion.getCloudOwner()); - this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, vfModuleId, null, - vfModules.getInstanceName(), vfModules.getInstanceParams(), cloudConfig); - } - } else if (bbName.contains(NETWORK)) { - networks = findNetworksByKey(key, resources); - String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID); - this.populateL3Network(networks.getInstanceName(), networks.getModelInfo(), service, bbName, - serviceInstance, lookupKeyMap, networkId, networks.getInstanceParams()); - } else if (bbName.contains("Configuration")) { - String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); - ModelInfo configurationModelInfo = new ModelInfo(); - configurationModelInfo.setModelCustomizationUuid(key); - ConfigurationResourceCustomization configurationCust = findConfigurationResourceCustomization(configurationModelInfo, service); - if(configurationCust != null) { - this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys()); - } else { - logger.debug("Could not find a configuration customization with key: {}", key); - } - } - return gBB; - } - - protected Networks findNetworksByKey(String key, Resources resources) { - for (Networks networks : resources.getNetworks()) { - if (networks.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) { - return networks; - } - } - return null; - } - - protected Pair<Vnfs, VfModules> getVfModulesAndItsVnfsByKey(String key, Resources resources) { - for (Vnfs vnfs : resources.getVnfs()) { - for (VfModules vfModules : vnfs.getVfModules()) { - if (vfModules.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) { - return new Pair<Vnfs, VfModules>(vnfs, vfModules); - } - } - } - return null; - } - - protected Vnfs findVnfsByKey(String key, Resources resources, Vnfs vnfs) { - for (Vnfs tempVnfs : resources.getVnfs()) { - if (tempVnfs.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) { - vnfs = tempVnfs; - break; - } - } - return vnfs; - } - - protected CloudRegion getCloudRegionFromMacroRequest(CloudConfiguration cloudConfiguration, Resources resources) { - if(cloudConfiguration == null) { - for(Vnfs vnfs : resources.getVnfs()) { - if(cloudConfiguration == null) { - cloudConfiguration = vnfs.getCloudConfiguration(); - } else { - break; - } - for(VfModules vfModules : vnfs.getVfModules()) { - if(cloudConfiguration == null) { - cloudConfiguration = vfModules.getCloudConfiguration(); - } else { - break; - } - } - } - for(Networks networks : resources.getNetworks()) { - if(cloudConfiguration == null) { - cloudConfiguration = networks.getCloudConfiguration(); - } else { - break; - } - } - } - if(cloudConfiguration != null) { - org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration); - return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); - } else { - logger.debug("Could not find any cloud configuration for this request."); - return null; - } - } - - protected String getVnfId(ExecuteBuildingBlock executeBB, Map<ResourceKey, String> lookupKeyMap) { - String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); - if (vnfId == null) { - InfraActiveRequests request = this.bbInputSetupUtils.getInfraActiveRequest(executeBB.getRequestId()); - vnfId = request.getVnfId(); - } - - return vnfId; - } - - protected String generateRandomUUID() { - return UUID.randomUUID().toString(); - } - - protected ServiceInstance getServiceInstanceHelper(RequestDetails requestDetails, Customer customer, - Project project, OwningEntity owningEntity, Map<ResourceKey, String> lookupKeyMap, String serviceInstanceId, - boolean aLaCarte, Service service, String bbName) throws Exception { - if (requestDetails.getRequestInfo().getInstanceName() == null && aLaCarte - && bbName.equalsIgnoreCase(AssignFlows.SERVICE_INSTANCE.toString())) { - throw new Exception("Request invalid missing: RequestInfo:InstanceName"); - } else { - org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = null; - if (aLaCarte && bbName.equalsIgnoreCase(AssignFlows.SERVICE_INSTANCE.toString())) { - serviceInstanceAAI = bbInputSetupUtils - .getAAIServiceInstanceByName(requestDetails.getRequestInfo().getInstanceName(), customer); - } - if (serviceInstanceId != null && serviceInstanceAAI == null) { - if(customer != null && customer.getServiceSubscription() != null) { - serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(), - customer.getServiceSubscription().getServiceType(), serviceInstanceId); - } else { - serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); - } - } - if (serviceInstanceAAI != null) { - lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId); - return this.getExistingServiceInstance(serviceInstanceAAI); - } else { - return createServiceInstance(requestDetails, project, owningEntity, lookupKeyMap, - serviceInstanceId); - } - } - } - - protected ServiceInstance createServiceInstance(RequestDetails requestDetails, Project project, - OwningEntity owningEntity, Map<ResourceKey, String> lookupKeyMap, String serviceInstanceId) { - ServiceInstance serviceInstance = new ServiceInstance(); - lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId); - serviceInstance.setServiceInstanceId(serviceInstanceId); - if(requestDetails.getRequestInfo() != null) { - serviceInstance.setServiceInstanceName(requestDetails.getRequestInfo().getInstanceName()); - } - serviceInstance.setOrchestrationStatus(OrchestrationStatus.PRECREATED); - serviceInstance.setProject(project); - serviceInstance.setOwningEntity(owningEntity); - return serviceInstance; - } - - public ServiceInstance getExistingServiceInstance(org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI) - throws Exception { - ServiceInstance serviceInstance = mapperLayer.mapAAIServiceInstanceIntoServiceInstance(serviceInstanceAAI); - if (serviceInstanceAAI.getRelationshipList() != null - && serviceInstanceAAI.getRelationshipList().getRelationship() != null - && !serviceInstanceAAI.getRelationshipList().getRelationship().isEmpty()) { - addRelationshipsToSI(serviceInstanceAAI, serviceInstance); - } - return serviceInstance; - } - - protected void populateNetworkCollectionAndInstanceGroupAssign(Service service, String bbName, - ServiceInstance serviceInstance, String resourceId, String key) throws Exception { - if (serviceInstance.getCollection() == null - && bbName.equalsIgnoreCase(AssignFlows.NETWORK_COLLECTION.toString())) { - Collection collection = this.createCollection(resourceId); - serviceInstance.setCollection(collection); - this.mapCatalogCollection(service, serviceInstance.getCollection(), key); - if(isVlanTagging(service, key)) { - InstanceGroup instanceGroup = this.createInstanceGroup(); - serviceInstance.getCollection().setInstanceGroup(instanceGroup); - this.mapCatalogNetworkCollectionInstanceGroup(service, - serviceInstance.getCollection().getInstanceGroup(), key); - } - } - } - - protected CollectionResourceCustomization findCatalogNetworkCollection(Service service, String key) { - for(CollectionResourceCustomization collectionCust : service.getCollectionResourceCustomizations()){ - if(collectionCust.getModelCustomizationUUID().equalsIgnoreCase(key)) { - return collectionCust; - } - } - return null; - } - - protected boolean isVlanTagging(Service service, String key) { - CollectionResourceCustomization collectionCust = findCatalogNetworkCollection(service, key); - if (collectionCust != null) { - CollectionResource collectionResource = collectionCust.getCollectionResource(); - if (collectionResource != null - && collectionResource.getInstanceGroup() != null - && collectionResource.getInstanceGroup().getToscaNodeType() != null - && collectionResource.getInstanceGroup().getToscaNodeType().contains("NetworkCollection")) { - return true; - } - } - return false; - } - - protected void mapCatalogNetworkCollectionInstanceGroup(Service service, InstanceGroup instanceGroup, String key) { - CollectionResourceCustomization collectionCust = this.findCatalogNetworkCollection(service, key); - org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = collectionCust.getCollectionResource().getInstanceGroup(); - instanceGroup.setModelInfoInstanceGroup( - mapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionCust, catalogInstanceGroup)); - } - - protected void mapCatalogCollection(Service service, Collection collection, String key) { - CollectionResourceCustomization collectionCust = findCatalogNetworkCollection(service, key); - if (collectionCust != null) { - CollectionResource collectionResource = collectionCust.getCollectionResource(); - if (collectionResource != null) { - collection.setModelInfoCollection( - mapperLayer.mapCatalogCollectionToCollection(collectionCust, collectionResource)); - } - } - } - - protected Collection createCollection(String collectionId) { - Collection collection = new Collection(); - collection.setId(collectionId); - collection.setOrchestrationStatus(OrchestrationStatus.PRECREATED); - return collection; - } - - protected InstanceGroup createInstanceGroup() { - InstanceGroup instanceGroup = new InstanceGroup(); - String instanceGroupId = this.generateRandomUUID(); - instanceGroup.setId(instanceGroupId); - return instanceGroup; - } - - protected void addRelationshipsToSI(org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI, - ServiceInstance serviceInstance) throws Exception { - AAIResultWrapper serviceInstanceWrapper = new AAIResultWrapper( - new AAICommonObjectMapperProvider().getMapper().writeValueAsString(serviceInstanceAAI)); - Optional<Relationships> relationshipsOp = serviceInstanceWrapper.getRelationships(); - Relationships relationships = null; - if (relationshipsOp.isPresent()) { - relationships = relationshipsOp.get(); - } else { - return; - } - - this.mapProject(relationships.getByType(AAIObjectType.PROJECT), serviceInstance); - this.mapOwningEntity(relationships.getByType(AAIObjectType.OWNING_ENTITY), serviceInstance); - this.mapL3Networks(relationships.getRelatedAAIUris(AAIObjectType.L3_NETWORK), serviceInstance.getNetworks()); - this.mapGenericVnfs(relationships.getRelatedAAIUris(AAIObjectType.GENERIC_VNF), serviceInstance.getVnfs()); - this.mapCollection(relationships.getByType(AAIObjectType.COLLECTION), serviceInstance); - this.mapConfigurations(relationships.getRelatedAAIUris(AAIObjectType.CONFIGURATION), serviceInstance.getConfigurations()); - } - - protected void mapConfigurations(List<AAIResourceUri> relatedAAIUris, List<Configuration> configurations) { - for (AAIResourceUri aaiResourceUri : relatedAAIUris) { - configurations.add(mapConfiguration(aaiResourceUri)); - } - } - - protected Configuration mapConfiguration(AAIResourceUri aaiResourceUri) { - AAIResultWrapper aaiConfigurationWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri); - Optional<org.onap.aai.domain.yang.Configuration> aaiConfigurationOp = aaiConfigurationWrapper - .asBean(org.onap.aai.domain.yang.Configuration.class); - if (!aaiConfigurationOp.isPresent()) { - return null; - } - - return this.mapperLayer.mapAAIConfiguration(aaiConfigurationOp.get()); - } - - protected void mapGenericVnfs(List<AAIResourceUri> list, List<GenericVnf> genericVnfs) { - for (AAIResourceUri aaiResourceUri : list) { - genericVnfs.add(this.mapGenericVnf(aaiResourceUri)); - } - } - - protected GenericVnf mapGenericVnf(AAIResourceUri aaiResourceUri) { - AAIResultWrapper aaiGenericVnfWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri); - Optional<org.onap.aai.domain.yang.GenericVnf> aaiGenericVnfOp = aaiGenericVnfWrapper - .asBean(org.onap.aai.domain.yang.GenericVnf.class); - if (!aaiGenericVnfOp.isPresent()) { - return null; - } - - GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnfOp.get()); - - Optional<Relationships> relationshipsOp = aaiGenericVnfWrapper.getRelationships(); - if (relationshipsOp.isPresent()) { - Relationships relationships = relationshipsOp.get(); - this.mapPlatform(relationships.getByType(AAIObjectType.PLATFORM), genericVnf); - this.mapLineOfBusiness(relationships.getByType(AAIObjectType.LINE_OF_BUSINESS), genericVnf); - genericVnf.getVolumeGroups().addAll(mapVolumeGroups(relationships.getByType(AAIObjectType.VOLUME_GROUP))); - genericVnf.getInstanceGroups().addAll(mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP))); - } - - return genericVnf; - } - - protected List<InstanceGroup> mapInstanceGroups(List<AAIResultWrapper> instanceGroups) { - List<InstanceGroup> instanceGroupsList = new ArrayList<>(); - for (AAIResultWrapper volumeGroupWrapper : instanceGroups) { - instanceGroupsList.add(this.mapInstanceGroup(volumeGroupWrapper)); - } - return instanceGroupsList; - } - - protected InstanceGroup mapInstanceGroup(AAIResultWrapper instanceGroupWrapper) { - Optional<org.onap.aai.domain.yang.InstanceGroup> aaiInstanceGroupOp = instanceGroupWrapper - .asBean(org.onap.aai.domain.yang.InstanceGroup.class); - org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = null; - - if (!aaiInstanceGroupOp.isPresent()) { - return null; - } - - aaiInstanceGroup = aaiInstanceGroupOp.get(); - InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstanceGroup); - instanceGroup.setModelInfoInstanceGroup(this.mapperLayer.mapCatalogInstanceGroupToInstanceGroup(null, - this.bbInputSetupUtils.getCatalogInstanceGroup(aaiInstanceGroup.getModelVersionId()))); - return instanceGroup; - } - - protected List<VolumeGroup> mapVolumeGroups(List<AAIResultWrapper> volumeGroups) { - List<VolumeGroup> volumeGroupsList = new ArrayList<>(); - for (AAIResultWrapper volumeGroupWrapper : volumeGroups) { - volumeGroupsList.add(this.mapVolumeGroup(volumeGroupWrapper)); - } - return volumeGroupsList; - } - - protected VolumeGroup mapVolumeGroup(AAIResultWrapper volumeGroupWrapper) { - Optional<org.onap.aai.domain.yang.VolumeGroup> aaiVolumeGroupOp = volumeGroupWrapper - .asBean(org.onap.aai.domain.yang.VolumeGroup.class); - org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = null; - - if (!aaiVolumeGroupOp.isPresent()) { - return null; - } - - aaiVolumeGroup = aaiVolumeGroupOp.get(); - return this.mapperLayer.mapAAIVolumeGroup(aaiVolumeGroup); - } - - protected void mapLineOfBusiness(List<AAIResultWrapper> lineOfBusinesses, GenericVnf genericVnf) { - if (!lineOfBusinesses.isEmpty()) { - AAIResultWrapper lineOfBusinessWrapper = lineOfBusinesses.get(0); - Optional<org.onap.aai.domain.yang.LineOfBusiness> aaiLineOfBusinessOp = lineOfBusinessWrapper - .asBean(org.onap.aai.domain.yang.LineOfBusiness.class); - org.onap.aai.domain.yang.LineOfBusiness aaiLineOfBusiness = null; - if (!aaiLineOfBusinessOp.isPresent()) { - return; - } - aaiLineOfBusiness = aaiLineOfBusinessOp.get(); - - LineOfBusiness lineOfBusiness = this.mapperLayer.mapAAILineOfBusiness(aaiLineOfBusiness); - genericVnf.setLineOfBusiness(lineOfBusiness); - } - } - - protected void mapPlatform(List<AAIResultWrapper> platforms, GenericVnf genericVnf) { - if (!platforms.isEmpty()) { - AAIResultWrapper platformWrapper = platforms.get(0); - Optional<org.onap.aai.domain.yang.Platform> aaiPlatformOp = platformWrapper - .asBean(org.onap.aai.domain.yang.Platform.class); - org.onap.aai.domain.yang.Platform aaiPlatform = null; - if (!aaiPlatformOp.isPresent()) { - return; - } - aaiPlatform = aaiPlatformOp.get(); - - Platform platform = this.mapperLayer.mapAAIPlatform(aaiPlatform); - genericVnf.setPlatform(platform); - } - } - - protected void mapCollection(List<AAIResultWrapper> collections, ServiceInstance serviceInstance) { - if (!collections.isEmpty()) { - AAIResultWrapper collectionWrapper = collections.get(0); - Optional<org.onap.aai.domain.yang.Collection> aaiCollectionOp = collectionWrapper - .asBean(org.onap.aai.domain.yang.Collection.class); - org.onap.aai.domain.yang.Collection aaiCollection = null; - if (!aaiCollectionOp.isPresent()) { - return; - } - aaiCollection = aaiCollectionOp.get(); - - Collection collection = this.mapperLayer.mapAAICollectionIntoCollection(aaiCollection); - NetworkCollectionResourceCustomization collectionResourceCust = - bbInputSetupUtils.getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId()); - collection.setModelInfoCollection(mapperLayer.mapCatalogCollectionToCollection(collectionResourceCust, collectionResourceCust.getCollectionResource())); - Optional<Relationships> relationshipsOp = collectionWrapper.getRelationships(); - Relationships relationships = null; - if (relationshipsOp.isPresent()) { - relationships = relationshipsOp.get(); - } else { - serviceInstance.setCollection(collection); - return; - } - List<InstanceGroup> instanceGroupsList = mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP)); - if(!instanceGroupsList.isEmpty()) { - collection.setInstanceGroup(instanceGroupsList.get(0)); - } - serviceInstance.setCollection(collection); - } - } - - protected void mapL3Networks(List<AAIResourceUri> list, List<L3Network> l3Networks) { - for (AAIResourceUri aaiResourceUri : list) { - l3Networks.add(this.mapL3Network(aaiResourceUri)); - } - } - - protected L3Network mapL3Network(AAIResourceUri aaiResourceUri) { - AAIResultWrapper aaiNetworkWrapper = this.bbInputSetupUtils.getAAIResourceDepthTwo(aaiResourceUri); - Optional<org.onap.aai.domain.yang.L3Network> aaiL3NetworkOp = aaiNetworkWrapper - .asBean(org.onap.aai.domain.yang.L3Network.class); - org.onap.aai.domain.yang.L3Network aaiL3Network = null; - - if (!aaiL3NetworkOp.isPresent()) { - return null; - } - - aaiL3Network = aaiL3NetworkOp.get(); - L3Network network = this.mapperLayer.mapAAIL3Network(aaiL3Network); - - Optional<Relationships> relationshipsOp = aaiNetworkWrapper.getRelationships(); - if (relationshipsOp.isPresent()) { - Relationships relationships = relationshipsOp.get(); - this.mapNetworkPolicies(relationships.getByType(AAIObjectType.NETWORK_POLICY), - network.getNetworkPolicies()); - mapRouteTableReferences(relationships.getByType(AAIObjectType.ROUTE_TABLE_REFERENCE), - network.getContrailNetworkRouteTableReferences()); - } - - return network; - } - - protected void mapNetworkPolicies(List<AAIResultWrapper> aaiNetworkPolicies, List<NetworkPolicy> networkPolicies) { - for (AAIResultWrapper networkPolicyWrapper : aaiNetworkPolicies) { - networkPolicies.add(this.mapNetworkPolicy(networkPolicyWrapper)); - } - } - - protected NetworkPolicy mapNetworkPolicy(AAIResultWrapper networkPolicyWrapper) { - Optional<org.onap.aai.domain.yang.NetworkPolicy> aaiNetworkPolicyOp = networkPolicyWrapper - .asBean(org.onap.aai.domain.yang.NetworkPolicy.class); - org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy = null; - - if (!aaiNetworkPolicyOp.isPresent()) { - return null; - } - - aaiNetworkPolicy = aaiNetworkPolicyOp.get(); - return this.mapperLayer.mapAAINetworkPolicy(aaiNetworkPolicy); - } - - protected void mapRouteTableReferences(List<AAIResultWrapper> routeTableReferences, - List<RouteTableReference> contrailNetworkRouteTableReferences) { - for (AAIResultWrapper routeTableReferenceWrapper : routeTableReferences) { - contrailNetworkRouteTableReferences.add(this.mapRouteTableReference(routeTableReferenceWrapper)); - } - } - - protected RouteTableReference mapRouteTableReference(AAIResultWrapper routeTableReferenceWrapper) { - Optional<org.onap.aai.domain.yang.RouteTableReference> aaiRouteTableReferenceOp = routeTableReferenceWrapper - .asBean(org.onap.aai.domain.yang.RouteTableReference.class); - org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference = null; - - if (!aaiRouteTableReferenceOp.isPresent()) { - return null; - } - - aaiRouteTableReference = aaiRouteTableReferenceOp.get(); - return this.mapperLayer.mapAAIRouteTableReferenceIntoRouteTableReference(aaiRouteTableReference); - } - - protected void mapOwningEntity(List<AAIResultWrapper> owningEntities, ServiceInstance serviceInstance) { - if (!owningEntities.isEmpty()) { - AAIResultWrapper owningEntityWrapper = owningEntities.get(0); - Optional<org.onap.aai.domain.yang.OwningEntity> aaiOwningEntityOp = owningEntityWrapper - .asBean(org.onap.aai.domain.yang.OwningEntity.class); - org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = null; - if (!aaiOwningEntityOp.isPresent()) { - return; - } - aaiOwningEntity = aaiOwningEntityOp.get(); - - OwningEntity owningEntity = this.mapperLayer.mapAAIOwningEntity(aaiOwningEntity); - serviceInstance.setOwningEntity(owningEntity); - } - } - - protected void mapProject(List<AAIResultWrapper> projects, ServiceInstance serviceInstance) { - if (!projects.isEmpty()) { - AAIResultWrapper projectWrapper = projects.get(0); - Optional<org.onap.aai.domain.yang.Project> aaiProjectOp = projectWrapper - .asBean(org.onap.aai.domain.yang.Project.class); - org.onap.aai.domain.yang.Project aaiProject = null; - if (!aaiProjectOp.isPresent()) { - return; - } - aaiProject = aaiProjectOp.get(); - - Project project = this.mapperLayer.mapAAIProject(aaiProject); - serviceInstance.setProject(project); - } - } - protected Customer mapCustomer(String globalCustomerId, String subscriptionServiceType) { - org.onap.aai.domain.yang.Customer aaiCustomer = this.bbInputSetupUtils.getAAICustomer(globalCustomerId); - org.onap.aai.domain.yang.ServiceSubscription aaiServiceSubscription = this.bbInputSetupUtils - .getAAIServiceSubscription(globalCustomerId, subscriptionServiceType); - Customer customer = this.mapperLayer.mapAAICustomer(aaiCustomer); - ServiceSubscription serviceSubscription = this.mapperLayer.mapAAIServiceSubscription(aaiServiceSubscription); - if(serviceSubscription != null){ - customer.setServiceSubscription(serviceSubscription); - } - return customer; - } + private static final Logger logger = LoggerFactory.getLogger(BBInputSetup.class); + private static final String FLOW_VAR_NAME = "flowToBeCalled"; + private static final String LOOKUP_KEY_MAP_VAR_NAME = "lookupKeyMap"; + private static final String GBB_INPUT_VAR_NAME = "gBBInput"; + private static final String EXECUTE_BB_VAR_NAME = "buildingBlock"; + private static final String VOLUME_GROUP = "VolumeGroup"; + private static final String VF_MODULE = "VfModule"; + private static final String NETWORK = "Network"; + private static final String VNF = "Vnf"; + private static final String NETWORK_COLLECTION = "NetworkCollection"; + private static final String PREPROV = "PREPROV"; + + @Autowired + private BBInputSetupUtils bbInputSetupUtils; + + @Autowired + private BBInputSetupMapperLayer mapperLayer; + + @Autowired + private CloudInfoFromAAI cloudInfoFromAAI; + + @Autowired + private ExceptionBuilder exceptionUtil; + + private ObjectMapper mapper = new ObjectMapper(); + + public BBInputSetupUtils getBbInputSetupUtils() { + return bbInputSetupUtils; + } + + public void setCloudInfoFromAAI(CloudInfoFromAAI cloudInfoFromAAI) { + this.cloudInfoFromAAI = cloudInfoFromAAI; + } + + public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) { + this.bbInputSetupUtils = bbInputSetupUtils; + } + + public BBInputSetupMapperLayer getMapperLayer() { + return mapperLayer; + } + + public void setMapperLayer(BBInputSetupMapperLayer mapperLayer) { + this.mapperLayer = mapperLayer; + } + + @Override + public void execute(DelegateExecution execution) throws Exception { + try { + GeneralBuildingBlock outputBB = null; + ExecuteBuildingBlock executeBB = this.getExecuteBBFromExecution(execution); + String resourceId = executeBB.getResourceId(); + String requestAction = executeBB.getRequestAction(); + String vnfType = executeBB.getVnfType(); + boolean aLaCarte = Boolean.TRUE.equals(executeBB.isaLaCarte()); + boolean homing = Boolean.TRUE.equals(executeBB.isHoming()); + Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); + outputBB = this.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, resourceId, vnfType); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.INDENT_OUTPUT); + logger.debug("GeneralBB: " + mapper.writeValueAsString(outputBB)); + + setHomingFlag(outputBB, homing, lookupKeyMap); + + execution.setVariable(FLOW_VAR_NAME, executeBB.getBuildingBlock().getBpmnFlowName()); + execution.setVariable(GBB_INPUT_VAR_NAME, outputBB); + execution.setVariable(LOOKUP_KEY_MAP_VAR_NAME, lookupKeyMap); + + BuildingBlockExecution gBuildingBlockExecution = new DelegateExecutionImpl(execution); + execution.setVariable("gBuildingBlockExecution", gBuildingBlockExecution); + execution.setVariable("RetryCount", 1); + execution.setVariable("handlingCode", "Success"); + } catch (Exception e) { + logger.error("Exception occurred", e); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e.getMessage()); + } + } + + protected void setHomingFlag(GeneralBuildingBlock outputBB, boolean homing, Map<ResourceKey, String> lookupKeyMap) { + + if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null && homing && outputBB != null) { + for (GenericVnf vnf : outputBB.getCustomer().getServiceSubscription().getServiceInstances().get(0) + .getVnfs()) { + if (vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnf.setCallHoming(homing); + } + } + } + } + + protected ExecuteBuildingBlock getExecuteBBFromExecution(DelegateExecution execution) { + return (ExecuteBuildingBlock) execution.getVariable(EXECUTE_BB_VAR_NAME); + } + + protected GeneralBuildingBlock getGBB(ExecuteBuildingBlock executeBB, Map<ResourceKey, String> lookupKeyMap, + String requestAction, boolean aLaCarte, String resourceId, String vnfType) throws Exception { + String requestId = executeBB.getRequestId(); + this.populateLookupKeyMapWithIds(executeBB.getWorkflowResourceIds(), lookupKeyMap); + RequestDetails requestDetails = executeBB.getRequestDetails(); + if (requestDetails == null) { + requestDetails = bbInputSetupUtils.getRequestDetails(requestId); + } + if (requestDetails.getModelInfo() == null) { + return this.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId); + } else { + ModelType modelType = requestDetails.getModelInfo().getModelType(); + if (aLaCarte && modelType.equals(ModelType.service)) { + return this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId); + } else if (aLaCarte && !modelType.equals(ModelType.service)) { + return this.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, + vnfType); + } else { + return this.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); + } + } + } + + protected void populateLookupKeyMapWithIds(WorkflowResourceIds workflowResourceIds, + Map<ResourceKey, String> lookupKeyMap) { + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, workflowResourceIds.getServiceInstanceId()); + lookupKeyMap.put(ResourceKey.NETWORK_ID, workflowResourceIds.getNetworkId()); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, workflowResourceIds.getVnfId()); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, workflowResourceIds.getVfModuleId()); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, workflowResourceIds.getVolumeGroupId()); + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, workflowResourceIds.getConfigurationId()); + lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, workflowResourceIds.getInstanceGroupId()); + } + + protected GeneralBuildingBlock getGBBALaCarteNonService(ExecuteBuildingBlock executeBB, + RequestDetails requestDetails, Map<ResourceKey, String> lookupKeyMap, String requestAction, + String resourceId, String vnfType) throws Exception { + String bbName = executeBB.getBuildingBlock().getBpmnFlowName(); + String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID); + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null; + if (serviceInstanceId != null) { + aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + } + Service service = null; + if (aaiServiceInstance != null) { + service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + } + if (aaiServiceInstance != null && service != null) { + ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance); + serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service)); + this.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap, + resourceId, vnfType, executeBB.getBuildingBlock().getKey(), + executeBB.getConfigurationResourceKeys()); + return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, + null); + } else { + logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance); + logger.debug("Related Service Instance Model Info from AAI: {}", service); + throw new Exception("Could not find relevant information for related Service Instance"); + } + } + + protected GeneralBuildingBlock getGBBCM(ExecuteBuildingBlock executeBB, RequestDetails requestDetails, + Map<ResourceKey, String> lookupKeyMap, String requestAction, String resourceId) throws Exception { + ServiceInstance serviceInstance = new ServiceInstance(); + String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID); + serviceInstance.setServiceInstanceId(serviceInstanceId); + Customer customer = new Customer(); + List<GenericVnf> genericVnfs = serviceInstance.getVnfs(); + + String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); + if (vnfId != null) { + org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); + GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf); + genericVnfs.add(genericVnf); + } + + String instanceGroupId = lookupKeyMap.get(ResourceKey.INSTANCE_GROUP_ID); + if (instanceGroupId != null) { + org.onap.aai.domain.yang.InstanceGroup aaiInstancegroup = + bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId); + InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstancegroup); + instanceGroup.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + + if (serviceInstanceId == null) { + Optional<org.onap.aai.domain.yang.ServiceInstance> aaiServiceInstanceOpt = + bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup(instanceGroupId); + if (aaiServiceInstanceOpt.isPresent()) { + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = aaiServiceInstanceOpt.get(); + serviceInstance = this.mapperLayer.mapAAIServiceInstanceIntoServiceInstance(aaiServiceInstance); + WorkflowResourceIds workflowResourceIds = executeBB.getWorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, workflowResourceIds.getServiceInstanceId()); + } else { + throw new NoServiceInstanceFoundException("Related ServiceInstance not found in A&AI."); + } + } + RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList(); + if (relatedInstanceList != null) { + for (RelatedInstanceList relatedInstList : relatedInstanceList) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { + org.onap.aai.domain.yang.GenericVnf aaiVnf = + bbInputSetupUtils.getAAIGenericVnf(relatedInstance.getInstanceId()); + GenericVnf vnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiVnf); + instanceGroup.getVnfs().add(vnf); + } + } + } + + serviceInstance.getInstanceGroups().add(instanceGroup); + customer.setServiceSubscription(new ServiceSubscription()); + } + return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, + customer); + } + + protected void populateObjectsOnAssignAndCreateFlows(RequestDetails requestDetails, Service service, String bbName, + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String vnfType, + String configurationKey, ConfigurationResourceKeys configurationResourceKeys) throws Exception { + ModelInfo modelInfo = requestDetails.getModelInfo(); + String instanceName = requestDetails.getRequestInfo().getInstanceName(); + String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId(); + ModelType modelType = modelInfo.getModelType(); + RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList(); + + org.onap.so.serviceinstancebeans.Platform platform = requestDetails.getPlatform(); + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = requestDetails.getLineOfBusiness(); + + if (modelType.equals(ModelType.network)) { + lookupKeyMap.put(ResourceKey.NETWORK_ID, resourceId); + this.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + null); + } else if (modelType.equals(ModelType.vnf)) { + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, resourceId); + this.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, + lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId); + } else if (modelType.equals(ModelType.volumeGroup)) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, resourceId); + this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + relatedInstanceList, instanceName, vnfType, null); + } else if (modelType.equals(ModelType.vfModule)) { + if (bbName.contains("Configuration")) { + String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); + ModelInfo configurationModelInfo = new ModelInfo(); + configurationModelInfo.setModelCustomizationUuid(configurationKey); + populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, + configurationId, instanceName, configurationResourceKeys); + } else { + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId); + this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration()); + } + } else if (modelType.equals(ModelType.instanceGroup)) { + lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, resourceId); + this.populateInstanceGroup(modelInfo, service, serviceInstance, resourceId, instanceName); + } else { + return; + } + } + + protected void populateInstanceGroup(ModelInfo modelInfo, Service service, ServiceInstance serviceInstance, + String instanceGroupId, String instanceName) { + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId(instanceGroupId); + instanceGroup.setInstanceGroupName(instanceName); + mapCatalogInstanceGroup(instanceGroup, modelInfo, service); + serviceInstance.getInstanceGroups().add(instanceGroup); + } + + protected void mapCatalogInstanceGroup(InstanceGroup instanceGroup, ModelInfo modelInfo, Service service) { + // @TODO: this will populate the instanceGroup model info. + // Dependent on MSO-5821 653458 US - MSO - Enhance Catalog DB Schema & Adapter to support VNF Groups + } + + protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName, + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, + String instanceName, ConfigurationResourceKeys configurationResourceKeys) { + Configuration configuration = null; + for (Configuration configurationTemp : serviceInstance.getConfigurations()) { + if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null && configurationTemp.getConfigurationId() + .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) { + configuration = configurationTemp; + org.onap.aai.domain.yang.Configuration aaiConfiguration = + bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()); + if (aaiConfiguration != null) { + modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId()); + } + } + } + if (configuration == null && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) { + configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId); + serviceInstance.getConfigurations().add(configuration); + } + if (configuration != null) { + Vnfc vnfc = getVnfcToConfiguration(configurationResourceKeys.getVnfcName()); + configuration.setVnfc(vnfc); + this.mapCatalogConfiguration(configuration, modelInfo, service, configurationResourceKeys); + } + } + + protected Vnfc getVnfcToConfiguration(String vnfcName) { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName); + Optional<org.onap.aai.domain.yang.Vnfc> vnfcOp = + bbInputSetupUtils.getAAIResourceDepthOne(uri).asBean(org.onap.aai.domain.yang.Vnfc.class); + if (vnfcOp.isPresent()) { + org.onap.aai.domain.yang.Vnfc vnfcAAI = vnfcOp.get(); + return this.mapperLayer.mapAAIVnfc(vnfcAAI); + } else { + return null; + } + } + + protected Configuration createConfiguration(Map<ResourceKey, String> lookupKeyMap, String instanceName, + String resourceId) { + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, resourceId); + Configuration configuration = new Configuration(); + configuration.setConfigurationId(resourceId); + configuration.setConfigurationName(instanceName); + configuration.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + return configuration; + } + + protected void mapCatalogConfiguration(Configuration configuration, ModelInfo modelInfo, Service service, + ConfigurationResourceKeys configurationResourceKeys) { + ConfigurationResourceCustomization configurationResourceCustomization = + findConfigurationResourceCustomization(modelInfo, service); + CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = + findVnfVfmoduleCvnfcConfigurationCustomization(service.getModelUUID(), + configurationResourceKeys.getVfModuleCustomizationUUID(), + configurationResourceKeys.getVnfResourceCustomizationUUID(), + configurationResourceKeys.getCvnfcCustomizationUUID(), configurationResourceCustomization); + if (configurationResourceCustomization != null && vnfVfmoduleCvnfcConfigurationCustomization != null) { + configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration( + configurationResourceCustomization, vnfVfmoduleCvnfcConfigurationCustomization)); + } else { + logger.debug("for Fabric configuration mapping by VF MODULE CUST UUID: " + + configurationResourceKeys.getVfModuleCustomizationUUID()); + vnfVfmoduleCvnfcConfigurationCustomization = findVnfVfmoduleCvnfcConfigurationCustomization( + service.getModelUUID(), configurationResourceKeys.getVnfResourceCustomizationUUID(), + configurationResourceKeys.getVfModuleCustomizationUUID(), + configurationResourceKeys.getCvnfcCustomizationUUID()); + if (vnfVfmoduleCvnfcConfigurationCustomization != null) { + configuration.setModelInfoConfiguration(this.mapperLayer + .mapCatalogConfigurationToConfiguration(vnfVfmoduleCvnfcConfigurationCustomization)); + } + } + } + + protected CvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String serviceModelUUID, + String vfModuleCustomizationUUID, String vnfResourceCustomizationUUID, String cvnfcCustomizationUUID, + ConfigurationResourceCustomization configurationResourceCustomization) { + return bbInputSetupUtils.getCvnfcConfigurationCustomization(serviceModelUUID, vnfResourceCustomizationUUID, + vfModuleCustomizationUUID, cvnfcCustomizationUUID); + } + + protected ConfigurationResourceCustomization findConfigurationResourceCustomization(ModelInfo modelInfo, + Service service) { + for (ConfigurationResourceCustomization resourceCust : service.getConfigurationCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { + return resourceCust; + } + } + return null; + } + + protected CvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String serviceModelUUID, + String vnfResourceCustomizationUUID, String vfModuleCustomizationUUID, String cvnfcCustomizationUUID) { + return bbInputSetupUtils.getCvnfcConfigurationCustomization(serviceModelUUID, vnfResourceCustomizationUUID, + vfModuleCustomizationUUID, cvnfcCustomizationUUID); + } + + protected void populateVfModule(ModelInfo modelInfo, Service service, String bbName, + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, + RelatedInstanceList[] relatedInstanceList, String instanceName, List<Map<String, String>> instanceParams, + CloudConfiguration cloudConfiguration) throws Exception { + String vnfModelCustomizationUUID = null; + if (relatedInstanceList != null) { + for (RelatedInstanceList relatedInstList : relatedInstanceList) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { + vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId(); + } + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.volumeGroup)) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, relatedInstance.getInstanceId()); + } + } + } + GenericVnf vnf = null; + for (GenericVnf tempVnf : serviceInstance.getVnfs()) { + if (tempVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnf = tempVnf; + vnfModelCustomizationUUID = + this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId(); + ModelInfo vnfModelInfo = new ModelInfo(); + vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); + this.mapCatalogVnf(tempVnf, vnfModelInfo, service); + Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(tempVnf, modelInfo, + cloudConfiguration.getCloudOwner(), cloudConfiguration.getLcpCloudRegionId(), lookupKeyMap); + if (volumeGroupIdOp.isPresent()) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get()); + } + break; + } + } + if (vnf != null) { + VfModule vfModule = null; + for (VfModule vfModuleTemp : vnf.getVfModules()) { + if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null + && vfModuleTemp.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) { + vfModule = vfModuleTemp; + } + String vfModuleCustId = bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModuleTemp.getVfModuleId()) + .getModelCustomizationId(); + ModelInfo modelInfoVfModule = new ModelInfo(); + modelInfoVfModule.setModelCustomizationId(vfModuleCustId); + mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, service, vnfModelCustomizationUUID); + } + if (vfModule == null && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) { + vfModule = createVfModule(lookupKeyMap, resourceId, instanceName, instanceParams); + vnf.getVfModules().add(vfModule); + mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + } + } else { + logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + throw new Exception("Could not find relevant information for related VNF"); + } + } + + protected Optional<String> getVolumeGroupIdRelatedToVfModule(GenericVnf vnf, ModelInfo modelInfo, String cloudOwner, + String cloudRegionId, Map<ResourceKey, String> lookupKeyMap) { + if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) == null) { + for (VolumeGroup volumeGroup : vnf.getVolumeGroups()) { + String volumeGroupCustId = + bbInputSetupUtils.getAAIVolumeGroup(cloudOwner, cloudRegionId, volumeGroup.getVolumeGroupId()) + .getModelCustomizationId(); + if (modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) { + return Optional.of(volumeGroup.getVolumeGroupId()); + } + } + } + return Optional.empty(); + } + + protected void mapCatalogVfModule(VfModule vfModule, ModelInfo modelInfo, Service service, + String vnfModelCustomizationUUID) { + if (modelInfo.getModelCustomizationUuid() != null) { + modelInfo.setModelCustomizationId(modelInfo.getModelCustomizationUuid()); + } + VnfResourceCustomization vnfResourceCustomization = null; + for (VnfResourceCustomization resourceCust : service.getVnfCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(vnfModelCustomizationUUID)) { + vnfResourceCustomization = resourceCust; + break; + } + } + if (vnfResourceCustomization != null) { + VfModuleCustomization vfResourceCustomization = vnfResourceCustomization.getVfModuleCustomizations() + .stream() // Convert to steam + .filter(x -> modelInfo.getModelCustomizationId().equalsIgnoreCase(x.getModelCustomizationUUID()))// find + // what + // we + // want + .findAny() // If 'findAny' then return found + .orElse(null); + if (vfResourceCustomization != null) { + vfModule.setModelInfoVfModule(this.mapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization)); + } + } + } + + protected VfModule createVfModule(Map<ResourceKey, String> lookupKeyMap, String vfModuleId, String instanceName, + List<Map<String, String>> instanceParams) { + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModuleId); + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId(vfModuleId); + vfModule.setVfModuleName(instanceName); + vfModule.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + if (instanceParams != null) { + for (Map<String, String> params : instanceParams) { + vfModule.getCloudParams().putAll(params); + } + } + return vfModule; + } + + protected void populateVolumeGroup(ModelInfo modelInfo, Service service, String bbName, + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, + RelatedInstanceList[] relatedInstanceList, String instanceName, String vnfType, + List<Map<String, String>> instanceParams) throws Exception { + VolumeGroup volumeGroup = null; + GenericVnf vnf = null; + String vnfModelCustomizationUUID = null; + String generatedVnfType = vnfType; + if (generatedVnfType == null || generatedVnfType.isEmpty()) { + generatedVnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); + } + if (relatedInstanceList != null) { + for (RelatedInstanceList relatedInstList : relatedInstanceList) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { + vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid(); + break; + } + } + } + for (GenericVnf tempVnf : serviceInstance.getVnfs()) { + if (tempVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnf = tempVnf; + vnfModelCustomizationUUID = + bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId(); + ModelInfo vnfModelInfo = new ModelInfo(); + vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); + mapCatalogVnf(tempVnf, vnfModelInfo, service); + break; + } + } + if (vnf != null && vnfModelCustomizationUUID != null) { + for (VolumeGroup volumeGroupTemp : vnf.getVolumeGroups()) { + if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroupTemp.getVolumeGroupId() + .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID))) { + volumeGroup = volumeGroupTemp; + break; + } + } + if (volumeGroup == null && bbName.equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString())) { + volumeGroup = + createVolumeGroup(lookupKeyMap, resourceId, instanceName, generatedVnfType, instanceParams); + vnf.getVolumeGroups().add(volumeGroup); + } + if (volumeGroup != null) { + mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); + } + } else { + logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); + throw new Exception("Could not find relevant information for related VNF"); + } + } + + protected VolumeGroup createVolumeGroup(Map<ResourceKey, String> lookupKeyMap, String volumeGroupId, + String instanceName, String vnfType, List<Map<String, String>> instanceParams) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupId); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId(volumeGroupId); + volumeGroup.setVolumeGroupName(instanceName); + volumeGroup.setVnfType(vnfType); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + if (instanceParams != null) { + for (Map<String, String> params : instanceParams) { + volumeGroup.getCloudParams().putAll(params); + } + } + return volumeGroup; + } + + protected void mapCatalogVolumeGroup(VolumeGroup volumeGroup, ModelInfo modelInfo, Service service, + String vnfModelCustomizationUUID) { + VfModuleCustomization vfResourceCustomization = + getVfResourceCustomization(modelInfo, service, vnfModelCustomizationUUID); + if (vfResourceCustomization != null) { + volumeGroup.setModelInfoVfModule(this.mapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization)); + } + } + + protected VfModuleCustomization getVfResourceCustomization(ModelInfo modelInfo, Service service, + String vnfModelCustomizationUUID) { + VnfResourceCustomization vnfResourceCustomization = null; + for (VnfResourceCustomization resourceCust : service.getVnfCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(vnfModelCustomizationUUID)) { + vnfResourceCustomization = resourceCust; + break; + } + } + if (vnfResourceCustomization != null) { + for (VfModuleCustomization vfResourceCust : vnfResourceCustomization.getVfModuleCustomizations()) { + if (vfResourceCust.getModelCustomizationUUID() + .equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { + return vfResourceCust; + } + } + + } + return null; + } + + protected void populateGenericVnf(ModelInfo modelInfo, String instanceName, + org.onap.so.serviceinstancebeans.Platform platform, + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, Service service, String bbName, + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, + RelatedInstanceList[] relatedInstanceList, String resourceId, String vnfType, + List<Map<String, String>> instanceParams, String productFamilyId) { + GenericVnf vnf = null; + ModelInfo instanceGroupModelInfo = null; + String instanceGroupId = null; + String generatedVnfType = vnfType; + if (generatedVnfType == null || generatedVnfType.isEmpty()) { + generatedVnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); + } + if (relatedInstanceList != null) { + for (RelatedInstanceList relatedInstList : relatedInstanceList) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.networkInstanceGroup)) { + instanceGroupModelInfo = relatedInstance.getModelInfo(); + instanceGroupId = relatedInstance.getInstanceId(); + } + } + } + for (GenericVnf vnfTemp : serviceInstance.getVnfs()) { + if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null + && vnfTemp.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + String vnfModelCustId = + bbInputSetupUtils.getAAIGenericVnf(vnfTemp.getVnfId()).getModelCustomizationId(); + modelInfo.setModelCustomizationUuid(vnfModelCustId); + vnf = vnfTemp; + break; + } + } + if (vnf == null && bbName.equalsIgnoreCase(AssignFlows.VNF.toString())) { + vnf = createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, resourceId, generatedVnfType, + instanceParams, productFamilyId); + serviceInstance.getVnfs().add(vnf); + mapVnfcCollectionInstanceGroup(vnf, modelInfo, service); + } + if (vnf != null) { + mapCatalogVnf(vnf, modelInfo, service); + if (instanceGroupId != null && instanceGroupModelInfo != null + && instanceGroupModelInfo.getModelType().equals(ModelType.networkInstanceGroup) + && !instanceGroupInList(vnf, instanceGroupId)) { + mapNetworkCollectionInstanceGroup(vnf, instanceGroupId); + } + } + } + + protected boolean instanceGroupInList(GenericVnf vnf, String instanceGroupId) { + for (InstanceGroup instanceGroup : vnf.getInstanceGroups()) { + if (instanceGroup.getId() != null && instanceGroup.getId().equalsIgnoreCase(instanceGroupId)) { + return true; + } + } + return false; + } + + protected void mapVnfcCollectionInstanceGroup(GenericVnf genericVnf, ModelInfo modelInfo, Service service) { + VnfResourceCustomization vnfResourceCustomization = getVnfResourceCustomizationFromService(modelInfo, service); + if (vnfResourceCustomization != null) { + List<VnfcInstanceGroupCustomization> vnfcInstanceGroups = + vnfResourceCustomization.getVnfcInstanceGroupCustomizations(); + for (VnfcInstanceGroupCustomization vnfcInstanceGroupCust : vnfcInstanceGroups) { + InstanceGroup instanceGroup = this.createInstanceGroup(); + org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = bbInputSetupUtils + .getCatalogInstanceGroup(vnfcInstanceGroupCust.getInstanceGroup().getModelUUID()); + instanceGroup.setModelInfoInstanceGroup( + this.mapperLayer.mapCatalogInstanceGroupToInstanceGroup(null, catalogInstanceGroup)); + instanceGroup.getModelInfoInstanceGroup().setFunction(vnfcInstanceGroupCust.getFunction()); + instanceGroup.setDescription(vnfcInstanceGroupCust.getDescription()); + genericVnf.getInstanceGroups().add(instanceGroup); + } + } + } + + protected void mapNetworkCollectionInstanceGroup(GenericVnf genericVnf, String instanceGroupId) { + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = + bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId); + InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstanceGroup); + instanceGroup.setModelInfoInstanceGroup(this.mapperLayer.mapCatalogInstanceGroupToInstanceGroup(null, + this.bbInputSetupUtils.getCatalogInstanceGroup(aaiInstanceGroup.getModelVersionId()))); + genericVnf.getInstanceGroups().add(instanceGroup); + } + + protected GenericVnf createGenericVnf(Map<ResourceKey, String> lookupKeyMap, String instanceName, + org.onap.so.serviceinstancebeans.Platform platform, + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, String vnfId, String vnfType, + List<Map<String, String>> instanceParams, String productFamilyId) { + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId); + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId(vnfId); + genericVnf.setVnfName(instanceName); + genericVnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + genericVnf.setVnfType(vnfType); + genericVnf.setProvStatus(PREPROV); + genericVnf.setServiceId(productFamilyId); + if (platform != null) { + genericVnf.setPlatform(this.mapperLayer.mapRequestPlatform(platform)); + } + if (lineOfBusiness != null) { + genericVnf.setLineOfBusiness(this.mapperLayer.mapRequestLineOfBusiness(lineOfBusiness)); + } + if (instanceParams != null) { + for (Map<String, String> params : instanceParams) { + genericVnf.getCloudParams().putAll(params); + } + } + return genericVnf; + } + + protected void mapCatalogVnf(GenericVnf genericVnf, ModelInfo modelInfo, Service service) { + VnfResourceCustomization vnfResourceCustomization = getVnfResourceCustomizationFromService(modelInfo, service); + if (vnfResourceCustomization != null) { + genericVnf.setModelInfoGenericVnf(this.mapperLayer.mapCatalogVnfToVnf(vnfResourceCustomization)); + } + } + + protected VnfResourceCustomization getVnfResourceCustomizationFromService(ModelInfo modelInfo, Service service) { + VnfResourceCustomization vnfResourceCustomization = null; + for (VnfResourceCustomization resourceCust : service.getVnfCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { + vnfResourceCustomization = resourceCust; + break; + } + } + return vnfResourceCustomization; + } + + protected void populateL3Network(String instanceName, ModelInfo modelInfo, Service service, String bbName, + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, + List<Map<String, String>> instanceParams) { + L3Network network = null; + for (L3Network networkTemp : serviceInstance.getNetworks()) { + if (lookupKeyMap.get(ResourceKey.NETWORK_ID) != null + && networkTemp.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) { + network = networkTemp; + break; + } + } + if (network == null && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) + || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { + network = createNetwork(lookupKeyMap, instanceName, resourceId, instanceParams); + serviceInstance.getNetworks().add(network); + } + if (network != null) { + mapCatalogNetwork(network, modelInfo, service); + } + } + + protected L3Network createNetwork(Map<ResourceKey, String> lookupKeyMap, String instanceName, String networkId, + List<Map<String, String>> instanceParams) { + lookupKeyMap.put(ResourceKey.NETWORK_ID, networkId); + L3Network network = new L3Network(); + network.setNetworkId(networkId); + network.setNetworkName(instanceName); + network.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + if (instanceParams != null) { + for (Map<String, String> params : instanceParams) { + network.getCloudParams().putAll(params); + } + } + return network; + } + + protected void mapCatalogNetwork(L3Network network, ModelInfo modelInfo, Service service) { + NetworkResourceCustomization networkResourceCustomization = null; + for (NetworkResourceCustomization resourceCust : service.getNetworkCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { + networkResourceCustomization = resourceCust; + break; + } + } + if (networkResourceCustomization != null) { + network.setModelInfoNetwork(this.mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization)); + } + } + + protected GeneralBuildingBlock getGBBALaCarteService(ExecuteBuildingBlock executeBB, RequestDetails requestDetails, + Map<ResourceKey, String> lookupKeyMap, String requestAction, String resourceId) throws Exception { + Customer customer = getCustomerAndServiceSubscription(requestDetails, resourceId); + if (customer != null) { + Project project = null; + OwningEntity owningEntity = null; + + if (requestDetails.getProject() != null) + project = mapperLayer.mapRequestProject(requestDetails.getProject()); + if (requestDetails.getOwningEntity() != null) + owningEntity = mapperLayer.mapRequestOwningEntity(requestDetails.getOwningEntity()); + + + Service service = + bbInputSetupUtils.getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); + if (service == null) { + service = bbInputSetupUtils.getCatalogServiceByModelVersionAndModelInvariantUUID( + requestDetails.getModelInfo().getModelVersion(), + requestDetails.getModelInfo().getModelInvariantId()); + if (service == null) { + throw new Exception("Could not find service for model version Id: " + + requestDetails.getModelInfo().getModelVersionId() + " and for model invariant Id: " + + requestDetails.getModelInfo().getModelInvariantId()); + } + } + ServiceInstance serviceInstance = this.getALaCarteServiceInstance(service, requestDetails, customer, + project, owningEntity, lookupKeyMap, resourceId, Boolean.TRUE.equals(executeBB.isaLaCarte()), + executeBB.getBuildingBlock().getBpmnFlowName()); + return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, + customer); + } else { + throw new Exception("Could not find customer"); + } + } + + protected Customer getCustomerAndServiceSubscription(RequestDetails requestDetails, String resourceId) { + Customer customer; + if (requestDetails.getSubscriberInfo() != null) { + customer = this.getCustomerFromRequest(requestDetails); + } else { + customer = this.getCustomerFromURI(resourceId); + } + if (customer != null) { + ServiceSubscription serviceSubscription = null; + serviceSubscription = getServiceSubscription(requestDetails, customer); + if (serviceSubscription == null) { + serviceSubscription = getServiceSubscriptionFromURI(resourceId, customer); + } + customer.setServiceSubscription(serviceSubscription); + return customer; + } else { + return null; + } + } + + protected ServiceSubscription getServiceSubscriptionFromURI(String resourceId, Customer customer) { + Map<String, String> uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(resourceId); + String subscriptionServiceType = uriKeys.get("service-type"); + org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionAAI = + bbInputSetupUtils.getAAIServiceSubscription(customer.getGlobalCustomerId(), subscriptionServiceType); + if (serviceSubscriptionAAI != null) { + return mapperLayer.mapAAIServiceSubscription(serviceSubscriptionAAI); + } else { + return null; + } + } + + protected Customer getCustomerFromURI(String resourceId) { + Map<String, String> uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(resourceId); + String globalCustomerId = uriKeys.get("global-customer-id"); + org.onap.aai.domain.yang.Customer customerAAI = this.bbInputSetupUtils.getAAICustomer(globalCustomerId); + if (customerAAI != null) { + return mapperLayer.mapAAICustomer(customerAAI); + } else { + return null; + } + } + + protected GeneralBuildingBlock populateGBBWithSIAndAdditionalInfo(RequestDetails requestDetails, + ServiceInstance serviceInstance, ExecuteBuildingBlock executeBB, String requestAction, Customer customer) + throws Exception { + GeneralBuildingBlock outputBB = new GeneralBuildingBlock(); + OrchestrationContext orchContext = mapperLayer.mapOrchestrationContext(requestDetails); + RequestContext requestContext = mapperLayer.mapRequestContext(requestDetails); + requestContext.setAction(requestAction); + requestContext.setMsoRequestId(executeBB.getRequestId()); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = + bbInputSetupUtils.getCloudRegion(requestDetails.getCloudConfiguration()); + CloudRegion cloudRegion = mapperLayer.mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion); + Tenant tenant = getTenant(requestDetails.getCloudConfiguration(), aaiCloudRegion); + outputBB.setOrchContext(orchContext); + outputBB.setRequestContext(requestContext); + outputBB.setCloudRegion(cloudRegion); + outputBB.setTenant(tenant); + if (customer == null) { + Map<String, String> uriKeys = + bbInputSetupUtils.getURIKeysFromServiceInstance(serviceInstance.getServiceInstanceId()); + String globalCustomerId = uriKeys.get("global-customer-id"); + String subscriptionServiceType = uriKeys.get("service-type"); + customer = mapCustomer(globalCustomerId, subscriptionServiceType); + } + outputBB.setServiceInstance(serviceInstance); + if (customer.getServiceSubscription() != null) { + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + } + outputBB.setCustomer(customer); + return outputBB; + } + + protected Tenant getTenant(CloudConfiguration cloudConfiguration, + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion) throws Exception { + Tenant tenant = new Tenant(); + if (cloudConfiguration != null && cloudConfiguration.getTenantId() != null && aaiCloudRegion != null + && aaiCloudRegion.getTenants() != null) { + for (org.onap.aai.domain.yang.Tenant aaiTenant : aaiCloudRegion.getTenants().getTenant()) { + if (aaiTenant.getTenantId().equalsIgnoreCase(cloudConfiguration.getTenantId())) { + tenant = mapperLayer.mapTenant(aaiTenant); + } + } + if (tenant.getTenantId() == null || tenant.getTenantName() == null) { + throw new Exception("Invalid tenant information retrieved: tenantId = " + tenant.getTenantId() + + " tenantName = " + tenant.getTenantName()); + } + } + return tenant; + } + + protected ServiceSubscription getServiceSubscription(RequestDetails requestDetails, Customer customer) { + org.onap.aai.domain.yang.ServiceSubscription aaiServiceSubscription = + bbInputSetupUtils.getAAIServiceSubscription(customer.getGlobalCustomerId(), + requestDetails.getRequestParameters().getSubscriptionServiceType()); + if (aaiServiceSubscription != null) { + return mapperLayer.mapAAIServiceSubscription(aaiServiceSubscription); + } else { + return null; + } + } + + protected Customer getCustomerFromRequest(RequestDetails requestDetails) { + org.onap.aai.domain.yang.Customer aaiCustomer = + bbInputSetupUtils.getAAICustomer(requestDetails.getSubscriberInfo().getGlobalSubscriberId()); + if (aaiCustomer != null) { + return mapperLayer.mapAAICustomer(aaiCustomer); + } else { + return null; + } + } + + protected ServiceInstance getALaCarteServiceInstance(Service service, RequestDetails requestDetails, + Customer customer, Project project, OwningEntity owningEntity, Map<ResourceKey, String> lookupKeyMap, + String serviceInstanceId, boolean aLaCarte, String bbName) throws Exception { + ServiceInstance serviceInstance = this.getServiceInstanceHelper(requestDetails, customer, project, owningEntity, + lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName); + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = null; + if (customer != null && customer.getServiceSubscription() != null) { + serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(), + customer.getServiceSubscription().getServiceType(), serviceInstanceId); + } else { + serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + } + if (serviceInstanceAAI != null + && !serviceInstanceAAI.getModelVersionId().equalsIgnoreCase(service.getModelUUID())) { + Service tempService = + this.bbInputSetupUtils.getCatalogServiceByModelUUID(serviceInstanceAAI.getModelVersionId()); + if (tempService != null) { + serviceInstance + .setModelInfoServiceInstance(mapperLayer.mapCatalogServiceIntoServiceInstance(tempService)); + return serviceInstance; + } else { + throw new Exception( + "Could not find model of existing SI. Service Instance in AAI already exists with different model version id: " + + serviceInstanceAAI.getModelVersionId()); + } + } + serviceInstance.setModelInfoServiceInstance(mapperLayer.mapCatalogServiceIntoServiceInstance(service)); + return serviceInstance; + } + + protected GeneralBuildingBlock getGBBMacro(ExecuteBuildingBlock executeBB, RequestDetails requestDetails, + Map<ResourceKey, String> lookupKeyMap, String requestAction, String resourceId, String vnfType) + throws Exception { + String bbName = executeBB.getBuildingBlock().getBpmnFlowName(); + String key = executeBB.getBuildingBlock().getKey(); + + if (requestAction.equalsIgnoreCase("deleteInstance") || requestAction.equalsIgnoreCase("unassignInstance") + || requestAction.equalsIgnoreCase("activateInstance") + || requestAction.equalsIgnoreCase("activateFabricConfiguration") + || requestAction.equalsIgnoreCase("recreateInstance") + || requestAction.equalsIgnoreCase("replaceInstance")) { + return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, requestAction, + requestDetails.getCloudConfiguration()); + } + + String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID); + GeneralBuildingBlock gBB = + this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, serviceInstanceId); + RequestParameters requestParams = requestDetails.getRequestParameters(); + Service service = null; + if (gBB != null && gBB.getServiceInstance() != null + && gBB.getServiceInstance().getModelInfoServiceInstance() != null + && gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid() != null) { + service = bbInputSetupUtils.getCatalogServiceByModelUUID( + gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid()); + } else { + throw new Exception("Could not get service instance for macro request"); + } + if (requestParams != null && requestParams.getUserParams() != null) { + for (Map<String, Object> userParams : requestParams.getUserParams()) { + if (userParams.containsKey("service")) { + String input = mapper.writeValueAsString(userParams.get("service")); + return getGBBMacroUserParams(executeBB, requestDetails, lookupKeyMap, vnfType, bbName, key, gBB, + requestParams, service, input); + } + } + } + if (requestAction.equalsIgnoreCase("deactivateInstance")) { + return gBB; + } else if (requestAction.equalsIgnoreCase("createInstance")) { + return getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, bbName, key, gBB, service); + } else { + throw new IllegalArgumentException( + "No user params on requestAction: assignInstance. Please specify user params."); + } + } + + protected GeneralBuildingBlock getGBBMacroNoUserParamsCreate(ExecuteBuildingBlock executeBB, + Map<ResourceKey, String> lookupKeyMap, String bbName, String key, GeneralBuildingBlock gBB, Service service) + throws Exception { + ServiceInstance serviceInstance = gBB.getServiceInstance(); + if (bbName.contains(NETWORK) && !bbName.contains(NETWORK_COLLECTION)) { + String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID); + ModelInfo networkModelInfo = new ModelInfo(); + if ((!Boolean.TRUE.equals(executeBB.getBuildingBlock().getIsVirtualLink()))) { + NetworkResourceCustomization networkCust = getNetworkCustomizationByKey(key, service); + if (networkCust != null) { + networkModelInfo.setModelCustomizationUuid(networkCust.getModelCustomizationUUID()); + this.populateL3Network(null, networkModelInfo, service, bbName, serviceInstance, lookupKeyMap, + networkId, null); + } else { + logger.debug("Could not find a network customization with key: {}", key); + } + } else { + logger.debug("Orchestrating on Collection Network Resource Customization"); + CollectionNetworkResourceCustomization collectionNetworkResourceCust = + bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key); + L3Network l3Network = getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId, + collectionNetworkResourceCust, serviceInstance); + NetworkResourceCustomization networkResourceCustomization = mapperLayer + .mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); + if (l3Network != null) { + l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization)); + } + } + } else if (bbName.contains("Configuration")) { + String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); + ModelInfo configurationModelInfo = new ModelInfo(); + configurationModelInfo.setModelCustomizationUuid(key); + this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, + configurationId, null, executeBB.getConfigurationResourceKeys()); + } + if (executeBB.getWorkflowResourceIds() != null) { + this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance, + executeBB.getWorkflowResourceIds().getNetworkCollectionId(), key); + } + return gBB; + } + + protected L3Network getVirtualLinkL3Network(Map<ResourceKey, String> lookupKeyMap, String bbName, String key, + String networkId, CollectionNetworkResourceCustomization collectionNetworkResourceCust, + ServiceInstance serviceInstance) { + if (collectionNetworkResourceCust != null) { + if ((bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) + || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { + L3Network network = createNetwork(lookupKeyMap, null, networkId, null); + serviceInstance.getNetworks().add(network); + return network; + } else { + for (L3Network network : serviceInstance.getNetworks()) { + if (network.getNetworkId().equalsIgnoreCase(networkId)) { + return network; + } + } + } + } + return null; + } + + protected NetworkResourceCustomization getNetworkCustomizationByKey(String key, Service service) { + for (NetworkResourceCustomization networkCust : service.getNetworkCustomizations()) { + if (networkCust.getModelCustomizationUUID().equalsIgnoreCase(key)) { + return networkCust; + } + } + return null; + } + + protected GeneralBuildingBlock getGBBMacroExistingService(ExecuteBuildingBlock executeBB, + Map<ResourceKey, String> lookupKeyMap, String bbName, String requestAction, + CloudConfiguration cloudConfiguration) throws Exception { + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null; + String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID); + RequestDetails requestDetails = executeBB.getRequestDetails(); + GeneralBuildingBlock gBB = null; + if (serviceInstanceId != null) { + aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + } + Service service = null; + if (aaiServiceInstance != null) { + service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + } + if (aaiServiceInstance != null && service != null) { + ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance); + serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service)); + gBB = populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); + } else { + logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance); + logger.debug("Related Service Instance Model Info from AAI: {}", service); + throw new Exception("Could not find relevant information for related Service Instance"); + } + ServiceInstance serviceInstance = gBB.getServiceInstance(); + CloudRegion cloudRegion = null; + if (cloudConfiguration == null) { + Optional<CloudRegion> cloudRegionOp = cloudInfoFromAAI.getCloudInfoFromAAI(serviceInstance); + if (cloudRegionOp.isPresent()) { + cloudRegion = cloudRegionOp.get(); + } + } + if (cloudConfiguration != null) { + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration); + cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); + } + gBB.setCloudRegion(cloudRegion); + if (bbName.contains(VNF)) { + for (GenericVnf genericVnf : serviceInstance.getVnfs()) { + if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null + && genericVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId()); + ModelInfo modelInfo = new ModelInfo(); + if (vnf != null) { + modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId()); + } + this.mapCatalogVnf(genericVnf, modelInfo, service); + } + } + } else if (bbName.contains(VF_MODULE)) { + for (GenericVnf vnf : serviceInstance.getVnfs()) { + for (VfModule vfModule : vnf.getVfModules()) { + if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null + && vfModule.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) { + String vnfModelCustomizationUUID = + this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId(); + ModelInfo vnfModelInfo = new ModelInfo(); + vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); + this.mapCatalogVnf(vnf, vnfModelInfo, service); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId()); + String vfModuleCustomizationUUID = this.bbInputSetupUtils + .getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId(); + ModelInfo vfModuleModelInfo = new ModelInfo(); + vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID); + this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID); + if (cloudRegion != null) { + Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(vnf, vfModuleModelInfo, + cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), lookupKeyMap); + if (volumeGroupIdOp.isPresent()) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get()); + } + } + break; + } + } + } + } else if (bbName.contains(VOLUME_GROUP)) { + for (GenericVnf vnf : serviceInstance.getVnfs()) { + for (VolumeGroup volumeGroup : vnf.getVolumeGroups()) { + if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroup.getVolumeGroupId() + .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID))) { + String vnfModelCustomizationUUID = + this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId(); + ModelInfo vnfModelInfo = new ModelInfo(); + vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); + this.mapCatalogVnf(vnf, vnfModelInfo, service); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId()); + if (cloudRegion != null) { + String volumeGroupCustomizationUUID = + this.bbInputSetupUtils + .getAAIVolumeGroup(cloudRegion.getCloudOwner(), + cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()) + .getModelCustomizationId(); + ModelInfo volumeGroupModelInfo = new ModelInfo(); + volumeGroupModelInfo.setModelCustomizationId(volumeGroupCustomizationUUID); + this.mapCatalogVolumeGroup(volumeGroup, volumeGroupModelInfo, service, + vnfModelCustomizationUUID); + } + break; + } + } + } + } else if (bbName.contains(NETWORK)) { + for (L3Network network : serviceInstance.getNetworks()) { + if (lookupKeyMap.get(ResourceKey.NETWORK_ID) != null + && network.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) { + String networkCustomizationUUID = + this.bbInputSetupUtils.getAAIL3Network(network.getNetworkId()).getModelCustomizationId(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid(networkCustomizationUUID); + this.mapCatalogNetwork(network, modelInfo, service); + break; + } + } + } else if (bbName.contains("Fabric")) { + for (Configuration configuration : serviceInstance.getConfigurations()) { + if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null && configuration.getConfigurationId() + .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) { + String configurationCustUUID = this.bbInputSetupUtils + .getAAIConfiguration(configuration.getConfigurationId()).getModelCustomizationId(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid(configurationCustUUID); + this.mapCatalogConfiguration(configuration, modelInfo, service, + executeBB.getConfigurationResourceKeys()); + break; + } + } + } + if (executeBB.getWorkflowResourceIds() != null) { + this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance, + executeBB.getWorkflowResourceIds().getNetworkCollectionId(), executeBB.getBuildingBlock().getKey()); + } + return gBB; + } + + protected GeneralBuildingBlock getGBBMacroUserParams(ExecuteBuildingBlock executeBB, RequestDetails requestDetails, + Map<ResourceKey, String> lookupKeyMap, String vnfType, String bbName, String key, GeneralBuildingBlock gBB, + RequestParameters requestParams, Service service, String input) throws Exception { + ServiceInstance serviceInstance = gBB.getServiceInstance(); + org.onap.so.serviceinstancebeans.Service serviceMacro = + mapper.readValue(input, org.onap.so.serviceinstancebeans.Service.class); + + Resources resources = serviceMacro.getResources(); + Vnfs vnfs = null; + VfModules vfModules = null; + Networks networks = null; + CloudConfiguration cloudConfiguration = requestDetails.getCloudConfiguration(); + CloudRegion cloudRegion = getCloudRegionFromMacroRequest(cloudConfiguration, resources); + gBB.setCloudRegion(cloudRegion); + if (bbName.contains(VNF)) { + vnfs = findVnfsByKey(key, resources, vnfs); + String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); + // This stores the vnf id in request db to be retrieved later when + // working on a vf module or volume group + InfraActiveRequests request = this.bbInputSetupUtils.getInfraActiveRequest(executeBB.getRequestId()); + if (request != null) { + this.bbInputSetupUtils.updateInfraActiveRequestVnfId(request, vnfId); + } + String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId(); + this.populateGenericVnf(vnfs.getModelInfo(), vnfs.getInstanceName(), vnfs.getPlatform(), + vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null, vnfId, vnfType, + vnfs.getInstanceParams(), productFamilyId); + } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) { + Pair<Vnfs, VfModules> vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources); + vfModules = vnfsAndVfModules.getValue1(); + vnfs = vnfsAndVfModules.getValue0(); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, getVnfId(executeBB, lookupKeyMap)); + if (vnfs == null) { + throw new Exception("Could not find Vnf to orchestrate VfModule"); + } + ModelInfo modelInfo = vfModules.getModelInfo(); + if (bbName.contains(VOLUME_GROUP)) { + String volumeGroupId = lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID); + this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, volumeGroupId, null, + vfModules.getVolumeGroupInstanceName(), vnfType, vfModules.getInstanceParams()); + } else { + String vfModuleId = lookupKeyMap.get(ResourceKey.VF_MODULE_ID); + CloudConfiguration cloudConfig = new CloudConfiguration(); + cloudConfig.setLcpCloudRegionId(cloudRegion.getLcpCloudRegionId()); + cloudConfig.setCloudOwner(cloudRegion.getCloudOwner()); + this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, vfModuleId, null, + vfModules.getInstanceName(), vfModules.getInstanceParams(), cloudConfig); + } + } else if (bbName.contains(NETWORK)) { + networks = findNetworksByKey(key, resources); + String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID); + this.populateL3Network(networks.getInstanceName(), networks.getModelInfo(), service, bbName, + serviceInstance, lookupKeyMap, networkId, networks.getInstanceParams()); + } else if (bbName.contains("Configuration")) { + String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); + ModelInfo configurationModelInfo = new ModelInfo(); + configurationModelInfo.setModelCustomizationUuid(key); + ConfigurationResourceCustomization configurationCust = + findConfigurationResourceCustomization(configurationModelInfo, service); + if (configurationCust != null) { + this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, + configurationId, null, executeBB.getConfigurationResourceKeys()); + } else { + logger.debug("Could not find a configuration customization with key: {}", key); + } + } + return gBB; + } + + protected Networks findNetworksByKey(String key, Resources resources) { + for (Networks networks : resources.getNetworks()) { + if (networks.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) { + return networks; + } + } + return null; + } + + protected Pair<Vnfs, VfModules> getVfModulesAndItsVnfsByKey(String key, Resources resources) { + for (Vnfs vnfs : resources.getVnfs()) { + for (VfModules vfModules : vnfs.getVfModules()) { + if (vfModules.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) { + return new Pair<Vnfs, VfModules>(vnfs, vfModules); + } + } + } + return null; + } + + protected Vnfs findVnfsByKey(String key, Resources resources, Vnfs vnfs) { + for (Vnfs tempVnfs : resources.getVnfs()) { + if (tempVnfs.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) { + vnfs = tempVnfs; + break; + } + } + return vnfs; + } + + protected CloudRegion getCloudRegionFromMacroRequest(CloudConfiguration cloudConfiguration, Resources resources) { + if (cloudConfiguration == null) { + for (Vnfs vnfs : resources.getVnfs()) { + if (cloudConfiguration == null) { + cloudConfiguration = vnfs.getCloudConfiguration(); + } else { + break; + } + for (VfModules vfModules : vnfs.getVfModules()) { + if (cloudConfiguration == null) { + cloudConfiguration = vfModules.getCloudConfiguration(); + } else { + break; + } + } + } + for (Networks networks : resources.getNetworks()) { + if (cloudConfiguration == null) { + cloudConfiguration = networks.getCloudConfiguration(); + } else { + break; + } + } + } + if (cloudConfiguration != null) { + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration); + return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); + } else { + logger.debug("Could not find any cloud configuration for this request."); + return null; + } + } + + protected String getVnfId(ExecuteBuildingBlock executeBB, Map<ResourceKey, String> lookupKeyMap) { + String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); + if (vnfId == null) { + InfraActiveRequests request = this.bbInputSetupUtils.getInfraActiveRequest(executeBB.getRequestId()); + vnfId = request.getVnfId(); + } + + return vnfId; + } + + protected String generateRandomUUID() { + return UUID.randomUUID().toString(); + } + + protected ServiceInstance getServiceInstanceHelper(RequestDetails requestDetails, Customer customer, + Project project, OwningEntity owningEntity, Map<ResourceKey, String> lookupKeyMap, String serviceInstanceId, + boolean aLaCarte, Service service, String bbName) throws Exception { + if (requestDetails.getRequestInfo().getInstanceName() == null && aLaCarte + && bbName.equalsIgnoreCase(AssignFlows.SERVICE_INSTANCE.toString())) { + throw new Exception("Request invalid missing: RequestInfo:InstanceName"); + } else { + org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = null; + if (aLaCarte && bbName.equalsIgnoreCase(AssignFlows.SERVICE_INSTANCE.toString())) { + serviceInstanceAAI = bbInputSetupUtils + .getAAIServiceInstanceByName(requestDetails.getRequestInfo().getInstanceName(), customer); + } + if (serviceInstanceId != null && serviceInstanceAAI == null) { + if (customer != null && customer.getServiceSubscription() != null) { + serviceInstanceAAI = + bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(), + customer.getServiceSubscription().getServiceType(), serviceInstanceId); + } else { + serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + } + } + if (serviceInstanceAAI != null) { + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId); + return this.getExistingServiceInstance(serviceInstanceAAI); + } else { + return createServiceInstance(requestDetails, project, owningEntity, lookupKeyMap, serviceInstanceId); + } + } + } + + protected ServiceInstance createServiceInstance(RequestDetails requestDetails, Project project, + OwningEntity owningEntity, Map<ResourceKey, String> lookupKeyMap, String serviceInstanceId) { + ServiceInstance serviceInstance = new ServiceInstance(); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId); + serviceInstance.setServiceInstanceId(serviceInstanceId); + if (requestDetails.getRequestInfo() != null) { + serviceInstance.setServiceInstanceName(requestDetails.getRequestInfo().getInstanceName()); + } + serviceInstance.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + serviceInstance.setProject(project); + serviceInstance.setOwningEntity(owningEntity); + return serviceInstance; + } + + public ServiceInstance getExistingServiceInstance(org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI) + throws Exception { + ServiceInstance serviceInstance = mapperLayer.mapAAIServiceInstanceIntoServiceInstance(serviceInstanceAAI); + if (serviceInstanceAAI.getRelationshipList() != null + && serviceInstanceAAI.getRelationshipList().getRelationship() != null + && !serviceInstanceAAI.getRelationshipList().getRelationship().isEmpty()) { + addRelationshipsToSI(serviceInstanceAAI, serviceInstance); + } + return serviceInstance; + } + + protected void populateNetworkCollectionAndInstanceGroupAssign(Service service, String bbName, + ServiceInstance serviceInstance, String resourceId, String key) throws Exception { + if (serviceInstance.getCollection() == null + && bbName.equalsIgnoreCase(AssignFlows.NETWORK_COLLECTION.toString())) { + Collection collection = this.createCollection(resourceId); + serviceInstance.setCollection(collection); + this.mapCatalogCollection(service, serviceInstance.getCollection(), key); + if (isVlanTagging(service, key)) { + InstanceGroup instanceGroup = this.createInstanceGroup(); + serviceInstance.getCollection().setInstanceGroup(instanceGroup); + this.mapCatalogNetworkCollectionInstanceGroup(service, + serviceInstance.getCollection().getInstanceGroup(), key); + } + } + } + + protected CollectionResourceCustomization findCatalogNetworkCollection(Service service, String key) { + for (CollectionResourceCustomization collectionCust : service.getCollectionResourceCustomizations()) { + if (collectionCust.getModelCustomizationUUID().equalsIgnoreCase(key)) { + return collectionCust; + } + } + return null; + } + + protected boolean isVlanTagging(Service service, String key) { + CollectionResourceCustomization collectionCust = findCatalogNetworkCollection(service, key); + if (collectionCust != null) { + CollectionResource collectionResource = collectionCust.getCollectionResource(); + if (collectionResource != null && collectionResource.getInstanceGroup() != null + && collectionResource.getInstanceGroup().getToscaNodeType() != null + && collectionResource.getInstanceGroup().getToscaNodeType().contains("NetworkCollection")) { + return true; + } + } + return false; + } + + protected void mapCatalogNetworkCollectionInstanceGroup(Service service, InstanceGroup instanceGroup, String key) { + CollectionResourceCustomization collectionCust = this.findCatalogNetworkCollection(service, key); + org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = + collectionCust.getCollectionResource().getInstanceGroup(); + instanceGroup.setModelInfoInstanceGroup( + mapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionCust, catalogInstanceGroup)); + } + + protected void mapCatalogCollection(Service service, Collection collection, String key) { + CollectionResourceCustomization collectionCust = findCatalogNetworkCollection(service, key); + if (collectionCust != null) { + CollectionResource collectionResource = collectionCust.getCollectionResource(); + if (collectionResource != null) { + collection.setModelInfoCollection( + mapperLayer.mapCatalogCollectionToCollection(collectionCust, collectionResource)); + } + } + } + + protected Collection createCollection(String collectionId) { + Collection collection = new Collection(); + collection.setId(collectionId); + collection.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + return collection; + } + + protected InstanceGroup createInstanceGroup() { + InstanceGroup instanceGroup = new InstanceGroup(); + String instanceGroupId = this.generateRandomUUID(); + instanceGroup.setId(instanceGroupId); + return instanceGroup; + } + + protected void addRelationshipsToSI(org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI, + ServiceInstance serviceInstance) throws Exception { + AAIResultWrapper serviceInstanceWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(serviceInstanceAAI)); + Optional<Relationships> relationshipsOp = serviceInstanceWrapper.getRelationships(); + Relationships relationships = null; + if (relationshipsOp.isPresent()) { + relationships = relationshipsOp.get(); + } else { + return; + } + + this.mapProject(relationships.getByType(AAIObjectType.PROJECT), serviceInstance); + this.mapOwningEntity(relationships.getByType(AAIObjectType.OWNING_ENTITY), serviceInstance); + this.mapL3Networks(relationships.getRelatedAAIUris(AAIObjectType.L3_NETWORK), serviceInstance.getNetworks()); + this.mapGenericVnfs(relationships.getRelatedAAIUris(AAIObjectType.GENERIC_VNF), serviceInstance.getVnfs()); + this.mapCollection(relationships.getByType(AAIObjectType.COLLECTION), serviceInstance); + this.mapConfigurations(relationships.getRelatedAAIUris(AAIObjectType.CONFIGURATION), + serviceInstance.getConfigurations()); + } + + protected void mapConfigurations(List<AAIResourceUri> relatedAAIUris, List<Configuration> configurations) { + for (AAIResourceUri aaiResourceUri : relatedAAIUris) { + configurations.add(mapConfiguration(aaiResourceUri)); + } + } + + protected Configuration mapConfiguration(AAIResourceUri aaiResourceUri) { + AAIResultWrapper aaiConfigurationWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri); + Optional<org.onap.aai.domain.yang.Configuration> aaiConfigurationOp = + aaiConfigurationWrapper.asBean(org.onap.aai.domain.yang.Configuration.class); + if (!aaiConfigurationOp.isPresent()) { + return null; + } + + return this.mapperLayer.mapAAIConfiguration(aaiConfigurationOp.get()); + } + + protected void mapGenericVnfs(List<AAIResourceUri> list, List<GenericVnf> genericVnfs) { + for (AAIResourceUri aaiResourceUri : list) { + genericVnfs.add(this.mapGenericVnf(aaiResourceUri)); + } + } + + protected GenericVnf mapGenericVnf(AAIResourceUri aaiResourceUri) { + AAIResultWrapper aaiGenericVnfWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri); + Optional<org.onap.aai.domain.yang.GenericVnf> aaiGenericVnfOp = + aaiGenericVnfWrapper.asBean(org.onap.aai.domain.yang.GenericVnf.class); + if (!aaiGenericVnfOp.isPresent()) { + return null; + } + + GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnfOp.get()); + + Optional<Relationships> relationshipsOp = aaiGenericVnfWrapper.getRelationships(); + if (relationshipsOp.isPresent()) { + Relationships relationships = relationshipsOp.get(); + this.mapPlatform(relationships.getByType(AAIObjectType.PLATFORM), genericVnf); + this.mapLineOfBusiness(relationships.getByType(AAIObjectType.LINE_OF_BUSINESS), genericVnf); + genericVnf.getVolumeGroups().addAll(mapVolumeGroups(relationships.getByType(AAIObjectType.VOLUME_GROUP))); + genericVnf.getInstanceGroups() + .addAll(mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP))); + } + + return genericVnf; + } + + protected List<InstanceGroup> mapInstanceGroups(List<AAIResultWrapper> instanceGroups) { + List<InstanceGroup> instanceGroupsList = new ArrayList<>(); + for (AAIResultWrapper volumeGroupWrapper : instanceGroups) { + instanceGroupsList.add(this.mapInstanceGroup(volumeGroupWrapper)); + } + return instanceGroupsList; + } + + protected InstanceGroup mapInstanceGroup(AAIResultWrapper instanceGroupWrapper) { + Optional<org.onap.aai.domain.yang.InstanceGroup> aaiInstanceGroupOp = + instanceGroupWrapper.asBean(org.onap.aai.domain.yang.InstanceGroup.class); + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = null; + + if (!aaiInstanceGroupOp.isPresent()) { + return null; + } + + aaiInstanceGroup = aaiInstanceGroupOp.get(); + InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstanceGroup); + instanceGroup.setModelInfoInstanceGroup(this.mapperLayer.mapCatalogInstanceGroupToInstanceGroup(null, + this.bbInputSetupUtils.getCatalogInstanceGroup(aaiInstanceGroup.getModelVersionId()))); + return instanceGroup; + } + + protected List<VolumeGroup> mapVolumeGroups(List<AAIResultWrapper> volumeGroups) { + List<VolumeGroup> volumeGroupsList = new ArrayList<>(); + for (AAIResultWrapper volumeGroupWrapper : volumeGroups) { + volumeGroupsList.add(this.mapVolumeGroup(volumeGroupWrapper)); + } + return volumeGroupsList; + } + + protected VolumeGroup mapVolumeGroup(AAIResultWrapper volumeGroupWrapper) { + Optional<org.onap.aai.domain.yang.VolumeGroup> aaiVolumeGroupOp = + volumeGroupWrapper.asBean(org.onap.aai.domain.yang.VolumeGroup.class); + org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = null; + + if (!aaiVolumeGroupOp.isPresent()) { + return null; + } + + aaiVolumeGroup = aaiVolumeGroupOp.get(); + return this.mapperLayer.mapAAIVolumeGroup(aaiVolumeGroup); + } + + protected void mapLineOfBusiness(List<AAIResultWrapper> lineOfBusinesses, GenericVnf genericVnf) { + if (!lineOfBusinesses.isEmpty()) { + AAIResultWrapper lineOfBusinessWrapper = lineOfBusinesses.get(0); + Optional<org.onap.aai.domain.yang.LineOfBusiness> aaiLineOfBusinessOp = + lineOfBusinessWrapper.asBean(org.onap.aai.domain.yang.LineOfBusiness.class); + org.onap.aai.domain.yang.LineOfBusiness aaiLineOfBusiness = null; + if (!aaiLineOfBusinessOp.isPresent()) { + return; + } + aaiLineOfBusiness = aaiLineOfBusinessOp.get(); + + LineOfBusiness lineOfBusiness = this.mapperLayer.mapAAILineOfBusiness(aaiLineOfBusiness); + genericVnf.setLineOfBusiness(lineOfBusiness); + } + } + + protected void mapPlatform(List<AAIResultWrapper> platforms, GenericVnf genericVnf) { + if (!platforms.isEmpty()) { + AAIResultWrapper platformWrapper = platforms.get(0); + Optional<org.onap.aai.domain.yang.Platform> aaiPlatformOp = + platformWrapper.asBean(org.onap.aai.domain.yang.Platform.class); + org.onap.aai.domain.yang.Platform aaiPlatform = null; + if (!aaiPlatformOp.isPresent()) { + return; + } + aaiPlatform = aaiPlatformOp.get(); + + Platform platform = this.mapperLayer.mapAAIPlatform(aaiPlatform); + genericVnf.setPlatform(platform); + } + } + + protected void mapCollection(List<AAIResultWrapper> collections, ServiceInstance serviceInstance) { + if (!collections.isEmpty()) { + AAIResultWrapper collectionWrapper = collections.get(0); + Optional<org.onap.aai.domain.yang.Collection> aaiCollectionOp = + collectionWrapper.asBean(org.onap.aai.domain.yang.Collection.class); + org.onap.aai.domain.yang.Collection aaiCollection = null; + if (!aaiCollectionOp.isPresent()) { + return; + } + aaiCollection = aaiCollectionOp.get(); + + Collection collection = this.mapperLayer.mapAAICollectionIntoCollection(aaiCollection); + NetworkCollectionResourceCustomization collectionResourceCust = bbInputSetupUtils + .getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId()); + collection.setModelInfoCollection(mapperLayer.mapCatalogCollectionToCollection(collectionResourceCust, + collectionResourceCust.getCollectionResource())); + Optional<Relationships> relationshipsOp = collectionWrapper.getRelationships(); + Relationships relationships = null; + if (relationshipsOp.isPresent()) { + relationships = relationshipsOp.get(); + } else { + serviceInstance.setCollection(collection); + return; + } + List<InstanceGroup> instanceGroupsList = + mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP)); + if (!instanceGroupsList.isEmpty()) { + collection.setInstanceGroup(instanceGroupsList.get(0)); + } + serviceInstance.setCollection(collection); + } + } + + protected void mapL3Networks(List<AAIResourceUri> list, List<L3Network> l3Networks) { + for (AAIResourceUri aaiResourceUri : list) { + l3Networks.add(this.mapL3Network(aaiResourceUri)); + } + } + + protected L3Network mapL3Network(AAIResourceUri aaiResourceUri) { + AAIResultWrapper aaiNetworkWrapper = this.bbInputSetupUtils.getAAIResourceDepthTwo(aaiResourceUri); + Optional<org.onap.aai.domain.yang.L3Network> aaiL3NetworkOp = + aaiNetworkWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); + org.onap.aai.domain.yang.L3Network aaiL3Network = null; + + if (!aaiL3NetworkOp.isPresent()) { + return null; + } + + aaiL3Network = aaiL3NetworkOp.get(); + L3Network network = this.mapperLayer.mapAAIL3Network(aaiL3Network); + + Optional<Relationships> relationshipsOp = aaiNetworkWrapper.getRelationships(); + if (relationshipsOp.isPresent()) { + Relationships relationships = relationshipsOp.get(); + this.mapNetworkPolicies(relationships.getByType(AAIObjectType.NETWORK_POLICY), + network.getNetworkPolicies()); + mapRouteTableReferences(relationships.getByType(AAIObjectType.ROUTE_TABLE_REFERENCE), + network.getContrailNetworkRouteTableReferences()); + } + + return network; + } + + protected void mapNetworkPolicies(List<AAIResultWrapper> aaiNetworkPolicies, List<NetworkPolicy> networkPolicies) { + for (AAIResultWrapper networkPolicyWrapper : aaiNetworkPolicies) { + networkPolicies.add(this.mapNetworkPolicy(networkPolicyWrapper)); + } + } + + protected NetworkPolicy mapNetworkPolicy(AAIResultWrapper networkPolicyWrapper) { + Optional<org.onap.aai.domain.yang.NetworkPolicy> aaiNetworkPolicyOp = + networkPolicyWrapper.asBean(org.onap.aai.domain.yang.NetworkPolicy.class); + org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy = null; + + if (!aaiNetworkPolicyOp.isPresent()) { + return null; + } + + aaiNetworkPolicy = aaiNetworkPolicyOp.get(); + return this.mapperLayer.mapAAINetworkPolicy(aaiNetworkPolicy); + } + + protected void mapRouteTableReferences(List<AAIResultWrapper> routeTableReferences, + List<RouteTableReference> contrailNetworkRouteTableReferences) { + for (AAIResultWrapper routeTableReferenceWrapper : routeTableReferences) { + contrailNetworkRouteTableReferences.add(this.mapRouteTableReference(routeTableReferenceWrapper)); + } + } + + protected RouteTableReference mapRouteTableReference(AAIResultWrapper routeTableReferenceWrapper) { + Optional<org.onap.aai.domain.yang.RouteTableReference> aaiRouteTableReferenceOp = + routeTableReferenceWrapper.asBean(org.onap.aai.domain.yang.RouteTableReference.class); + org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference = null; + + if (!aaiRouteTableReferenceOp.isPresent()) { + return null; + } + + aaiRouteTableReference = aaiRouteTableReferenceOp.get(); + return this.mapperLayer.mapAAIRouteTableReferenceIntoRouteTableReference(aaiRouteTableReference); + } + + protected void mapOwningEntity(List<AAIResultWrapper> owningEntities, ServiceInstance serviceInstance) { + if (!owningEntities.isEmpty()) { + AAIResultWrapper owningEntityWrapper = owningEntities.get(0); + Optional<org.onap.aai.domain.yang.OwningEntity> aaiOwningEntityOp = + owningEntityWrapper.asBean(org.onap.aai.domain.yang.OwningEntity.class); + org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = null; + if (!aaiOwningEntityOp.isPresent()) { + return; + } + aaiOwningEntity = aaiOwningEntityOp.get(); + + OwningEntity owningEntity = this.mapperLayer.mapAAIOwningEntity(aaiOwningEntity); + serviceInstance.setOwningEntity(owningEntity); + } + } + + protected void mapProject(List<AAIResultWrapper> projects, ServiceInstance serviceInstance) { + if (!projects.isEmpty()) { + AAIResultWrapper projectWrapper = projects.get(0); + Optional<org.onap.aai.domain.yang.Project> aaiProjectOp = + projectWrapper.asBean(org.onap.aai.domain.yang.Project.class); + org.onap.aai.domain.yang.Project aaiProject = null; + if (!aaiProjectOp.isPresent()) { + return; + } + aaiProject = aaiProjectOp.get(); + + Project project = this.mapperLayer.mapAAIProject(aaiProject); + serviceInstance.setProject(project); + } + } + + protected Customer mapCustomer(String globalCustomerId, String subscriptionServiceType) { + org.onap.aai.domain.yang.Customer aaiCustomer = this.bbInputSetupUtils.getAAICustomer(globalCustomerId); + org.onap.aai.domain.yang.ServiceSubscription aaiServiceSubscription = + this.bbInputSetupUtils.getAAIServiceSubscription(globalCustomerId, subscriptionServiceType); + Customer customer = this.mapperLayer.mapAAICustomer(aaiCustomer); + ServiceSubscription serviceSubscription = this.mapperLayer.mapAAIServiceSubscription(aaiServiceSubscription); + if (serviceSubscription != null) { + customer.setServiceSubscription(serviceSubscription); + } + return customer; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index d8c80ced75..177c918305 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -28,7 +28,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; - import org.modelmapper.ModelMapper; import org.modelmapper.convention.MatchingStrategies; import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; @@ -90,432 +89,443 @@ import org.springframework.stereotype.Component; @Component("BBInputSetupMapperLayer") public class BBInputSetupMapperLayer { - private static final String USER_PARAM_NAME_KEY = "name"; + private static final String USER_PARAM_NAME_KEY = "name"; private static final String USER_PARAM_VALUE_KEY = "value"; - private static final Logger logger = LoggerFactory.getLogger(BBInputSetupMapperLayer.class); - - private ModelMapper modelMapper = new ModelMapper(); - - public Customer mapAAICustomer(org.onap.aai.domain.yang.Customer customerAAI) { - return modelMapper.map(customerAAI, Customer.class); - } - - public ServiceSubscription mapAAIServiceSubscription( - org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionAAI) { - return modelMapper.map(serviceSubscriptionAAI, ServiceSubscription.class); - } - - protected Project mapAAIProject(org.onap.aai.domain.yang.Project aaiProject) { - return modelMapper.map(aaiProject, Project.class); - } - - protected OwningEntity mapAAIOwningEntity(org.onap.aai.domain.yang.OwningEntity aaiOwningEntity) { - return modelMapper.map(aaiOwningEntity, OwningEntity.class); - } - - protected Platform mapAAIPlatform(org.onap.aai.domain.yang.Platform aaiPlatform) { - return modelMapper.map(aaiPlatform, Platform.class); - } - - protected LineOfBusiness mapAAILineOfBusiness(org.onap.aai.domain.yang.LineOfBusiness aaiLineOfBusiness) { - return modelMapper.map(aaiLineOfBusiness, LineOfBusiness.class); - } - - protected SegmentationAssignment mapAAISegmentationAssignment( - org.onap.aai.domain.yang.SegmentationAssignment aaiSegmentationAssignment) { - return modelMapper.map(aaiSegmentationAssignment, SegmentationAssignment.class); - } - - protected CtagAssignment mapAAICtagAssignment(org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment) { - return modelMapper.map(aaiCtagAssignment, CtagAssignment.class); - } - - protected Subnet mapAAISubnet(org.onap.aai.domain.yang.Subnet aaiSubnet) { - return modelMapper.map(aaiSubnet, Subnet.class); - } - - protected License mapAAILicense(org.onap.aai.domain.yang.License aaiLicense) { - return modelMapper.map(aaiLicense, License.class); - } - - protected Entitlement mapAAIEntitlement(org.onap.aai.domain.yang.Entitlement aaiEntitlement) { - return modelMapper.map(aaiEntitlement, Entitlement.class); - } - - protected LagInterface mapAAILagInterface(org.onap.aai.domain.yang.LagInterface aaiLagInterface) { - return modelMapper.map(aaiLagInterface, LagInterface.class); - } - - protected VfModule mapAAIVfModule(org.onap.aai.domain.yang.VfModule aaiVfModule) { - VfModule vfModule = modelMapper.map(aaiVfModule, VfModule.class); - vfModule.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVfModule.getOrchestrationStatus())); - - ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); - modelInfoVfModule.setIsBaseBoolean(aaiVfModule.isIsBaseVfModule()); - vfModule.setModelInfoVfModule(modelInfoVfModule); - return vfModule; - } - - public NetworkPolicy mapAAINetworkPolicy(org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy) { - return modelMapper.map(aaiNetworkPolicy, NetworkPolicy.class); - } - - protected VolumeGroup mapAAIVolumeGroup(org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup) { - VolumeGroup volumeGroup = modelMapper.map(aaiVolumeGroup, VolumeGroup.class); - volumeGroup.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVolumeGroup.getOrchestrationStatus())); - return volumeGroup; - } - - protected void setPlatformAndLOBIntoServiceInstance(Platform platformMSO, LineOfBusiness lineOfBusinessMSO, - ServiceInstance serviceInstance, Map<ResourceKey, String> resourcesToBeOrchestrated) { - String vnfId = resourcesToBeOrchestrated.get(ResourceKey.GENERIC_VNF_ID); - if (vnfId != null && !serviceInstance.getVnfs().isEmpty()) { - for (GenericVnf vnf : serviceInstance.getVnfs()) { - if (vnf.getVnfId().equalsIgnoreCase(vnfId)) { - vnf.setPlatform(platformMSO); - vnf.setLineOfBusiness(lineOfBusinessMSO); - break; - } - } - } - } - - public ModelInfoServiceInstance mapCatalogServiceIntoServiceInstance(Service service) { - return modelMapper.map(service, ModelInfoServiceInstance.class); - } - - protected ModelInfoInstanceGroup mapCatalogInstanceGroupToInstanceGroup(CollectionResourceCustomization collectionCust, InstanceGroup instanceGroup) { - ModelInfoInstanceGroup modelInfoInstanceGroup = modelMapper.map(instanceGroup, ModelInfoInstanceGroup.class); - if(instanceGroup.getType() != null && instanceGroup.getType().equals(InstanceGroupType.L3_NETWORK)) - modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_L3_NETWORK); - else - modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_VNFC); - if(collectionCust != null) { - List<CollectionResourceInstanceGroupCustomization> instanceGroupCustList = instanceGroup.getCollectionInstanceGroupCustomizations(); - for(CollectionResourceInstanceGroupCustomization collectionInsatnceGroupCust : instanceGroupCustList) { - if(collectionInsatnceGroupCust.getModelCustomizationUUID().equalsIgnoreCase(collectionCust.getModelCustomizationUUID())) { - modelInfoInstanceGroup.setFunction(collectionInsatnceGroupCust.getFunction()); - modelInfoInstanceGroup.setDescription(collectionInsatnceGroupCust.getDescription()); - break; - } - } - } - return modelInfoInstanceGroup; - } - - protected ModelInfoCollection mapCatalogCollectionToCollection(CollectionResourceCustomization collectionCust, - CollectionResource collectionResource) { - ModelInfoCollection modelInfoCollection = new ModelInfoCollection(); - modelInfoCollection.setCollectionFunction(collectionCust.getFunction()); - modelInfoCollection.setCollectionRole(collectionCust.getRole()); - modelInfoCollection.setCollectionType(collectionCust.getType()); - modelInfoCollection.setDescription(collectionResource.getDescription()); - modelInfoCollection.setModelInvariantUUID(collectionResource.getModelInvariantUUID()); - modelInfoCollection.setModelVersionId(collectionResource.getModelUUID()); - modelInfoCollection.setModelCustomizationUUID(collectionCust.getModelCustomizationUUID()); - return modelInfoCollection; - } - - public ServiceInstance mapAAIServiceInstanceIntoServiceInstance( - org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance) { - ServiceInstance serviceInstance = modelMapper.map(aaiServiceInstance, ServiceInstance.class); - if (aaiServiceInstance.getAllottedResources() != null) { - for (org.onap.aai.domain.yang.AllottedResource allottedResource : aaiServiceInstance.getAllottedResources() - .getAllottedResource()) { - serviceInstance.getAllottedResources().add(mapAAIAllottedResource(allottedResource)); - } - } - serviceInstance.setOrchestrationStatus( - this.mapOrchestrationStatusFromAAI(aaiServiceInstance.getOrchestrationStatus())); - return serviceInstance; - } - - protected AllottedResource mapAAIAllottedResource(org.onap.aai.domain.yang.AllottedResource aaiAllottedResource) { - AllottedResource allottedResource = modelMapper.map(aaiAllottedResource, AllottedResource.class); - return allottedResource; - } - - protected L3Network mapAAIL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network) { - L3Network network = modelMapper.map(aaiL3Network, L3Network.class); - mapAllSubnetsIntoL3Network(aaiL3Network, network); - mapAllCtagAssignmentsIntoL3Network(aaiL3Network, network); - mapAllSegmentationAssignmentsIntoL3Network(aaiL3Network, network); - network.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiL3Network.getOrchestrationStatus())); - return network; - } - - protected void mapAllSegmentationAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, - L3Network network) { - if (aaiL3Network.getSegmentationAssignments() != null) { - for (org.onap.aai.domain.yang.SegmentationAssignment aaiSegmentationAssignment : aaiL3Network - .getSegmentationAssignments().getSegmentationAssignment()) { - network.getSegmentationAssignments().add(mapAAISegmentationAssignment(aaiSegmentationAssignment)); - } - } - } - - protected void mapAllCtagAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, - L3Network network) { - if (aaiL3Network.getCtagAssignments() != null) { - for (org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment : aaiL3Network.getCtagAssignments() - .getCtagAssignment()) { - network.getCtagAssignments().add(mapAAICtagAssignment(aaiCtagAssignment)); - } - } - } - - protected void mapAllSubnetsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, L3Network network) { - if (aaiL3Network.getSubnets() != null) { - for (org.onap.aai.domain.yang.Subnet aaiSubnet : aaiL3Network.getSubnets().getSubnet()) { - network.getSubnets().add(mapAAISubnet(aaiSubnet)); - } - } - } - - protected GenericVnf mapAAIGenericVnfIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf) { - GenericVnf genericVnf = modelMapper.map(aaiGenericVnf, GenericVnf.class); - mapAllVfModulesIntoGenericVnf(aaiGenericVnf, genericVnf); - mapAllLagInterfacesIntoGenericVnf(aaiGenericVnf, genericVnf); - mapAllEntitlementsIntoGenericVnf(aaiGenericVnf, genericVnf); - mapAllLicensesIntoGenericVnf(aaiGenericVnf, genericVnf); - genericVnf.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiGenericVnf.getOrchestrationStatus())); - return genericVnf; - } - - protected void mapAllLicensesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, - GenericVnf genericVnf) { - if (aaiGenericVnf.getLicenses() != null) { - for (org.onap.aai.domain.yang.License aaiLicense : aaiGenericVnf.getLicenses().getLicense()) { - genericVnf.setLicense(mapAAILicense(aaiLicense)); - } - } - } - - protected void mapAllEntitlementsIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, - GenericVnf genericVnf) { - if (aaiGenericVnf.getEntitlements() != null) { - for (org.onap.aai.domain.yang.Entitlement aaiEntitlement : aaiGenericVnf.getEntitlements() - .getEntitlement()) { - genericVnf.getEntitlements().add(mapAAIEntitlement(aaiEntitlement)); - } - } - } - - protected void mapAllLagInterfacesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, - GenericVnf genericVnf) { - if (aaiGenericVnf.getLagInterfaces() != null) { - for (org.onap.aai.domain.yang.LagInterface aaiLagInterface : aaiGenericVnf.getLagInterfaces() - .getLagInterface()) { - genericVnf.getLagInterfaces().add(mapAAILagInterface(aaiLagInterface)); - } - } - } - - protected void mapAllVfModulesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, - GenericVnf genericVnf) { - if (aaiGenericVnf.getVfModules() != null) { - for (org.onap.aai.domain.yang.VfModule aaiVfModule : aaiGenericVnf.getVfModules().getVfModule()) { - VfModule vfModule = mapAAIVfModule(aaiVfModule); - genericVnf.getVfModules().add(vfModule); - } - } - } - - public OrchestrationStatus mapOrchestrationStatusFromAAI(String orchestrationStatus) { - - Optional<OrchestrationStatus> result = Arrays.asList(OrchestrationStatus.values()).stream() - .filter(item -> item.fuzzyMap(orchestrationStatus)) - .findFirst(); - - return result.orElse(null); - - } - - public RequestContext mapRequestContext(RequestDetails requestDetails) { - RequestContext context = new RequestContext(); - modelMapper.map(requestDetails.getRequestInfo(), context); - org.onap.so.serviceinstancebeans.RequestParameters requestParameters = requestDetails.getRequestParameters(); - if (null != requestParameters) { - context.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType()); - context.setRequestParameters(this.mapRequestParameters(requestDetails.getRequestParameters())); - context.setUserParams(this.mapNameValueUserParams(requestDetails.getRequestParameters())); - } - if (requestDetails.getConfigurationParameters() != null) { - context.setConfigurationParameters(requestDetails.getConfigurationParameters()); - } - return context; - } - - protected RequestParameters mapRequestParameters(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) { - RequestParameters requestParams = new RequestParameters(); - requestParams.setaLaCarte(requestParameters.getALaCarte()); - requestParams.setUsePreload(requestParameters.getUsePreload()); - requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType()); - requestParams.setUserParams(requestParameters.getUserParams()); - requestParams.setPayload(requestParameters.getPayload()); - return requestParams; - } - - protected Map<String,Object> mapNameValueUserParams(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) { - Map<String,Object> userParamsResult = new HashMap<String,Object>(); - if (requestParameters.getUserParams() != null) { - List<Map<String, Object>> userParams = requestParameters.getUserParams(); - for (Map<String, Object> userParamsMap : userParams) { - if ( userParamsMap.containsKey(USER_PARAM_NAME_KEY) && (userParamsMap.get(USER_PARAM_NAME_KEY) instanceof String) - && userParamsMap.containsKey(USER_PARAM_VALUE_KEY)) { - userParamsResult.put((String) userParamsMap.get(USER_PARAM_NAME_KEY), userParamsMap.get(USER_PARAM_VALUE_KEY)); - } - } - } - return userParamsResult; - } - - protected OrchestrationContext mapOrchestrationContext(RequestDetails requestDetails) { - OrchestrationContext context = new OrchestrationContext(); - context.setIsRollbackEnabled(!(requestDetails.getRequestInfo().getSuppressRollback())); - return context; - } - - protected CloudRegion mapCloudRegion(CloudConfiguration cloudConfiguration, org.onap.aai.domain.yang.CloudRegion aaiCloudRegion) { - CloudRegion cloudRegion = new CloudRegion(); - if(cloudConfiguration != null) - cloudRegion = modelMapper.map(cloudConfiguration, CloudRegion.class); - if(aaiCloudRegion != null) - modelMapper.map(aaiCloudRegion, cloudRegion); - return cloudRegion; - } - - protected Tenant mapTenant(org.onap.aai.domain.yang.Tenant aaiTenant) { - Tenant tenant = new Tenant(); - if(aaiTenant != null) { - modelMapper.map(aaiTenant, tenant); - } - return tenant; - } - - protected Collection mapAAICollectionIntoCollection(org.onap.aai.domain.yang.Collection aaiCollection) { - Collection collection = new Collection(); - collection.setId(aaiCollection.getCollectionId()); - collection.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiCollection.getOrchestrationStatus())); - return collection; - } - - protected org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup mapAAIInstanceGroupIntoInstanceGroup( - org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup) { - return modelMapper.map(aaiInstanceGroup, - org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup.class); - } - - public RouteTableReference mapAAIRouteTableReferenceIntoRouteTableReference( - org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference) { - return modelMapper.map(aaiRouteTableReference, RouteTableReference.class); - } - - protected ModelInfoNetwork mapCatalogNetworkToNetwork(NetworkResourceCustomization networkResourceCustomization) { - modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); - ModelInfoNetwork modelInfoNetwork = modelMapper.map(networkResourceCustomization, ModelInfoNetwork.class); - modelMapper.map(networkResourceCustomization.getNetworkResource(), modelInfoNetwork); - modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD); - return modelInfoNetwork; - } - - protected ModelInfoGenericVnf mapCatalogVnfToVnf(VnfResourceCustomization vnfResourceCustomization) { - ModelInfoGenericVnf modelInfoVnf = modelMapper.map(vnfResourceCustomization, ModelInfoGenericVnf.class); - modelMapper.map(vnfResourceCustomization.getVnfResources(), modelInfoVnf); - return modelInfoVnf; - } - - protected ModelInfoVfModule mapCatalogVfModuleToVfModule(VfModuleCustomization vfResourceCustomization) { - ModelInfoVfModule modelInfoVfModule = modelMapper.map(vfResourceCustomization, ModelInfoVfModule.class); - modelMapper.map(vfResourceCustomization.getVfModule(), modelInfoVfModule); - return modelInfoVfModule; - } - - protected Platform mapRequestPlatform(org.onap.so.serviceinstancebeans.Platform platform) { - return modelMapper.map(platform, Platform.class); - } - - protected LineOfBusiness mapRequestLineOfBusiness( - org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness) { - return modelMapper.map(lineOfBusiness, LineOfBusiness.class); - } - - public Configuration mapAAIConfiguration(org.onap.aai.domain.yang.Configuration configurationAAI) { - modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); - Configuration configuration = modelMapper.map(configurationAAI, Configuration.class); - modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD); - configuration.getForwarderEvcs().addAll(mapAllForwarderEvcs(configurationAAI)); - configuration.getEvcs().addAll(mapAllEvcs(configurationAAI)); - configuration.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(configurationAAI.getOrchestrationStatus())); - return configuration; - } - - protected List<Evc> mapAllEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) { - List<Evc> listOfEvcs = new ArrayList<>(); - if (configurationAAI.getEvcs() != null) { - for (org.onap.aai.domain.yang.Evc aaiEvc : configurationAAI.getEvcs().getEvc()) { - listOfEvcs.add(mapEvc(aaiEvc)); - } - } - return listOfEvcs; - } - - protected Evc mapEvc(org.onap.aai.domain.yang.Evc aaiEvc) { - return modelMapper.map(aaiEvc, Evc.class); - } - - protected List<ForwarderEvc> mapAllForwarderEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) { - List<ForwarderEvc> listOfForwarderEvcs = new ArrayList<>(); - if (configurationAAI.getForwarderEvcs() != null) { - for (org.onap.aai.domain.yang.ForwarderEvc aaiForwarderEvc : configurationAAI.getForwarderEvcs().getForwarderEvc()) { - listOfForwarderEvcs.add(mapForwarderEvc(aaiForwarderEvc)); - } - } - return listOfForwarderEvcs; - } - - protected ForwarderEvc mapForwarderEvc(org.onap.aai.domain.yang.ForwarderEvc aaiForwarderEvc) { - return modelMapper.map(aaiForwarderEvc, ForwarderEvc.class); - } - - protected OwningEntity mapRequestOwningEntity(org.onap.so.serviceinstancebeans.OwningEntity owningEntity) { - return modelMapper.map(owningEntity, OwningEntity.class); - } - - protected Project mapRequestProject(org.onap.so.serviceinstancebeans.Project project) { - return modelMapper.map(project, Project.class); - } - - protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration( - ConfigurationResourceCustomization configurationResourceCustomization, - CvnfcConfigurationCustomization cvnfcConfigurationCustomization) { - ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); - modelInfoConfiguration.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID()); - modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID()); - modelInfoConfiguration.setModelInvariantId(configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID()); - modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName()); - return modelInfoConfiguration; - } - - protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration( - CvnfcConfigurationCustomization cvnfcConfigurationCustomization) { - ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); - modelInfoConfiguration.setModelVersionId(cvnfcConfigurationCustomization.getConfigurationResource().getModelUUID()); - modelInfoConfiguration.setModelCustomizationId(cvnfcConfigurationCustomization.getModelCustomizationUUID()); - modelInfoConfiguration.setModelInvariantId(cvnfcConfigurationCustomization.getConfigurationResource().getModelInvariantUUID()); - modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName()); - modelInfoConfiguration.setConfigurationType(cvnfcConfigurationCustomization.getConfigurationType()); - modelInfoConfiguration.setConfigurationRole(cvnfcConfigurationCustomization.getConfigurationRole()); - return modelInfoConfiguration; - } - - public NetworkResourceCustomization mapCollectionNetworkResourceCustToNetworkResourceCust( - CollectionNetworkResourceCustomization collectionNetworkResourceCust) { - return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class); - } - - public Vnfc mapAAIVnfc(org.onap.aai.domain.yang.Vnfc vnfcAAI) { - return modelMapper.map(vnfcAAI, Vnfc.class); - } + private static final Logger logger = LoggerFactory.getLogger(BBInputSetupMapperLayer.class); + + private ModelMapper modelMapper = new ModelMapper(); + + public Customer mapAAICustomer(org.onap.aai.domain.yang.Customer customerAAI) { + return modelMapper.map(customerAAI, Customer.class); + } + + public ServiceSubscription mapAAIServiceSubscription( + org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionAAI) { + return modelMapper.map(serviceSubscriptionAAI, ServiceSubscription.class); + } + + protected Project mapAAIProject(org.onap.aai.domain.yang.Project aaiProject) { + return modelMapper.map(aaiProject, Project.class); + } + + protected OwningEntity mapAAIOwningEntity(org.onap.aai.domain.yang.OwningEntity aaiOwningEntity) { + return modelMapper.map(aaiOwningEntity, OwningEntity.class); + } + + protected Platform mapAAIPlatform(org.onap.aai.domain.yang.Platform aaiPlatform) { + return modelMapper.map(aaiPlatform, Platform.class); + } + + protected LineOfBusiness mapAAILineOfBusiness(org.onap.aai.domain.yang.LineOfBusiness aaiLineOfBusiness) { + return modelMapper.map(aaiLineOfBusiness, LineOfBusiness.class); + } + + protected SegmentationAssignment mapAAISegmentationAssignment( + org.onap.aai.domain.yang.SegmentationAssignment aaiSegmentationAssignment) { + return modelMapper.map(aaiSegmentationAssignment, SegmentationAssignment.class); + } + + protected CtagAssignment mapAAICtagAssignment(org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment) { + return modelMapper.map(aaiCtagAssignment, CtagAssignment.class); + } + + protected Subnet mapAAISubnet(org.onap.aai.domain.yang.Subnet aaiSubnet) { + return modelMapper.map(aaiSubnet, Subnet.class); + } + + protected License mapAAILicense(org.onap.aai.domain.yang.License aaiLicense) { + return modelMapper.map(aaiLicense, License.class); + } + + protected Entitlement mapAAIEntitlement(org.onap.aai.domain.yang.Entitlement aaiEntitlement) { + return modelMapper.map(aaiEntitlement, Entitlement.class); + } + + protected LagInterface mapAAILagInterface(org.onap.aai.domain.yang.LagInterface aaiLagInterface) { + return modelMapper.map(aaiLagInterface, LagInterface.class); + } + + protected VfModule mapAAIVfModule(org.onap.aai.domain.yang.VfModule aaiVfModule) { + VfModule vfModule = modelMapper.map(aaiVfModule, VfModule.class); + vfModule.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVfModule.getOrchestrationStatus())); + + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setIsBaseBoolean(aaiVfModule.isIsBaseVfModule()); + vfModule.setModelInfoVfModule(modelInfoVfModule); + return vfModule; + } + + public NetworkPolicy mapAAINetworkPolicy(org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy) { + return modelMapper.map(aaiNetworkPolicy, NetworkPolicy.class); + } + + protected VolumeGroup mapAAIVolumeGroup(org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup) { + VolumeGroup volumeGroup = modelMapper.map(aaiVolumeGroup, VolumeGroup.class); + volumeGroup.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVolumeGroup.getOrchestrationStatus())); + return volumeGroup; + } + + protected void setPlatformAndLOBIntoServiceInstance(Platform platformMSO, LineOfBusiness lineOfBusinessMSO, + ServiceInstance serviceInstance, Map<ResourceKey, String> resourcesToBeOrchestrated) { + String vnfId = resourcesToBeOrchestrated.get(ResourceKey.GENERIC_VNF_ID); + if (vnfId != null && !serviceInstance.getVnfs().isEmpty()) { + for (GenericVnf vnf : serviceInstance.getVnfs()) { + if (vnf.getVnfId().equalsIgnoreCase(vnfId)) { + vnf.setPlatform(platformMSO); + vnf.setLineOfBusiness(lineOfBusinessMSO); + break; + } + } + } + } + + public ModelInfoServiceInstance mapCatalogServiceIntoServiceInstance(Service service) { + return modelMapper.map(service, ModelInfoServiceInstance.class); + } + + protected ModelInfoInstanceGroup mapCatalogInstanceGroupToInstanceGroup( + CollectionResourceCustomization collectionCust, InstanceGroup instanceGroup) { + ModelInfoInstanceGroup modelInfoInstanceGroup = modelMapper.map(instanceGroup, ModelInfoInstanceGroup.class); + if (instanceGroup.getType() != null && instanceGroup.getType().equals(InstanceGroupType.L3_NETWORK)) + modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_L3_NETWORK); + else + modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_VNFC); + if (collectionCust != null) { + List<CollectionResourceInstanceGroupCustomization> instanceGroupCustList = + instanceGroup.getCollectionInstanceGroupCustomizations(); + for (CollectionResourceInstanceGroupCustomization collectionInsatnceGroupCust : instanceGroupCustList) { + if (collectionInsatnceGroupCust.getModelCustomizationUUID() + .equalsIgnoreCase(collectionCust.getModelCustomizationUUID())) { + modelInfoInstanceGroup.setFunction(collectionInsatnceGroupCust.getFunction()); + modelInfoInstanceGroup.setDescription(collectionInsatnceGroupCust.getDescription()); + break; + } + } + } + return modelInfoInstanceGroup; + } + + protected ModelInfoCollection mapCatalogCollectionToCollection(CollectionResourceCustomization collectionCust, + CollectionResource collectionResource) { + ModelInfoCollection modelInfoCollection = new ModelInfoCollection(); + modelInfoCollection.setCollectionFunction(collectionCust.getFunction()); + modelInfoCollection.setCollectionRole(collectionCust.getRole()); + modelInfoCollection.setCollectionType(collectionCust.getType()); + modelInfoCollection.setDescription(collectionResource.getDescription()); + modelInfoCollection.setModelInvariantUUID(collectionResource.getModelInvariantUUID()); + modelInfoCollection.setModelVersionId(collectionResource.getModelUUID()); + modelInfoCollection.setModelCustomizationUUID(collectionCust.getModelCustomizationUUID()); + return modelInfoCollection; + } + + public ServiceInstance mapAAIServiceInstanceIntoServiceInstance( + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance) { + ServiceInstance serviceInstance = modelMapper.map(aaiServiceInstance, ServiceInstance.class); + if (aaiServiceInstance.getAllottedResources() != null) { + for (org.onap.aai.domain.yang.AllottedResource allottedResource : aaiServiceInstance.getAllottedResources() + .getAllottedResource()) { + serviceInstance.getAllottedResources().add(mapAAIAllottedResource(allottedResource)); + } + } + serviceInstance.setOrchestrationStatus( + this.mapOrchestrationStatusFromAAI(aaiServiceInstance.getOrchestrationStatus())); + return serviceInstance; + } + + protected AllottedResource mapAAIAllottedResource(org.onap.aai.domain.yang.AllottedResource aaiAllottedResource) { + AllottedResource allottedResource = modelMapper.map(aaiAllottedResource, AllottedResource.class); + return allottedResource; + } + + protected L3Network mapAAIL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network) { + L3Network network = modelMapper.map(aaiL3Network, L3Network.class); + mapAllSubnetsIntoL3Network(aaiL3Network, network); + mapAllCtagAssignmentsIntoL3Network(aaiL3Network, network); + mapAllSegmentationAssignmentsIntoL3Network(aaiL3Network, network); + network.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiL3Network.getOrchestrationStatus())); + return network; + } + + protected void mapAllSegmentationAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, + L3Network network) { + if (aaiL3Network.getSegmentationAssignments() != null) { + for (org.onap.aai.domain.yang.SegmentationAssignment aaiSegmentationAssignment : aaiL3Network + .getSegmentationAssignments().getSegmentationAssignment()) { + network.getSegmentationAssignments().add(mapAAISegmentationAssignment(aaiSegmentationAssignment)); + } + } + } + + protected void mapAllCtagAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, + L3Network network) { + if (aaiL3Network.getCtagAssignments() != null) { + for (org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment : aaiL3Network.getCtagAssignments() + .getCtagAssignment()) { + network.getCtagAssignments().add(mapAAICtagAssignment(aaiCtagAssignment)); + } + } + } + + protected void mapAllSubnetsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, L3Network network) { + if (aaiL3Network.getSubnets() != null) { + for (org.onap.aai.domain.yang.Subnet aaiSubnet : aaiL3Network.getSubnets().getSubnet()) { + network.getSubnets().add(mapAAISubnet(aaiSubnet)); + } + } + } + + protected GenericVnf mapAAIGenericVnfIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf) { + GenericVnf genericVnf = modelMapper.map(aaiGenericVnf, GenericVnf.class); + mapAllVfModulesIntoGenericVnf(aaiGenericVnf, genericVnf); + mapAllLagInterfacesIntoGenericVnf(aaiGenericVnf, genericVnf); + mapAllEntitlementsIntoGenericVnf(aaiGenericVnf, genericVnf); + mapAllLicensesIntoGenericVnf(aaiGenericVnf, genericVnf); + genericVnf.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiGenericVnf.getOrchestrationStatus())); + return genericVnf; + } + + protected void mapAllLicensesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, + GenericVnf genericVnf) { + if (aaiGenericVnf.getLicenses() != null) { + for (org.onap.aai.domain.yang.License aaiLicense : aaiGenericVnf.getLicenses().getLicense()) { + genericVnf.setLicense(mapAAILicense(aaiLicense)); + } + } + } + + protected void mapAllEntitlementsIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, + GenericVnf genericVnf) { + if (aaiGenericVnf.getEntitlements() != null) { + for (org.onap.aai.domain.yang.Entitlement aaiEntitlement : aaiGenericVnf.getEntitlements() + .getEntitlement()) { + genericVnf.getEntitlements().add(mapAAIEntitlement(aaiEntitlement)); + } + } + } + + protected void mapAllLagInterfacesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, + GenericVnf genericVnf) { + if (aaiGenericVnf.getLagInterfaces() != null) { + for (org.onap.aai.domain.yang.LagInterface aaiLagInterface : aaiGenericVnf.getLagInterfaces() + .getLagInterface()) { + genericVnf.getLagInterfaces().add(mapAAILagInterface(aaiLagInterface)); + } + } + } + + protected void mapAllVfModulesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf, + GenericVnf genericVnf) { + if (aaiGenericVnf.getVfModules() != null) { + for (org.onap.aai.domain.yang.VfModule aaiVfModule : aaiGenericVnf.getVfModules().getVfModule()) { + VfModule vfModule = mapAAIVfModule(aaiVfModule); + genericVnf.getVfModules().add(vfModule); + } + } + } + + public OrchestrationStatus mapOrchestrationStatusFromAAI(String orchestrationStatus) { + + Optional<OrchestrationStatus> result = Arrays.asList(OrchestrationStatus.values()).stream() + .filter(item -> item.fuzzyMap(orchestrationStatus)).findFirst(); + + return result.orElse(null); + + } + + public RequestContext mapRequestContext(RequestDetails requestDetails) { + RequestContext context = new RequestContext(); + modelMapper.map(requestDetails.getRequestInfo(), context); + org.onap.so.serviceinstancebeans.RequestParameters requestParameters = requestDetails.getRequestParameters(); + if (null != requestParameters) { + context.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType()); + context.setRequestParameters(this.mapRequestParameters(requestDetails.getRequestParameters())); + context.setUserParams(this.mapNameValueUserParams(requestDetails.getRequestParameters())); + } + if (requestDetails.getConfigurationParameters() != null) { + context.setConfigurationParameters(requestDetails.getConfigurationParameters()); + } + return context; + } + + protected RequestParameters mapRequestParameters( + org.onap.so.serviceinstancebeans.RequestParameters requestParameters) { + RequestParameters requestParams = new RequestParameters(); + requestParams.setaLaCarte(requestParameters.getALaCarte()); + requestParams.setUsePreload(requestParameters.getUsePreload()); + requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType()); + requestParams.setUserParams(requestParameters.getUserParams()); + requestParams.setPayload(requestParameters.getPayload()); + return requestParams; + } + + protected Map<String, Object> mapNameValueUserParams( + org.onap.so.serviceinstancebeans.RequestParameters requestParameters) { + Map<String, Object> userParamsResult = new HashMap<String, Object>(); + if (requestParameters.getUserParams() != null) { + List<Map<String, Object>> userParams = requestParameters.getUserParams(); + for (Map<String, Object> userParamsMap : userParams) { + if (userParamsMap.containsKey(USER_PARAM_NAME_KEY) + && (userParamsMap.get(USER_PARAM_NAME_KEY) instanceof String) + && userParamsMap.containsKey(USER_PARAM_VALUE_KEY)) { + userParamsResult.put((String) userParamsMap.get(USER_PARAM_NAME_KEY), + userParamsMap.get(USER_PARAM_VALUE_KEY)); + } + } + } + return userParamsResult; + } + + protected OrchestrationContext mapOrchestrationContext(RequestDetails requestDetails) { + OrchestrationContext context = new OrchestrationContext(); + context.setIsRollbackEnabled(!(requestDetails.getRequestInfo().getSuppressRollback())); + return context; + } + + protected CloudRegion mapCloudRegion(CloudConfiguration cloudConfiguration, + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion) { + CloudRegion cloudRegion = new CloudRegion(); + if (cloudConfiguration != null) + cloudRegion = modelMapper.map(cloudConfiguration, CloudRegion.class); + if (aaiCloudRegion != null) + modelMapper.map(aaiCloudRegion, cloudRegion); + return cloudRegion; + } + + protected Tenant mapTenant(org.onap.aai.domain.yang.Tenant aaiTenant) { + Tenant tenant = new Tenant(); + if (aaiTenant != null) { + modelMapper.map(aaiTenant, tenant); + } + return tenant; + } + + protected Collection mapAAICollectionIntoCollection(org.onap.aai.domain.yang.Collection aaiCollection) { + Collection collection = new Collection(); + collection.setId(aaiCollection.getCollectionId()); + collection.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiCollection.getOrchestrationStatus())); + return collection; + } + + protected org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup mapAAIInstanceGroupIntoInstanceGroup( + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup) { + return modelMapper.map(aaiInstanceGroup, org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup.class); + } + + public RouteTableReference mapAAIRouteTableReferenceIntoRouteTableReference( + org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference) { + return modelMapper.map(aaiRouteTableReference, RouteTableReference.class); + } + + protected ModelInfoNetwork mapCatalogNetworkToNetwork(NetworkResourceCustomization networkResourceCustomization) { + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + ModelInfoNetwork modelInfoNetwork = modelMapper.map(networkResourceCustomization, ModelInfoNetwork.class); + modelMapper.map(networkResourceCustomization.getNetworkResource(), modelInfoNetwork); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD); + return modelInfoNetwork; + } + + protected ModelInfoGenericVnf mapCatalogVnfToVnf(VnfResourceCustomization vnfResourceCustomization) { + ModelInfoGenericVnf modelInfoVnf = modelMapper.map(vnfResourceCustomization, ModelInfoGenericVnf.class); + modelMapper.map(vnfResourceCustomization.getVnfResources(), modelInfoVnf); + return modelInfoVnf; + } + + protected ModelInfoVfModule mapCatalogVfModuleToVfModule(VfModuleCustomization vfResourceCustomization) { + ModelInfoVfModule modelInfoVfModule = modelMapper.map(vfResourceCustomization, ModelInfoVfModule.class); + modelMapper.map(vfResourceCustomization.getVfModule(), modelInfoVfModule); + return modelInfoVfModule; + } + + protected Platform mapRequestPlatform(org.onap.so.serviceinstancebeans.Platform platform) { + return modelMapper.map(platform, Platform.class); + } + + protected LineOfBusiness mapRequestLineOfBusiness(org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness) { + return modelMapper.map(lineOfBusiness, LineOfBusiness.class); + } + + public Configuration mapAAIConfiguration(org.onap.aai.domain.yang.Configuration configurationAAI) { + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT); + Configuration configuration = modelMapper.map(configurationAAI, Configuration.class); + modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD); + configuration.getForwarderEvcs().addAll(mapAllForwarderEvcs(configurationAAI)); + configuration.getEvcs().addAll(mapAllEvcs(configurationAAI)); + configuration + .setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(configurationAAI.getOrchestrationStatus())); + return configuration; + } + + protected List<Evc> mapAllEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) { + List<Evc> listOfEvcs = new ArrayList<>(); + if (configurationAAI.getEvcs() != null) { + for (org.onap.aai.domain.yang.Evc aaiEvc : configurationAAI.getEvcs().getEvc()) { + listOfEvcs.add(mapEvc(aaiEvc)); + } + } + return listOfEvcs; + } + + protected Evc mapEvc(org.onap.aai.domain.yang.Evc aaiEvc) { + return modelMapper.map(aaiEvc, Evc.class); + } + + protected List<ForwarderEvc> mapAllForwarderEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) { + List<ForwarderEvc> listOfForwarderEvcs = new ArrayList<>(); + if (configurationAAI.getForwarderEvcs() != null) { + for (org.onap.aai.domain.yang.ForwarderEvc aaiForwarderEvc : configurationAAI.getForwarderEvcs() + .getForwarderEvc()) { + listOfForwarderEvcs.add(mapForwarderEvc(aaiForwarderEvc)); + } + } + return listOfForwarderEvcs; + } + + protected ForwarderEvc mapForwarderEvc(org.onap.aai.domain.yang.ForwarderEvc aaiForwarderEvc) { + return modelMapper.map(aaiForwarderEvc, ForwarderEvc.class); + } + + protected OwningEntity mapRequestOwningEntity(org.onap.so.serviceinstancebeans.OwningEntity owningEntity) { + return modelMapper.map(owningEntity, OwningEntity.class); + } + + protected Project mapRequestProject(org.onap.so.serviceinstancebeans.Project project) { + return modelMapper.map(project, Project.class); + } + + protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration( + ConfigurationResourceCustomization configurationResourceCustomization, + CvnfcConfigurationCustomization cvnfcConfigurationCustomization) { + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); + modelInfoConfiguration + .setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID()); + modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID()); + modelInfoConfiguration.setModelInvariantId( + configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID()); + modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName()); + return modelInfoConfiguration; + } + + protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration( + CvnfcConfigurationCustomization cvnfcConfigurationCustomization) { + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); + modelInfoConfiguration + .setModelVersionId(cvnfcConfigurationCustomization.getConfigurationResource().getModelUUID()); + modelInfoConfiguration.setModelCustomizationId(cvnfcConfigurationCustomization.getModelCustomizationUUID()); + modelInfoConfiguration.setModelInvariantId( + cvnfcConfigurationCustomization.getConfigurationResource().getModelInvariantUUID()); + modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName()); + modelInfoConfiguration.setConfigurationType(cvnfcConfigurationCustomization.getConfigurationType()); + modelInfoConfiguration.setConfigurationRole(cvnfcConfigurationCustomization.getConfigurationRole()); + return modelInfoConfiguration; + } + + public NetworkResourceCustomization mapCollectionNetworkResourceCustToNetworkResourceCust( + CollectionNetworkResourceCustomization collectionNetworkResourceCust) { + return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class); + } + + public Vnfc mapAAIVnfc(org.onap.aai.domain.yang.Vnfc vnfcAAI) { + return modelMapper.map(vnfcAAI, Vnfc.class); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index 9a08d1872d..5cf2bd7b39 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -26,7 +26,6 @@ import java.io.IOException; import java.util.List; import java.util.Map; import java.util.Optional; - import org.onap.aai.domain.yang.CloudRegion; import org.onap.aai.domain.yang.Configuration; import org.onap.aai.domain.yang.GenericVnf; @@ -49,7 +48,6 @@ import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; - import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; @@ -67,7 +65,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; - import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -75,379 +72,395 @@ import com.fasterxml.jackson.databind.SerializationFeature; @Component("BBInputSetupUtils") public class BBInputSetupUtils { - private static final Logger logger = LoggerFactory.getLogger(BBInputSetupUtils.class); - private ObjectMapper objectMapper = new ObjectMapper(); - private static final String REQUEST_ERROR = "Could not find request."; - - @Autowired - protected CatalogDbClient catalogDbClient; - - @Autowired - protected RequestsDbClient requestsDbClient; - - @Autowired - protected InjectionHelper injectionHelper; - - public void updateInfraActiveRequestVnfId(InfraActiveRequests request, String vnfId) { - if(request != null) { - request.setVnfId(vnfId); - this.requestsDbClient.updateInfraActiveRequests(request); - } else { - logger.debug(REQUEST_ERROR); - } - } - - public void updateInfraActiveRequestVfModuleId(InfraActiveRequests request, String vfModuleId) { - if(request != null) { - request.setVfModuleId(vfModuleId); - this.requestsDbClient.updateInfraActiveRequests(request); - } else { - logger.debug(REQUEST_ERROR); - } - } - - public void updateInfraActiveRequestVolumeGroupId(InfraActiveRequests request, String volumeGroupId) { - if(request != null) { - request.setVolumeGroupId(volumeGroupId); - this.requestsDbClient.updateInfraActiveRequests(request); - } else { - logger.debug(REQUEST_ERROR); - } - } - - public void updateInfraActiveRequestNetworkId(InfraActiveRequests request, String networkId) { - if(request != null) { - request.setNetworkId(networkId); - this.requestsDbClient.updateInfraActiveRequests(request); - } else { - logger.debug(REQUEST_ERROR); - } - } - - public Service getCatalogServiceByModelUUID(String modelUUID) { - return catalogDbClient.getServiceByID(modelUUID); - } - - public Service getCatalogServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) { - return catalogDbClient.getServiceByModelVersionAndModelInvariantUUID(modelVersion, modelInvariantUUID); - } - - public CollectionNetworkResourceCustomization getCatalogCollectionNetworkResourceCustByID(String key) { - return catalogDbClient.getCollectionNetworkResourceCustomizationByID(key); - } - - public NetworkCollectionResourceCustomization getCatalogNetworkCollectionResourceCustByID( - String collectionCustomizationId) { - return catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCustomizationId); - } - - public VfModuleCustomization getVfModuleCustomizationByModelCuztomizationUUID(String modelCustomizationUUID) { - return catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(modelCustomizationUUID); - } - - public CvnfcConfigurationCustomization getCvnfcConfigurationCustomization(String serviceModelUUID, String vnfCustomizationUuid, - String vfModuleCustomizationUuid, String cvnfcCustomizationUuid){ - return catalogDbClient.getCvnfcCustomization(serviceModelUUID, vnfCustomizationUuid,vfModuleCustomizationUuid, cvnfcCustomizationUuid); - } - - public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroups(String modelCustomizationUUID) { - return catalogDbClient.getVnfcInstanceGroupsByVnfResourceCust(modelCustomizationUUID); - } - - public Map<String, String> getURIKeysFromServiceInstance(String serviceInstanceId) { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); - return uri.getURIKeys(); - } - - protected RequestDetails getRequestDetails(String requestId) throws IOException { - if (requestId != null && !requestId.isEmpty()) { - InfraActiveRequests activeRequest = this.getInfraActiveRequest(requestId); - String requestBody = activeRequest.getRequestBody().replaceAll("\\\\", ""); - objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - objectMapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - return objectMapper.readValue(requestBody, RequestDetails.class); - } else { - return null; - } - } - - protected InfraActiveRequests getInfraActiveRequest(String requestId) { - if (requestId != null && !requestId.isEmpty()) { - return requestsDbClient.getInfraActiveRequestbyRequestId(requestId); - } else { - return null; - } - } - - protected CloudRegion getCloudRegion(CloudConfiguration cloudConfiguration) { - if (cloudConfiguration != null) { - String cloudRegionId = cloudConfiguration.getLcpCloudRegionId(); - String cloudOwner = cloudConfiguration.getCloudOwner(); - if (cloudRegionId != null && cloudOwner != null && !cloudRegionId.isEmpty() && !cloudOwner.isEmpty()) { - return injectionHelper.getAaiClient().get(CloudRegion.class, - AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, - cloudRegionId).depth(Depth.TWO)).orElse(null); - - } else { - return null; - } - } else { - return null; - } - } - - protected InstanceGroup getAAIInstanceGroup(String instanceGroupId) { - return injectionHelper.getAaiClient().get(InstanceGroup.class, - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)) - .orElse(null); - } - - public org.onap.aai.domain.yang.Customer getAAICustomer(String globalSubscriberId) { - return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Customer.class, - AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId)) - .orElse(null); - } - - public ServiceSubscription getAAIServiceSubscription(String globalSubscriberId, String subscriptionServiceType) { - - if(globalSubscriberId == null || globalSubscriberId.equals("") || subscriptionServiceType == null || subscriptionServiceType.equals("")) { - return null; - } else { - return injectionHelper.getAaiClient().get(ServiceSubscription.class, AAIUriFactory.createResourceUri( - AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, subscriptionServiceType)) - .orElse(null); - } - - } - - public ServiceInstance getAAIServiceInstanceById(String serviceInstanceId) { - return injectionHelper.getAaiClient().get(ServiceInstance.class, - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId).depth(Depth.TWO)) - .orElse(null); - } - - protected ServiceInstance getAAIServiceInstanceByIdAndCustomer(String globalCustomerId, String serviceType, - String serviceInstanceId) { - return injectionHelper.getAaiClient().get(ServiceInstance.class, AAIUriFactory.createResourceUri( - AAIObjectType.SERVICE_INSTANCE, globalCustomerId, serviceType, serviceInstanceId).depth(Depth.TWO)) - .orElse(null); - } - - protected org.onap.aai.domain.yang.ServiceInstances getAAIServiceInstancesByName(String serviceInstanceName, - Customer customer) { - - return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.ServiceInstances.class, - AAIUriFactory - .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(), - customer.getServiceSubscription().getServiceType()) - .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO)) - .orElseGet(() -> { - logger.debug("No Service Instance matched by name"); - return null; - }); - } - - public org.onap.aai.domain.yang.ServiceInstance getAAIServiceInstanceByName(String serviceInstanceName, - Customer customer) throws Exception { - org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null; - org.onap.aai.domain.yang.ServiceInstances aaiServiceInstances = null; - aaiServiceInstances = getAAIServiceInstancesByName(serviceInstanceName, customer); - - if (aaiServiceInstances == null) { - return null; - } else if (aaiServiceInstances.getServiceInstance().size() > 1) { - throw new Exception("Multiple Service Instances Returned"); - } else { - aaiServiceInstance = aaiServiceInstances.getServiceInstance().get(0); - } - return aaiServiceInstance; - } - - protected ServiceInstances getAAIServiceInstancesByName(String globalCustomerId, String serviceType, - String serviceInstanceName) { - - return injectionHelper.getAaiClient().get(ServiceInstances.class, - AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, globalCustomerId, serviceType) - .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO)) - .orElseGet(() -> { - logger.debug("No Service Instance matched by name"); - return null; - }); - } - - public Optional<ServiceInstance> getAAIServiceInstanceByName(String globalCustomerId, String serviceType, - String serviceInstanceName) throws Exception { - ServiceInstance aaiServiceInstance = null; - ServiceInstances aaiServiceInstances = null; - aaiServiceInstances = getAAIServiceInstancesByName(globalCustomerId, serviceType, serviceInstanceName); - - if (aaiServiceInstances == null) { - return Optional.empty(); - } else if (aaiServiceInstances.getServiceInstance().size() > 1) { - throw new Exception("Multiple Service Instances Returned"); - } else { - aaiServiceInstance = aaiServiceInstances.getServiceInstance().get(0); - } - return Optional.of(aaiServiceInstance); - } - - public org.onap.so.db.catalog.beans.InstanceGroup getCatalogInstanceGroup(String modelUUID) { - return this.catalogDbClient.getInstanceGroupByModelUUID(modelUUID); - } - - public List<CollectionResourceInstanceGroupCustomization> getCollectionResourceInstanceGroupCustomization( - String modelCustomizationUUID) { - return this.catalogDbClient - .getCollectionResourceInstanceGroupCustomizationByModelCustUUID(modelCustomizationUUID); - } - - public AAIResultWrapper getAAIResourceDepthOne(AAIResourceUri aaiResourceUri) { - AAIResourceUri clonedUri = aaiResourceUri.clone(); - return this.injectionHelper.getAaiClient().get(clonedUri.depth(Depth.ONE)); - } - - public AAIResultWrapper getAAIResourceDepthTwo(AAIResourceUri aaiResourceUri) { - AAIResourceUri clonedUri = aaiResourceUri.clone(); - return this.injectionHelper.getAaiClient().get(clonedUri.depth(Depth.TWO)); - } - - public Configuration getAAIConfiguration(String configurationId) { - return this.injectionHelper.getAaiClient().get(Configuration.class, - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId).depth(Depth.ONE)) - .orElseGet(() -> { - logger.debug("No Configuration matched by id"); - return null; - }); - } - - public GenericVnf getAAIGenericVnf(String vnfId) { - - return this.injectionHelper.getAaiClient().get(GenericVnf.class, - AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)) - .orElseGet(() -> { - logger.debug("No Generic Vnf matched by id"); - return null; - }); - } - - public VolumeGroup getAAIVolumeGroup(String cloudOwnerId, String cloudRegionId, String volumeGroupId) { - return this.injectionHelper.getAaiClient().get(VolumeGroup.class, - AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwnerId, cloudRegionId, volumeGroupId).depth(Depth.ONE)) - .orElseGet(() -> { - logger.debug("No Generic Vnf matched by id"); - return null; - }); - } - - public VfModule getAAIVfModule(String vnfId, String vfModuleId) { - return this.injectionHelper.getAaiClient().get(VfModule.class, - AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE)) - .orElseGet(() -> { - logger.debug("No Generic Vnf matched by id"); - return null; - }); - } - - public L3Network getAAIL3Network(String networkId) { - - return this.injectionHelper.getAaiClient().get(L3Network.class, - AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE)) - .orElseGet(() -> { - logger.debug("No Generic Vnf matched by id"); - return null; - }); - - } - - public Optional<ServiceInstance> getRelatedServiceInstanceFromInstanceGroup(String instanceGroupId) throws Exception { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId); - uri.relatedTo(AAIObjectPlurals.SERVICE_INSTANCE); - Optional<ServiceInstances> serviceInstances = injectionHelper.getAaiClient().get(ServiceInstances.class, uri); - ServiceInstance serviceInstance = null; - if (!serviceInstances.isPresent()) { - logger.debug("No ServiceInstances were found"); - return Optional.empty(); - } else { - if (serviceInstances.get().getServiceInstance().isEmpty()) { - throw new NoServiceInstanceFoundException("No ServiceInstances Returned"); - } else if (serviceInstances.get().getServiceInstance().size() > 1) { - throw new MultipleObjectsFoundException("Multiple ServiceInstances Returned"); - } else { - serviceInstance = serviceInstances.get().getServiceInstance().get(0); - } - return Optional.of(serviceInstance); - } - } - - public Optional<L3Network> getRelatedNetworkByNameFromServiceInstance(String serviceInstanceId, String networkName) throws Exception{ - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); - uri.relatedTo(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName); - Optional<L3Networks> networks = injectionHelper.getAaiClient().get(L3Networks.class, uri); - L3Network network = null; - if (!networks.isPresent()) { - logger.debug("No Networks matched by name"); - return Optional.empty(); - } else { - if (networks.get().getL3Network().size() > 1) { - throw new Exception("Multiple Networks Returned"); - } else { - network = networks.get().getL3Network().get(0); - } - return Optional.of(network); - } - } - - public Optional<GenericVnf> getRelatedVnfByNameFromServiceInstance(String serviceInstanceId, String vnfName) throws Exception { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); - uri.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName); - Optional<GenericVnfs> vnfs = injectionHelper.getAaiClient().get(GenericVnfs.class, uri); - GenericVnf vnf = null; - if (!vnfs.isPresent()) { - logger.debug("No Vnfs matched by name"); - return Optional.empty(); - } else { - if (vnfs.get().getGenericVnf().size() > 1) { - throw new Exception("Multiple Vnfs Returned"); - } else { - vnf = vnfs.get().getGenericVnf().get(0); - } - return Optional.of(vnf); - } - } - - public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVnf(String vnfId, String volumeGroupName) throws Exception{ - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); - uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName); - Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri); - VolumeGroup volumeGroup = null; - if (!volumeGroups.isPresent()) { - logger.debug("No VolumeGroups matched by name"); - return Optional.empty(); - } else { - if (volumeGroups.get().getVolumeGroup().size() > 1) { - throw new Exception("Multiple VolumeGroups Returned"); - } else { - volumeGroup = volumeGroups.get().getVolumeGroup().get(0); - } - return Optional.of(volumeGroup); - } - } - - public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vnfId, String vfModuleId, String volumeGroupName) throws Exception { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId); - uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName); - Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri); - VolumeGroup volumeGroup = null; - if (!volumeGroups.isPresent()) { - logger.debug("No VolumeGroups matched by name"); - return Optional.empty(); - } else { - if (volumeGroups.get().getVolumeGroup().size() > 1) { - throw new Exception("Multiple VolumeGroups Returned"); - } else { - volumeGroup = volumeGroups.get().getVolumeGroup().get(0); - } - return Optional.of(volumeGroup); - } - } + private static final Logger logger = LoggerFactory.getLogger(BBInputSetupUtils.class); + private ObjectMapper objectMapper = new ObjectMapper(); + private static final String REQUEST_ERROR = "Could not find request."; + + @Autowired + protected CatalogDbClient catalogDbClient; + + @Autowired + protected RequestsDbClient requestsDbClient; + + @Autowired + protected InjectionHelper injectionHelper; + + public void updateInfraActiveRequestVnfId(InfraActiveRequests request, String vnfId) { + if (request != null) { + request.setVnfId(vnfId); + this.requestsDbClient.updateInfraActiveRequests(request); + } else { + logger.debug(REQUEST_ERROR); + } + } + + public void updateInfraActiveRequestVfModuleId(InfraActiveRequests request, String vfModuleId) { + if (request != null) { + request.setVfModuleId(vfModuleId); + this.requestsDbClient.updateInfraActiveRequests(request); + } else { + logger.debug(REQUEST_ERROR); + } + } + + public void updateInfraActiveRequestVolumeGroupId(InfraActiveRequests request, String volumeGroupId) { + if (request != null) { + request.setVolumeGroupId(volumeGroupId); + this.requestsDbClient.updateInfraActiveRequests(request); + } else { + logger.debug(REQUEST_ERROR); + } + } + + public void updateInfraActiveRequestNetworkId(InfraActiveRequests request, String networkId) { + if (request != null) { + request.setNetworkId(networkId); + this.requestsDbClient.updateInfraActiveRequests(request); + } else { + logger.debug(REQUEST_ERROR); + } + } + + public Service getCatalogServiceByModelUUID(String modelUUID) { + return catalogDbClient.getServiceByID(modelUUID); + } + + public Service getCatalogServiceByModelVersionAndModelInvariantUUID(String modelVersion, + String modelInvariantUUID) { + return catalogDbClient.getServiceByModelVersionAndModelInvariantUUID(modelVersion, modelInvariantUUID); + } + + public CollectionNetworkResourceCustomization getCatalogCollectionNetworkResourceCustByID(String key) { + return catalogDbClient.getCollectionNetworkResourceCustomizationByID(key); + } + + public NetworkCollectionResourceCustomization getCatalogNetworkCollectionResourceCustByID( + String collectionCustomizationId) { + return catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCustomizationId); + } + + public VfModuleCustomization getVfModuleCustomizationByModelCuztomizationUUID(String modelCustomizationUUID) { + return catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(modelCustomizationUUID); + } + + public CvnfcConfigurationCustomization getCvnfcConfigurationCustomization(String serviceModelUUID, + String vnfCustomizationUuid, String vfModuleCustomizationUuid, String cvnfcCustomizationUuid) { + return catalogDbClient.getCvnfcCustomization(serviceModelUUID, vnfCustomizationUuid, vfModuleCustomizationUuid, + cvnfcCustomizationUuid); + } + + public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroups(String modelCustomizationUUID) { + return catalogDbClient.getVnfcInstanceGroupsByVnfResourceCust(modelCustomizationUUID); + } + + public Map<String, String> getURIKeysFromServiceInstance(String serviceInstanceId) { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + return uri.getURIKeys(); + } + + protected RequestDetails getRequestDetails(String requestId) throws IOException { + if (requestId != null && !requestId.isEmpty()) { + InfraActiveRequests activeRequest = this.getInfraActiveRequest(requestId); + String requestBody = activeRequest.getRequestBody().replaceAll("\\\\", ""); + objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + objectMapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + return objectMapper.readValue(requestBody, RequestDetails.class); + } else { + return null; + } + } + + protected InfraActiveRequests getInfraActiveRequest(String requestId) { + if (requestId != null && !requestId.isEmpty()) { + return requestsDbClient.getInfraActiveRequestbyRequestId(requestId); + } else { + return null; + } + } + + protected CloudRegion getCloudRegion(CloudConfiguration cloudConfiguration) { + if (cloudConfiguration != null) { + String cloudRegionId = cloudConfiguration.getLcpCloudRegionId(); + String cloudOwner = cloudConfiguration.getCloudOwner(); + if (cloudRegionId != null && cloudOwner != null && !cloudRegionId.isEmpty() && !cloudOwner.isEmpty()) { + return injectionHelper.getAaiClient().get(CloudRegion.class, AAIUriFactory + .createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, cloudRegionId).depth(Depth.TWO)) + .orElse(null); + + } else { + return null; + } + } else { + return null; + } + } + + protected InstanceGroup getAAIInstanceGroup(String instanceGroupId) { + return injectionHelper.getAaiClient().get(InstanceGroup.class, + AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)).orElse(null); + } + + public org.onap.aai.domain.yang.Customer getAAICustomer(String globalSubscriberId) { + return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Customer.class, + AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId)).orElse(null); + } + + public ServiceSubscription getAAIServiceSubscription(String globalSubscriberId, String subscriptionServiceType) { + + if (globalSubscriberId == null || globalSubscriberId.equals("") || subscriptionServiceType == null + || subscriptionServiceType.equals("")) { + return null; + } else { + return injectionHelper.getAaiClient().get(ServiceSubscription.class, AAIUriFactory + .createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, subscriptionServiceType)) + .orElse(null); + } + + } + + public ServiceInstance getAAIServiceInstanceById(String serviceInstanceId) { + return injectionHelper.getAaiClient() + .get(ServiceInstance.class, AAIUriFactory + .createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId).depth(Depth.TWO)) + .orElse(null); + } + + protected ServiceInstance getAAIServiceInstanceByIdAndCustomer(String globalCustomerId, String serviceType, + String serviceInstanceId) { + return injectionHelper.getAaiClient().get(ServiceInstance.class, AAIUriFactory + .createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId, serviceType, serviceInstanceId) + .depth(Depth.TWO)).orElse(null); + } + + protected org.onap.aai.domain.yang.ServiceInstances getAAIServiceInstancesByName(String serviceInstanceName, + Customer customer) { + + return injectionHelper.getAaiClient() + .get(org.onap.aai.domain.yang.ServiceInstances.class, + AAIUriFactory + .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(), + customer.getServiceSubscription().getServiceType()) + .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO)) + .orElseGet(() -> { + logger.debug("No Service Instance matched by name"); + return null; + }); + } + + public org.onap.aai.domain.yang.ServiceInstance getAAIServiceInstanceByName(String serviceInstanceName, + Customer customer) throws Exception { + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null; + org.onap.aai.domain.yang.ServiceInstances aaiServiceInstances = null; + aaiServiceInstances = getAAIServiceInstancesByName(serviceInstanceName, customer); + + if (aaiServiceInstances == null) { + return null; + } else if (aaiServiceInstances.getServiceInstance().size() > 1) { + throw new Exception("Multiple Service Instances Returned"); + } else { + aaiServiceInstance = aaiServiceInstances.getServiceInstance().get(0); + } + return aaiServiceInstance; + } + + protected ServiceInstances getAAIServiceInstancesByName(String globalCustomerId, String serviceType, + String serviceInstanceName) { + + return injectionHelper.getAaiClient() + .get(ServiceInstances.class, + AAIUriFactory + .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, globalCustomerId, serviceType) + .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO)) + .orElseGet(() -> { + logger.debug("No Service Instance matched by name"); + return null; + }); + } + + public Optional<ServiceInstance> getAAIServiceInstanceByName(String globalCustomerId, String serviceType, + String serviceInstanceName) throws Exception { + ServiceInstance aaiServiceInstance = null; + ServiceInstances aaiServiceInstances = null; + aaiServiceInstances = getAAIServiceInstancesByName(globalCustomerId, serviceType, serviceInstanceName); + + if (aaiServiceInstances == null) { + return Optional.empty(); + } else if (aaiServiceInstances.getServiceInstance().size() > 1) { + throw new Exception("Multiple Service Instances Returned"); + } else { + aaiServiceInstance = aaiServiceInstances.getServiceInstance().get(0); + } + return Optional.of(aaiServiceInstance); + } + + public org.onap.so.db.catalog.beans.InstanceGroup getCatalogInstanceGroup(String modelUUID) { + return this.catalogDbClient.getInstanceGroupByModelUUID(modelUUID); + } + + public List<CollectionResourceInstanceGroupCustomization> getCollectionResourceInstanceGroupCustomization( + String modelCustomizationUUID) { + return this.catalogDbClient + .getCollectionResourceInstanceGroupCustomizationByModelCustUUID(modelCustomizationUUID); + } + + public AAIResultWrapper getAAIResourceDepthOne(AAIResourceUri aaiResourceUri) { + AAIResourceUri clonedUri = aaiResourceUri.clone(); + return this.injectionHelper.getAaiClient().get(clonedUri.depth(Depth.ONE)); + } + + public AAIResultWrapper getAAIResourceDepthTwo(AAIResourceUri aaiResourceUri) { + AAIResourceUri clonedUri = aaiResourceUri.clone(); + return this.injectionHelper.getAaiClient().get(clonedUri.depth(Depth.TWO)); + } + + public Configuration getAAIConfiguration(String configurationId) { + return this.injectionHelper.getAaiClient() + .get(Configuration.class, + AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId).depth(Depth.ONE)) + .orElseGet(() -> { + logger.debug("No Configuration matched by id"); + return null; + }); + } + + public GenericVnf getAAIGenericVnf(String vnfId) { + + return this.injectionHelper.getAaiClient() + .get(GenericVnf.class, + AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)) + .orElseGet(() -> { + logger.debug("No Generic Vnf matched by id"); + return null; + }); + } + + public VolumeGroup getAAIVolumeGroup(String cloudOwnerId, String cloudRegionId, String volumeGroupId) { + return this.injectionHelper.getAaiClient() + .get(VolumeGroup.class, AAIUriFactory + .createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwnerId, cloudRegionId, volumeGroupId) + .depth(Depth.ONE)) + .orElseGet(() -> { + logger.debug("No Generic Vnf matched by id"); + return null; + }); + } + + public VfModule getAAIVfModule(String vnfId, String vfModuleId) { + return this.injectionHelper.getAaiClient() + .get(VfModule.class, + AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE)) + .orElseGet(() -> { + logger.debug("No Generic Vnf matched by id"); + return null; + }); + } + + public L3Network getAAIL3Network(String networkId) { + + return this.injectionHelper.getAaiClient() + .get(L3Network.class, + AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE)) + .orElseGet(() -> { + logger.debug("No Generic Vnf matched by id"); + return null; + }); + + } + + public Optional<ServiceInstance> getRelatedServiceInstanceFromInstanceGroup(String instanceGroupId) + throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId); + uri.relatedTo(AAIObjectPlurals.SERVICE_INSTANCE); + Optional<ServiceInstances> serviceInstances = injectionHelper.getAaiClient().get(ServiceInstances.class, uri); + ServiceInstance serviceInstance = null; + if (!serviceInstances.isPresent()) { + logger.debug("No ServiceInstances were found"); + return Optional.empty(); + } else { + if (serviceInstances.get().getServiceInstance().isEmpty()) { + throw new NoServiceInstanceFoundException("No ServiceInstances Returned"); + } else if (serviceInstances.get().getServiceInstance().size() > 1) { + throw new MultipleObjectsFoundException("Multiple ServiceInstances Returned"); + } else { + serviceInstance = serviceInstances.get().getServiceInstance().get(0); + } + return Optional.of(serviceInstance); + } + } + + public Optional<L3Network> getRelatedNetworkByNameFromServiceInstance(String serviceInstanceId, String networkName) + throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + uri.relatedTo(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName); + Optional<L3Networks> networks = injectionHelper.getAaiClient().get(L3Networks.class, uri); + L3Network network = null; + if (!networks.isPresent()) { + logger.debug("No Networks matched by name"); + return Optional.empty(); + } else { + if (networks.get().getL3Network().size() > 1) { + throw new Exception("Multiple Networks Returned"); + } else { + network = networks.get().getL3Network().get(0); + } + return Optional.of(network); + } + } + + public Optional<GenericVnf> getRelatedVnfByNameFromServiceInstance(String serviceInstanceId, String vnfName) + throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + uri.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName); + Optional<GenericVnfs> vnfs = injectionHelper.getAaiClient().get(GenericVnfs.class, uri); + GenericVnf vnf = null; + if (!vnfs.isPresent()) { + logger.debug("No Vnfs matched by name"); + return Optional.empty(); + } else { + if (vnfs.get().getGenericVnf().size() > 1) { + throw new Exception("Multiple Vnfs Returned"); + } else { + vnf = vnfs.get().getGenericVnf().get(0); + } + return Optional.of(vnf); + } + } + + public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVnf(String vnfId, String volumeGroupName) + throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName); + Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri); + VolumeGroup volumeGroup = null; + if (!volumeGroups.isPresent()) { + logger.debug("No VolumeGroups matched by name"); + return Optional.empty(); + } else { + if (volumeGroups.get().getVolumeGroup().size() > 1) { + throw new Exception("Multiple VolumeGroups Returned"); + } else { + volumeGroup = volumeGroups.get().getVolumeGroup().get(0); + } + return Optional.of(volumeGroup); + } + } + + public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vnfId, String vfModuleId, + String volumeGroupName) throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId); + uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName); + Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri); + VolumeGroup volumeGroup = null; + if (!volumeGroups.isPresent()) { + logger.debug("No VolumeGroups matched by name"); + return Optional.empty(); + } else { + if (volumeGroups.get().getVolumeGroup().size() > 1) { + throw new Exception("Multiple VolumeGroups Returned"); + } else { + volumeGroup = volumeGroups.get().getVolumeGroup().get(0); + } + return Optional.of(volumeGroup); + } + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java index 7fcc613913..e4012e1290 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java @@ -24,7 +24,6 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import java.util.List; import java.util.Optional; - import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; @@ -37,80 +36,81 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; - import com.fasterxml.jackson.core.JsonProcessingException; @Component public class CloudInfoFromAAI { - private static final Logger logger = LoggerFactory.getLogger(CloudInfoFromAAI.class); - @Autowired - private BBInputSetupUtils bbInputSetupUtils; - - public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) { - this.bbInputSetupUtils = bbInputSetupUtils; - } - - protected Optional<CloudRegion> getCloudInfoFromAAI(ServiceInstance serviceInstance) throws JsonProcessingException { - Optional<Relationships> relationshipsOp = Optional.empty(); - if(!serviceInstance.getVnfs().isEmpty()) { - GenericVnf vnf = serviceInstance.getVnfs().get(0); - org.onap.aai.domain.yang.GenericVnf aaiVnf = bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()); - AAIResultWrapper vnfWrapper = new AAIResultWrapper( - new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiVnf)); - relationshipsOp = getRelationshipsFromWrapper(vnfWrapper); - } else if(!serviceInstance.getNetworks().isEmpty()) { - L3Network network = serviceInstance.getNetworks().get(0); - org.onap.aai.domain.yang.L3Network aaiL3Network = bbInputSetupUtils.getAAIL3Network(network.getNetworkId()); - AAIResultWrapper networkWrapper = new AAIResultWrapper( - new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiL3Network)); - relationshipsOp = getRelationshipsFromWrapper(networkWrapper); - } else { - logger.debug("BBInputSetup could not find a cloud region or tenant, since there are no resources under the SI."); - return Optional.empty(); - } - if (relationshipsOp.isPresent()) { - return getRelatedCloudRegionAndTenant(relationshipsOp.get()); - } else { - logger.debug("BBInputSetup could not find a cloud region or tenant"); - return Optional.empty(); - } - } + private static final Logger logger = LoggerFactory.getLogger(CloudInfoFromAAI.class); + @Autowired + private BBInputSetupUtils bbInputSetupUtils; + + public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) { + this.bbInputSetupUtils = bbInputSetupUtils; + } + + protected Optional<CloudRegion> getCloudInfoFromAAI(ServiceInstance serviceInstance) + throws JsonProcessingException { + Optional<Relationships> relationshipsOp = Optional.empty(); + if (!serviceInstance.getVnfs().isEmpty()) { + GenericVnf vnf = serviceInstance.getVnfs().get(0); + org.onap.aai.domain.yang.GenericVnf aaiVnf = bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()); + AAIResultWrapper vnfWrapper = + new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiVnf)); + relationshipsOp = getRelationshipsFromWrapper(vnfWrapper); + } else if (!serviceInstance.getNetworks().isEmpty()) { + L3Network network = serviceInstance.getNetworks().get(0); + org.onap.aai.domain.yang.L3Network aaiL3Network = bbInputSetupUtils.getAAIL3Network(network.getNetworkId()); + AAIResultWrapper networkWrapper = new AAIResultWrapper( + new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiL3Network)); + relationshipsOp = getRelationshipsFromWrapper(networkWrapper); + } else { + logger.debug( + "BBInputSetup could not find a cloud region or tenant, since there are no resources under the SI."); + return Optional.empty(); + } + if (relationshipsOp.isPresent()) { + return getRelatedCloudRegionAndTenant(relationshipsOp.get()); + } else { + logger.debug("BBInputSetup could not find a cloud region or tenant"); + return Optional.empty(); + } + } - protected Optional<Relationships> getRelationshipsFromWrapper(AAIResultWrapper wrapper) { - Optional<Relationships> relationshipsOp; - relationshipsOp = wrapper.getRelationships(); - if(relationshipsOp.isPresent()) { - return relationshipsOp; - } - return Optional.empty(); - } + protected Optional<Relationships> getRelationshipsFromWrapper(AAIResultWrapper wrapper) { + Optional<Relationships> relationshipsOp; + relationshipsOp = wrapper.getRelationships(); + if (relationshipsOp.isPresent()) { + return relationshipsOp; + } + return Optional.empty(); + } - protected Optional<CloudRegion> getRelatedCloudRegionAndTenant(Relationships relationships) { - CloudRegion cloudRegion = new CloudRegion(); - List<AAIResultWrapper> cloudRegions = relationships.getByType(AAIObjectType.CLOUD_REGION); - List<AAIResultWrapper> tenants = relationships.getByType(AAIObjectType.TENANT); - if(!cloudRegions.isEmpty()) { - AAIResultWrapper cloudRegionWrapper = cloudRegions.get(0); - Optional<org.onap.aai.domain.yang.CloudRegion> aaiCloudRegionOp = cloudRegionWrapper - .asBean(org.onap.aai.domain.yang.CloudRegion.class); - if(aaiCloudRegionOp.isPresent()) { - org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = aaiCloudRegionOp.get(); - cloudRegion.setCloudOwner(aaiCloudRegion.getCloudOwner()); - cloudRegion.setCloudRegionVersion(aaiCloudRegion.getCloudRegionVersion()); - cloudRegion.setLcpCloudRegionId(aaiCloudRegion.getCloudRegionId()); - cloudRegion.setComplex(aaiCloudRegion.getComplexName()); - } - } - if(!tenants.isEmpty()) { - AAIResultWrapper tenantWrapper = tenants.get(0); - Optional<org.onap.aai.domain.yang.Tenant> aaiTenantOp = tenantWrapper - .asBean(org.onap.aai.domain.yang.Tenant.class); - if(aaiTenantOp.isPresent()) { - org.onap.aai.domain.yang.Tenant aaiTenant = aaiTenantOp.get(); - cloudRegion.setTenantId(aaiTenant.getTenantId()); - } - } - return Optional.of(cloudRegion); - } + protected Optional<CloudRegion> getRelatedCloudRegionAndTenant(Relationships relationships) { + CloudRegion cloudRegion = new CloudRegion(); + List<AAIResultWrapper> cloudRegions = relationships.getByType(AAIObjectType.CLOUD_REGION); + List<AAIResultWrapper> tenants = relationships.getByType(AAIObjectType.TENANT); + if (!cloudRegions.isEmpty()) { + AAIResultWrapper cloudRegionWrapper = cloudRegions.get(0); + Optional<org.onap.aai.domain.yang.CloudRegion> aaiCloudRegionOp = + cloudRegionWrapper.asBean(org.onap.aai.domain.yang.CloudRegion.class); + if (aaiCloudRegionOp.isPresent()) { + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = aaiCloudRegionOp.get(); + cloudRegion.setCloudOwner(aaiCloudRegion.getCloudOwner()); + cloudRegion.setCloudRegionVersion(aaiCloudRegion.getCloudRegionVersion()); + cloudRegion.setLcpCloudRegionId(aaiCloudRegion.getCloudRegionId()); + cloudRegion.setComplex(aaiCloudRegion.getComplexName()); + } + } + if (!tenants.isEmpty()) { + AAIResultWrapper tenantWrapper = tenants.get(0); + Optional<org.onap.aai.domain.yang.Tenant> aaiTenantOp = + tenantWrapper.asBean(org.onap.aai.domain.yang.Tenant.class); + if (aaiTenantOp.isPresent()) { + org.onap.aai.domain.yang.Tenant aaiTenant = aaiTenantOp.get(); + cloudRegion.setTenantId(aaiTenant.getTenantId()); + } + } + return Optional.of(cloudRegion); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java index aa992d6153..c8e296d5ac 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import java.util.Map; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.core.WorkflowException; @@ -44,154 +43,154 @@ import org.springframework.stereotype.Component; @Component public class ExecuteBuildingBlockRainyDay { - private static final Logger logger = LoggerFactory.getLogger(ExecuteBuildingBlockRainyDay.class); - public static final String HANDLING_CODE = "handlingCode"; + private static final Logger logger = LoggerFactory.getLogger(ExecuteBuildingBlockRainyDay.class); + public static final String HANDLING_CODE = "handlingCode"; + + @Autowired + private CatalogDbClient catalogDbClient; + @Autowired + private RequestsDbClient requestDbclient; + private static final String ASTERISK = "*"; + + @Autowired + private Environment environment; + protected String retryDurationPath = "mso.rainyDay.retryDurationMultiplier"; + protected String defaultCode = "mso.rainyDay.defaultCode"; + protected String maxRetries = "mso.rainyDay.maxRetries"; + + public void setRetryTimer(DelegateExecution execution) { + try { + int retryDurationMult = Integer.parseInt(this.environment.getProperty(retryDurationPath)); + int retryCount = (int) execution.getVariable("retryCount"); + int retryTimeToWait = (int) Math.pow(retryDurationMult, retryCount) * 10; + String RetryDuration = "PT" + retryTimeToWait + "S"; + execution.setVariable("RetryDuration", RetryDuration); + } catch (Exception e) { + logger.error("Exception occurred", e); + throw new BpmnError("Unknown error incrementing retry counter"); + } + } + + public void queryRainyDayTable(DelegateExecution execution, boolean primaryPolicy) { + try { + ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock"); + String bbName = ebb.getBuildingBlock().getBpmnFlowName(); + GeneralBuildingBlock gBBInput = (GeneralBuildingBlock) execution.getVariable("gBBInput"); + String requestId = (String) execution.getVariable("mso-request-id"); + Map<ResourceKey, String> lookupKeyMap = (Map<ResourceKey, String>) execution.getVariable("lookupKeyMap"); + String serviceType = ASTERISK; + boolean aLaCarte = (boolean) execution.getVariable("aLaCarte"); + boolean suppressRollback = (boolean) execution.getVariable("suppressRollback"); + String handlingCode = ""; + + WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); + try { + // Extract error data to be returned to WorkflowAction + execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage()); + } catch (Exception e) { + logger.error("No WorkflowException Found", e); + } - @Autowired - private CatalogDbClient catalogDbClient; - @Autowired - private RequestsDbClient requestDbclient; - private static final String ASTERISK = "*"; + if (suppressRollback) { + handlingCode = "Abort"; + } else { + try { + serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0) + .getModelInfoServiceInstance().getServiceType(); + } catch (Exception ex) { + // keep default serviceType value + } + String vnfType = ASTERISK; + try { + for (GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0) + .getVnfs()) { + if (vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + vnfType = vnf.getVnfType(); + } + } + } catch (Exception ex) { + // keep default vnfType value + } - @Autowired - private Environment environment; - protected String retryDurationPath = "mso.rainyDay.retryDurationMultiplier"; - protected String defaultCode = "mso.rainyDay.defaultCode"; - protected String maxRetries = "mso.rainyDay.maxRetries"; + String errorCode = ASTERISK; + try { + errorCode = "" + workflowException.getErrorCode(); + } catch (Exception ex) { + // keep default errorCode value + } + try { + errorCode = "" + (String) execution.getVariable("WorkflowExceptionCode"); + } catch (Exception ex) { + // keep default errorCode value + } - public void setRetryTimer(DelegateExecution execution) { - try { - int retryDurationMult = Integer.parseInt(this.environment.getProperty(retryDurationPath)); - int retryCount = (int) execution.getVariable("retryCount"); - int retryTimeToWait = (int) Math.pow(retryDurationMult, retryCount) * 10; - String RetryDuration = "PT" + retryTimeToWait + "S"; - execution.setVariable("RetryDuration", RetryDuration); - } catch (Exception e) { - logger.error("Exception occurred", e); - throw new BpmnError("Unknown error incrementing retry counter"); - } - } + String workStep = ASTERISK; + try { + workStep = workflowException.getWorkStep(); + } catch (Exception ex) { + // keep default workStep value + } - public void queryRainyDayTable(DelegateExecution execution, boolean primaryPolicy) { - try { - ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock"); - String bbName = ebb.getBuildingBlock().getBpmnFlowName(); - GeneralBuildingBlock gBBInput = (GeneralBuildingBlock) execution.getVariable("gBBInput"); - String requestId = (String) execution.getVariable("mso-request-id"); - Map<ResourceKey, String> lookupKeyMap = (Map<ResourceKey, String>) execution.getVariable("lookupKeyMap"); - String serviceType = ASTERISK; - boolean aLaCarte = (boolean) execution.getVariable("aLaCarte"); - boolean suppressRollback = (boolean) execution.getVariable("suppressRollback"); - String handlingCode = ""; - - WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); - try { - // Extract error data to be returned to WorkflowAction - execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage()); - } catch (Exception e) { - logger.error("No WorkflowException Found",e); - } - - if (suppressRollback) { - handlingCode = "Abort"; - } else { - try { - serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0) - .getModelInfoServiceInstance().getServiceType(); - } catch (Exception ex) { - // keep default serviceType value - } - String vnfType = ASTERISK; - try { - for (GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0) - .getVnfs()) { - if (vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { - vnfType = vnf.getVnfType(); - } - } - } catch (Exception ex) { - // keep default vnfType value - } - - String errorCode = ASTERISK; - try { - errorCode = "" + workflowException.getErrorCode(); - } catch (Exception ex) { - // keep default errorCode value - } - try { - errorCode = "" + (String) execution.getVariable("WorkflowExceptionCode"); - } catch (Exception ex) { - // keep default errorCode value - } + RainyDayHandlerStatus rainyDayHandlerStatus; + rainyDayHandlerStatus = catalogDbClient + .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName, + serviceType, vnfType, errorCode, workStep); + if (rainyDayHandlerStatus == null) { + rainyDayHandlerStatus = catalogDbClient + .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName, + ASTERISK, ASTERISK, errorCode, ASTERISK); + } - String workStep = ASTERISK; - try { - workStep = workflowException.getWorkStep(); - } catch (Exception ex) { - // keep default workStep value - } - - RainyDayHandlerStatus rainyDayHandlerStatus; - rainyDayHandlerStatus = catalogDbClient - .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName, - serviceType, vnfType, errorCode, workStep); - if (rainyDayHandlerStatus == null) { - rainyDayHandlerStatus = catalogDbClient - .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName, - ASTERISK, ASTERISK, errorCode, ASTERISK); - } - - if (rainyDayHandlerStatus == null) { - rainyDayHandlerStatus = catalogDbClient - .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName, - ASTERISK, ASTERISK, ASTERISK, ASTERISK); - if (rainyDayHandlerStatus == null) { - handlingCode = "Abort"; - } else { - if (primaryPolicy) { - handlingCode = rainyDayHandlerStatus.getPolicy(); - } else { - handlingCode = rainyDayHandlerStatus.getSecondaryPolicy(); - } - } - } else { - if (primaryPolicy) { - handlingCode = rainyDayHandlerStatus.getPolicy(); - } else { - handlingCode = rainyDayHandlerStatus.getSecondaryPolicy(); - } - } - if (!primaryPolicy) { - try { - InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); - request.setRetryStatusMessage("Retries have been exhausted."); - requestDbclient.updateInfraActiveRequests(request); - } catch (Exception ex) { - logger.error("Failed to update Request Db Infra Active Requests with Retry Status",ex); - } - } - if (handlingCode.equals("RollbackToAssigned") && !aLaCarte) { - handlingCode = "Rollback"; - } - } - logger.debug("RainyDayHandler Status Code is: {}", handlingCode); - execution.setVariable(HANDLING_CODE, handlingCode); - } catch (Exception e) { - String code = this.environment.getProperty(defaultCode); - logger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = {}", code, e); - execution.setVariable(HANDLING_CODE, code); - } - try{ - int envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries)); - execution.setVariable("maxRetries", envMaxRetries); - } catch (Exception ex) { - logger.error("Could not read maxRetries from config file. Setting max to 5 retries"); - execution.setVariable("maxRetries", 5); - } - } + if (rainyDayHandlerStatus == null) { + rainyDayHandlerStatus = catalogDbClient + .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName, + ASTERISK, ASTERISK, ASTERISK, ASTERISK); + if (rainyDayHandlerStatus == null) { + handlingCode = "Abort"; + } else { + if (primaryPolicy) { + handlingCode = rainyDayHandlerStatus.getPolicy(); + } else { + handlingCode = rainyDayHandlerStatus.getSecondaryPolicy(); + } + } + } else { + if (primaryPolicy) { + handlingCode = rainyDayHandlerStatus.getPolicy(); + } else { + handlingCode = rainyDayHandlerStatus.getSecondaryPolicy(); + } + } + if (!primaryPolicy) { + try { + InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); + request.setRetryStatusMessage("Retries have been exhausted."); + requestDbclient.updateInfraActiveRequests(request); + } catch (Exception ex) { + logger.error("Failed to update Request Db Infra Active Requests with Retry Status", ex); + } + } + if (handlingCode.equals("RollbackToAssigned") && !aLaCarte) { + handlingCode = "Rollback"; + } + } + logger.debug("RainyDayHandler Status Code is: {}", handlingCode); + execution.setVariable(HANDLING_CODE, handlingCode); + } catch (Exception e) { + String code = this.environment.getProperty(defaultCode); + logger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = {}", code, e); + execution.setVariable(HANDLING_CODE, code); + } + try { + int envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries)); + execution.setVariable("maxRetries", envMaxRetries); + } catch (Exception ex) { + logger.error("Could not read maxRetries from config file. Setting max to 5 retries"); + execution.setVariable("maxRetries", 5); + } + } - public void setHandlingStatusSuccess(DelegateExecution execution) { - execution.setVariable(HANDLING_CODE, "Success"); - } + public void setHandlingStatusSuccess(DelegateExecution execution) { + execution.setVariable(HANDLING_CODE, "Success"); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java index 8af6e809f4..4332a6cf4e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java @@ -26,9 +26,7 @@ import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.util.List; import java.util.Optional; - import javax.persistence.Id; - import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -38,111 +36,115 @@ import org.onap.so.client.exception.BBObjectNotFoundException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; - import com.google.common.base.CaseFormat; @Component public class ExtractPojosForBB { - private static final Logger logger = LoggerFactory.getLogger(ExtractPojosForBB.class); - - public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key) throws BBObjectNotFoundException { - return extractByKey(execution, key, execution.getLookupMap().get(key)); - } - public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value) - throws BBObjectNotFoundException { + private static final Logger logger = LoggerFactory.getLogger(ExtractPojosForBB.class); + + public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key) throws BBObjectNotFoundException { + return extractByKey(execution, key, execution.getLookupMap().get(key)); + } + + public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value) + throws BBObjectNotFoundException { + + Optional<T> result = Optional.empty(); + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + try { + ServiceInstance serviceInstance; + GenericVnf vnf; + switch (key) { + case SERVICE_INSTANCE_ID: + result = lookupObjectInList(gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), + value); + break; + case GENERIC_VNF_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + result = lookupObjectInList(serviceInstance.getVnfs(), value); + break; + case NETWORK_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + result = lookupObjectInList(serviceInstance.getNetworks(), value); + break; + case VOLUME_GROUP_ID: + vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + result = lookupObjectInList(vnf.getVolumeGroups(), value); + break; + case VF_MODULE_ID: + vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + result = lookupObjectInList(vnf.getVfModules(), value); + break; + case ALLOTTED_RESOURCE_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + result = lookupObjectInList(serviceInstance.getAllottedResources(), value); + break; + case CONFIGURATION_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + result = lookupObjectInList(serviceInstance.getConfigurations(), value); + break; + case VPN_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + result = lookupObjectInList(gBBInput.getCustomer().getVpnBindings(), value); + break; + case VPN_BONDING_LINK_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + result = lookupObjectInList(serviceInstance.getVpnBondingLinks(), value); + break; + case INSTANCE_GROUP_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + result = lookupObjectInList(serviceInstance.getInstanceGroups(), value); + break; + default: + throw new BBObjectNotFoundException(key, value); + } + } catch (BBObjectNotFoundException e) { // re-throw parent object not found + throw e; + } catch (Exception e) { // convert all other exceptions to object not found + logger.warn("BBObjectNotFoundException in ExtractPojosForBB", + "BBObject " + key + " was not found in " + "gBBInput using reference value: " + value); + throw new BBObjectNotFoundException(key, value); + } + + if (result.isPresent()) { + return result.get(); + } else { + throw new BBObjectNotFoundException(key, value); + } + } + + protected <T> Optional<T> lookupObject(Object obj, String value) throws IllegalAccessException, + IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + return findValue(obj, value); + } + + protected <T> Optional<T> lookupObjectInList(List<?> list, String value) throws IllegalAccessException, + IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + Optional<T> result = Optional.empty(); + for (Object obj : list) { + result = findValue(obj, value); + if (result.isPresent()) { + break; + } + } + return result; + + } - Optional<T> result = Optional.empty(); - GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - try { - ServiceInstance serviceInstance; - GenericVnf vnf; - switch (key) { - case SERVICE_INSTANCE_ID: - result = lookupObjectInList(gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value); - break; - case GENERIC_VNF_ID: - serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - result = lookupObjectInList(serviceInstance.getVnfs(), value); - break; - case NETWORK_ID: - serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - result = lookupObjectInList(serviceInstance.getNetworks(), value); - break; - case VOLUME_GROUP_ID: - vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - result = lookupObjectInList(vnf.getVolumeGroups(), value); - break; - case VF_MODULE_ID: - vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - result = lookupObjectInList(vnf.getVfModules(), value); - break; - case ALLOTTED_RESOURCE_ID: - serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - result = lookupObjectInList(serviceInstance.getAllottedResources(), value); - break; - case CONFIGURATION_ID: - serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - result = lookupObjectInList(serviceInstance.getConfigurations(), value); - break; - case VPN_ID: - serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - result = lookupObjectInList(gBBInput.getCustomer().getVpnBindings(), value); - break; - case VPN_BONDING_LINK_ID: - serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - result = lookupObjectInList(serviceInstance.getVpnBondingLinks(),value); - break; - case INSTANCE_GROUP_ID: - serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - result = lookupObjectInList(serviceInstance.getInstanceGroups(), value); - break; - default: - throw new BBObjectNotFoundException(key, value); - } - } catch (BBObjectNotFoundException e) { // re-throw parent object not found - throw e; - } catch (Exception e) { // convert all other exceptions to object not found - logger.warn("BBObjectNotFoundException in ExtractPojosForBB", "BBObject " + key + " was not found in " - + "gBBInput using reference value: " + value); - throw new BBObjectNotFoundException(key, value); - } - - if (result.isPresent()) { - return result.get(); - } else { - throw new BBObjectNotFoundException(key, value); - } - } - - protected <T> Optional<T> lookupObject(Object obj, String value) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { - return findValue(obj, value); - } + protected <T> Optional<T> findValue(Object obj, String value) throws IllegalAccessException, + IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + for (Field field : obj.getClass().getDeclaredFields()) { + if (field.isAnnotationPresent(Id.class)) { + String fieldName = field.getName(); + fieldName = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, fieldName); + String fieldValue = (String) obj.getClass().getMethod("get" + fieldName).invoke(obj); + if (fieldValue.equals(value)) { + return Optional.of((T) obj); + } + } + } - protected <T> Optional<T> lookupObjectInList(List<?> list, String value) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { - Optional<T> result = Optional.empty(); - for (Object obj : list) { - result = findValue(obj, value); - if (result.isPresent()) { - break; - } - } - return result; - - } - - protected <T> Optional<T> findValue(Object obj, String value) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { - for (Field field : obj.getClass().getDeclaredFields()) { - if (field.isAnnotationPresent(Id.class)) { - String fieldName = field.getName(); - fieldName = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, fieldName); - String fieldValue = (String) obj.getClass().getMethod("get" + fieldName).invoke(obj); - if (fieldValue.equals(value)) { - return Optional.of((T)obj); - } - } - } - - return Optional.empty(); - } + return Optional.empty(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundException.java index d63f98b6ce..ab24cf155c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundException.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundException.java @@ -22,26 +22,26 @@ package org.onap.so.bpmn.servicedecomposition.tasks.exceptions; public class MultipleObjectsFoundException extends Exception { - private static final long serialVersionUID = -5045275644426587447L; - - public MultipleObjectsFoundException() { - super(); - } - - public MultipleObjectsFoundException(String message) { - super(message); - } - - public MultipleObjectsFoundException(String message, Throwable cause) { - super(message, cause); - } - - public MultipleObjectsFoundException(Throwable cause) { - super(cause); - } - - public MultipleObjectsFoundException(String message, Throwable cause, boolean enableSuppression, - boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } + private static final long serialVersionUID = -5045275644426587447L; + + public MultipleObjectsFoundException() { + super(); + } + + public MultipleObjectsFoundException(String message) { + super(message); + } + + public MultipleObjectsFoundException(String message, Throwable cause) { + super(message, cause); + } + + public MultipleObjectsFoundException(Throwable cause) { + super(cause); + } + + public MultipleObjectsFoundException(String message, Throwable cause, boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundException.java index 2ef1a80cce..acf222566a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundException.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundException.java @@ -22,26 +22,26 @@ package org.onap.so.bpmn.servicedecomposition.tasks.exceptions; public class NoServiceInstanceFoundException extends Exception { - private static final long serialVersionUID = 3270499954054029908L; - - public NoServiceInstanceFoundException() { - super(); - } - - public NoServiceInstanceFoundException(String message) { - super(message); - } - - public NoServiceInstanceFoundException(String message, Throwable cause) { - super(message, cause); - } - - public NoServiceInstanceFoundException(Throwable cause) { - super(cause); - } - - public NoServiceInstanceFoundException(String message, Throwable cause, boolean enableSuppression, - boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } + private static final long serialVersionUID = 3270499954054029908L; + + public NoServiceInstanceFoundException() { + super(); + } + + public NoServiceInstanceFoundException(String message) { + super(message); + } + + public NoServiceInstanceFoundException(String message, Throwable cause) { + super(message, cause); + } + + public NoServiceInstanceFoundException(Throwable cause) { + super(cause); + } + + public NoServiceInstanceFoundException(String message, Throwable cause, boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java index a15e044818..eccd81217f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java @@ -23,7 +23,6 @@ package org.onap.so.client.appc; import java.util.HashMap; import java.util.List; import java.util.Optional; - import org.onap.appc.client.lcm.model.Action; import org.onap.appc.client.lcm.model.Status; import org.onap.so.bpmn.appc.payload.PayloadClient; @@ -32,154 +31,163 @@ import org.onap.so.client.appc.ApplicationControllerSupport.StatusCategory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; @Component public class ApplicationControllerAction { - protected ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator(); - private String errorCode = "1002"; - private String errorMessage = "Unable to reach App C Servers"; - private static Logger logger = LoggerFactory.getLogger(ApplicationControllerAction.class); - - public void runAppCCommand(Action action, String msoRequestId, String vnfId, Optional<String> payload, HashMap<String, String> payloadInfo, String controllerType){ - Status appCStatus = null; - try{ - String vnfName = payloadInfo.getOrDefault("vnfName", ""); - String aicIdentity = payloadInfo.getOrDefault("vnfName",""); - String vnfHostIpAddress = payloadInfo.getOrDefault("vnfHostIpAddress",""); - String vmIdList = payloadInfo.getOrDefault("vmIdList", ""); - String vserverIdList = payloadInfo.getOrDefault("vserverIdList", ""); - String identityUrl = payloadInfo.getOrDefault("identityUrl", ""); - switch(action){ - case ResumeTraffic: - appCStatus = resumeTrafficAction(msoRequestId, vnfId, vnfName, controllerType); - break; - case Start: - case Stop: - appCStatus = startStopAction(action, msoRequestId, vnfId, aicIdentity, controllerType); - break; - case Unlock: - case Lock: - appCStatus = client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), Optional.empty(), controllerType); - break; - case QuiesceTraffic: - appCStatus = quiesceTrafficAction(msoRequestId, vnfId, payload, vnfName, controllerType); - break; - case HealthCheck: - appCStatus = healthCheckAction(msoRequestId, vnfId, vnfName, vnfHostIpAddress, controllerType); - break; - case Snapshot: - String vmIds = JsonUtils.getJsonValue(vmIdList, "vmIds"); - String vserverIds = JsonUtils.getJsonValue(vserverIdList, "vserverIds"); - String vmId = ""; - String vserverId = ""; - ObjectMapper mapper = new ObjectMapper(); - List<String> vmIdJsonList = mapper.readValue(vmIds, new TypeReference<List<String>>(){}); - List<String> vserverIdJsonList = mapper.readValue(vserverIds, new TypeReference<List<String>>(){}); - int i = 0; - while(i < vmIdJsonList.size()){ - vmId = vmIdJsonList.get(i); - vserverId = vserverIdJsonList.get(i); - Optional<String> vserverIdString = Optional.of(vserverId); - appCStatus = snapshotAction(msoRequestId, vnfId, vmId, vserverIdString, identityUrl, controllerType); - i++; - } - break; - case ConfigModify: - case ConfigScaleOut: - case DistributeTraffic: - case DistributeTrafficCheck: - appCStatus = payloadAction(action, msoRequestId, vnfId, payload, controllerType); - break; - case UpgradePreCheck: - case UpgradePostCheck: - case UpgradeSoftware: - case UpgradeBackup: - appCStatus = upgradeAction(action,msoRequestId, vnfId, payload, vnfName, controllerType); - break; - default: - errorMessage = "Unable to idenify Action request for AppCClient"; - break; - } - if(appCStatus != null){ - errorCode = Integer.toString(appCStatus.getCode()); - errorMessage = appCStatus.getMessage(); - - } - if(ApplicationControllerSupport.getCategoryOf(appCStatus).equals(StatusCategory.NORMAL)){ - errorCode = "0"; - } - } - catch(JsonProcessingException e){ - logger.error("Incorrect Payload format for action request: {}", action.toString(),e); - errorMessage = e.getMessage(); - } - catch(ApplicationControllerOrchestratorException e){ - logger.error("Error building Appc request: {}",e.getMessage(), e); - errorCode = "1002"; - errorMessage = e.getMessage(); - } - catch (NoSuchMethodError e) { - logger.error( "Error building Appc request: {}", e.getMessage(), e); - errorMessage = e.getMessage(); - } - catch(Exception e){ - logger.error("Error building Appc request: {}", e.getMessage(), e); - errorMessage = e.getMessage(); - } - } - - private Status payloadAction(Action action, String msoRequestId, String vnfId, Optional<String> payload, String controllerType) throws JsonProcessingException, IllegalArgumentException,ApplicationControllerOrchestratorException{ - if(!(payload.isPresent())){ - throw new IllegalArgumentException("Payload is not present for " + action.toString()); - } - return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); - } - - private Status quiesceTrafficAction(String msoRequestId, String vnfId, Optional<String> payload, String vnfName, String controllerType) throws JsonProcessingException, IllegalArgumentException,ApplicationControllerOrchestratorException{ - if(!(payload.isPresent())){ - throw new IllegalArgumentException("Payload is not present for " + Action.QuiesceTraffic.toString()); - } - payload = PayloadClient.quiesceTrafficFormat(payload, vnfName); - return client.vnfCommand(Action.QuiesceTraffic, msoRequestId, vnfId, Optional.empty(), payload, controllerType); - } - - private Status upgradeAction(Action action, String msoRequestId, String vnfId, Optional<String> payload, String vnfName, String controllerType) throws JsonProcessingException, IllegalArgumentException,ApplicationControllerOrchestratorException{ - if(!(payload.isPresent())){ - throw new IllegalArgumentException("Payload is not present for " + action.toString()); - } - payload = PayloadClient.upgradeFormat(payload, vnfName); - return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); - } - - private Status resumeTrafficAction(String msoRequestId, String vnfId, String vnfName, String controllerType)throws JsonProcessingException, ApplicationControllerOrchestratorException{ - Optional<String> payload = PayloadClient.resumeTrafficFormat(vnfName); - return client.vnfCommand(Action.ResumeTraffic, msoRequestId, vnfId, Optional.empty(), payload, controllerType); - } - - private Status startStopAction(Action action, String msoRequestId, String vnfId, String aicIdentity, String controllerType)throws JsonProcessingException, ApplicationControllerOrchestratorException{ - Optional<String> payload = PayloadClient.startStopFormat(aicIdentity); - return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); - } - - private Status healthCheckAction(String msoRequestId, String vnfId, String vnfName, String vnfHostIpAddress, String controllerType)throws JsonProcessingException, ApplicationControllerOrchestratorException{ - Optional<String> payload = PayloadClient.healthCheckFormat(vnfName, vnfHostIpAddress); - return client.vnfCommand(Action.HealthCheck, msoRequestId, vnfId, Optional.empty(), payload, controllerType); - } - - private Status snapshotAction(String msoRequestId, String vnfId, String vmId, Optional<String> vserverId, String identityUrl, String controllerType) throws JsonProcessingException, ApplicationControllerOrchestratorException{ - Optional<String> payload = PayloadClient.snapshotFormat(vmId, identityUrl); - return client.vnfCommand(Action.Snapshot, msoRequestId, vnfId, vserverId, payload, controllerType); - } - - public String getErrorMessage(){ - return errorMessage; - } - - public String getErrorCode(){ - return errorCode; - } + protected ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator(); + private String errorCode = "1002"; + private String errorMessage = "Unable to reach App C Servers"; + private static Logger logger = LoggerFactory.getLogger(ApplicationControllerAction.class); + + public void runAppCCommand(Action action, String msoRequestId, String vnfId, Optional<String> payload, + HashMap<String, String> payloadInfo, String controllerType) { + Status appCStatus = null; + try { + String vnfName = payloadInfo.getOrDefault("vnfName", ""); + String aicIdentity = payloadInfo.getOrDefault("vnfName", ""); + String vnfHostIpAddress = payloadInfo.getOrDefault("vnfHostIpAddress", ""); + String vmIdList = payloadInfo.getOrDefault("vmIdList", ""); + String vserverIdList = payloadInfo.getOrDefault("vserverIdList", ""); + String identityUrl = payloadInfo.getOrDefault("identityUrl", ""); + switch (action) { + case ResumeTraffic: + appCStatus = resumeTrafficAction(msoRequestId, vnfId, vnfName, controllerType); + break; + case Start: + case Stop: + appCStatus = startStopAction(action, msoRequestId, vnfId, aicIdentity, controllerType); + break; + case Unlock: + case Lock: + appCStatus = client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), Optional.empty(), + controllerType); + break; + case QuiesceTraffic: + appCStatus = quiesceTrafficAction(msoRequestId, vnfId, payload, vnfName, controllerType); + break; + case HealthCheck: + appCStatus = healthCheckAction(msoRequestId, vnfId, vnfName, vnfHostIpAddress, controllerType); + break; + case Snapshot: + String vmIds = JsonUtils.getJsonValue(vmIdList, "vmIds"); + String vserverIds = JsonUtils.getJsonValue(vserverIdList, "vserverIds"); + String vmId = ""; + String vserverId = ""; + ObjectMapper mapper = new ObjectMapper(); + List<String> vmIdJsonList = mapper.readValue(vmIds, new TypeReference<List<String>>() {}); + List<String> vserverIdJsonList = mapper.readValue(vserverIds, new TypeReference<List<String>>() {}); + int i = 0; + while (i < vmIdJsonList.size()) { + vmId = vmIdJsonList.get(i); + vserverId = vserverIdJsonList.get(i); + Optional<String> vserverIdString = Optional.of(vserverId); + appCStatus = + snapshotAction(msoRequestId, vnfId, vmId, vserverIdString, identityUrl, controllerType); + i++; + } + break; + case ConfigModify: + case ConfigScaleOut: + case DistributeTraffic: + case DistributeTrafficCheck: + appCStatus = payloadAction(action, msoRequestId, vnfId, payload, controllerType); + break; + case UpgradePreCheck: + case UpgradePostCheck: + case UpgradeSoftware: + case UpgradeBackup: + appCStatus = upgradeAction(action, msoRequestId, vnfId, payload, vnfName, controllerType); + break; + default: + errorMessage = "Unable to idenify Action request for AppCClient"; + break; + } + if (appCStatus != null) { + errorCode = Integer.toString(appCStatus.getCode()); + errorMessage = appCStatus.getMessage(); + + } + if (ApplicationControllerSupport.getCategoryOf(appCStatus).equals(StatusCategory.NORMAL)) { + errorCode = "0"; + } + } catch (JsonProcessingException e) { + logger.error("Incorrect Payload format for action request: {}", action.toString(), e); + errorMessage = e.getMessage(); + } catch (ApplicationControllerOrchestratorException e) { + logger.error("Error building Appc request: {}", e.getMessage(), e); + errorCode = "1002"; + errorMessage = e.getMessage(); + } catch (NoSuchMethodError e) { + logger.error("Error building Appc request: {}", e.getMessage(), e); + errorMessage = e.getMessage(); + } catch (Exception e) { + logger.error("Error building Appc request: {}", e.getMessage(), e); + errorMessage = e.getMessage(); + } + } + + private Status payloadAction(Action action, String msoRequestId, String vnfId, Optional<String> payload, + String controllerType) + throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException { + if (!(payload.isPresent())) { + throw new IllegalArgumentException("Payload is not present for " + action.toString()); + } + return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); + } + + private Status quiesceTrafficAction(String msoRequestId, String vnfId, Optional<String> payload, String vnfName, + String controllerType) + throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException { + if (!(payload.isPresent())) { + throw new IllegalArgumentException("Payload is not present for " + Action.QuiesceTraffic.toString()); + } + payload = PayloadClient.quiesceTrafficFormat(payload, vnfName); + return client.vnfCommand(Action.QuiesceTraffic, msoRequestId, vnfId, Optional.empty(), payload, controllerType); + } + + private Status upgradeAction(Action action, String msoRequestId, String vnfId, Optional<String> payload, + String vnfName, String controllerType) + throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException { + if (!(payload.isPresent())) { + throw new IllegalArgumentException("Payload is not present for " + action.toString()); + } + payload = PayloadClient.upgradeFormat(payload, vnfName); + return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); + } + + private Status resumeTrafficAction(String msoRequestId, String vnfId, String vnfName, String controllerType) + throws JsonProcessingException, ApplicationControllerOrchestratorException { + Optional<String> payload = PayloadClient.resumeTrafficFormat(vnfName); + return client.vnfCommand(Action.ResumeTraffic, msoRequestId, vnfId, Optional.empty(), payload, controllerType); + } + + private Status startStopAction(Action action, String msoRequestId, String vnfId, String aicIdentity, + String controllerType) throws JsonProcessingException, ApplicationControllerOrchestratorException { + Optional<String> payload = PayloadClient.startStopFormat(aicIdentity); + return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); + } + + private Status healthCheckAction(String msoRequestId, String vnfId, String vnfName, String vnfHostIpAddress, + String controllerType) throws JsonProcessingException, ApplicationControllerOrchestratorException { + Optional<String> payload = PayloadClient.healthCheckFormat(vnfName, vnfHostIpAddress); + return client.vnfCommand(Action.HealthCheck, msoRequestId, vnfId, Optional.empty(), payload, controllerType); + } + + private Status snapshotAction(String msoRequestId, String vnfId, String vmId, Optional<String> vserverId, + String identityUrl, String controllerType) + throws JsonProcessingException, ApplicationControllerOrchestratorException { + Optional<String> payload = PayloadClient.snapshotFormat(vmId, identityUrl); + return client.vnfCommand(Action.Snapshot, msoRequestId, vnfId, vserverId, payload, controllerType); + } + + public String getErrorMessage() { + return errorMessage; + } + + public String getErrorCode() { + return errorCode; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerCallback.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerCallback.java index cb3f144cd1..0f21c6c286 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerCallback.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerCallback.java @@ -23,18 +23,18 @@ package org.onap.so.client.appc; import org.onap.appc.client.lcm.api.ResponseHandler; import org.onap.appc.client.lcm.exceptions.AppcClientException; -public class ApplicationControllerCallback<T> implements ResponseHandler<T> { - - @Override - public void onResponse(T response) { - - - } - - @Override - public void onException(AppcClientException exception) { - - - } +public class ApplicationControllerCallback<T> implements ResponseHandler<T> { + + @Override + public void onResponse(T response) { + + + } + + @Override + public void onException(AppcClientException exception) { + + + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java index 89eff5f65a..e810fc0259 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java @@ -26,7 +26,6 @@ import java.time.Instant; import java.util.Properties; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; - import org.onap.so.bpmn.core.UrnPropertiesReader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,160 +46,163 @@ import org.onap.appc.client.lcm.model.ZULU; public class ApplicationControllerClient { - public static final String DEFAULT_CONTROLLER_TYPE = "APPC"; - - private static final String CLIENT_NAME = "MSO"; - - private static final String API_VER = "2.00"; - private static final String ORIGINATOR_ID = "MSO"; - private static final int FLAGS_TTL = 65000; - private static Logger logger = LoggerFactory.getLogger(ApplicationControllerClient.class); - - private ApplicationControllerSupport appCSupport; - - // APPC gave us an API where the controllerType is configured in the - // client object, which is not what we asked for. We asked for an API - // in which the client would have additional methods that could take - // the controllerType as a parameter, so that we would not need to - // maintain multiple client objects. This map should be removed when - // the (hopefully short-term) controllerType becomes obsolete. - - private final String controllerType; - - private static ConcurrentHashMap<String, LifeCycleManagerStateful> appCClients = new ConcurrentHashMap<>(); - - /** - * Creates an ApplicationControllerClient for communication with APP-C. - */ - public ApplicationControllerClient() { - this(DEFAULT_CONTROLLER_TYPE); - } - - /** - * Creates an ApplicationControllerClient for the specified controller type. - * @param controllerType the controller type: "appc" or "sdnc". - */ - public ApplicationControllerClient(String controllerType) { - if (controllerType == null) { - controllerType = DEFAULT_CONTROLLER_TYPE; - } - this.controllerType = controllerType.toUpperCase(); - appCSupport = new ApplicationControllerSupport(); - } - - /** - * Gets the controller type. - * @return the controllertype - */ - public String getControllerType() { - return controllerType; - } - - /** - * Returns the AppC client object associated with this ApplicationControllerClient. - * AppC client objects are shared objects. One is created if it does not exist. - * @return the client object, or null if creation failed - */ - public LifeCycleManagerStateful getAppCClient() { - return appCClients.computeIfAbsent(controllerType, k -> createAppCClient(k)); - } - - protected LifeCycleManagerStateful createAppCClient(String controllerType) { - try { - if (controllerType == null) { - controllerType = DEFAULT_CONTROLLER_TYPE; - } - controllerType = controllerType.toUpperCase(); - return AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class) - .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType)); - } catch (AppcClientException e) { - logger.error("Error in getting LifeCycleManagerStateful: {}",e.getMessage(), e); - // This null value will cause NullPointerException when used later. - // Error handling could certainly be improved here. - return null; - } - } - - public Status runCommand(Action action, org.onap.appc.client.lcm.model.ActionIdentifiers actionIdentifiers, - org.onap.appc.client.lcm.model.Payload payload, String requestID) - throws ApplicationControllerOrchestratorException { - Object requestObject; - requestObject = createRequest(action, actionIdentifiers, payload, requestID); - appCSupport.logLCMMessage(requestObject); - LifeCycleManagerStateful client = getAppCClient(); - Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, false); - try { - Object response = lcmMethod.invoke(client, requestObject); - return appCSupport.getStatusFromGenericResponse(response); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - throw new RuntimeException(String.format("%s : %s", "Unable to invoke action", action.toString()), e); - } - } - - protected Properties getLCMProperties() { - return getLCMProperties("appc"); - } - - protected Properties getLCMProperties(String controllerType) { - Properties properties = new Properties(); - - properties.put("topic.read", UrnPropertiesReader.getVariable("appc.client.topic.read.name")); - properties.put("topic.write", UrnPropertiesReader.getVariable("appc.client.topic.write")); - properties.put("SDNC-topic.read", UrnPropertiesReader.getVariable("appc.client.topic.sdnc.read")); - properties.put("SDNC-topic.write", UrnPropertiesReader.getVariable("appc.client.topic.sdnc.write")); - properties.put("topic.read.timeout", UrnPropertiesReader.getVariable("appc.client.topic.read.timeout")); - properties.put("client.response.timeout", UrnPropertiesReader.getVariable("appc.client.response.timeout")); - properties.put("poolMembers", UrnPropertiesReader.getVariable("appc.client.poolMembers")); - properties.put("controllerType", controllerType); - properties.put("client.key", UrnPropertiesReader.getVariable("appc.client.key")); - properties.put("client.secret", UrnPropertiesReader.getVariable("appc.client.secret")); - properties.put("client.name", CLIENT_NAME); - properties.put("service", UrnPropertiesReader.getVariable("appc.client.service")); - return properties; - } - - public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) { - Object requestObject = appCSupport.getInput(action.name()); - try { - CommonHeader commonHeader = buildCommonHeader(requestId); - requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject, - commonHeader); - requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action); - requestObject.getClass().getDeclaredMethod("setActionIdentifiers", ActionIdentifiers.class) - .invoke(requestObject, identifier); - if (payload != null) { - requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload); - } - } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { - logger.error("Error building Appc request", e); - } - return requestObject; - } - - private CommonHeader buildCommonHeader(String requestId) { - CommonHeader commonHeader = new CommonHeader(); - commonHeader.setApiVer(API_VER); - commonHeader.setOriginatorId(ORIGINATOR_ID); - commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId); - commonHeader.setSubRequestId(UUID.randomUUID().toString()); - Flags flags = new Flags(); - String flagsMode = "NORMAL"; - Mode mode = Mode.valueOf(flagsMode); - flags.setMode(mode); - String flagsForce = "FALSE"; - Force force = Force.valueOf(flagsForce); - flags.setForce(force); - flags.setTtl(FLAGS_TTL); - commonHeader.setFlags(flags); - Instant timestamp = Instant.now(); - ZULU zulu = new ZULU(timestamp.toString()); - commonHeader.setTimestamp(zulu); - return commonHeader; - } - - public Flags createRequestFlags() { - Flags flags = new Flags(); - flags.setTtl(6000); - return flags; - } + public static final String DEFAULT_CONTROLLER_TYPE = "APPC"; + + private static final String CLIENT_NAME = "MSO"; + + private static final String API_VER = "2.00"; + private static final String ORIGINATOR_ID = "MSO"; + private static final int FLAGS_TTL = 65000; + private static Logger logger = LoggerFactory.getLogger(ApplicationControllerClient.class); + + private ApplicationControllerSupport appCSupport; + + // APPC gave us an API where the controllerType is configured in the + // client object, which is not what we asked for. We asked for an API + // in which the client would have additional methods that could take + // the controllerType as a parameter, so that we would not need to + // maintain multiple client objects. This map should be removed when + // the (hopefully short-term) controllerType becomes obsolete. + + private final String controllerType; + + private static ConcurrentHashMap<String, LifeCycleManagerStateful> appCClients = new ConcurrentHashMap<>(); + + /** + * Creates an ApplicationControllerClient for communication with APP-C. + */ + public ApplicationControllerClient() { + this(DEFAULT_CONTROLLER_TYPE); + } + + /** + * Creates an ApplicationControllerClient for the specified controller type. + * + * @param controllerType the controller type: "appc" or "sdnc". + */ + public ApplicationControllerClient(String controllerType) { + if (controllerType == null) { + controllerType = DEFAULT_CONTROLLER_TYPE; + } + this.controllerType = controllerType.toUpperCase(); + appCSupport = new ApplicationControllerSupport(); + } + + /** + * Gets the controller type. + * + * @return the controllertype + */ + public String getControllerType() { + return controllerType; + } + + /** + * Returns the AppC client object associated with this ApplicationControllerClient. AppC client objects are shared + * objects. One is created if it does not exist. + * + * @return the client object, or null if creation failed + */ + public LifeCycleManagerStateful getAppCClient() { + return appCClients.computeIfAbsent(controllerType, k -> createAppCClient(k)); + } + + protected LifeCycleManagerStateful createAppCClient(String controllerType) { + try { + if (controllerType == null) { + controllerType = DEFAULT_CONTROLLER_TYPE; + } + controllerType = controllerType.toUpperCase(); + return AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class) + .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType)); + } catch (AppcClientException e) { + logger.error("Error in getting LifeCycleManagerStateful: {}", e.getMessage(), e); + // This null value will cause NullPointerException when used later. + // Error handling could certainly be improved here. + return null; + } + } + + public Status runCommand(Action action, org.onap.appc.client.lcm.model.ActionIdentifiers actionIdentifiers, + org.onap.appc.client.lcm.model.Payload payload, String requestID) + throws ApplicationControllerOrchestratorException { + Object requestObject; + requestObject = createRequest(action, actionIdentifiers, payload, requestID); + appCSupport.logLCMMessage(requestObject); + LifeCycleManagerStateful client = getAppCClient(); + Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, false); + try { + Object response = lcmMethod.invoke(client, requestObject); + return appCSupport.getStatusFromGenericResponse(response); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + throw new RuntimeException(String.format("%s : %s", "Unable to invoke action", action.toString()), e); + } + } + + protected Properties getLCMProperties() { + return getLCMProperties("appc"); + } + + protected Properties getLCMProperties(String controllerType) { + Properties properties = new Properties(); + + properties.put("topic.read", UrnPropertiesReader.getVariable("appc.client.topic.read.name")); + properties.put("topic.write", UrnPropertiesReader.getVariable("appc.client.topic.write")); + properties.put("SDNC-topic.read", UrnPropertiesReader.getVariable("appc.client.topic.sdnc.read")); + properties.put("SDNC-topic.write", UrnPropertiesReader.getVariable("appc.client.topic.sdnc.write")); + properties.put("topic.read.timeout", UrnPropertiesReader.getVariable("appc.client.topic.read.timeout")); + properties.put("client.response.timeout", UrnPropertiesReader.getVariable("appc.client.response.timeout")); + properties.put("poolMembers", UrnPropertiesReader.getVariable("appc.client.poolMembers")); + properties.put("controllerType", controllerType); + properties.put("client.key", UrnPropertiesReader.getVariable("appc.client.key")); + properties.put("client.secret", UrnPropertiesReader.getVariable("appc.client.secret")); + properties.put("client.name", CLIENT_NAME); + properties.put("service", UrnPropertiesReader.getVariable("appc.client.service")); + return properties; + } + + public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) { + Object requestObject = appCSupport.getInput(action.name()); + try { + CommonHeader commonHeader = buildCommonHeader(requestId); + requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject, + commonHeader); + requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action); + requestObject.getClass().getDeclaredMethod("setActionIdentifiers", ActionIdentifiers.class) + .invoke(requestObject, identifier); + if (payload != null) { + requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload); + } + } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { + logger.error("Error building Appc request", e); + } + return requestObject; + } + + private CommonHeader buildCommonHeader(String requestId) { + CommonHeader commonHeader = new CommonHeader(); + commonHeader.setApiVer(API_VER); + commonHeader.setOriginatorId(ORIGINATOR_ID); + commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId); + commonHeader.setSubRequestId(UUID.randomUUID().toString()); + Flags flags = new Flags(); + String flagsMode = "NORMAL"; + Mode mode = Mode.valueOf(flagsMode); + flags.setMode(mode); + String flagsForce = "FALSE"; + Force force = Force.valueOf(flagsForce); + flags.setForce(force); + flags.setTtl(FLAGS_TTL); + commonHeader.setFlags(flags); + Instant timestamp = Instant.now(); + ZULU zulu = new ZULU(timestamp.toString()); + commonHeader.setTimestamp(zulu); + return commonHeader; + } + + public Flags createRequestFlags() { + Flags flags = new Flags(); + flags.setTtl(6000); + return flags; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClientV2.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClientV2.java index d4599a5248..dc5b6308bb 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClientV2.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClientV2.java @@ -32,7 +32,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; - import javax.annotation.PostConstruct; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -44,111 +43,111 @@ import java.util.UUID; @Deprecated public class ApplicationControllerClientV2 { - private static final String CLIENT_NAME = "MSO"; - private static final String API_VER = "2.00"; - private static final String ORIGINATOR_ID = "MSO"; - private static final int FLAGS_TTL = 65000; - private static Logger logger = LoggerFactory.getLogger(ApplicationControllerClientV2.class); + private static final String CLIENT_NAME = "MSO"; + private static final String API_VER = "2.00"; + private static final String ORIGINATOR_ID = "MSO"; + private static final int FLAGS_TTL = 65000; + private static Logger logger = LoggerFactory.getLogger(ApplicationControllerClientV2.class); + + // @Autowired + ApplicationControllerConfiguration applicationControllerConfiguration; - //@Autowired - ApplicationControllerConfiguration applicationControllerConfiguration; + // @Autowired + private ApplicationControllerSupport appCSupport; - //@Autowired - private ApplicationControllerSupport appCSupport; + private static LifeCycleManagerStateful client; - private static LifeCycleManagerStateful client; + // @PostConstruct + public void buildClient() { + client = this.getAppCClient(""); + } - //@PostConstruct - public void buildClient() { - client = this.getAppCClient(""); - } - - //@PostConstruct - public void buildClient(String controllerType) { - client = this.getAppCClient(controllerType); - } + // @PostConstruct + public void buildClient(String controllerType) { + client = this.getAppCClient(controllerType); + } - public Status runCommand(Action action, ActionIdentifiers actionIdentifiers, Payload payload, String requestID) - throws ApplicationControllerOrchestratorException { - Object requestObject; - requestObject = createRequest(action, actionIdentifiers, payload, requestID); - appCSupport.logLCMMessage(requestObject); - Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, false); - try { - Object response = lcmMethod.invoke(client, requestObject); - return appCSupport.getStatusFromGenericResponse(response); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - throw new RuntimeException(String.format("%s : %s", "Unable to invoke action", action.toString()), e); - } - } + public Status runCommand(Action action, ActionIdentifiers actionIdentifiers, Payload payload, String requestID) + throws ApplicationControllerOrchestratorException { + Object requestObject; + requestObject = createRequest(action, actionIdentifiers, payload, requestID); + appCSupport.logLCMMessage(requestObject); + Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, false); + try { + Object response = lcmMethod.invoke(client, requestObject); + return appCSupport.getStatusFromGenericResponse(response); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + throw new RuntimeException(String.format("%s : %s", "Unable to invoke action", action.toString()), e); + } + } - public LifeCycleManagerStateful getAppCClient(String controllerType) { - if (client == null) - try { - client = AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class) - .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType)); - } catch (AppcClientException e) { - logger.error("Error in getting LifeCycleManagerStateful Client", e); - } - return client; - } + public LifeCycleManagerStateful getAppCClient(String controllerType) { + if (client == null) + try { + client = AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class) + .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType)); + } catch (AppcClientException e) { + logger.error("Error in getting LifeCycleManagerStateful Client", e); + } + return client; + } - protected Properties getLCMProperties(String controllerType) { - Properties properties = new Properties(); - properties.put("topic.read", applicationControllerConfiguration.getReadTopic()); - properties.put("topic.read.timeout", applicationControllerConfiguration.getReadTimeout()); - properties.put("client.response.timeout", applicationControllerConfiguration.getResponseTimeout()); - properties.put("topic.write", applicationControllerConfiguration.getWrite()); - properties.put("poolMembers", applicationControllerConfiguration.getPoolMembers()); - properties.put("client.key", applicationControllerConfiguration.getClientKey()); - properties.put("client.secret", applicationControllerConfiguration.getClientSecret()); - properties.put("client.name", CLIENT_NAME); - properties.put("service", applicationControllerConfiguration.getService()); - return properties; - } + protected Properties getLCMProperties(String controllerType) { + Properties properties = new Properties(); + properties.put("topic.read", applicationControllerConfiguration.getReadTopic()); + properties.put("topic.read.timeout", applicationControllerConfiguration.getReadTimeout()); + properties.put("client.response.timeout", applicationControllerConfiguration.getResponseTimeout()); + properties.put("topic.write", applicationControllerConfiguration.getWrite()); + properties.put("poolMembers", applicationControllerConfiguration.getPoolMembers()); + properties.put("client.key", applicationControllerConfiguration.getClientKey()); + properties.put("client.secret", applicationControllerConfiguration.getClientSecret()); + properties.put("client.name", CLIENT_NAME); + properties.put("service", applicationControllerConfiguration.getService()); + return properties; + } - public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) { - Object requestObject = appCSupport.getInput(action.name()); - try { - CommonHeader commonHeader = buildCommonHeader(requestId); - requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject, - commonHeader); - requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action); - requestObject.getClass().getDeclaredMethod("setActionIdentifiers", ActionIdentifiers.class) - .invoke(requestObject, identifier); - if (payload != null) { - requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload); - } - } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { - logger.error("Error building Appc request", e); - } - return requestObject; - } + public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) { + Object requestObject = appCSupport.getInput(action.name()); + try { + CommonHeader commonHeader = buildCommonHeader(requestId); + requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject, + commonHeader); + requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action); + requestObject.getClass().getDeclaredMethod("setActionIdentifiers", ActionIdentifiers.class) + .invoke(requestObject, identifier); + if (payload != null) { + requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload); + } + } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { + logger.error("Error building Appc request", e); + } + return requestObject; + } - private CommonHeader buildCommonHeader(String requestId) { - CommonHeader commonHeader = new CommonHeader(); - commonHeader.setApiVer(API_VER); - commonHeader.setOriginatorId(ORIGINATOR_ID); - commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId); - commonHeader.setSubRequestId(requestId); - Flags flags = new Flags(); - String flagsMode = "NORMAL"; - Mode mode = Mode.valueOf(flagsMode); - flags.setMode(mode); - String flagsForce = "FALSE"; - Force force = Force.valueOf(flagsForce); - flags.setForce(force); - flags.setTtl(FLAGS_TTL); - commonHeader.setFlags(flags); - Instant timestamp = Instant.now(); - ZULU zulu = new ZULU(timestamp.toString()); - commonHeader.setTimestamp(zulu); - return commonHeader; - } + private CommonHeader buildCommonHeader(String requestId) { + CommonHeader commonHeader = new CommonHeader(); + commonHeader.setApiVer(API_VER); + commonHeader.setOriginatorId(ORIGINATOR_ID); + commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId); + commonHeader.setSubRequestId(requestId); + Flags flags = new Flags(); + String flagsMode = "NORMAL"; + Mode mode = Mode.valueOf(flagsMode); + flags.setMode(mode); + String flagsForce = "FALSE"; + Force force = Force.valueOf(flagsForce); + flags.setForce(force); + flags.setTtl(FLAGS_TTL); + commonHeader.setFlags(flags); + Instant timestamp = Instant.now(); + ZULU zulu = new ZULU(timestamp.toString()); + commonHeader.setTimestamp(zulu); + return commonHeader; + } - public Flags createRequestFlags() { - Flags flags = new Flags(); - flags.setTtl(6000); - return flags; - } + public Flags createRequestFlags() { + Flags flags = new Flags(); + flags.setTtl(6000); + return flags; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java index 430767f24a..165d9577af 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java @@ -26,60 +26,60 @@ import org.springframework.stereotype.Service; @Configuration public class ApplicationControllerConfiguration { - @Value("${appc.client.topic.read.name}") - private String readTopic; + @Value("${appc.client.topic.read.name}") + private String readTopic; - @Value("${appc.client.topic.read.timeout}") - private String readTimeout; + @Value("${appc.client.topic.read.timeout}") + private String readTimeout; - @Value("${appc.client.response.timeout}") - private String responseTimeout; + @Value("${appc.client.response.timeout}") + private String responseTimeout; - @Value("${appc.client.topic.write}") - private String write; + @Value("${appc.client.topic.write}") + private String write; - @Value("${appc.client.poolMembers}") - private String poolMembers; + @Value("${appc.client.poolMembers}") + private String poolMembers; - @Value("${appc.client.key}") - private String clientKey; + @Value("${appc.client.key}") + private String clientKey; - @Value("${appc.client.secret}") - private String clientSecret; + @Value("${appc.client.secret}") + private String clientSecret; - @Value("${appc.client.service}") - private String service; + @Value("${appc.client.service}") + private String service; - public String getClientKey() { - return clientKey; - } + public String getClientKey() { + return clientKey; + } - public String getClientSecret() { - return clientSecret; - } + public String getClientSecret() { + return clientSecret; + } - public String getPoolMembers() { - return poolMembers; - } - - public String getReadTimeout() { - return readTimeout; - } + public String getPoolMembers() { + return poolMembers; + } - public String getResponseTimeout() { - return responseTimeout; - } + public String getReadTimeout() { + return readTimeout; + } - public String getReadTopic() { - return readTopic; - } + public String getResponseTimeout() { + return responseTimeout; + } - public String getService() { - return service; - } + public String getReadTopic() { + return readTopic; + } - public String getWrite() { - return write; - } + public String getService() { + return service; + } + + public String getWrite() { + return write; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestrator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestrator.java index 84e0f93294..fd5f07b708 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestrator.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestrator.java @@ -21,9 +21,7 @@ package org.onap.so.client.appc; import java.util.Optional; - import org.onap.so.client.appc.ApplicationControllerSupport.StatusCategory; - import org.onap.appc.client.lcm.model.Action; import org.onap.appc.client.lcm.model.ActionIdentifiers; import org.onap.appc.client.lcm.model.Payload; @@ -31,23 +29,24 @@ import org.onap.appc.client.lcm.model.Status; public class ApplicationControllerOrchestrator { - public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> vserverId, Optional<String> request, String controllerType) throws ApplicationControllerOrchestratorException { - ApplicationControllerClient client = new ApplicationControllerClient(controllerType); - Status status; - ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); - actionIdentifiers.setVnfId(vnfId); - if (vserverId.isPresent()) { - actionIdentifiers.setVserverId(vserverId.get()); - } - Payload payload = null; - if (request.isPresent()) { - payload = new Payload(request.get()); - } - status = client.runCommand(action, actionIdentifiers, payload, requestId); - if (ApplicationControllerSupport.getCategoryOf(status).equals(StatusCategory.ERROR)) { - throw new ApplicationControllerOrchestratorException(status.getMessage(), status.getCode()); - } else { - return status; - } - } + public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> vserverId, + Optional<String> request, String controllerType) throws ApplicationControllerOrchestratorException { + ApplicationControllerClient client = new ApplicationControllerClient(controllerType); + Status status; + ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); + actionIdentifiers.setVnfId(vnfId); + if (vserverId.isPresent()) { + actionIdentifiers.setVserverId(vserverId.get()); + } + Payload payload = null; + if (request.isPresent()) { + payload = new Payload(request.get()); + } + status = client.runCommand(action, actionIdentifiers, payload, requestId); + if (ApplicationControllerSupport.getCategoryOf(status).equals(StatusCategory.ERROR)) { + throw new ApplicationControllerOrchestratorException(status.getMessage(), status.getCode()); + } else { + return status; + } + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestratorException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestratorException.java index 2532e485ed..58e566e096 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestratorException.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestratorException.java @@ -22,15 +22,14 @@ package org.onap.so.client.appc; public class ApplicationControllerOrchestratorException extends Exception { - private final int appcCode; - - public ApplicationControllerOrchestratorException(String message, int code) { - super(message); - appcCode = code; - } - - public int getAppcCode() - { - return appcCode; - } + private final int appcCode; + + public ApplicationControllerOrchestratorException(String message, int code) { + super(message); + appcCode = code; + } + + public int getAppcCode() { + return appcCode; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java index ef8749ece9..10d3d85ffc 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java @@ -26,15 +26,12 @@ import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; - import org.springframework.stereotype.Component; - import org.onap.appc.client.lcm.api.LifeCycleManagerStateful; import org.onap.appc.client.lcm.api.ResponseHandler; import org.onap.appc.client.lcm.model.Status; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -43,173 +40,173 @@ import org.springframework.stereotype.Service; public class ApplicationControllerSupport { - private static final int ACCEPT_SERIES = 100; - private static final int ERROR_SERIES = 200; - private static final int REJECT_SERIES = 300; - private static final int SUCCESS_SERIES = 400; - private static final int SUCCESS_STATUS = SUCCESS_SERIES; - private static final int PARTIAL_SERIES = 500; - private static final int PARTIAL_SUCCESS_STATUS = PARTIAL_SERIES; - private static final int PARTIAL_FAILURE_STATUS = PARTIAL_SERIES + 1; - - private static Logger logger = LoggerFactory.getLogger(ApplicationControllerSupport.class); - private String lcmModelPackage = "org.onap.appc.client.lcm.model"; - - /** - * @param action - * @return - * @throws ClassNotFoundException - * @throws InstantiationException - * @throws IllegalAccessException - */ - public Object getInput(String action) { - try { - return getInputClass(action).newInstance(); - } catch (IllegalAccessException | InstantiationException e) { - throw new RuntimeException( - String.format("%s : %s", "Unable to instantiate viable LCM Kit input class for action", action), e); - } - } - - /** - * @param action - * @return - * @throws ClassNotFoundException - */ - public Method getAPIMethod(String action, LifeCycleManagerStateful lcmStateful, boolean async) { - Method[] methods = lcmStateful.getClass().getMethods(); - for (Method method : methods) { - if (method.getName().equalsIgnoreCase(action)) { - Class<?>[] methodParameterTypes = method.getParameterTypes(); - if (methodParameterTypes.length > 0) { - if (getInputClass(action).equals(methodParameterTypes[0])) { - if (async) { - if (methodParameterTypes.length == 2 - && ResponseHandler.class.isAssignableFrom(methodParameterTypes[1])) { - return method; - } - } else if (methodParameterTypes.length == 1) { - return method; - } - } - } - } - } - throw new RuntimeException(String.format("%s : %s, async=%b", - "Unable to derive viable LCM Kit API method for action", action, async)); - } - - public Status getStatusFromGenericResponse(Object response) { - Method statusReader = getBeanPropertyMethodFor(response.getClass(), "status", false); - if (statusReader != null) { - try { - return (Status) statusReader.invoke(response); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - logger.error("Unable to obtain status from LCM Kit response", e); - } - } - return new Status(); - } - - public static StatusCategory getCategoryOf(Status status) { - int codeSeries = status.getCode() - (status.getCode() % 100); - switch (codeSeries) { - case ACCEPT_SERIES: - return StatusCategory.NORMAL; - case ERROR_SERIES: - case REJECT_SERIES: - return StatusCategory.ERROR; - case SUCCESS_SERIES: - return status.getCode() == SUCCESS_STATUS ? StatusCategory.NORMAL : StatusCategory.ERROR; - case PARTIAL_SERIES: - switch (status.getCode()) { - case PARTIAL_SUCCESS_STATUS: - return StatusCategory.NORMAL; - case PARTIAL_FAILURE_STATUS: - return StatusCategory.ERROR; - default: - return StatusCategory.WARNING; - } - default: - return StatusCategory.WARNING; - } - } - - public static boolean getFinalityOf(Status status) { - int codeSeries = status.getCode() - (status.getCode() % 100); - switch (codeSeries) { - case ACCEPT_SERIES: - case PARTIAL_SERIES: - return false; - case ERROR_SERIES: - case REJECT_SERIES: - case SUCCESS_SERIES: - return true; - default: - return true; - } - } - - private Method getBeanPropertyMethodFor(Class<?> clazz, String propertyName, boolean isWriter) { - BeanInfo beanInfo; - try { - beanInfo = Introspector.getBeanInfo(clazz, Object.class); - } catch (IntrospectionException e) { - throw new RuntimeException( - String.format("Unable to produce bean property method for class : %s, property : %s, writer=%b", - clazz.getName(), propertyName, isWriter), - e); - } - PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); - for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { - if (propertyDescriptor.getName().equals(propertyName)) { - return isWriter ? propertyDescriptor.getWriteMethod() : propertyDescriptor.getReadMethod(); - } - } - throw new RuntimeException( - String.format("Unable to produce bean property method for class : %s, property : %s, writer=%b", - clazz.getName(), propertyName, isWriter)); - } - - /** - * @param action - * @return - * @throws ClassNotFoundException - */ - private Class<?> getInputClass(String action) { - try { - return Class.forName(lcmModelPackage + '.' + action + "Input"); - } catch (ClassNotFoundException e) { - throw new RuntimeException(String.format("%s : %s using package : %s", - "Unable to identify viable LCM Kit input class for action", action, lcmModelPackage), e); - } - } - - public enum StatusCategory { - NORMAL("normal"), WARNING("warning"), ERROR("error"); - - private final String category; - - private StatusCategory(final String category) { - this.category = category; - } - - @Override - public String toString() { - return category; - } - } - - public void logLCMMessage(Object message) { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.setSerializationInclusion(Include.NON_NULL); - ObjectWriter writer = objectMapper.writerWithDefaultPrettyPrinter(); - String inputAsJSON; - try { - inputAsJSON = writer.writeValueAsString(message); - logger.info("LCM Kit input message follows: {}" , inputAsJSON); - } catch (JsonProcessingException e) { - logger.error("Error in logging LCM Message", e); - } - } + private static final int ACCEPT_SERIES = 100; + private static final int ERROR_SERIES = 200; + private static final int REJECT_SERIES = 300; + private static final int SUCCESS_SERIES = 400; + private static final int SUCCESS_STATUS = SUCCESS_SERIES; + private static final int PARTIAL_SERIES = 500; + private static final int PARTIAL_SUCCESS_STATUS = PARTIAL_SERIES; + private static final int PARTIAL_FAILURE_STATUS = PARTIAL_SERIES + 1; + + private static Logger logger = LoggerFactory.getLogger(ApplicationControllerSupport.class); + private String lcmModelPackage = "org.onap.appc.client.lcm.model"; + + /** + * @param action + * @return + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + */ + public Object getInput(String action) { + try { + return getInputClass(action).newInstance(); + } catch (IllegalAccessException | InstantiationException e) { + throw new RuntimeException( + String.format("%s : %s", "Unable to instantiate viable LCM Kit input class for action", action), e); + } + } + + /** + * @param action + * @return + * @throws ClassNotFoundException + */ + public Method getAPIMethod(String action, LifeCycleManagerStateful lcmStateful, boolean async) { + Method[] methods = lcmStateful.getClass().getMethods(); + for (Method method : methods) { + if (method.getName().equalsIgnoreCase(action)) { + Class<?>[] methodParameterTypes = method.getParameterTypes(); + if (methodParameterTypes.length > 0) { + if (getInputClass(action).equals(methodParameterTypes[0])) { + if (async) { + if (methodParameterTypes.length == 2 + && ResponseHandler.class.isAssignableFrom(methodParameterTypes[1])) { + return method; + } + } else if (methodParameterTypes.length == 1) { + return method; + } + } + } + } + } + throw new RuntimeException(String.format("%s : %s, async=%b", + "Unable to derive viable LCM Kit API method for action", action, async)); + } + + public Status getStatusFromGenericResponse(Object response) { + Method statusReader = getBeanPropertyMethodFor(response.getClass(), "status", false); + if (statusReader != null) { + try { + return (Status) statusReader.invoke(response); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + logger.error("Unable to obtain status from LCM Kit response", e); + } + } + return new Status(); + } + + public static StatusCategory getCategoryOf(Status status) { + int codeSeries = status.getCode() - (status.getCode() % 100); + switch (codeSeries) { + case ACCEPT_SERIES: + return StatusCategory.NORMAL; + case ERROR_SERIES: + case REJECT_SERIES: + return StatusCategory.ERROR; + case SUCCESS_SERIES: + return status.getCode() == SUCCESS_STATUS ? StatusCategory.NORMAL : StatusCategory.ERROR; + case PARTIAL_SERIES: + switch (status.getCode()) { + case PARTIAL_SUCCESS_STATUS: + return StatusCategory.NORMAL; + case PARTIAL_FAILURE_STATUS: + return StatusCategory.ERROR; + default: + return StatusCategory.WARNING; + } + default: + return StatusCategory.WARNING; + } + } + + public static boolean getFinalityOf(Status status) { + int codeSeries = status.getCode() - (status.getCode() % 100); + switch (codeSeries) { + case ACCEPT_SERIES: + case PARTIAL_SERIES: + return false; + case ERROR_SERIES: + case REJECT_SERIES: + case SUCCESS_SERIES: + return true; + default: + return true; + } + } + + private Method getBeanPropertyMethodFor(Class<?> clazz, String propertyName, boolean isWriter) { + BeanInfo beanInfo; + try { + beanInfo = Introspector.getBeanInfo(clazz, Object.class); + } catch (IntrospectionException e) { + throw new RuntimeException( + String.format("Unable to produce bean property method for class : %s, property : %s, writer=%b", + clazz.getName(), propertyName, isWriter), + e); + } + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { + if (propertyDescriptor.getName().equals(propertyName)) { + return isWriter ? propertyDescriptor.getWriteMethod() : propertyDescriptor.getReadMethod(); + } + } + throw new RuntimeException( + String.format("Unable to produce bean property method for class : %s, property : %s, writer=%b", + clazz.getName(), propertyName, isWriter)); + } + + /** + * @param action + * @return + * @throws ClassNotFoundException + */ + private Class<?> getInputClass(String action) { + try { + return Class.forName(lcmModelPackage + '.' + action + "Input"); + } catch (ClassNotFoundException e) { + throw new RuntimeException(String.format("%s : %s using package : %s", + "Unable to identify viable LCM Kit input class for action", action, lcmModelPackage), e); + } + } + + public enum StatusCategory { + NORMAL("normal"), WARNING("warning"), ERROR("error"); + + private final String category; + + private StatusCategory(final String category) { + this.category = category; + } + + @Override + public String toString() { + return category; + } + } + + public void logLCMMessage(Object message) { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.setSerializationInclusion(Include.NON_NULL); + ObjectWriter writer = objectMapper.writerWithDefaultPrettyPrinter(); + String inputAsJSON; + try { + inputAsJSON = writer.writeValueAsString(message); + logger.info("LCM Kit input message follows: {}", inputAsJSON); + } catch (JsonProcessingException e) { + logger.error("Error in logging LCM Message", e); + } + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBean.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBean.java index fff818f09b..f839079338 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBean.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBean.java @@ -25,16 +25,16 @@ import com.fasterxml.jackson.annotation.JsonProperty; @JsonInclude(JsonInclude.Include.NON_NULL) public class AVPNDmaapBean { - - @JsonProperty("asyncRequestStatus") - private AsyncRequestStatus asyncRequestStatus; - public AsyncRequestStatus getAsyncRequestStatus() { - return asyncRequestStatus; - } + @JsonProperty("asyncRequestStatus") + private AsyncRequestStatus asyncRequestStatus; - public void setAsyncRequestStatus(AsyncRequestStatus asyncRequestStatus) { - this.asyncRequestStatus = asyncRequestStatus; - } + public AsyncRequestStatus getAsyncRequestStatus() { + return asyncRequestStatus; + } + + public void setAsyncRequestStatus(AsyncRequestStatus asyncRequestStatus) { + this.asyncRequestStatus = asyncRequestStatus; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AsyncRequestStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AsyncRequestStatus.java index 13206e8c92..14e0cd0411 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AsyncRequestStatus.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AsyncRequestStatus.java @@ -25,95 +25,95 @@ import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName(value = "asyncRequestStatus") public class AsyncRequestStatus { - - @JsonProperty("requestId") - private String requestId; - @JsonProperty("clientSource") - private String clientSource; - @JsonProperty("correlator") - private String correlator; - @JsonProperty("instanceReferences") - private InstanceReferences instanceReferences; - @JsonProperty("startTime") - private String startTime; - @JsonProperty("finishTime") - private String finishTime; - @JsonProperty("requestScope") - private String requestScope; - @JsonProperty("requestType") - private String requestType; - @JsonProperty("requestStatus") - private RequestStatus requestStatus; - - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public String getClientSource() { - return clientSource; - } - - public void setClientSource(String clientSource) { - this.clientSource = clientSource; - } - - public String getCorrelator() { - return correlator; - } - - public void setCorrelator(String correlator) { - this.correlator = correlator; - } - - public InstanceReferences getInstanceReferences() { - return instanceReferences; - } - - public void setInstanceReferences(InstanceReferences instanceReferences) { - this.instanceReferences = instanceReferences; - } - - public String getStartTime() { - return startTime; - } - - public void setStartTime(String startTime) { - this.startTime = startTime; - } - - public String getFinishTime() { - return finishTime; - } - - public void setFinishTime(String finishTime) { - this.finishTime = finishTime; - } - - public String getRequestScope() { - return requestScope; - } - - public void setRequestScope(String requestScope) { - this.requestScope = requestScope; - } - - public String getRequestType() { - return requestType; - } - - public void setRequestType(String requestType) { - this.requestType = requestType; - } - - public RequestStatus getRequestStatus() { - return requestStatus; - } - - public void setRequestStatus(RequestStatus requestStatus) { - this.requestStatus = requestStatus; - } + + @JsonProperty("requestId") + private String requestId; + @JsonProperty("clientSource") + private String clientSource; + @JsonProperty("correlator") + private String correlator; + @JsonProperty("instanceReferences") + private InstanceReferences instanceReferences; + @JsonProperty("startTime") + private String startTime; + @JsonProperty("finishTime") + private String finishTime; + @JsonProperty("requestScope") + private String requestScope; + @JsonProperty("requestType") + private String requestType; + @JsonProperty("requestStatus") + private RequestStatus requestStatus; + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public String getClientSource() { + return clientSource; + } + + public void setClientSource(String clientSource) { + this.clientSource = clientSource; + } + + public String getCorrelator() { + return correlator; + } + + public void setCorrelator(String correlator) { + this.correlator = correlator; + } + + public InstanceReferences getInstanceReferences() { + return instanceReferences; + } + + public void setInstanceReferences(InstanceReferences instanceReferences) { + this.instanceReferences = instanceReferences; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getFinishTime() { + return finishTime; + } + + public void setFinishTime(String finishTime) { + this.finishTime = finishTime; + } + + public String getRequestScope() { + return requestScope; + } + + public void setRequestScope(String requestScope) { + this.requestScope = requestScope; + } + + public String getRequestType() { + return requestType; + } + + public void setRequestType(String requestType) { + this.requestType = requestType; + } + + public RequestStatus getRequestStatus() { + return requestStatus; + } + + public void setRequestStatus(RequestStatus requestStatus) { + this.requestStatus = requestStatus; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/InstanceReferences.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/InstanceReferences.java index 322f41bf75..31189517aa 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/InstanceReferences.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/InstanceReferences.java @@ -26,14 +26,14 @@ import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName(value = "instanceReferences") public class InstanceReferences { - @JsonProperty("serviceInstanceId") - private String serviceInstanceId; + @JsonProperty("serviceInstanceId") + private String serviceInstanceId; - public String getServiceInstanceId() { - return serviceInstanceId; - } + public String getServiceInstanceId() { + return serviceInstanceId; + } - public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/RequestStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/RequestStatus.java index edc8be7bfe..34f17c404f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/RequestStatus.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/RequestStatus.java @@ -26,54 +26,54 @@ import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName(value = "requestStatus") public class RequestStatus { - @JsonProperty("timestamp") - private String timestamp; - @JsonProperty("requestState") - private String requestState; - @JsonProperty("statusMessage") - private String statusMessage; - @JsonProperty("percentProgress") - private String percentProgress; - @JsonProperty("wasRolledBack") - private Boolean wasRolledBack; - - public String getTimestamp() { - return timestamp; - } - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } - - public String getRequestState() { - return requestState; - } - - public void setRequestState(String requestState) { - this.requestState = requestState; - } - - public String getStatusMessage() { - return statusMessage; - } - - public void setStatusMessage(String statusMessage) { - this.statusMessage = statusMessage; - } - - public String getPercentProgress() { - return percentProgress; - } - - public void setPercentProgress(String percentProgress) { - this.percentProgress = percentProgress; - } + @JsonProperty("timestamp") + private String timestamp; + @JsonProperty("requestState") + private String requestState; + @JsonProperty("statusMessage") + private String statusMessage; + @JsonProperty("percentProgress") + private String percentProgress; + @JsonProperty("wasRolledBack") + private Boolean wasRolledBack; - public Boolean isWasRolledBack() { - return wasRolledBack; - } + public String getTimestamp() { + return timestamp; + } - public void setWasRolledBack(Boolean wasRolledBack) { - this.wasRolledBack = wasRolledBack; - } + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + public String getRequestState() { + return requestState; + } + + public void setRequestState(String requestState) { + this.requestState = requestState; + } + + public String getStatusMessage() { + return statusMessage; + } + + public void setStatusMessage(String statusMessage) { + this.statusMessage = statusMessage; + } + + public String getPercentProgress() { + return percentProgress; + } + + public void setPercentProgress(String percentProgress) { + this.percentProgress = percentProgress; + } + + public Boolean isWasRolledBack() { + return wasRolledBack; + } + + public void setWasRolledBack(Boolean wasRolledBack) { + this.wasRolledBack = wasRolledBack; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java index 083a6b6e1f..6bfa67502d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java @@ -25,7 +25,6 @@ package org.onap.so.client.cds; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; - import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers; import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader; @@ -40,12 +39,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; - import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.Struct; import com.google.protobuf.Struct.Builder; import com.google.protobuf.util.JsonFormat; - import io.grpc.Status; /** @@ -67,28 +64,26 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener { private ExceptionBuilder exceptionUtil; /** - * Extracting data from execution object and building the ExecutionServiceInput - * Object + * Extracting data from execution object and building the ExecutionServiceInput Object * - * @param execution - * DelegateExecution object + * @param execution DelegateExecution object */ public void constructExecutionServiceInputObject(DelegateExecution execution) { logger.trace("Start AbstractCDSProcessingBBUtils.preProcessRequest "); try { - AbstractCDSPropertiesBean executionObject = (AbstractCDSPropertiesBean) execution - .getVariable("executionObject"); + AbstractCDSPropertiesBean executionObject = + (AbstractCDSPropertiesBean) execution.getVariable("executionObject"); String payload = executionObject.getRequestObject(); CommonHeader commonHeader = CommonHeader.newBuilder().setOriginatorId(executionObject.getOriginatorId()) .setRequestId(executionObject.getRequestId()).setSubRequestId(executionObject.getSubRequestId()) .build(); - ActionIdentifiers actionIdentifiers = ActionIdentifiers.newBuilder() - .setBlueprintName(executionObject.getBlueprintName()) - .setBlueprintVersion(executionObject.getBlueprintVersion()) - .setActionName(executionObject.getActionName()).setMode(executionObject.getMode()).build(); + ActionIdentifiers actionIdentifiers = + ActionIdentifiers.newBuilder().setBlueprintName(executionObject.getBlueprintName()) + .setBlueprintVersion(executionObject.getBlueprintVersion()) + .setActionName(executionObject.getActionName()).setMode(executionObject.getMode()).build(); Builder struct = Struct.newBuilder(); try { @@ -99,9 +94,9 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener { executionObject.getActionName(), e); } - ExecutionServiceInput executionServiceInput = ExecutionServiceInput.newBuilder() - .setCommonHeader(commonHeader).setActionIdentifiers(actionIdentifiers).setPayload(struct.build()) - .build(); + ExecutionServiceInput executionServiceInput = + ExecutionServiceInput.newBuilder().setCommonHeader(commonHeader) + .setActionIdentifiers(actionIdentifiers).setPayload(struct.build()).build(); execution.setVariable("executionServiceInput", executionServiceInput); @@ -111,11 +106,9 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener { } /** - * get the executionServiceInput object from execution and send a request to CDS - * Client and wait for TIMEOUT period + * get the executionServiceInput object from execution and send a request to CDS Client and wait for TIMEOUT period * - * @param execution - * DelegateExecution object + * @param execution DelegateExecution object */ public void sendRequestToCDSClient(DelegateExecution execution) { @@ -127,13 +120,13 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener { "No RestProperty.CDSProperties implementation found on classpath, can't create client."); } - ExecutionServiceInput executionServiceInput = (ExecutionServiceInput) execution - .getVariable("executionServiceInput"); + ExecutionServiceInput executionServiceInput = + (ExecutionServiceInput) execution.getVariable("executionServiceInput"); - try(CDSProcessingClient cdsClient = new CDSProcessingClient(this)) { + try (CDSProcessingClient cdsClient = new CDSProcessingClient(this)) { CountDownLatch countDownLatch = cdsClient.sendRequest(executionServiceInput); countDownLatch.await(props.getTimeout(), TimeUnit.SECONDS); - } catch (InterruptedException ex){ + } catch (InterruptedException ex) { logger.error("Caught exception in sendRequestToCDSClient in AbstractCDSProcessingBBUtils : ", ex); Thread.currentThread().interrupt(); } @@ -158,21 +151,21 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener { switch (eventType) { - case EVENT_COMPONENT_FAILURE: - // failed processing with failure - cdsResponse.set(FAILED); - break; - case EVENT_COMPONENT_PROCESSING: - // still processing - cdsResponse.set(PROCESSING); - break; - case EVENT_COMPONENT_EXECUTED: - // done with async processing - cdsResponse.set(SUCCESS); - break; - default: - cdsResponse.set(FAILED); - break; + case EVENT_COMPONENT_FAILURE: + // failed processing with failure + cdsResponse.set(FAILED); + break; + case EVENT_COMPONENT_PROCESSING: + // still processing + cdsResponse.set(PROCESSING); + break; + case EVENT_COMPONENT_EXECUTED: + // done with async processing + cdsResponse.set(SUCCESS); + break; + default: + cdsResponse.set(FAILED); + break; } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java index 4b645984cf..2e84f384dc 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java @@ -4,86 +4,86 @@ import java.io.Serializable; public class AbstractCDSPropertiesBean implements Serializable { - private static final long serialVersionUID = -4800522372460352963L; + private static final long serialVersionUID = -4800522372460352963L; - private String blueprintName; + private String blueprintName; - private String blueprintVersion; + private String blueprintVersion; - private String requestObject; + private String requestObject; - private String originatorId; + private String originatorId; - private String requestId; + private String requestId; - private String subRequestId; + private String subRequestId; - private String actionName; + private String actionName; - private String mode; + private String mode; - public String getBlueprintName() { - return blueprintName; - } + public String getBlueprintName() { + return blueprintName; + } - public void setBlueprintName(String blueprintName) { - this.blueprintName = blueprintName; - } + public void setBlueprintName(String blueprintName) { + this.blueprintName = blueprintName; + } - public String getBlueprintVersion() { - return blueprintVersion; - } + public String getBlueprintVersion() { + return blueprintVersion; + } - public void setBlueprintVersion(String blueprintVersion) { - this.blueprintVersion = blueprintVersion; - } + public void setBlueprintVersion(String blueprintVersion) { + this.blueprintVersion = blueprintVersion; + } - public String getRequestObject() { - return requestObject; - } + public String getRequestObject() { + return requestObject; + } - public void setRequestObject(String requestObject) { - this.requestObject = requestObject; - } + public void setRequestObject(String requestObject) { + this.requestObject = requestObject; + } - public String getOriginatorId() { - return originatorId; - } + public String getOriginatorId() { + return originatorId; + } - public void setOriginatorId(String originatorId) { - this.originatorId = originatorId; - } + public void setOriginatorId(String originatorId) { + this.originatorId = originatorId; + } - public String getRequestId() { - return requestId; - } + public String getRequestId() { + return requestId; + } - public void setRequestId(String requestId) { - this.requestId = requestId; - } + public void setRequestId(String requestId) { + this.requestId = requestId; + } - public String getSubRequestId() { - return subRequestId; - } + public String getSubRequestId() { + return subRequestId; + } - public void setSubRequestId(String subRequestId) { - this.subRequestId = subRequestId; - } + public void setSubRequestId(String subRequestId) { + this.subRequestId = subRequestId; + } - public String getActionName() { - return actionName; - } + public String getActionName() { + return actionName; + } - public void setActionName(String actionName) { - this.actionName = actionName; - } + public void setActionName(String actionName) { + this.actionName = actionName; + } - public String getMode() { - return mode; - } + public String getMode() { + return mode; + } - public void setMode(String mode) { - this.mode = mode; - } + public void setMode(String mode) { + this.mode = mode; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java index bdb9161735..cb0b5663e6 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java @@ -2,111 +2,104 @@ package org.onap.so.client.cds.beans; import java.util.HashMap; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"service-instance-id", -"pnf-id", -"pnf-name", -"service-model-uuid", -"pnf-customization-uuid" -}) +@JsonPropertyOrder({"service-instance-id", "pnf-id", "pnf-name", "service-model-uuid", "pnf-customization-uuid"}) public class ConfigAssignPropertiesForPnf { - @JsonProperty("service-instance-id") - private String serviceInstanceId; - - @JsonProperty("pnf-id") - private String pnfId; - - @JsonProperty("pnf-name") - private String pnfName; - - @JsonProperty("service-model-uuid") - private String serviceModelUuid; - - @JsonProperty("pnf-customization-uuid") - private String pnfCustomizationUuid; - - @JsonIgnore - private Map<String, Object> userParam = new HashMap<String, Object>(); - - public String getServiceInstanceId() { - return serviceInstanceId; - } - - public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - - public String getPnfId() { - return pnfId; - } - - public void setPnfId(String pnfId) { - this.pnfId = pnfId; - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - - public String getServiceModelUuid() { - return serviceModelUuid; - } - - public void setServiceModelUuid(String serviceModelUuid) { - this.serviceModelUuid = serviceModelUuid; - } - - public String getPnfCustomizationUuid() { - return pnfCustomizationUuid; - } - - public void setPnfCustomizationUuid(String pnfCustomizationUuid) { - this.pnfCustomizationUuid = pnfCustomizationUuid; - } - - public Map<String, Object> getUserParam() { - return this.userParam; - } - - public void setUserParam(String name, Object value) { - this.userParam.put(name, value); - } - - @Override - public String toString() { - - final StringBuilder sb = new StringBuilder("{"); - sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\""); - sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\""); - sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\""); - sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\""); - sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\""); - for (Map.Entry<String, Object> entry : userParam.entrySet()) { - sb.append(","); - sb.append("\""); - sb.append(entry.getKey()); - sb.append("\""); - sb.append(":"); - sb.append("\""); - sb.append(entry.getValue()); - sb.append("\""); - } - sb.append('}'); - - return sb.toString(); - } + @JsonProperty("service-instance-id") + private String serviceInstanceId; + + @JsonProperty("pnf-id") + private String pnfId; + + @JsonProperty("pnf-name") + private String pnfName; + + @JsonProperty("service-model-uuid") + private String serviceModelUuid; + + @JsonProperty("pnf-customization-uuid") + private String pnfCustomizationUuid; + + @JsonIgnore + private Map<String, Object> userParam = new HashMap<String, Object>(); + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + public String getPnfId() { + return pnfId; + } + + public void setPnfId(String pnfId) { + this.pnfId = pnfId; + } + + public String getPnfName() { + return pnfName; + } + + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } + + public String getServiceModelUuid() { + return serviceModelUuid; + } + + public void setServiceModelUuid(String serviceModelUuid) { + this.serviceModelUuid = serviceModelUuid; + } + + public String getPnfCustomizationUuid() { + return pnfCustomizationUuid; + } + + public void setPnfCustomizationUuid(String pnfCustomizationUuid) { + this.pnfCustomizationUuid = pnfCustomizationUuid; + } + + public Map<String, Object> getUserParam() { + return this.userParam; + } + + public void setUserParam(String name, Object value) { + this.userParam.put(name, value); + } + + @Override + public String toString() { + + final StringBuilder sb = new StringBuilder("{"); + sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\""); + sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\""); + sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\""); + sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\""); + sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\""); + for (Map.Entry<String, Object> entry : userParam.entrySet()) { + sb.append(","); + sb.append("\""); + sb.append(entry.getKey()); + sb.append("\""); + sb.append(":"); + sb.append("\""); + sb.append(entry.getValue()); + sb.append("\""); + } + sb.append('}'); + + return sb.toString(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java index 1ce26d8585..bd894e3e7f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java @@ -2,23 +2,16 @@ package org.onap.so.client.cds.beans; import java.util.HashMap; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"service-instance-id", -"vnf-id", -"vnf-name", -"service-model-uuid", -"vnf-customization-uuid" -}) +@JsonPropertyOrder({"service-instance-id", "vnf-id", "vnf-name", "service-model-uuid", "vnf-customization-uuid"}) public class ConfigAssignPropertiesForVnf { - + @JsonProperty("service-instance-id") private String serviceInstanceId; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java index b96847f422..33b7187ac8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java @@ -5,42 +5,39 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"config-assign-properties", -"resolution-key" -}) +@JsonPropertyOrder({"config-assign-properties", "resolution-key"}) public class ConfigAssignRequestPnf { - @JsonProperty("resolution-key") - private String resolutionKey; - @JsonProperty("config-assign-properties") - private ConfigAssignPropertiesForPnf configAssignPropertiesForPnf; - - public String getResolutionKey() { - return resolutionKey; - } - - public void setResolutionKey(String resolutionKey) { - this.resolutionKey = resolutionKey; - } - - public ConfigAssignPropertiesForPnf getConfigAssignPropertiesForPnf() { - return configAssignPropertiesForPnf; - } - - public void setConfigAssignPropertiesForPnf(ConfigAssignPropertiesForPnf configAssignPropertiesForPnf) { - this.configAssignPropertiesForPnf = configAssignPropertiesForPnf; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{"); - sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\""); - sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForPnf.toString()); - sb.append('}'); - sb.append('}'); - - return sb.toString(); - } + @JsonProperty("resolution-key") + private String resolutionKey; + @JsonProperty("config-assign-properties") + private ConfigAssignPropertiesForPnf configAssignPropertiesForPnf; + + public String getResolutionKey() { + return resolutionKey; + } + + public void setResolutionKey(String resolutionKey) { + this.resolutionKey = resolutionKey; + } + + public ConfigAssignPropertiesForPnf getConfigAssignPropertiesForPnf() { + return configAssignPropertiesForPnf; + } + + public void setConfigAssignPropertiesForPnf(ConfigAssignPropertiesForPnf configAssignPropertiesForPnf) { + this.configAssignPropertiesForPnf = configAssignPropertiesForPnf; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{"); + sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\""); + sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForPnf.toString()); + sb.append('}'); + sb.append('}'); + + return sb.toString(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java index b3a9601e2e..8512c4017f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java @@ -1,45 +1,43 @@ package org.onap.so.client.cds.beans; + import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"config-assign-properties", -"resolution-key" -}) +@JsonPropertyOrder({"config-assign-properties", "resolution-key"}) public class ConfigAssignRequestVnf { - @JsonProperty("resolution-key") - private String resolutionKey; - @JsonProperty("config-assign-properties") - private ConfigAssignPropertiesForVnf configAssignPropertiesForVnf; - - public String getResolutionKey() { - return resolutionKey; - } - - public void setResolutionKey(String resolutionKey) { - this.resolutionKey = resolutionKey; - } - - public ConfigAssignPropertiesForVnf getConfigAssignPropertiesForVnf() { - return configAssignPropertiesForVnf; - } - - public void setConfigAssignPropertiesForVnf(ConfigAssignPropertiesForVnf configAssignPropertiesForVnf) { - this.configAssignPropertiesForVnf = configAssignPropertiesForVnf; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{"); - sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\""); - sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForVnf.toString()); - sb.append('}'); - sb.append('}'); - - return sb.toString(); - } - + @JsonProperty("resolution-key") + private String resolutionKey; + @JsonProperty("config-assign-properties") + private ConfigAssignPropertiesForVnf configAssignPropertiesForVnf; + + public String getResolutionKey() { + return resolutionKey; + } + + public void setResolutionKey(String resolutionKey) { + this.resolutionKey = resolutionKey; + } + + public ConfigAssignPropertiesForVnf getConfigAssignPropertiesForVnf() { + return configAssignPropertiesForVnf; + } + + public void setConfigAssignPropertiesForVnf(ConfigAssignPropertiesForVnf configAssignPropertiesForVnf) { + this.configAssignPropertiesForVnf = configAssignPropertiesForVnf; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{"); + sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\""); + sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForVnf.toString()); + sb.append('}'); + sb.append('}'); + + return sb.toString(); + } + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java index 6fadc7b55c..a9a3b0db15 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java @@ -5,114 +5,107 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"service-instance-id", -"pnf-id", -"pnf-name", -"pnf-ipv4-address", -"pnf-ipv6-address", -"service-model-uuid", -"pnf-customization-uuid" -}) +@JsonPropertyOrder({"service-instance-id", "pnf-id", "pnf-name", "pnf-ipv4-address", "pnf-ipv6-address", + "service-model-uuid", "pnf-customization-uuid"}) public class ConfigDeployPropertiesForPnf { - @JsonProperty("service-instance-id") - private String serviceInstanceId; + @JsonProperty("service-instance-id") + private String serviceInstanceId; - @JsonProperty("pnf-id") - private String pnfId; + @JsonProperty("pnf-id") + private String pnfId; - @JsonProperty("pnf-name") - private String pnfName; + @JsonProperty("pnf-name") + private String pnfName; - /** - * Config Deploy require IP address of PNF. - */ - @JsonProperty("pnf-ipv4-address") - private String pnfIpV4Address; + /** + * Config Deploy require IP address of PNF. + */ + @JsonProperty("pnf-ipv4-address") + private String pnfIpV4Address; - @JsonProperty("pnf-ipv6-address") - private String pnfIpV6Address; + @JsonProperty("pnf-ipv6-address") + private String pnfIpV6Address; - @JsonProperty("service-model-uuid") - private String serviceModelUuid; + @JsonProperty("service-model-uuid") + private String serviceModelUuid; - @JsonProperty("pnf-customization-uuid") - private String pnfCustomizationUuid; + @JsonProperty("pnf-customization-uuid") + private String pnfCustomizationUuid; - public String getServiceInstanceId() { - return serviceInstanceId; - } + public String getServiceInstanceId() { + return serviceInstanceId; + } - public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } - public String getPnfId() { - return pnfId; - } + public String getPnfId() { + return pnfId; + } - public void setPnfId(String pnfId) { - this.pnfId = pnfId; - } + public void setPnfId(String pnfId) { + this.pnfId = pnfId; + } - public String getPnfName() { - return pnfName; - } + public String getPnfName() { + return pnfName; + } - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } + public void setPnfName(String pnfName) { + this.pnfName = pnfName; + } - public String getServiceModelUuid() { - return serviceModelUuid; - } + public String getServiceModelUuid() { + return serviceModelUuid; + } - public void setServiceModelUuid(String serviceModelUuid) { - this.serviceModelUuid = serviceModelUuid; - } + public void setServiceModelUuid(String serviceModelUuid) { + this.serviceModelUuid = serviceModelUuid; + } - public String getPnfCustomizationUuid() { - return pnfCustomizationUuid; - } + public String getPnfCustomizationUuid() { + return pnfCustomizationUuid; + } - public void setPnfCustomizationUuid(String pnfCustomizationUuid) { - this.pnfCustomizationUuid = pnfCustomizationUuid; - } + public void setPnfCustomizationUuid(String pnfCustomizationUuid) { + this.pnfCustomizationUuid = pnfCustomizationUuid; + } - public String getPnfIpV4Address() { - return pnfIpV4Address; - } + public String getPnfIpV4Address() { + return pnfIpV4Address; + } - public void setPnfIpV4Address(String pnfIpV4Address) { - this.pnfIpV4Address = pnfIpV4Address; - } + public void setPnfIpV4Address(String pnfIpV4Address) { + this.pnfIpV4Address = pnfIpV4Address; + } - public String getPnfIpV6Address() { - return pnfIpV6Address; - } + public String getPnfIpV6Address() { + return pnfIpV6Address; + } - public void setPnfIpV6Address(String pnfIpV6Address) { - this.pnfIpV6Address = pnfIpV6Address; - } + public void setPnfIpV6Address(String pnfIpV6Address) { + this.pnfIpV6Address = pnfIpV6Address; + } - @Override - public String toString() { + @Override + public String toString() { - final StringBuilder sb = new StringBuilder("{"); - sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\""); - sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\""); - sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\""); - sb.append(", \"pnf-ipv4-address\":").append("\"").append(pnfIpV4Address).append("\""); - sb.append(", \"pnf-ipv6-address\":").append("\"").append(pnfIpV6Address).append("\""); - sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\""); - sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\""); + final StringBuilder sb = new StringBuilder("{"); + sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\""); + sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\""); + sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\""); + sb.append(", \"pnf-ipv4-address\":").append("\"").append(pnfIpV4Address).append("\""); + sb.append(", \"pnf-ipv6-address\":").append("\"").append(pnfIpV6Address).append("\""); + sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\""); + sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\""); - sb.append('}'); + sb.append('}'); - return sb.toString(); - } + return sb.toString(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java index ca2530b541..a3ac91ab9d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java @@ -5,83 +5,77 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"service-instance-id", -"vnf-id", -"vnf-name", -"service-model-uuid", -"vnf-customization-uuid" -}) +@JsonPropertyOrder({"service-instance-id", "vnf-id", "vnf-name", "service-model-uuid", "vnf-customization-uuid"}) public class ConfigDeployPropertiesForVnf { - @JsonProperty("service-instance-id") - private String serviceInstanceId; + @JsonProperty("service-instance-id") + private String serviceInstanceId; - @JsonProperty("vnf-id") - private String vnfId; + @JsonProperty("vnf-id") + private String vnfId; - @JsonProperty("vnf-name") - private String vnfName; + @JsonProperty("vnf-name") + private String vnfName; - @JsonProperty("service-model-uuid") - private String serviceModelUuid; + @JsonProperty("service-model-uuid") + private String serviceModelUuid; - @JsonProperty("vnf-customization-uuid") - private String vnfCustomizationUuid; + @JsonProperty("vnf-customization-uuid") + private String vnfCustomizationUuid; - public String getServiceInstanceId() { - return serviceInstanceId; - } + public String getServiceInstanceId() { + return serviceInstanceId; + } - public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } - public String getVnfId() { - return vnfId; - } + public String getVnfId() { + return vnfId; + } - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } - public String getVnfName() { - return vnfName; - } + public String getVnfName() { + return vnfName; + } - public void setVnfName(String vnfName) { - this.vnfName = vnfName; - } + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } - public String getServiceModelUuid() { - return serviceModelUuid; - } + public String getServiceModelUuid() { + return serviceModelUuid; + } - public void setServiceModelUuid(String serviceModelUuid) { - this.serviceModelUuid = serviceModelUuid; - } + public void setServiceModelUuid(String serviceModelUuid) { + this.serviceModelUuid = serviceModelUuid; + } - public String getVnfCustomizationUuid() { - return vnfCustomizationUuid; - } + public String getVnfCustomizationUuid() { + return vnfCustomizationUuid; + } - public void setVnfCustomizationUuid(String vnfCustomizationUuid) { - this.vnfCustomizationUuid = vnfCustomizationUuid; - } + public void setVnfCustomizationUuid(String vnfCustomizationUuid) { + this.vnfCustomizationUuid = vnfCustomizationUuid; + } - @Override - public String toString() { + @Override + public String toString() { - final StringBuilder sb = new StringBuilder("{"); - sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\""); - sb.append(", \"vnf-id\":").append("\"").append(vnfId).append("\""); - sb.append(", \"vnf-name\":").append("\"").append(vnfName).append("\""); - sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\""); - sb.append(", \"vnf-customization-uuid\":").append("\"").append(vnfCustomizationUuid).append("\""); + final StringBuilder sb = new StringBuilder("{"); + sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\""); + sb.append(", \"vnf-id\":").append("\"").append(vnfId).append("\""); + sb.append(", \"vnf-name\":").append("\"").append(vnfName).append("\""); + sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\""); + sb.append(", \"vnf-customization-uuid\":").append("\"").append(vnfCustomizationUuid).append("\""); - sb.append('}'); + sb.append('}'); - return sb.toString(); - } + return sb.toString(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java index 4635008d3f..817729ba4f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java @@ -5,42 +5,39 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"config-deploy-properties", -"resolution-key" -}) +@JsonPropertyOrder({"config-deploy-properties", "resolution-key"}) public class ConfigDeployRequestPnf { - @JsonProperty("resolution-key") - private String resolutionKey; - - @JsonProperty("config-deploy-properties") - private ConfigDeployPropertiesForPnf configDeployPropertiesForPnf; - - public String getResolutionKey() { - return resolutionKey; - } - - public void setResolutionKey(String resolutionKey) { - this.resolutionKey = resolutionKey; - } - - public ConfigDeployPropertiesForPnf getConfigDeployPropertiesForPnf() { - return configDeployPropertiesForPnf; - } - - public void setConfigDeployPropertiesForPnf(ConfigDeployPropertiesForPnf configDeployPropertiesForPnf) { - this.configDeployPropertiesForPnf = configDeployPropertiesForPnf; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{"); - sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\""); - sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForPnf.toString()); - sb.append('}'); - sb.append('}'); - - return sb.toString(); - } + @JsonProperty("resolution-key") + private String resolutionKey; + + @JsonProperty("config-deploy-properties") + private ConfigDeployPropertiesForPnf configDeployPropertiesForPnf; + + public String getResolutionKey() { + return resolutionKey; + } + + public void setResolutionKey(String resolutionKey) { + this.resolutionKey = resolutionKey; + } + + public ConfigDeployPropertiesForPnf getConfigDeployPropertiesForPnf() { + return configDeployPropertiesForPnf; + } + + public void setConfigDeployPropertiesForPnf(ConfigDeployPropertiesForPnf configDeployPropertiesForPnf) { + this.configDeployPropertiesForPnf = configDeployPropertiesForPnf; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{"); + sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\""); + sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForPnf.toString()); + sb.append('}'); + sb.append('}'); + + return sb.toString(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java index 53b956d3c4..c5fc0307b2 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java @@ -5,42 +5,39 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"config-deploy-properties", -"resolution-key" -}) +@JsonPropertyOrder({"config-deploy-properties", "resolution-key"}) public class ConfigDeployRequestVnf { - @JsonProperty("resolution-key") - private String resolutionKey; - - @JsonProperty("config-deploy-properties") - private ConfigDeployPropertiesForVnf configDeployPropertiesForVnf; - - public String getResolutionKey() { - return resolutionKey; - } - - public void setResolutionKey(String resolutionKey) { - this.resolutionKey = resolutionKey; - } - - public ConfigDeployPropertiesForVnf getConfigDeployPropertiesForVnf() { - return configDeployPropertiesForVnf; - } - - public void setConfigDeployPropertiesForVnf(ConfigDeployPropertiesForVnf configDeployPropertiesForVnf) { - this.configDeployPropertiesForVnf = configDeployPropertiesForVnf; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{"); - sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\""); - sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForVnf.toString()); - sb.append('}'); - sb.append('}'); - - return sb.toString(); - } + @JsonProperty("resolution-key") + private String resolutionKey; + + @JsonProperty("config-deploy-properties") + private ConfigDeployPropertiesForVnf configDeployPropertiesForVnf; + + public String getResolutionKey() { + return resolutionKey; + } + + public void setResolutionKey(String resolutionKey) { + this.resolutionKey = resolutionKey; + } + + public ConfigDeployPropertiesForVnf getConfigDeployPropertiesForVnf() { + return configDeployPropertiesForVnf; + } + + public void setConfigDeployPropertiesForVnf(ConfigDeployPropertiesForVnf configDeployPropertiesForVnf) { + this.configDeployPropertiesForVnf = configDeployPropertiesForVnf; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{"); + sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\""); + sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForVnf.toString()); + sb.append('}'); + sb.append('}'); + + return sb.toString(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DefaultDmaapPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DefaultDmaapPropertiesImpl.java index c5f08d4809..b037a86a78 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DefaultDmaapPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DefaultDmaapPropertiesImpl.java @@ -17,24 +17,23 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - + package org.onap.so.client.dmaapproperties; import org.onap.so.client.dmaap.DmaapProperties; - import java.util.Map; public class DefaultDmaapPropertiesImpl implements DmaapProperties { - private final Map<String, String> properties; + private final Map<String, String> properties; - public DefaultDmaapPropertiesImpl() { - this.properties = new DmaapPropertiesMap(); - } + public DefaultDmaapPropertiesImpl() { + this.properties = new DmaapPropertiesMap(); + } - @Override - public Map<String, String> getProperties() { - return properties; - } + @Override + public Map<String, String> getProperties() { + return properties; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java index cbedefe7eb..cc262b250f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java @@ -23,7 +23,6 @@ package org.onap.so.client.dmaapproperties; import javax.inject.Provider; - import org.onap.so.client.avpn.dmaap.beans.AVPNDmaapBean; import org.onap.so.client.avpn.dmaap.beans.AsyncRequestStatus; import org.onap.so.client.avpn.dmaap.beans.InstanceReferences; @@ -33,86 +32,90 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @Component public class DmaapPropertiesClient { - private static final Logger logger = LoggerFactory.getLogger(DmaapPropertiesClient.class); - - @Autowired - private Provider<GlobalDmaapPublisher> dmaapPublisher; - - protected AVPNDmaapBean buildRequestJson(String requestId, String clientSource, String correlator, String serviceInstanceId, String startTime, String finishTime, - String requestScope, String requestType, String timestamp, String requestState, String statusMessage, String percentProgress, Boolean wasRolledBack) { - - RequestStatus requestStatus = buildRequestStatus(timestamp, requestState, statusMessage, percentProgress, wasRolledBack); - - InstanceReferences instanceReferences = buildInstanceReferences(serviceInstanceId); - - AsyncRequestStatus asyncRequestStatus = buildAsyncRequestStatus(requestId, clientSource, correlator, startTime, finishTime, - requestScope, requestType, requestStatus, instanceReferences); - - AVPNDmaapBean dmaapBean = new AVPNDmaapBean(); - dmaapBean.setAsyncRequestStatus(asyncRequestStatus); - - return dmaapBean; - } - - private String jsonToString(AVPNDmaapBean dmaapBean) throws JsonProcessingException, MapperException { - try { - return new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(dmaapBean); - } catch (JsonProcessingException e) { - logger.error("Exception occurred", e); - throw new MapperException(e.getMessage()); - } - } - - private AsyncRequestStatus buildAsyncRequestStatus(String requestId, String clientSource, String correlator, String startTime, - String finishTime, String requestScope, String requestType, - RequestStatus requestStatus, InstanceReferences instanceReferences) { - - AsyncRequestStatus asyncRequestStatus = new AsyncRequestStatus(); - asyncRequestStatus.setRequestId(requestId); - asyncRequestStatus.setClientSource(clientSource); - asyncRequestStatus.setCorrelator(correlator); - asyncRequestStatus.setStartTime(startTime); - asyncRequestStatus.setFinishTime(finishTime); - asyncRequestStatus.setRequestScope(requestScope); - asyncRequestStatus.setRequestType(requestType); - asyncRequestStatus.setInstanceReferences(instanceReferences); - asyncRequestStatus.setRequestStatus(requestStatus); - - return asyncRequestStatus; - } - - private InstanceReferences buildInstanceReferences(String serviceInstanceId) { - InstanceReferences instanceReferences = new InstanceReferences(); - instanceReferences.setServiceInstanceId(serviceInstanceId); - return instanceReferences; - } - - private RequestStatus buildRequestStatus(String timestamp, String requestState, String statusMessage, - String percentProgress, Boolean wasRolledBack) { - RequestStatus requestStatus = new RequestStatus(); - requestStatus.setTimestamp(timestamp); - requestStatus.setRequestState(requestState); - requestStatus.setStatusMessage(statusMessage); - requestStatus.setPercentProgress(percentProgress); - requestStatus.setWasRolledBack(wasRolledBack); - return requestStatus; - } - - public void dmaapPublishRequest(String requestId, String clientSource, String correlator, String serviceInstanceId, String startTime, - String finishTime, String requestScope, String requestType, String timestamp, String requestState, - String statusMessage, String percentProgress, Boolean wasRolledBack) throws MapperException, JsonProcessingException { - - AVPNDmaapBean bean = this.buildRequestJson(requestId, clientSource, correlator, serviceInstanceId, startTime, finishTime, - requestScope, requestType, timestamp, requestState, statusMessage, percentProgress, wasRolledBack); - - String request = jsonToString(bean); - dmaapPublisher.get().send(request); - } + private static final Logger logger = LoggerFactory.getLogger(DmaapPropertiesClient.class); + + @Autowired + private Provider<GlobalDmaapPublisher> dmaapPublisher; + + protected AVPNDmaapBean buildRequestJson(String requestId, String clientSource, String correlator, + String serviceInstanceId, String startTime, String finishTime, String requestScope, String requestType, + String timestamp, String requestState, String statusMessage, String percentProgress, + Boolean wasRolledBack) { + + RequestStatus requestStatus = + buildRequestStatus(timestamp, requestState, statusMessage, percentProgress, wasRolledBack); + + InstanceReferences instanceReferences = buildInstanceReferences(serviceInstanceId); + + AsyncRequestStatus asyncRequestStatus = buildAsyncRequestStatus(requestId, clientSource, correlator, startTime, + finishTime, requestScope, requestType, requestStatus, instanceReferences); + + AVPNDmaapBean dmaapBean = new AVPNDmaapBean(); + dmaapBean.setAsyncRequestStatus(asyncRequestStatus); + + return dmaapBean; + } + + private String jsonToString(AVPNDmaapBean dmaapBean) throws JsonProcessingException, MapperException { + try { + return new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(dmaapBean); + } catch (JsonProcessingException e) { + logger.error("Exception occurred", e); + throw new MapperException(e.getMessage()); + } + } + + private AsyncRequestStatus buildAsyncRequestStatus(String requestId, String clientSource, String correlator, + String startTime, String finishTime, String requestScope, String requestType, RequestStatus requestStatus, + InstanceReferences instanceReferences) { + + AsyncRequestStatus asyncRequestStatus = new AsyncRequestStatus(); + asyncRequestStatus.setRequestId(requestId); + asyncRequestStatus.setClientSource(clientSource); + asyncRequestStatus.setCorrelator(correlator); + asyncRequestStatus.setStartTime(startTime); + asyncRequestStatus.setFinishTime(finishTime); + asyncRequestStatus.setRequestScope(requestScope); + asyncRequestStatus.setRequestType(requestType); + asyncRequestStatus.setInstanceReferences(instanceReferences); + asyncRequestStatus.setRequestStatus(requestStatus); + + return asyncRequestStatus; + } + + private InstanceReferences buildInstanceReferences(String serviceInstanceId) { + InstanceReferences instanceReferences = new InstanceReferences(); + instanceReferences.setServiceInstanceId(serviceInstanceId); + return instanceReferences; + } + + private RequestStatus buildRequestStatus(String timestamp, String requestState, String statusMessage, + String percentProgress, Boolean wasRolledBack) { + RequestStatus requestStatus = new RequestStatus(); + requestStatus.setTimestamp(timestamp); + requestStatus.setRequestState(requestState); + requestStatus.setStatusMessage(statusMessage); + requestStatus.setPercentProgress(percentProgress); + requestStatus.setWasRolledBack(wasRolledBack); + return requestStatus; + } + + public void dmaapPublishRequest(String requestId, String clientSource, String correlator, String serviceInstanceId, + String startTime, String finishTime, String requestScope, String requestType, String timestamp, + String requestState, String statusMessage, String percentProgress, Boolean wasRolledBack) + throws MapperException, JsonProcessingException { + + AVPNDmaapBean bean = this.buildRequestJson(requestId, clientSource, correlator, serviceInstanceId, startTime, + finishTime, requestScope, requestType, timestamp, requestState, statusMessage, percentProgress, + wasRolledBack); + + String request = jsonToString(bean); + dmaapPublisher.get().send(request); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesMap.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesMap.java index 796ccf18b7..b6ec2c5b9c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesMap.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesMap.java @@ -21,27 +21,26 @@ package org.onap.so.client.dmaapproperties; import org.onap.so.bpmn.core.UrnPropertiesReader; - import java.util.HashMap; /** - * This class is used when Dmaap Properties are to be accessed from - * application.yaml and it delegates get calls to UrnPropertyReader class - * for reading the value from active configuration + * This class is used when Dmaap Properties are to be accessed from application.yaml and it delegates get calls to + * UrnPropertyReader class for reading the value from active configuration + * * @param <K> Key for Map Entry * @param <V> Value for Map Entry */ -public class DmaapPropertiesMap<K,V> extends HashMap<K,V> { +public class DmaapPropertiesMap<K, V> extends HashMap<K, V> { @Override public V get(Object key) { - return (V)UrnPropertiesReader.getVariable((String)key); + return (V) UrnPropertiesReader.getVariable((String) key); } @Override public V getOrDefault(Object key, V defaultValue) { - String str = UrnPropertiesReader.getVariable((String)key); - return str ==null ? defaultValue : (V)str; + String str = UrnPropertiesReader.getVariable((String) key); + return str == null ? defaultValue : (V) str; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java index 17b99e2741..cb22fc5c7c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java @@ -21,10 +21,8 @@ package org.onap.so.client.dmaapproperties; import java.io.IOException; import java.util.Optional; - import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.client.dmaap.DmaapPublisher; - import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @@ -32,32 +30,32 @@ import org.springframework.stereotype.Component; @Scope("prototype") public class GlobalDmaapPublisher extends DmaapPublisher { - - public GlobalDmaapPublisher() throws IOException { - super(); - } - - @Override - public String getAuth() { - return UrnPropertiesReader.getVariable("mso.global.dmaap.auth"); - } + public GlobalDmaapPublisher() throws IOException { + super(); + } + + @Override + public String getAuth() { + + return UrnPropertiesReader.getVariable("mso.global.dmaap.auth"); + } - @Override - public String getKey() { + @Override + public String getKey() { - return UrnPropertiesReader.getVariable("mso.msoKey"); - } + return UrnPropertiesReader.getVariable("mso.msoKey"); + } - @Override - public String getTopic() { - return UrnPropertiesReader.getVariable("mso.global.dmaap.publisher.topic"); - } + @Override + public String getTopic() { + return UrnPropertiesReader.getVariable("mso.global.dmaap.publisher.topic"); + } - @Override - public Optional<String> getHost() { - return Optional.ofNullable(UrnPropertiesReader.getVariable("mso.global.dmaap.host")); - } + @Override + public Optional<String> getHost() { + return Optional.ofNullable(UrnPropertiesReader.getVariable("mso.global.dmaap.host")); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BBObjectNotFoundException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BBObjectNotFoundException.java index 26c8d80075..8a1a110fac 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BBObjectNotFoundException.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BBObjectNotFoundException.java @@ -22,24 +22,23 @@ package org.onap.so.client.exception; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; -public class BBObjectNotFoundException extends Exception{ - private ResourceKey resourceKey; - private String resourceValue; - +public class BBObjectNotFoundException extends Exception { + private ResourceKey resourceKey; + private String resourceValue; + public BBObjectNotFoundException() {} - public BBObjectNotFoundException(ResourceKey resourceKey, String resourceValue) - { - super("BBObject" + resourceKey + " was not found in gBBInput using reference value: " + resourceValue); - this.resourceKey = resourceKey; - this.resourceValue = resourceValue; + public BBObjectNotFoundException(ResourceKey resourceKey, String resourceValue) { + super("BBObject" + resourceKey + " was not found in gBBInput using reference value: " + resourceValue); + this.resourceKey = resourceKey; + this.resourceValue = resourceValue; } public ResourceKey getResourceKey() { - return resourceKey; + return resourceKey; } - + public String getResourceValue() { - return resourceValue; + return resourceValue; } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java index ac8ff9efe4..333d99ed2e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java @@ -20,13 +20,12 @@ package org.onap.so.client.exception; -public class BadResponseException extends Exception{ +public class BadResponseException extends Exception { - public BadResponseException() {} + public BadResponseException() {} - public BadResponseException(String message) - { - super(message); + public BadResponseException(String message) { + super(message); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index cb65f4d420..ae5e41f7ce 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -35,96 +35,101 @@ import org.springframework.stereotype.Component; @Component public class ExceptionBuilder { - private static final Logger logger = LoggerFactory.getLogger(ExceptionBuilder.class); - - public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception) { - String msg = "Exception in %s.%s "; - try{ - logger.error("Exception occurred", exception); - - String errorVariable = "Error%s%s"; - - StackTraceElement[] trace = Thread.currentThread().getStackTrace(); - for (StackTraceElement traceElement : trace) { - if (!traceElement.getClassName().equals(this.getClass().getName()) && !traceElement.getClassName().equals(Thread.class.getName())) { - msg = String.format(msg, traceElement.getClassName(), traceElement.getMethodName()); - String shortClassName = traceElement.getClassName().substring(traceElement.getClassName().lastIndexOf(".") + 1); - errorVariable = String.format(errorVariable, shortClassName, traceElement.getMethodName()); - break; - } - } - - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue(), msg.toString()); - execution.setVariable(errorVariable, exception.getMessage()); - } catch (Exception ex){ - //log trace, allow process to complete gracefully - logger.error("Exception occurred", ex); - } - - if (exception.getMessage() != null) - msg = msg.concat(exception.getMessage()); - buildAndThrowWorkflowException(execution, errorCode, msg); - } - - public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception) { - String msg = "Exception in %s.%s "; - try{ - logger.error("Exception occurred", exception); - - String errorVariable = "Error%s%s"; - - StackTraceElement[] trace = Thread.currentThread().getStackTrace(); - for (StackTraceElement traceElement : trace) { - if (!traceElement.getClassName().equals(this.getClass().getName()) && !traceElement.getClassName().equals(Thread.class.getName())) { - msg = String.format(msg, traceElement.getClassName(), traceElement.getMethodName()); - String shortClassName = traceElement.getClassName().substring(traceElement.getClassName().lastIndexOf(".") + 1); - errorVariable = String.format(errorVariable, shortClassName, traceElement.getMethodName()); - break; - } - } - logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue(), msg.toString()); - execution.setVariable(errorVariable, exception.getMessage()); - } catch (Exception ex){ - //log trace, allow process to complete gracefully - logger.error("Exception occurred", ex); - } - - if (exception.getMessage() != null) - msg = msg.concat(exception.getMessage()); - buildAndThrowWorkflowException(execution, errorCode, msg); - } - - public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage) { - if (execution instanceof DelegateExecutionImpl) { - buildAndThrowWorkflowException(((DelegateExecutionImpl) execution).getDelegateExecution(), errorCode, errorMessage); - } - } - - public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { - String processKey = getProcessKey(execution); - logger.info("Building a WorkflowException for Subflow"); - - WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); - execution.setVariable("WorkflowException", exception); - execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); - logger.info("Outgoing WorkflowException is {}", exception); - logger.info("Throwing MSOWorkflowException"); - throw new BpmnError("MSOWorkflowException"); - } - - public void buildAndThrowWorkflowException(DelegateExecution execution, String errorCode, String errorMessage) { - execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); - throw new BpmnError(errorCode,errorMessage); - } - - public String getProcessKey(DelegateExecution execution) { - String testKey = (String) execution.getVariable("testProcessKey"); - if (testKey != null) { - return testKey; - } - return execution.getProcessEngineServices().getRepositoryService() - .getProcessDefinition(execution.getProcessDefinitionId()).getKey(); - } + private static final Logger logger = LoggerFactory.getLogger(ExceptionBuilder.class); + + public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception) { + String msg = "Exception in %s.%s "; + try { + logger.error("Exception occurred", exception); + + String errorVariable = "Error%s%s"; + + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); + for (StackTraceElement traceElement : trace) { + if (!traceElement.getClassName().equals(this.getClass().getName()) + && !traceElement.getClassName().equals(Thread.class.getName())) { + msg = String.format(msg, traceElement.getClassName(), traceElement.getMethodName()); + String shortClassName = + traceElement.getClassName().substring(traceElement.getClassName().lastIndexOf(".") + 1); + errorVariable = String.format(errorVariable, shortClassName, traceElement.getMethodName()); + break; + } + } + + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue(), msg.toString()); + execution.setVariable(errorVariable, exception.getMessage()); + } catch (Exception ex) { + // log trace, allow process to complete gracefully + logger.error("Exception occurred", ex); + } + + if (exception.getMessage() != null) + msg = msg.concat(exception.getMessage()); + buildAndThrowWorkflowException(execution, errorCode, msg); + } + + public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception) { + String msg = "Exception in %s.%s "; + try { + logger.error("Exception occurred", exception); + + String errorVariable = "Error%s%s"; + + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); + for (StackTraceElement traceElement : trace) { + if (!traceElement.getClassName().equals(this.getClass().getName()) + && !traceElement.getClassName().equals(Thread.class.getName())) { + msg = String.format(msg, traceElement.getClassName(), traceElement.getMethodName()); + String shortClassName = + traceElement.getClassName().substring(traceElement.getClassName().lastIndexOf(".") + 1); + errorVariable = String.format(errorVariable, shortClassName, traceElement.getMethodName()); + break; + } + } + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", + ErrorCode.UnknownError.getValue(), msg.toString()); + execution.setVariable(errorVariable, exception.getMessage()); + } catch (Exception ex) { + // log trace, allow process to complete gracefully + logger.error("Exception occurred", ex); + } + + if (exception.getMessage() != null) + msg = msg.concat(exception.getMessage()); + buildAndThrowWorkflowException(execution, errorCode, msg); + } + + public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage) { + if (execution instanceof DelegateExecutionImpl) { + buildAndThrowWorkflowException(((DelegateExecutionImpl) execution).getDelegateExecution(), errorCode, + errorMessage); + } + } + + public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) { + String processKey = getProcessKey(execution); + logger.info("Building a WorkflowException for Subflow"); + + WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); + execution.setVariable("WorkflowException", exception); + execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); + logger.info("Outgoing WorkflowException is {}", exception); + logger.info("Throwing MSOWorkflowException"); + throw new BpmnError("MSOWorkflowException"); + } + + public void buildAndThrowWorkflowException(DelegateExecution execution, String errorCode, String errorMessage) { + execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); + throw new BpmnError(errorCode, errorMessage); + } + + public String getProcessKey(DelegateExecution execution) { + String testKey = (String) execution.getVariable("testProcessKey"); + if (testKey != null) { + return testKey; + } + return execution.getProcessEngineServices().getRepositoryService() + .getProcessDefinition(execution.getProcessDefinitionId()).getKey(); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java index 3f3beadb92..354c669d62 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java @@ -20,13 +20,12 @@ package org.onap.so.client.exception; -public class MapperException extends Exception{ - +public class MapperException extends Exception { + public MapperException() {} - public MapperException(String message) - { - super(message); + public MapperException(String message) { + super(message); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/OrchestrationStatusValidationException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/OrchestrationStatusValidationException.java index fe7b079568..e9d1e1fba0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/OrchestrationStatusValidationException.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/OrchestrationStatusValidationException.java @@ -20,10 +20,10 @@ package org.onap.so.client.exception; -public class OrchestrationStatusValidationException extends Exception{ - public OrchestrationStatusValidationException() {} +public class OrchestrationStatusValidationException extends Exception { + public OrchestrationStatusValidationException() {} public OrchestrationStatusValidationException(String message) { - super(message); + super(message); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java index b7164e327e..c88e9ae34f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java @@ -22,7 +22,6 @@ package org.onap.so.client.restproperties; import java.net.MalformedURLException; import java.net.URL; - import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.client.aai.AAIProperties; import org.onap.so.client.aai.AAIVersion; @@ -31,33 +30,33 @@ import org.springframework.stereotype.Component; @Component public class AAIPropertiesImpl implements AAIProperties { - public static final String MSO_MSO_KEY = "mso.msoKey"; - public static final String AAI_AUTH = "aai.auth"; - public static final String AAI_ENDPOINT = "aai.endpoint"; - private UrnPropertiesReader reader; - - @Override - public URL getEndpoint() throws MalformedURLException { - return new URL(reader.getVariable(AAI_ENDPOINT)); - } - - @Override - public String getSystemName() { - return "MSO"; - } - - @Override - public AAIVersion getDefaultVersion() { - return AAIVersion.LATEST; - } - - @Override - public String getAuth() { - return reader.getVariable(AAI_AUTH); - } - - @Override - public String getKey() { - return reader.getVariable(MSO_MSO_KEY); - } + public static final String MSO_MSO_KEY = "mso.msoKey"; + public static final String AAI_AUTH = "aai.auth"; + public static final String AAI_ENDPOINT = "aai.endpoint"; + private UrnPropertiesReader reader; + + @Override + public URL getEndpoint() throws MalformedURLException { + return new URL(reader.getVariable(AAI_ENDPOINT)); + } + + @Override + public String getSystemName() { + return "MSO"; + } + + @Override + public AAIVersion getDefaultVersion() { + return AAIVersion.LATEST; + } + + @Override + public String getAuth() { + return reader.getVariable(AAI_AUTH); + } + + @Override + public String getKey() { + return reader.getVariable(MSO_MSO_KEY); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java index d1888b17df..64c45653e1 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java @@ -75,9 +75,9 @@ public class CDSPropertiesImpl implements CDSProperties { public boolean mapNotFoundToEmpty() { return false; } - + @Override - public int getTimeout() { - return Integer.parseInt(Objects.requireNonNull(UrnPropertiesReader.getVariable(TIMEOUT))); - } + public int getTimeout() { + return Integer.parseInt(Objects.requireNonNull(UrnPropertiesReader.getVariable(TIMEOUT))); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/PolicyRestPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/PolicyRestPropertiesImpl.java index 1e43adceba..4bdb8bd0fb 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/PolicyRestPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/PolicyRestPropertiesImpl.java @@ -22,44 +22,42 @@ package org.onap.so.client.restproperties; import java.net.MalformedURLException; import java.net.URL; - import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.client.policy.PolicyRestProperties; public class PolicyRestPropertiesImpl implements PolicyRestProperties { - public static final String POLICY_ENDPOINT = "policy.endpoint"; - public static final String POLICY_ENVIRONMENT = "policy.environment"; - public static final String POLICY_AUTH = "policy.auth"; - public static final String POLICY_CLIENT_AUTH = "policy.client.auth"; - - public PolicyRestPropertiesImpl() { - } - - @Override - public URL getEndpoint() { - try { - return new URL(UrnPropertiesReader.getVariable(POLICY_ENDPOINT)); - } catch (MalformedURLException e) { - return null; - } - } - - @Override - public String getSystemName() { - return "MSO"; - } - - public String getClientAuth() { - return UrnPropertiesReader.getVariable(POLICY_CLIENT_AUTH); - } - - public String getAuth() { - return UrnPropertiesReader.getVariable(POLICY_AUTH); - } - - public String getEnvironment() { - return UrnPropertiesReader.getVariable(POLICY_ENVIRONMENT); - } + public static final String POLICY_ENDPOINT = "policy.endpoint"; + public static final String POLICY_ENVIRONMENT = "policy.environment"; + public static final String POLICY_AUTH = "policy.auth"; + public static final String POLICY_CLIENT_AUTH = "policy.client.auth"; + + public PolicyRestPropertiesImpl() {} + + @Override + public URL getEndpoint() { + try { + return new URL(UrnPropertiesReader.getVariable(POLICY_ENDPOINT)); + } catch (MalformedURLException e) { + return null; + } + } + + @Override + public String getSystemName() { + return "MSO"; + } + + public String getClientAuth() { + return UrnPropertiesReader.getVariable(POLICY_CLIENT_AUTH); + } + + public String getAuth() { + return UrnPropertiesReader.getVariable(POLICY_AUTH); + } + + public String getEnvironment() { + return UrnPropertiesReader.getVariable(POLICY_ENVIRONMENT); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/UrnPropertiesReaderWrapper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/UrnPropertiesReaderWrapper.java index 030eff92e2..5cd567a7e3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/UrnPropertiesReaderWrapper.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/UrnPropertiesReaderWrapper.java @@ -24,7 +24,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader; public class UrnPropertiesReaderWrapper { - public String getVariable(String key) { - return UrnPropertiesReader.getVariable(key); - } + public String getVariable(String key) { + return UrnPropertiesReader.getVariable(key); + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java index 64283d78ca..528b10ef6f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java @@ -23,8 +23,8 @@ package org.openecomp.mso.bpmn.common.workflow.service; import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; /** - * Exception thrown when an error occurs while processing the workflow. - * This encapsulates the workflow response so that the same can be sent back to api handler. + * Exception thrown when an error occurs while processing the workflow. This encapsulates the workflow response so that + * the same can be sent back to api handler. */ public class WorkflowProcessorException extends RuntimeException { WorkflowResponse workflowResponse; |