diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java')
194 files changed, 12501 insertions, 10277 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java index 5a0de6f5e9..d3ddc60d3e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/PayloadClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,26 +18,36 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload; - -import org.openecomp.mso.bpmn.appc.payload.beans.*; +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; +import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersUpgrade; +import org.onap.so.bpmn.appc.payload.beans.HealthCheckAction; +import org.onap.so.bpmn.appc.payload.beans.QuiesceTrafficAction; +import org.onap.so.bpmn.appc.payload.beans.RequestParametersHealthCheck; +import org.onap.so.bpmn.appc.payload.beans.ResumeTrafficAction; +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 org.openecomp.mso.bpmn.core.json.JsonUtils; -import com.fasterxml.jackson.databind.JsonMappingException; 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.get(); + 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); @@ -58,7 +68,7 @@ public class PayloadClient { public static Optional<String> quiesceTrafficFormat(Optional<String> payload, String vnfName) throws JsonProcessingException{ QuiesceTrafficAction payloadResult = new QuiesceTrafficAction(); ConfigurationParametersQuiesce configParams = new ConfigurationParametersQuiesce(); - String payloadString = payload.get(); + String payloadString = payload.isPresent() ? payload.get() : ""; String operationsTimeout = JsonUtils.getJsonValue(payloadString, "operations-timeout"); configParams.setOperationsTimeout(operationsTimeout); configParams.setVnfName(vnfName); @@ -68,7 +78,7 @@ public class PayloadClient { public static Optional<String> startStopFormat(String aicIdentity) throws JsonProcessingException{ StartStopAction payloadResult = new StartStopAction(); - payloadResult.setAICIdentity(aicIdentity); + payloadResult.setAicIdentity(aicIdentity); return Optional.of(mapper.writeValueAsString(payloadResult)); } @@ -90,20 +100,4 @@ public class PayloadClient { return Optional.of(mapper.writeValueAsString(payloadResult)); } - /*public Optional<String> verifySnapshotFormat(Optional<String> payload) throws Exception, JsonProcessingException, JsonMappingException{ - final Snapshot check = mapper.readValue(payload.get(), Snapshot.class); - return Optional.of(mapper.writeValueAsString(check)); - } - - public Optional<String> verifyUpgradeFormat(Optional<String> payload) throws Exception, JsonProcessingException, JsonMappingException{ - final UpdateCheck check = mapper.readValue(payload.get(), UpdateCheck.class); - return Optional.of(mapper.writeValueAsString(check)); - } - - public Optional<String> verifyQuiesceTrafficFormat(Optional<String> payload)throws Exception, JsonProcessingException, JsonMappingException{ - final QuiesceTraffic check = mapper.readValue(payload.get(), QuiesceTraffic.class); - return Optional.of(mapper.writeValueAsString(check)); - } - */ - } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigModifyAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigModifyAction.java index 09ad2bf439..3c39a8d66c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigModifyAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigModifyAction.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,42 +18,42 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.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({
-"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;
-}
-
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.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({ +"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; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java index dda7856168..c88169bb80 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,41 +18,41 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.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({
-"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;
-}
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.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({ +"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; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java index 000b1bdbf7..a8964f3bc5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.beans; +package org.onap.so.bpmn.appc.payload.beans; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -42,4 +42,4 @@ return vnfName; public void setVnfName(String vnfName) { this.vnfName = vnfName; } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java index e354d9ca2e..878a136962 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,42 +18,42 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.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({
-"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;
-}
-
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.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({ +"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; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java index 820618e828..6b5e59f2e0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,28 +18,28 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.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({
-"vnf_name"
-})
-public class ConfigurationParametersResumeTraffic {
-
-@JsonProperty("vnf_name")
-private String vnfName;
-
-@JsonProperty("vnf_name")
-public String getVnfName() {
-return vnfName;
-}
-
-@JsonProperty("vnf_name")
-public void setVnfName(String vnfName) {
-this.vnfName = vnfName;
-}
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.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({ +"vnf_name" +}) +public class ConfigurationParametersResumeTraffic { + +@JsonProperty("vnf_name") +private String vnfName; + +@JsonProperty("vnf_name") +public String getVnfName() { +return vnfName; +} + +@JsonProperty("vnf_name") +public void setVnfName(String vnfName) { +this.vnfName = vnfName; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java index 0845e7c37d..ff51b06dbe 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,54 +18,54 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.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({
-"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")
-public String getVnfName() {
-return 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 void setExistingSoftwareVersion(String existingSoftwareVersion) {
-this.existingSoftwareVersion = existingSoftwareVersion;
-}
-
-@JsonProperty("new-software-version")
-public String getNewSoftwareVersion() {
-return newSoftwareVersion;
-}
-
-@JsonProperty("new-software-version")
-public void setNewSoftwareVersion(String newSoftwareVersion) {
-this.newSoftwareVersion = newSoftwareVersion;
-}
-
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.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({ +"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") +public String getVnfName() { +return 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 void setExistingSoftwareVersion(String existingSoftwareVersion) { +this.existingSoftwareVersion = existingSoftwareVersion; +} + +@JsonProperty("new-software-version") +public String getNewSoftwareVersion() { +return newSoftwareVersion; +} + +@JsonProperty("new-software-version") +public void setNewSoftwareVersion(String newSoftwareVersion) { +this.newSoftwareVersion = newSoftwareVersion; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/HealthCheckAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/HealthCheckAction.java index 53408f1ead..4d194650c4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/HealthCheckAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/HealthCheckAction.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,42 +18,41 @@ * ============LICENSE_END========================================================= */ -
-package org.openecomp.mso.bpmn.appc.payload.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({
-"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;
-}
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.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({ +"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; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/QuiesceTrafficAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/QuiesceTrafficAction.java index cbe8ee0b91..0b16c6ca90 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/QuiesceTrafficAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/QuiesceTrafficAction.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,29 +18,28 @@ * ============LICENSE_END========================================================= */ -
-package org.openecomp.mso.bpmn.appc.payload.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({
-"configuration-parameters"
-})
-public class QuiesceTrafficAction {
-
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersQuiesce configurationParameters;
-
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersQuiesce getConfigurationParameters() {
-return configurationParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersQuiesce configurationParameters) {
-this.configurationParameters = configurationParameters;
-}
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.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({ +"configuration-parameters" +}) +public class QuiesceTrafficAction { + +@JsonProperty("configuration-parameters") +private ConfigurationParametersQuiesce configurationParameters; + +@JsonProperty("configuration-parameters") +public ConfigurationParametersQuiesce getConfigurationParameters() { +return configurationParameters; +} + +@JsonProperty("configuration-parameters") +public void setConfigurationParameters(ConfigurationParametersQuiesce configurationParameters) { +this.configurationParameters = configurationParameters; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersConfigModify.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigModify.java index 41b3314e7c..58c9234d60 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersConfigModify.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigModify.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,29 +18,29 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.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({
-"vnf-host-ip-address"
-})
-public class RequestParametersConfigModify {
-
-@JsonProperty("vnf-host-ip-address")
-private String vnfHostIpAddress;
-
-@JsonProperty("vnf-host-ip-address")
-public String getVnfHostIpAddress() {
-return vnfHostIpAddress;
-}
-
-@JsonProperty("vnf-host-ip-address")
-public void setVnfHostIpAddress(String vnfHostIpAddress) {
-this.vnfHostIpAddress = vnfHostIpAddress;
-}
-
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.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({ +"vnf-host-ip-address" +}) +public class RequestParametersConfigModify { + +@JsonProperty("vnf-host-ip-address") +private String vnfHostIpAddress; + +@JsonProperty("vnf-host-ip-address") +public String getVnfHostIpAddress() { +return vnfHostIpAddress; +} + +@JsonProperty("vnf-host-ip-address") +public void setVnfHostIpAddress(String vnfHostIpAddress) { +this.vnfHostIpAddress = vnfHostIpAddress; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersHealthCheck.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java index dcdb4fb71e..ca87ad6d15 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersHealthCheck.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.beans; +package org.onap.so.bpmn.appc.payload.beans; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -44,4 +44,4 @@ public void setVnfName(String vnfName) { this.vnfName = vnfName; } -}
\ No newline at end of file +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ResumeTrafficAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ResumeTrafficAction.java index de4fe25cd7..b642a376fe 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ResumeTrafficAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ResumeTrafficAction.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,28 +18,28 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.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({
-"configuration-parameters"
-})
-public class ResumeTrafficAction {
-
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersResumeTraffic configurationParameters;
-
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersResumeTraffic getConfigurationParameters() {
-return configurationParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersResumeTraffic configurationParameters) {
-this.configurationParameters = configurationParameters;
-}
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.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({ +"configuration-parameters" +}) +public class ResumeTrafficAction { + +@JsonProperty("configuration-parameters") +private ConfigurationParametersResumeTraffic configurationParameters; + +@JsonProperty("configuration-parameters") +public ConfigurationParametersResumeTraffic getConfigurationParameters() { +return configurationParameters; +} + +@JsonProperty("configuration-parameters") +public void setConfigurationParameters(ConfigurationParametersResumeTraffic configurationParameters) { +this.configurationParameters = configurationParameters; +} +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/SnapshotAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/SnapshotAction.java index bb74798300..0499e5d6c0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/SnapshotAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/SnapshotAction.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,42 +18,42 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.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({
-"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;
-}
-
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.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({ +"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; +} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/StartStopAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/StartStopAction.java index 988c282076..f2b5b905a5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/StartStopAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/StartStopAction.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,38 +18,28 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.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({
- " AICIdentity "
-})
-public class StartStopAction {
-
- @JsonProperty(" AICIdentity ")
- private String aICIdentity;
-
- @JsonProperty(" AICIdentity ")
- public String getAICIdentity() {
- return aICIdentity;
- }
-
- @JsonProperty(" AICIdentity ")
- public void setAICIdentity(String aICIdentity) {
- this.aICIdentity = aICIdentity;
- } +package org.onap.so.bpmn.appc.payload.beans; - public String getaICIdentity() { - return aICIdentity; - } +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + " AICIdentity " +}) +public class StartStopAction { - public void setaICIdentity(String aICIdentity) { - this.aICIdentity = aICIdentity; + @JsonProperty(" AICIdentity ") + private String aicIdentity; + + @JsonProperty(" AICIdentity ") + public String getAicIdentity() { + return aicIdentity; } -
-}
\ No newline at end of file + @JsonProperty(" AICIdentity ") + public void setAicIdentity(String aicIdentity) { + this.aicIdentity = aicIdentity; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/UpgradeAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/UpgradeAction.java index 3486fa73ba..3e07f328ce 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/UpgradeAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/UpgradeAction.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,28 +18,28 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.appc.payload.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({
-"configuration-parameters"
-})
-public class UpgradeAction {
-
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersUpgrade configurationParameters;
-
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersUpgrade getConfigurationParameters() {
-return configurationParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersUpgrade configurationParameters) {
-this.configurationParameters = configurationParameters;
-}
-}
\ No newline at end of file +package org.onap.so.bpmn.appc.payload.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({ +"configuration-parameters" +}) +public class UpgradeAction { + +@JsonProperty("configuration-parameters") +private ConfigurationParametersUpgrade configurationParameters; + +@JsonProperty("configuration-parameters") +public ConfigurationParametersUpgrade getConfigurationParameters() { +return 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/ActionPreProcessor.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/ActionPreProcessor.java new file mode 100644 index 0000000000..19ab520c6c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/ActionPreProcessor.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + + +import org.camunda.bpm.engine.delegate.DelegateExecution; + +/** + * interface to be extended by the classes, where pre processing is required + */ +public interface ActionPreProcessor { + + /** + * method to bind and return the action + * + * @return + */ + String getAction(); + + /** + * method to preform certain pre processing task before BB execution + * + * @param execution + * @return + */ + boolean process(DelegateExecution execution); +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java index 64e5adc091..a2f6637b5b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java @@ -1,46 +1,37 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.workflow.service;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ws.rs.ApplicationPath;
-import javax.ws.rs.core.Application;
-
-@ApplicationPath("/")
-public class WorkflowResourceApplication extends Application {
- private Set<Object> singletons = new HashSet<>();
- private Set<Class<?>> classes = new HashSet<>();
-
- public WorkflowResourceApplication() {
- }
-
- @Override
- public Set<Class<?>> getClasses() {
- return classes;
- }
-
- @Override
- public Set<Object> getSingletons() {
- return singletons;
- }
-}
+/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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(); +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/Status.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGenerator.java index e9750a2b3b..5a126ffe7d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/Status.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DefaultToShortClassNameBeanNameGenerator.java @@ -18,23 +18,16 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.adapter.requests.db.entities; +package org.onap.so.bpmn.common; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.AnnotationBeanNameGenerator; +import org.springframework.util.ClassUtils; -/* - * Enum for Status values returned by API Handler to Tail-F -*/ -public enum Status { - PENDING, INPROGRESS, COMPLETED, FAILED, TIMEOUT; - - public boolean isFinished () { - switch (this) { - case COMPLETED: - case FAILED: - case TIMEOUT: - return true; - default: - return false; - } - } +public class DefaultToShortClassNameBeanNameGenerator extends AnnotationBeanNameGenerator { + + @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 new file mode 100644 index 0000000000..ef564c6af4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java @@ -0,0 +1,118 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + +public class DelegateExecutionImpl implements BuildingBlockExecution, Serializable { + + private final Map<String, Serializable> seedMap; + private transient DelegateExecution execution; + private static final String INVALID_INPUT_MISSING = "Expected variable of \"%s\" not found in execution"; + private static final String INVALID_INPUT_CLASS_CAST = "Expected variable of \"%s\" was the wrong object type in the execution"; + + private static final String MISSING_MSG = "Execution variable \"gBBInput\" cannot be null when executing building blocks"; + private static final String MALFORMED_MSG = "Execution variable \"gBBInput\" must contain an element of type GeneralBuildingBlock"; + + public DelegateExecutionImpl(Map<String, Serializable> seedMap) { + this.seedMap = seedMap; + } + + public DelegateExecutionImpl(DelegateExecution execution) { + this.seedMap = new HashMap<>(); + execution.getVariables().forEach((key, value) -> { + if (value instanceof Serializable) { + seedMap.put(key, (Serializable)value); + } + }); + /* must occur for junit tests to work */ + this.execution = execution; + } + @Override + public GeneralBuildingBlock getGeneralBuildingBlock() { + try { + GeneralBuildingBlock generalBuildingBlock = (GeneralBuildingBlock) execution.getVariable("gBBInput"); + + if (generalBuildingBlock == null) { + throw new MissingBuildingBlockInputException(MISSING_MSG); + } + + return generalBuildingBlock; + } catch (ClassCastException e) { + throw new MalformedBuildingBlockInputException(MALFORMED_MSG, e); + } + } + + @Override + public <T> T getVariable(String key) { + return this.get(key); + } + + @Override + public <T> T getRequiredVariable(String key) throws RequiredExecutionVariableExeception { + final T result; + + result = this.get(key); + if (result == null) { + throw new RequiredExecutionVariableExeception(String.format(INVALID_INPUT_MISSING, key)); + + } + return result; + } + + @Override + public void setVariable(String key, Serializable value) { + this.execution.setVariable(key, value); + } + + @Override + public Map<ResourceKey, String> getLookupMap() { + return this.get("lookupKeyMap"); + } + + public DelegateExecution getDelegateExecution() { + return this.execution; + } + + public void setDelegateExecution(DelegateExecution execution) { + this.execution = execution; + this.seedMap.forEach((key, value) -> { + if (!execution.hasVariable(key)) { + execution.setVariable(key, value); + } + }); + } + + protected <T> T get(String key) { + final Object value = this.execution.getVariable(key); + + return (T)value; + } +} 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 new file mode 100644 index 0000000000..56b059ec16 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectExecution.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.springframework.stereotype.Component; + +@Component +public class InjectExecution { + + 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 new file mode 100644 index 0000000000..f1c2c8dda6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import org.onap.so.client.aai.AAICommonObjectMapperProvider; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.sdno.SDNOValidator; +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. + * + * 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 + */ + +@Component +public class InjectionHelper { + public AAIResourcesClient getAaiClient() { + return new AAIResourcesClient(); + } + + public SDNOValidator getSdnoValidator() { + return new SDNOValidatorImpl(); + } + + public AAICommonObjectMapperProvider getAaiCommonObjectMapperProvider() { + return new AAICommonObjectMapperProvider(); + } + + public AAIResultWrapper getAaiResultWrapper(String json) { + return new AAIResultWrapper(json); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/SpringContextHelper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/SpringContextHelper.java new file mode 100644 index 0000000000..edc544d939 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/SpringContextHelper.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +@Component +public class SpringContextHelper implements ApplicationContextAware { + + private static ApplicationContext context; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + context = applicationContext; + } + + public static ApplicationContext getAppContext() { + return context; + } +} 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 new file mode 100644 index 0000000000..1da989bfb7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MalformedBuildingBlockInputException.java @@ -0,0 +1,47 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.exceptions; + +public class MalformedBuildingBlockInputException extends RuntimeException { + private static final long serialVersionUID = -9168146273898271648L; + + public MalformedBuildingBlockInputException() { + super(); + } + + public MalformedBuildingBlockInputException(String message) { + super(message); + } + + public MalformedBuildingBlockInputException(String message, Throwable cause) { + super(message, cause); + } + + public MalformedBuildingBlockInputException(Throwable cause) { + super(cause); + } + + 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 new file mode 100644 index 0000000000..5ad28a5ba0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/MissingBuildingBlockInputException.java @@ -0,0 +1,47 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.exceptions; + +public class MissingBuildingBlockInputException extends RuntimeException { + private static final long serialVersionUID = 7098084383189271401L; + + public MissingBuildingBlockInputException() { + super(); + } + + public MissingBuildingBlockInputException(String message) { + super(message); + } + + public MissingBuildingBlockInputException(String message, Throwable cause) { + super(message, cause); + } + + public MissingBuildingBlockInputException(Throwable cause) { + super(cause); + } + + 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 new file mode 100644 index 0000000000..8c77bb445e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/exceptions/RequiredExecutionVariableExeception.java @@ -0,0 +1,38 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.exceptions; + +public class RequiredExecutionVariableExeception extends Exception { + + 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); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnIntegerParam.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnIntegerParam.java index 033c6876bd..80479e19c0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnIntegerParam.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnIntegerParam.java @@ -17,7 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.recipe; +package org.onap.so.bpmn.common.recipe; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnParam.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnParam.java index 4b58b51560..01285cd5ec 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnParam.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnParam.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.recipe; +package org.onap.so.bpmn.common.recipe; import com.fasterxml.jackson.annotation.JsonProperty; /** diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java index 6a17d600cb..bbaebb64dc 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java @@ -1,224 +1,205 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.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;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.openecomp.mso.utils.CryptoUtils;
-
-/**
- * Support to call resource recipes from the BPMN workflow.
- * Such as call resource recipe in service workflow.
- * <br>
- * <p>
- * </p>
- *
- * @author
- * @version ONAP Beijing Release 2018-02-27
- */
-public class BpmnRestClient {
-
- public static final String DEFAULT_BPEL_AUTH = "admin:admin";
-
- public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
-
- public static final String CONTENT_TYPE_JSON = "application/json";
-
- public static final String CAMUNDA_AUTH = "camundaAuth";
-
- private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
-
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private static boolean noProperties = true;
-
- //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 static MsoJavaProperties loadMsoProperties() {
- MsoJavaProperties msoProperties;
- try {
- msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_APIHANDLER_INFRA);
- } catch(Exception e) {
- msoLogger.error(MessageEnum.APIH_LOAD_PROPERTIES_FAIL, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError,
- "Exception when loading MSO Properties", e);
- return null;
- }
-
- if(msoProperties != null && msoProperties.size() > 0) {
- noProperties = false;
- msoLogger.info(MessageEnum.APIH_PROPERTY_LOAD_SUC, "", "");
- return msoProperties;
- } else {
- msoLogger.error(MessageEnum.APIH_NO_PROPERTIES, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError,
- "No MSO APIH_INFRA Properties found");
- return null;
- }
- }
-
- public synchronized static final boolean getNoPropertiesState() {
- return noProperties;
- }
-
- /**
- * post the recipe Uri
- * <br>
- *
- * @param recipeUri The request recipe uri
- * @param requestId the request id
- * @param recipeTimeout The recipe time out
- * @param requestAction The request action
- * @param serviceInstanceId The service instance id
- * @param serviceType The service Type
- * @param requestDetails The request Details, these information is from runtime
- * @param recipeParamXsd The recipe params, its from recipe design
- * @return The response of the recipe.
- * @throws ClientProtocolException
- * @throws IOException
- * @since ONAP Beijing Release
- */
- public static 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);
- MsoJavaProperties props = loadMsoProperties();
- msoLogger.debug("call the bpmn, url:" + recipeUri);
- String jsonReq = wrapResourceRequest(requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, requestDetails, recipeParamXsd);
-
- StringEntity input = new StringEntity(jsonReq);
- input.setContentType(CONTENT_TYPE_JSON);
- String encryptedCredentials;
- if(props != null) {
- encryptedCredentials = props.getProperty(CAMUNDA_AUTH, null);
- if(encryptedCredentials != null) {
- String userCredentials = getEncryptedPropValue(encryptedCredentials, DEFAULT_BPEL_AUTH, ENCRYPTION_KEY);
- 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>
- *
- * @param requestId
- * @param recipeTimeout
- * @param requestAction
- * @param serviceInstanceId
- * @param serviceType
- * @param requestDetails
- * @param recipeParams
- * @return
- * @since ONAP Beijing Release
- */
- private static String wrapResourceRequest(String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType,
- String requestDetails, String recipeParams) {
- String jsonReq = null;
- if(requestId == null) {
- requestId = "";
- }
- if(requestAction == null) {
- requestAction = "";
- }
- if(serviceInstanceId == null) {
- serviceInstanceId = "";
- }
-
- if(requestDetails == null) {
- requestDetails = "";
- }
-
- try {
- ResourceRecipeRequest recipeRequest = new ResourceRecipeRequest();
- BpmnParam resourceInput = new BpmnParam();
- BpmnParam host = new BpmnParam();
- BpmnParam requestIdInput = new BpmnParam();
- BpmnParam requestActionInput = new BpmnParam();
- BpmnParam serviceInstanceIdInput = new BpmnParam();
- BpmnParam serviceTypeInput = new BpmnParam();
- BpmnParam recipeParamsInput = new BpmnParam();
- BpmnParam recipeTimeoutInput = new BpmnParam();
- recipeTimeoutInput.setValue(DEFAULT_TIME_OUT);
- // host.setValue(parseURL());
- requestIdInput.setValue(requestId);
- requestActionInput.setValue(requestAction);
- serviceInstanceIdInput.setValue(serviceInstanceId);
- serviceTypeInput.setValue(serviceType);
- recipeParamsInput.setValue(recipeParams);
- resourceInput.setValue(requestDetails);
- recipeRequest.setHost(host);
- recipeRequest.setRequestId(requestIdInput);
- recipeRequest.setRequestAction(requestActionInput);
- recipeRequest.setServiceInstanceId(serviceInstanceIdInput);
- recipeRequest.setServiceType(serviceTypeInput);
- recipeRequest.setRecipeParams(recipeParamsInput);
- recipeRequest.setResourceInput(resourceInput);
- recipeRequest.setRecipeTimeout(recipeTimeoutInput);
- jsonReq = recipeRequest.toString();
- msoLogger.debug("request body is " + jsonReq);
- } catch(Exception e) {
- msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapVIDRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request",
- e);
- }
- return jsonReq;
- }
-
- /**
- * <br>
- *
- * @param prop
- * @param defaultValue
- * @param encryptionKey
- * @return
- * @since ONAP Beijing Release
- */
- protected static String getEncryptedPropValue(String prop, String defaultValue, String encryptionKey) {
- try {
- return CryptoUtils.decrypt(prop, encryptionKey);
- } catch(GeneralSecurityException e) {
- msoLogger.debug("Security exception", e);
- }
- return defaultValue;
- }
-
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.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; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.CryptoUtils; +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> + * <p> + * </p> + * + * @author + * @version ONAP Beijing Release 2018-02-27 + */ +@Component +public class BpmnRestClient { + + public static final String DEFAULT_BPEL_AUTH = "admin:admin"; + + public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + + public static final String CONTENT_TYPE_JSON = "application/json"; + + public static final String CAMUNDA_AUTH = "camundaAuth"; + + private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; + @Autowired + private UrnPropertiesReader urnPropertiesReader; + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, BpmnRestClient.class); + + private static boolean noProperties = true; + + //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() { + return noProperties; + } + + /** + * post the recipe Uri + * <br> + * + * @param recipeUri The request recipe uri + * @param requestId the request id + * @param recipeTimeout The recipe time out + * @param requestAction The request action + * @param serviceInstanceId The service instance id + * @param serviceType The service Type + * @param requestDetails The request Details, these information is from runtime + * @param recipeParamXsd The recipe params, its from recipe design + * @return The response of the recipe. + * @throws ClientProtocolException + * @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 { + + HttpClient client = HttpClientBuilder.create().build(); + + HttpPost post = new HttpPost(recipeUri); + RequestConfig requestConfig = + RequestConfig.custom().setSocketTimeout(recipeTimeout).setConnectTimeout(recipeTimeout).setConnectionRequestTimeout(recipeTimeout).build(); + post.setConfig(requestConfig); + msoLogger.debug("call the bpmn, url:" + recipeUri); + 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); + 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> + * + * @param requestId + * @param recipeTimeout + * @param requestAction + * @param serviceInstanceId + * @param serviceType + * @param requestDetails + * @param recipeParams + * @return + * @since ONAP Beijing Release + */ + private String wrapResourceRequest(String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType, + String requestDetails, String recipeParams) { + String jsonReq = null; + if(requestId == null) { + requestId = ""; + } + if(requestAction == null) { + requestAction = ""; + } + if(serviceInstanceId == null) { + serviceInstanceId = ""; + } + + if(requestDetails == null) { + requestDetails = ""; + } + + try { + ResourceRecipeRequest recipeRequest = new ResourceRecipeRequest(); + BpmnParam resourceInput = new BpmnParam(); + BpmnParam host = new BpmnParam(); + BpmnParam requestIdInput = new BpmnParam(); + BpmnParam requestActionInput = new BpmnParam(); + BpmnParam serviceInstanceIdInput = new BpmnParam(); + BpmnParam serviceTypeInput = new BpmnParam(); + BpmnParam recipeParamsInput = new BpmnParam(); + BpmnIntegerParam recipeTimeoutInput = new BpmnIntegerParam(); + recipeTimeoutInput.setValue(recipeTimeout); + // host.setValue(parseURL()); + requestIdInput.setValue(requestId); + requestActionInput.setValue(requestAction); + serviceInstanceIdInput.setValue(serviceInstanceId); + serviceTypeInput.setValue(serviceType); + recipeParamsInput.setValue(recipeParams); + resourceInput.setValue(requestDetails); + recipeRequest.setHost(host); + recipeRequest.setRequestId(requestIdInput); + recipeRequest.setRequestAction(requestActionInput); + recipeRequest.setServiceInstanceId(serviceInstanceIdInput); + recipeRequest.setServiceType(serviceTypeInput); + recipeRequest.setRecipeParams(recipeParamsInput); + recipeRequest.setResourceInput(resourceInput); + recipeRequest.setRecipeTimeout(recipeTimeoutInput); + jsonReq = recipeRequest.toString(); + msoLogger.trace("request body is " + jsonReq); + } catch(Exception e) { + msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapVIDRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", + e); + } + return jsonReq; + } + + /** + * <br> + * + * @param prop + * @param defaultValue + * @param encryptionKey + * @return + * @since ONAP Beijing Release + */ + protected String getEncryptedPropValue(String prop, String defaultValue, String encryptionKey) { + try { + return CryptoUtils.decrypt(prop, encryptionKey); + } catch(GeneralSecurityException e) { + msoLogger.debug("Security exception", e); + } + return defaultValue; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java index 42547faa1e..4c345babc8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java @@ -17,10 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.recipe; +package org.onap.so.bpmn.common.recipe; -import org.openecomp.mso.bpmn.core.domain.ModelInfo; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.bpmn.core.domain.ModelInfo; +import org.onap.so.logger.MsoLogger; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -42,7 +42,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; @JsonRootName("variables") public class ResourceInput { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); + private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, ResourceInput.class); @JsonProperty("resourceInstanceName") private String resourceInstanceName; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java index 3ec43e10ae..4c6edfa099 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceRecipeRequest.java @@ -18,9 +18,9 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.recipe; +package org.onap.so.bpmn.common.recipe; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.logger.MsoLogger; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -37,7 +37,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; @JsonRootName("variables") public class ResourceRecipeRequest { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); + private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, ResourceRecipeRequest.class); @JsonProperty("resourceInput") private BpmnParam resourceInput; @@ -61,7 +61,7 @@ public class ResourceRecipeRequest { private BpmnParam recipeParams; @JsonProperty("mso-service-request-timeout") - private BpmnParam recipeTimeout; + private BpmnIntegerParam recipeTimeout; @JsonProperty("resourceInput") public BpmnParam getResourceInput() { @@ -134,12 +134,12 @@ public class ResourceRecipeRequest { } @JsonProperty("mso-service-request-timeout") - public BpmnParam getRecipeTimeout() { + public BpmnIntegerParam getRecipeTimeout() { return recipeTimeout; } @JsonProperty("mso-service-request-timeout") - public void setRecipeTimeout(BpmnParam recipeTimeout) { + public void setRecipeTimeout(BpmnIntegerParam recipeTimeout) { this.recipeTimeout = recipeTimeout; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index d1ec60a1cd..ca2da772fb 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.resource; +package org.onap.so.bpmn.common.resource; import java.io.File; import java.io.IOException; @@ -30,11 +30,9 @@ import java.util.Map; import java.util.Optional; import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; import org.camunda.bpm.engine.runtime.Execution; -import org.jboss.resteasy.client.jaxrs.ResteasyClient; -import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; -import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException; import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory; @@ -42,10 +40,12 @@ import org.onap.sdc.toscaparser.api.NodeTemplate; import org.onap.sdc.toscaparser.api.Property; import org.onap.sdc.toscaparser.api.functions.GetInput; import org.onap.sdc.toscaparser.api.parameters.Input; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; +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.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.TargetEntity; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -59,9 +59,8 @@ public class ResourceRequestBuilder { public static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar?serviceModelUuid="; - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ResourceRequestBuilder.class); - static JsonUtils jsonUtil = new JsonUtils(); /** @@ -72,7 +71,7 @@ public class ResourceRequestBuilder { * "requestInputs":{K,V} * } * <br> - * + * * @param execution Execution context * @param serviceUuid The service template uuid * @param resourceCustomizationUuid The resource customization uuid @@ -82,7 +81,7 @@ public class ResourceRequestBuilder { */ @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")); + 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 = ""; @@ -127,6 +126,7 @@ public class ResourceRequestBuilder { throws SdcToscaParserException { Map<String, Object> resouceRequest = new HashMap<>(); + String csarpath = null; try { csarpath = getCsarFromUuid(serviceUuid); @@ -183,12 +183,10 @@ public class ResourceRequestBuilder { } private static String getCsarFromUuid(String uuid) throws Exception { - - ResteasyClient client = new ResteasyClientBuilder().build(); - Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - String catalogEndPoint = properties.get("mso.catalog.db.endpoint"); - ResteasyWebTarget target = client.target(catalogEndPoint + SERVICE_URL_TOSCA_CSAR + uuid); - Response response = target.request().get(); + String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint"); + HttpClient client = new HttpClient(UriBuilder.fromUri(catalogEndPoint + SERVICE_URL_TOSCA_CSAR + uuid).build().toURL(), "application/json", TargetEntity.CATALOG_DB); + + Response response = client.get(); String value = response.readEntity(String.class); HashMap<String, String> map = new Gson().fromJson(value, new TypeToken<HashMap<String, String>>() {}.getType()); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java index 13cff65018..093dac39c3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java @@ -1,68 +1,68 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.util;
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-import org.openecomp.mso.logger.MsoLogger;
-import java.util.Properties;
-
-public class CryptoHandler implements ICryptoHandler {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private static String msoKey = "aa3871669d893c7fb8abbcda31b88b4f";
- private static String msoAaiEncryptedPwd;
-
- @Override
- public String getMsoAaiPassword() {
- Properties keyProp = new Properties ();
- try {
- keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("urn.properties"));
- msoAaiEncryptedPwd =(String) keyProp.get ("mso.AaiEncrypted.Pwd");
- return CryptoUtils.decrypt(msoAaiEncryptedPwd, msoKey);
- } catch (GeneralSecurityException | IOException e) {
- LOGGER.debug("GeneralSecurityException :",e);
- return null;
- }
- }
-
-
- @Override
- public String encryptMsoPassword(String plainMsoPwd) {
- try {
- return CryptoUtils.encrypt(plainMsoPwd, msoKey);
- } catch (GeneralSecurityException e) {
- LOGGER.debug("GeneralSecurityException :",e);
- return null;
- }
- }
-
- @Override
- public String decryptMsoPassword(String encryptedPwd) {
- try {
- return CryptoUtils.decrypt(encryptedPwd, msoKey);
- } catch (GeneralSecurityException e) {
- LOGGER.debug("GeneralSecurityException :",e);
- return null;
- }
- }
-
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.util; +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.util.Properties; +import org.onap.so.utils.CryptoUtils; + +import org.onap.so.logger.MsoLogger; + +public class CryptoHandler implements ICryptoHandler { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, 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; + } + } + + + @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; + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java index acf92f5aa8..6314a849d2 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java @@ -1,27 +1,27 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.util;
-
-public interface ICryptoHandler {
- public String getMsoAaiPassword();
- public String encryptMsoPassword(String plainPwd);
- public String decryptMsoPassword(String encryptedPwd);
-}
+/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.util; + +public interface ICryptoHandler { + public String getMsoAaiPassword(); + public String encryptMsoPassword(String plainPwd); + public String decryptMsoPassword(String encryptedPwd); +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowCallbackResponse.java index 25669d7625..13d2126805 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowCallbackResponse.java @@ -1,52 +1,52 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.workflow.service;
-
-/**
- * @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;
- }
-
-}
+/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.common.workflow.context; + + +/** + * @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; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContext.java index fc0ba44974..3ec7773791 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContext.java @@ -1,96 +1,98 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.workflow.service;
-
-import java.util.concurrent.Delayed;
-import java.util.concurrent.TimeUnit;
-
-import org.jboss.resteasy.spi.AsynchronousResponse;
-
-/**
- * @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 AsynchronousResponse asynchronousResponse;
- private final long startTime;
- private final long timeout;
-
- public WorkflowContext(String processKey, String requestId,
- AsynchronousResponse asynchronousResponse, long timeout) {
- this.processKey = processKey;
- this.requestId = requestId;
- this.asynchronousResponse = asynchronousResponse;
- this.timeout = timeout;
- this.startTime = System.currentTimeMillis();
- }
-
- public String getRequestId() {
- return requestId;
- }
-
- public String getProcessKey() {
- return processKey;
- }
-
- public AsynchronousResponse getAsynchronousResponse() {
- return asynchronousResponse;
- }
-
- public long getTimeout() {
- return timeout;
- }
-
- public long getStartTime() {
- return startTime;
- }
-
- /**
- * 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;
- }
- }
-}
+package org.onap.so.bpmn.common.workflow.context; +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + + +import java.util.concurrent.Delayed; +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 + */ +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; + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java index 4dfae8b2a3..39c32de77d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java @@ -1,3 +1,4 @@ +package org.onap.so.bpmn.common.workflow.context; /*- * ============LICENSE_START======================================================= * ONAP - SO @@ -18,29 +19,30 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.workflow.service; + import java.util.concurrent.DelayQueue; import java.util.concurrent.TimeUnit; -import javax.ws.rs.core.Response; - -import org.jboss.resteasy.spi.AsynchronousResponse; -import org.slf4j.MDC; - -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.stereotype.Component; /** * Workflow Context Holder instance which can be accessed elsewhere either in groovy scripts or Java * @version 1.0 * */ + +@Component public class WorkflowContextHolder { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,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 @@ -97,70 +99,34 @@ public class WorkflowContextHolder { * @param callbackResponse * @return */ - public Response processCallback(String processKey, String processInstanceId, - String requestId, WorkflowCallbackResponse callbackResponse) { + public void processCallback(String processKey, String processInstanceId, + String requestId, WorkflowCallbackResponse callbackResponse) { WorkflowResponse workflowResponse = new WorkflowResponse(); - WorkflowContext workflowContext = getWorkflowContext(requestId); - - if (workflowContext == null) { - msoLogger.debug("Unable to correlate workflow context for request id: " + requestId - + ":processInstance Id:" + processInstanceId - + ":process key:" + processKey); - workflowResponse.setMessage("Fail"); - workflowResponse.setMessageCode(400); - workflowResponse.setContent("Unable to correlate workflow context, bad request. Request Id: " + requestId); - return Response.serverError().entity(workflowResponse).build(); - } - - responseQueue.remove(workflowContext); - - msoLogger.debug("Using callback response for request id: " + requestId); - workflowResponse.setContent(callbackResponse.getResponse()); - workflowResponse.setProcessInstanceId(processInstanceId); + workflowResponse.setResponse(callbackResponse.getResponse()); + workflowResponse.setProcessInstanceID(processInstanceId); workflowResponse.setMessageCode(callbackResponse.getStatusCode()); workflowResponse.setMessage(callbackResponse.getMessage()); - sendWorkflowResponseToClient(processKey, workflowContext, workflowResponse); - return Response.ok().entity(workflowResponse).build(); - } - - /** - * Send the response to client asynchronously when invoked by the BPMN process - * @param processKey - * @param workflowContext - * @param workflowResponse - */ - private void sendWorkflowResponseToClient(String processKey, WorkflowContext workflowContext, - WorkflowResponse workflowResponse) { - msoLogger.debug(logMarker + "Sending the response for request id: " + workflowContext.getRequestId()); - recordEvents(processKey, workflowResponse, workflowContext.getStartTime()); - Response response = Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build(); - AsynchronousResponse asyncResp = workflowContext.getAsynchronousResponse(); - asyncResp.setResponse(response); + 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 - *git review -R + * * */ private class TimeoutThread extends Thread { + @Override public void run() { while (!isInterrupted()) { try { WorkflowContext requestObject = responseQueue.take(); + MsoLogger.setLogContext(requestObject.getRequestId(), null); msoLogger.debug("Time remaining for request id: " + requestObject.getRequestId() + ":" + requestObject.getDelay(TimeUnit.MILLISECONDS)); msoLogger.debug("Preparing timeout response for " + requestObject.getProcessKey() + ":" + ":" + requestObject.getRequestId()); - WorkflowResponse response = new WorkflowResponse(); - response.setMessage("Fail"); - response.setContent("Request timedout, request id:" + requestObject.getRequestId()); - //response.setProcessInstanceID(requestObject.getProcessInstance().getProcessInstanceId()); - recordEvents(requestObject.getProcessKey(), response, requestObject.getStartTime()); - response.setMessageCode(500); - Response result = Response.status(500).entity(response).build(); - requestObject.getAsynchronousResponse().setResponse(result); - msoLogger.debug("Sending timeout response for request id:" + requestObject.getRequestId() + ":response:" + response); } catch (InterruptedException e) { - break; + Thread.currentThread().interrupt(); } catch (Exception e) { msoLogger.debug("WorkflowContextHolder timeout thread caught exception: " + e); msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), @@ -168,21 +134,7 @@ public class WorkflowContextHolder { } } - msoLogger.debug("WorkflowContextHolder timeout thread interrupted, quitting"); } } - - private static void recordEvents(String processKey, WorkflowResponse response, - long startTime) { - - msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - logMarker + response.getMessage() + " for processKey: " - + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker - + response.getMessage() + " for processKey: " - + processKey + " with content: " + response.getContent()); - - } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowResponse.java index 02702e3b3c..f5aa0b33c6 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowResponse.java @@ -1,97 +1,78 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.workflow.service;
-
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * A synchronous response from a workflow.
- */
-public class WorkflowResponse {
-
- @JsonProperty("processInstanceId")
- private String processInstanceId;
-
- @JsonProperty("messageCode")
- private int messageCode;
-
- @JsonProperty("message")
- private String message;
-
- @JsonProperty("variables")
- private Map<String,String> variables;
-
- @JsonProperty("content")
- private String content;
-
- public String getProcessInstanceId() {
- return processInstanceId;
- }
-
- public void setProcessInstanceId(String processInstanceId) {
- this.processInstanceId = processInstanceId;
- }
-
- public int getMessageCode() {
- return messageCode;
- }
-
- public void setMessageCode(int messageCode) {
- this.messageCode = messageCode;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public Map<String,String> getVariables() {
- return variables;
- }
-
- public void setVariables(Map<String,String> variables) {
- this.variables = variables;
- }
-
- public String getContent() {
- return content;
- }
-
- public void setContent(String content) {
- this.content = content;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "["
- + "processInstanceId=" + processInstanceId
- + ",messageCode=" + messageCode
- + ",message=" + message
- + ",variables=" + variables
- + ",content=" + content
- + "]";
- }
-}
\ No newline at end of file +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.workflow.context; + +import java.util.Map; + +/** + * @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 + "]"; + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBean.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java index f566418ade..1f83c3135e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBean.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java @@ -18,31 +18,23 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.adapter.requests.db.entities; - +package org.onap.so.bpmn.servicedecomposition; import java.io.Serializable; - -/** - * Jax-WS Fault Bean for MsoRequestsDB Exception - */ -public class MsoRequestsDbExceptionBean implements Serializable { - - private static final long serialVersionUID = 1360000062602372639L; - - private String message; - - public MsoRequestsDbExceptionBean () {} - - public MsoRequestsDbExceptionBean (String message) { - this.message = message; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } +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 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 new file mode 100644 index 0000000000..1263e7ba7c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.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); + } + + } +} 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 new file mode 100644 index 0000000000..775d80db75 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AllottedResource.java @@ -0,0 +1,129 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; +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 String type; + @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(); + } + +} 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 new file mode 100644 index 0000000000..f39253e6aa --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CloudRegion.java @@ -0,0 +1,104 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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 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; + + 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; + } + @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 new file mode 100644 index 0000000000..6bbdb1ed67 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Collection.java @@ -0,0 +1,97 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + + +@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 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(); + } + + +} 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 new file mode 100644 index 0000000000..bcff93c5af --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java @@ -0,0 +1,230 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +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.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; +import java.util.List; +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<ForwarderEvc>(); + @JsonProperty("evcs") + private List<Evc> evcs = new ArrayList<Evc>(); + @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 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 new file mode 100644 index 0000000000..937c79be1d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java @@ -0,0 +1,65 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + } + + 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 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 new file mode 100644 index 0000000000..985f51035c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Customer.java @@ -0,0 +1,99 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; +import org.apache.commons.lang3.builder.HashCodeBuilder; +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 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(); + } +} 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 new file mode 100644 index 0000000000..fdcb59d3c3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Entitlement.java @@ -0,0 +1,70 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + + @Id + @JsonProperty("group-uuid") + private String groupUuid; + @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(); + } +} 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 new file mode 100644 index 0000000000..3ef0f71386 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Evc.java @@ -0,0 +1,164 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + + @Id + @JsonProperty("evc-id") + private String evcId; + @JsonProperty("forwarding-path-topology") + private String forwardingPathTopology; + @JsonProperty("cir-value") + private String cirValue; + @JsonProperty("cir-units") + private String cirUnits; + @JsonProperty("connection-diversity-group-id") + private String connectionDiversityGroupId; + @JsonProperty("service-hours") + private String serviceHours; + @JsonProperty("esp-evc-circuit-id") + private String espEvcCircuitId; + @JsonProperty("esp-evc-cir-value") + private String espEvcCirValue; + @JsonProperty("esp-evc-cir-units") + private String espEvcCirUnits; + @JsonProperty("esp-itu-code") + private String espItuCode; + @JsonProperty("collector-pop-clli") + private String collectorPopClli; + @JsonProperty("inter-connect-type-ingress") + private String interConnectTypeIngress; + @JsonProperty("tagmode-access-ingress") + private String tagmodeAccessIngress; + @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(); + } +} 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 new file mode 100644 index 0000000000..70f7d5af42 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ForwarderEvc.java @@ -0,0 +1,103 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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(); + } +} 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 new file mode 100644 index 0000000000..218763a006 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java @@ -0,0 +1,510 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +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.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 List<InstanceGroup> instanceGroups = new ArrayList<InstanceGroup>(); + @JsonProperty("call-homing") + private boolean callHoming; + + + 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 String getManagementOption() { + return managementOption; + } + + public void setManagementOption(String managementOption) { + this.managementOption = managementOption; + } + + public String getIpv4OamAddress() { + return ipv4OamAddress; + } + + public void setIpv4OamAddress(String ipv4OamAddress) { + this.ipv4OamAddress = ipv4OamAddress; + } + + public String getIpv4Loopback0Address() { + return ipv4Loopback0Address; + } + + public void setIpv4Loopback0Address(String ipv4Loopback0Address) { + this.ipv4Loopback0Address = ipv4Loopback0Address; + } + + public String getNmLanV6Address() { + return nmLanV6Address; + } + + public void setNmLanV6Address(String nmLanV6Address) { + this.nmLanV6Address = nmLanV6Address; + } + + public String getManagementV6Address() { + return managementV6Address; + } + + public void setManagementV6Address(String managementV6Address) { + this.managementV6Address = managementV6Address; + } + + public Long getVcpu() { + return vcpu; + } + + public void setVcpu(Long vcpu) { + this.vcpu = vcpu; + } + + public String getVcpuUnits() { + return vcpuUnits; + } + + public void setVcpuUnits(String vcpuUnits) { + this.vcpuUnits = vcpuUnits; + } + + public List<LInterface> getlInterfaces() { + return lInterfaces; + } + + public List<LagInterface> getLagInterfaces() { + return lagInterfaces; + } + + public List<Entitlement> getEntitlements() { + return entitlements; + } + + public List<VfModule> getVfModules() { + return vfModules; + } + + public Long getVmemory() { + return vmemory; + } + + public void setVmemory(Long vmemory) { + this.vmemory = vmemory; + } + + public String getVmemoryUnits() { + return vmemoryUnits; + } + + public void setVmemoryUnits(String vmemoryUnits) { + this.vmemoryUnits = vmemoryUnits; + } + + public Long getVdisk() { + return vdisk; + } + + public void setVdisk(Long vdisk) { + this.vdisk = vdisk; + } + + public String getVdiskUnits() { + return vdiskUnits; + } + + public void setVdiskUnits(String vdiskUnits) { + this.vdiskUnits = vdiskUnits; + } + + public boolean isInMaint() { + return inMaint; + } + + public void setInMaint(boolean inMaint) { + this.inMaint = inMaint; + } + + public boolean isClosedLoopDisabled() { + return isClosedLoopDisabled; + } + + public void setClosedLoopDisabled(boolean isClosedLoopDisabled) { + this.isClosedLoopDisabled = isClosedLoopDisabled; + } + + public String getSummaryStatus() { + return summaryStatus; + } + + public void setSummaryStatus(String summaryStatus) { + this.summaryStatus = summaryStatus; + } + + public Boolean getEncryptedAccessFlag() { + return encryptedAccessFlag; + } + + public void setEncryptedAccessFlag(Boolean encryptedAccessFlag) { + this.encryptedAccessFlag = encryptedAccessFlag; + } + + public String getAsNumber() { + return asNumber; + } + + public void setAsNumber(String asNumber) { + this.asNumber = asNumber; + } + + public String getRegionalResourceSubzone() { + return regionalResourceSubzone; + } + + public void setRegionalResourceSubzone(String regionalResourceSubzone) { + this.regionalResourceSubzone = regionalResourceSubzone; + } + + public License getLicense() { + return license; + } + + public void setLicense(License license) { + this.license = license; + } + + public String getSelflink() { + return selflink; + } + + public void setSelflink(String selflink) { + this.selflink = selflink; + } + + public String getIpv4OamGatewayAddress() { + return ipv4OamGatewayAddress; + } + + public void setIpv4OamGatewayAddress(String ipv4OamGatewayAddress) { + this.ipv4OamGatewayAddress = ipv4OamGatewayAddress; + } + + public Integer getIpv4OamGatewayAddressPrefixLength() { + return ipv4OamGatewayAddressPrefixLength; + } + + public void setIpv4OamGatewayAddressPrefixLength(Integer ipv4OamGatewayAddressPrefixLength) { + this.ipv4OamGatewayAddressPrefixLength = ipv4OamGatewayAddressPrefixLength; + } + + public Long getVlanIdOuter() { + return 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(); + } + +} 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 new file mode 100644 index 0000000000..75356ac9db --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/HostRoute.java @@ -0,0 +1,84 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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>{ + + private static final long serialVersionUID = -2468793257174064133L; + + @Id + @JsonProperty("host-route-id") + private String hostRouteId; + @JsonProperty("route-prefix") + private String routePrefix; + @JsonProperty("next-hop") + private String nextHop; + @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(); + } +} 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 new file mode 100644 index 0000000000..deb8c8e393 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java @@ -0,0 +1,104 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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 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("model-info-instance-group") + private ModelInfoInstanceGroup modelInfoInstanceGroup; + @JsonProperty("instance-group-function") + private String instanceGroupFunction; + + 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 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; + } + @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 new file mode 100644 index 0000000000..55b8a752b6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv4AddressList.java @@ -0,0 +1,108 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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>{ + + private static final long serialVersionUID = -1566884527411610879L; + + @Id + @JsonProperty("l3-interface-ipv4-address") + private String l3InterfaceIpv4Address; + @JsonProperty("l3-interface-ipv4-prefix-length") + private Long l3InterfaceIpv4PrefixLength; + @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 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 new file mode 100644 index 0000000000..209c64762f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3InterfaceIpv6AddressList.java @@ -0,0 +1,123 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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(); + } +} 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 new file mode 100644 index 0000000000..51cd998073 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java @@ -0,0 +1,269 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.bbobjects; + +import java.io.Serializable; +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; + + @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") + private boolean isBoundToVpn; + @JsonProperty("service-id") + private String serviceId; + @JsonProperty("network-role-instance") + private Long networkRoleInstance; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("heat-stack-id") + private String heatStackId; + @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") + private String widgetModelId; + @JsonProperty("widget-model-version") + private String widgetModelVersion; + @JsonProperty("physical-network-name") + private String physicalNetworkName; + @JsonProperty("is-provider-network") + private boolean isProviderNetwork; + @JsonProperty("is-shared-network") + private boolean isSharedNetwork; + @JsonProperty("is-external-network") + private boolean isExternalNetwork; + @JsonProperty("self-link") + private String selflink; + @JsonProperty("operational-status") + private String operationalStatus; + @JsonProperty("subnets") + private List<Subnet> subnets = new ArrayList<>(); + @JsonProperty("ctag-assignments") + private List<CtagAssignment> ctagAssignments = new ArrayList<>(); + @JsonProperty("segmentation-assignments") + private List<SegmentationAssignment> segmentationAssignments = new ArrayList<>(); + @JsonProperty("model-info-network") + private ModelInfoNetwork modelInfoNetwork; + + 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 isBoundToVpn() { + 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 isProviderNetwork() { + return isProviderNetwork; + } + public void setIsProviderNetwork(boolean isProviderNetwork) { + this.isProviderNetwork = isProviderNetwork; + } + public boolean isSharedNetwork() { + return isSharedNetwork; + } + public void setIsSharedNetwork(boolean isSharedNetwork) { + this.isSharedNetwork = isSharedNetwork; + } + public boolean isExternalNetwork() { + 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; + } + @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 new file mode 100644 index 0000000000..4bba39ee62 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java @@ -0,0 +1,191 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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>{ + + private static final long serialVersionUID = 5629921809747079453L; + + @Id + @JsonProperty("interface-name") + private String interfaceName; + @JsonProperty("interface-role") + private String interfaceRole; + @JsonProperty("v6-wan-link-ip") + private String v6WanLinkIp; + @JsonProperty("self-link") + private String selflink; + @JsonProperty("interface-id") + private String interfaceId; + @JsonProperty("macaddr") + private String macaddr; + @JsonProperty("network-name") + private String networkName; + @JsonProperty("management-option") + private String managementOption; + @JsonProperty("interface-description") + private String interfaceDescription; + @JsonProperty("is-port-mirrored") + private boolean isPortMirrored; + @JsonProperty("in-maint") + private boolean inMaint; + @JsonProperty("prov-status") + private String provStatus; + @JsonProperty("is-ip-unnumbered") + private boolean isIpUnnumbered; + @JsonProperty("allowed-address-pairs") + private String allowedAddressPairs; + @JsonProperty("vlans") + private List<Vlan> vlans = new ArrayList<Vlan>(); + @JsonProperty("sriov-vfs") + private List<SriovVf> sriovVfs = new ArrayList<SriovVf>(); + @JsonProperty("l-interfaces") + private List<LInterface> lInterfaces = new ArrayList<LInterface>(); + @JsonProperty("l3-interface-ipv4-address-list") + private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>(); + @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 isPortMirrored() { + 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 isIpUnnumbered() { + 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 new file mode 100644 index 0000000000..8a3248e92c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java @@ -0,0 +1,123 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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>{ + + private static final long serialVersionUID = -7493461787172382640L; + + @Id + @JsonProperty("interface-name") + private String interfaceName; + @JsonProperty("interface-description") + private String interfaceDescription; + @JsonProperty("speed-value") + private String speedValue; + @JsonProperty("speed-units") + private String speedUnits; + @JsonProperty("interface-id") + private String interfaceId; + @JsonProperty("interface-role") + private String interfaceRole; + @JsonProperty("prov-status") + private String provStatus; + @JsonProperty("in-maint") + private boolean inMaint; + @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(); + } +} 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 new file mode 100644 index 0000000000..5868da563c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java @@ -0,0 +1,63 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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("line-of-business") +public class LineOfBusiness implements Serializable, ShallowCopy<LineOfBusiness> { + + private static final long serialVersionUID = -7697815326894443926L; + + @Id + @JsonProperty("line-of-business-name") + private String lineOfBusinessName; + + public String getLineOfBusinessName() { + return 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 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 new file mode 100644 index 0000000000..2e7d278901 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Metadatum.java @@ -0,0 +1,66 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + + @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(); + } +} 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 new file mode 100644 index 0000000000..a920a585cb --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/NetworkPolicy.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.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>{ + + 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; + } + + @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(); + } +} 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 new file mode 100644 index 0000000000..e28e41ed46 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/OwningEntity.java @@ -0,0 +1,68 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; +import org.apache.commons.lang3.builder.HashCodeBuilder; +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; + + 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(); + } +} 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 new file mode 100644 index 0000000000..498d096e65 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java @@ -0,0 +1,83 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.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; + + @Id + @JsonProperty("pserver-id") + private String pserverId; + @JsonProperty("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(); + } + +} 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 new file mode 100644 index 0000000000..4f54139386 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java @@ -0,0 +1,149 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.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; + + @Id + @JsonProperty("link-name") + private String linkName; + @JsonProperty("interface-name") + private String interfaceName; + @JsonProperty("service-provider-name") + private String serviceProviderName; + @JsonProperty("circuit-id") + private String circuitId; + @JsonProperty("management-option") + private String managementOption; + @JsonProperty("bandwidth-up") + private int bandwidthUp; + @JsonProperty("bandwidth-down") + private int bandwidthDown; + @JsonProperty("bandwidth-units") + private String bandwidthUnits; + @JsonProperty("wan-port") + private String wanPort; + + + public String getLinkName(){ + return linkName; + } + + public void setLinkName(String linkName){ + this.linkName = linkName; + } + + public String getInterfaceName(){ + return interfaceName; + } + + public void setInterfaceName(String interfaceName){ + this.interfaceName = interfaceName; + } + + + public String getServiceProviderName(){ + return serviceProviderName; + } + + + public void setServiceProviderName(String serviceProviderName){ + this.serviceProviderName = serviceProviderName; + } + + public String getCircuitId(){ + return circuitId; + } + + public void setCircuitId(String circuitId){ + this.circuitId = circuitId; + } + + public String getManagementOption(){ + return managementOption; + } + + public void setManagementOption(String managementOption){ + this.managementOption = managementOption; + } + + public int getBandwidthUp(){ + return bandwidthUp; + } + + public void setBandwidthUp(int bandwidthUp){ + this.bandwidthUp = bandwidthUp; + } + + public int getBandwidthDown(){ + return bandwidthDown; + } + + public void setBandwidthDown(int bandwidthDown){ + this.bandwidthDown = bandwidthDown; + } + + public String getBandwidthUnits(){ + return bandwidthUnits; + } + + public void setBandwidthUnits(String bandwidthUnits){ + this.bandwidthUnits = bandwidthUnits; + } + + public String getWanPort(){ + return 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 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 new file mode 100644 index 0000000000..642417fa56 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Platform.java @@ -0,0 +1,63 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + + @Id + @JsonProperty("platform-name") + private String platformName; + + public String getPlatformName() { + return 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 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 new file mode 100644 index 0000000000..2ec4108343 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.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; + +@JsonRootName("pnf") +public class Pnf implements Serializable, ShallowCopy<Pnf> { + + private static final long serialVersionUID = -2544848120774529501L; + + @Id + @JsonProperty("pnf-id") + private String pnfId; + + @JsonProperty("pnf-name") + private String pnfName; + + @JsonProperty("role") + private String role; + + @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(); + } +} 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 new file mode 100644 index 0000000000..a815f6af1a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Project.java @@ -0,0 +1,63 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; +import org.apache.commons.lang3.builder.HashCodeBuilder; +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(); + } +} 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 new file mode 100644 index 0000000000..0d8c3201bc --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTableReference.java @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.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 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(); + } +} 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 new file mode 100644 index 0000000000..fc97306cfe --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/RouteTarget.java @@ -0,0 +1,84 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; +import org.apache.commons.lang3.builder.HashCodeBuilder; +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") + protected String globalRouteTarget; + @Id + @JsonProperty("route-target-role") + protected String routeTargetRole; + @JsonProperty("resource-version") + protected String resourceVersion; + + public String getGlobalRouteTarget() { + return globalRouteTarget; + } + + public void setGlobalRouteTarget(String value) { + this.globalRouteTarget = value; + } + + public String getRouteTargetRole() { + return routeTargetRole; + } + + public void setRouteTargetRole(String value) { + this.routeTargetRole = value; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String value) { + 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 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 new file mode 100644 index 0000000000..a299f1ef42 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SegmentationAssignment.java @@ -0,0 +1,60 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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>{ + + private static final long serialVersionUID = 5751570091375657521L; + + @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(); + } +} 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 new file mode 100644 index 0000000000..259a988262 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java @@ -0,0 +1,206 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; +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 String vhnPortalUrl; + @JsonProperty("service-instance-location-id") + private String serviceInstanceLocationId; + @JsonProperty("selflink") + private String selflink; + @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; + + 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; + } + @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 new file mode 100644 index 0000000000..fa076770d7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceProxy.java @@ -0,0 +1,108 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + +@JsonRootName("service-proxy") +public class ServiceProxy extends SolutionCandidates implements Serializable, ShallowCopy<ServiceProxy> { + private static final long serialVersionUID = 1491890223056651430L; + + @Id + @JsonProperty("id") + private String id; + + @JsonProperty("type") + private String type; + + @JsonProperty("service-instance") + private ServiceInstance serviceInstance; + + @JsonProperty("model-info-service-proxy") + 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(); + } + +} 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 new file mode 100644 index 0000000000..56f95516b1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java @@ -0,0 +1,76 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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>{ + + 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; + } + 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 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 new file mode 100644 index 0000000000..fcea22819e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/SriovVf.java @@ -0,0 +1,156 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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>{ + + private static final long serialVersionUID = -7790331637399859914L; + + @Id + @JsonProperty("pci-id") + private String pciId; + @JsonProperty("vf-vlan-filter") + private String vfVlanFilter; + @JsonProperty("vf-mac-filter") + private String vfMacFilter; + @JsonProperty("vf-vlan-strip") + private Boolean vfVlanStrip; + @JsonProperty("vf-vlan-anti-spoof-check") + private Boolean vfVlanAntiSpoofCheck; + @JsonProperty("vf-mac-anti-spoof-check") + private Boolean vfMacAntiSpoofCheck; + @JsonProperty("vf-mirrors") + private String vfMirrors; + @JsonProperty("vf-broadcast-allow") + private Boolean vfBroadcastAllow; + @JsonProperty("vf-unknown-multicast-allow") + private Boolean vfUnknownMulticastAllow; + @JsonProperty("vf-unknown-unicast-allow") + private Boolean vfUnknownUnicastAllow; + @JsonProperty("vf-insert-stag") + private Boolean vfInsertStag; + @JsonProperty("vf-link-status") + private String vfLinkStatus; + @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(); + } +} 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 new file mode 100644 index 0000000000..cb23f3a3b9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java @@ -0,0 +1,173 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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>{ + + private static final long serialVersionUID = -6789344717555598319L; + + @Id + @JsonProperty("subnet-id") + private String subnetId; + @JsonProperty("subnet-name") + private String subnetName; + @JsonProperty("neutron-subnet-id") + private String neutronSubnetId; + @JsonProperty("gateway-address") + private String gatewayAddress; + @JsonProperty("network-start-address") + private String networkStartAddress; + @JsonProperty("cidr-mask") + private String cidrMask; + @JsonProperty("ip-version") + private String ipVersion; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("dhcp-enabled") + private boolean dhcpEnabled; + @JsonProperty("dhcp-start") + private String dhcpStart; + @JsonProperty("dhcp-end") + private String dhcpEnd; + @JsonProperty("subnet-role") + private String subnetRole; + @JsonProperty("ip-assignment-direction") + private String ipAssignmentDirection; + @JsonProperty("subnet-sequence") + private Integer subnetSequence; + @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(); + } +} 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 new file mode 100644 index 0000000000..fba78d7a87 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java @@ -0,0 +1,137 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + +@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 String heatStackId; + @JsonProperty("contrail-service-instance-fqdn") + private String contrailServiceInstanceFqdn; + @JsonProperty("module-index") + private Integer moduleIndex; + @JsonProperty("selflink") + private String selflink; + @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; + } + @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 new file mode 100644 index 0000000000..65eeedc44c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java @@ -0,0 +1,162 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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>{ + + private static final long serialVersionUID = 1260512753640402946L; + + @Id + @JsonProperty("vlan-interface") + private String vlanInterface; + @JsonProperty("vlan-id-inner") + private Long vlanIdInner; + @JsonProperty("vlan-id-outer") + private Long vlanIdOuter; + @JsonProperty("speed-value") + private String speedValue; + @JsonProperty("speed-units") + private String speedUnits; + @JsonProperty("vlan-description") + private String vlanDescription; + @JsonProperty("backdoor-connection") + private String backdoorConnection; + @JsonProperty("vpn-key") + private String vpnKey; + @JsonProperty("orchestration-status") + private OrchestrationStatus orchestrationStatus; + @JsonProperty("in-maint") + private boolean inMaint; + @JsonProperty("prov-status") + private String provStatus; + @JsonProperty("is-ip-unnumbered") + private boolean isIpUnnumbered; + @JsonProperty("l3-interface-ipv4-address-list") + private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>(); + @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 isIpUnnumbered() { + 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/VolumeGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java new file mode 100644 index 0000000000..565a151077 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java @@ -0,0 +1,121 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + +@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(); + } +} 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 new file mode 100644 index 0000000000..36e1af443c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBinding.java @@ -0,0 +1,141 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + + +@JsonRootName("vpn-binding") +public class VpnBinding implements Serializable, ShallowCopy<VpnBinding> { + private static final long serialVersionUID = 3283413795353486924L; + + @Id + @JsonProperty("vpn-id") + private String vpnId; + @JsonProperty("vpn-name") + private String vpnName; + @JsonProperty("vpn-platform") + private String vpnPlatform; + @JsonProperty("vpn-type") + private String vpnType; + @JsonProperty("vpn-region") + private String vpnRegion; + @JsonProperty("customer-vpn-id") + private String customerVpnId; + @JsonProperty("route-distinguisher") + private String routeDistinguisher; + @JsonProperty("resource-version") + private String resourceVersion; + @JsonProperty("route-targets") + private List<RouteTarget> routeTargets = new ArrayList<>(); + + public String getVpnId() { + return vpnId; + } + + public void setVpnId(String value) { + this.vpnId = value; + } + + public String getVpnName() { + return vpnName; + } + + public void setVpnName(String value) { + this.vpnName = value; + } + + public String getVpnPlatform() { + return vpnPlatform; + } + + public void setVpnPlatform(String value) { + this.vpnPlatform = value; + } + + public String getVpnType() { + return vpnType; + } + + public void setVpnType(String value) { + this.vpnType = value; + } + + public String getVpnRegion() { + return vpnRegion; + } + + public void setVpnRegion(String value) { + this.vpnRegion = value; + } + + public String getCustomerVpnId() { + return customerVpnId; + } + + public void setCustomerVpnId(String value) { + this.customerVpnId = value; + } + + public String getRouteDistinguisher() { + return routeDistinguisher; + } + + public void setRouteDistinguisher(String value) { + this.routeDistinguisher = value; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String value) { + this.resourceVersion = value; + } + + public List<RouteTarget> getRouteTargets() { + 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 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 new file mode 100644 index 0000000000..dec3d48203 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java @@ -0,0 +1,166 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + +@JsonRootName("vpn-bonding-link") +public class VpnBondingLink implements Serializable, ShallowCopy<VpnBondingLink> { + + private static final long serialVersionUID = -8355973761714642727L; + + @Id + @JsonProperty("vpn-bonding-link-id") + private String vpnBondingLinkId; + + @JsonProperty("configurations") + private List<Configuration> configurations = new ArrayList<Configuration>(); + + @JsonProperty("service-proxies") + private List<ServiceProxy> serviceProxies = new ArrayList<ServiceProxy>(); + + public String getVpnBondingLinkId() { + return vpnBondingLinkId; + } + + public void setVpnBondingLinkId(String vpnBondingLinkId) { + 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 Configuration getVnrConfiguration() { + 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 + public void setVnrConfiguration(Configuration vnrConfiguration) { + if(vnrConfiguration.getConfigurationType() == null){ + vnrConfiguration.setConfigurationType("vlan"); + } + configurations.add(vnrConfiguration); + } + + //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 + public void setVrfConfiguration(Configuration vrfConfiguration) { + if(vrfConfiguration.getConfigurationType() == null){ + vrfConfiguration.setConfigurationType("vrf"); + } + configurations.add(vrfConfiguration); + } + + //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; + } + } + return serviceProxy; + } + + //TODO temp solution until references are updated + public void setInfrastructureServiceProxy(ServiceProxy infrastructureServiceProxy) { + infrastructureServiceProxy.setType("infrastructure"); + serviceProxies.add(infrastructureServiceProxy); + } + + //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; + } + + //TODO temp solution until references are updated + public void setTransportServiceProxy(ServiceProxy 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 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 new file mode 100644 index 0000000000..5746dcd586 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java @@ -0,0 +1,66 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + + 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; + } +} 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 new file mode 100644 index 0000000000..36a24bd1e1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java @@ -0,0 +1,103 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + + 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; + } +} 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 new file mode 100644 index 0000000000..adea99c4f3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java @@ -0,0 +1,93 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; +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 long serialVersionUID = -429247436428110843L; + + private RequestContext requestContext; + private OrchestrationContext orchContext; + private Map<String, String> userInput; + private CloudRegion cloudRegion; + + private Customer customer; + private ServiceInstance serviceInstance; + + public CloudRegion getCloudRegion() { + return cloudRegion; + } + + public void setCloudRegion(CloudRegion cloudRegion) { + this.cloudRegion = cloudRegion; + } + + public RequestContext getRequestContext() { + return requestContext; + } + + public void setRequestContext(RequestContext requestContext) { + this.requestContext = requestContext; + } + + public OrchestrationContext getOrchContext() { + return orchContext; + } + + public void setOrchContext(OrchestrationContext orchContext) { + this.orchContext = orchContext; + } + + public Map<String, String> getUserInput() { + return userInput; + } + + public void setUserInput(Map<String, String> userInput) { + this.userInput = userInput; + } + + public Customer getCustomer() { + return customer; + } + + public void setCustomer(Customer customer) { + this.customer = customer; + } + + public ServiceInstance getServiceInstance() { + return 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 new file mode 100644 index 0000000000..4662db23a1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java @@ -0,0 +1,34 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; +} 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 new file mode 100644 index 0000000000..433315b2ed --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.entities; + +import java.io.Serializable; +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; + + @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; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputException.java index 4625bfb74f..21828871db 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterResponse.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/exceptions/InvalidBuildingBlockInputException.java @@ -18,36 +18,30 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.sdnc.sync; +package org.onap.so.bpmn.servicedecomposition.entities.exceptions; +public class InvalidBuildingBlockInputException extends Exception { + private static final long serialVersionUID = 221404474263656742L; + + public InvalidBuildingBlockInputException() { + super(); + } -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; + public InvalidBuildingBlockInputException(String message) { + super(message); + } + public InvalidBuildingBlockInputException(String message, Throwable cause) { + super(message, cause); + } -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -//SDNCAdapter to BPEL Sync Response(ACK) - async response(s) follow -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "SDNCAdapterResponse") -public class SDNCAdapterResponse { - + public InvalidBuildingBlockInputException(Throwable cause) { + super(cause); + } + 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 new file mode 100644 index 0000000000..e1a12bbad9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java @@ -0,0 +1,56 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; +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; + } + +} 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 new file mode 100644 index 0000000000..d594c73638 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java @@ -0,0 +1,44 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + +@JsonRootName("orchestration-context") +public class OrchestrationContext implements Serializable { + + private static final long serialVersionUID = 6843015923244810369L; + + @JsonProperty("is-rollback-enabled") + private boolean isRollbackEnabled; + + public boolean getIsRollbackEnabled() { + return this.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 new file mode 100644 index 0000000000..7715651b68 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java @@ -0,0 +1,115 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.generalobjects; + +import java.io.Serializable; +import java.util.HashMap; + +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 HashMap<String, String> userParams; + @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; + + 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 HashMap<String, String> getUserParams() { + return userParams; + } + public void setUserParams(HashMap<String, String> 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; + } +} 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 new file mode 100644 index 0000000000..24c0548641 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestParameters.java @@ -0,0 +1,112 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.generalobjects; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName(value = "requestParameters") +@JsonInclude(Include.NON_DEFAULT) +public class RequestParameters implements Serializable { + + private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, 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; + + + 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 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; + } + + + @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){ + log.error("Unable to convert Sniro Manager Request to string", e); + } + return json; + } + + @Override + public String toString() { + return "RequestParameters [subscriptionServiceType=" + + subscriptionServiceType + ", userParams=" + userParams + + ", aLaCarte=" + aLaCarte + "]"; + } +}
\ No newline at end of file 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 new file mode 100644 index 0000000000..01846681db --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java @@ -0,0 +1,71 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.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("candidateType") + private CandidateType candidateType; + @JsonProperty("candidates") + private List<String> candidates; + + /** + * list of candidates + * i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc. + */ + public List<String> getCandidates() { + return candidates; + } + + /** + * list of candidates + * i.e. actual serviceInstanceId, actual vnfName, actual cloudRegionId, etc. + */ + public void setCandidates(List<String> candidates) { + this.candidates = candidates; + } + + /** + * Way to identify the type of candidate + * i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc. + */ + public CandidateType getCandidateType(){ + return candidateType; + } + + /** + * Way to identify the type of candidate + * i.e. "serviceInstanceId", "vnfName", "cloudRegionId", etc. + */ + public void setCandidateType(CandidateType candidateType){ + this.candidateType = candidateType; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java index 91e3a59276..9540b9148e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,29 +18,27 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.sdnc.beans;
-
-public enum SDNCSvcAction {
- ACTIVATE("activate"),
- DELETE("delete"),
- ASSIGN("assign"),
- ROLLBACK("rollback"),
- UNASSIGN("unassign"),
- DEACTIVATE("deactivate"),
- CHANGE_DELETE("changedelete"),
- CHANGE_ASSIGN("changeassign"),
- CREATE("create"),
- ENABLE("enable"),
- DISABLE("disable");
-
- private final String name;
-
- private SDNCSvcAction(String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- return name;
- }
-}
+package org.onap.so.bpmn.servicedecomposition.homingobjects; + +public enum CandidateType { + SERVICE_INSTANCE_ID("serviceInstanceId"), + CLOUD_REGION_ID("cloudRegionId"), + VNF_ID("vnfId"), + VNF_NAME("vnfName"); + + private final String name; + + private CandidateType(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } + + //TODO added to get PojoTest to work + public String getName(){ + 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 new file mode 100644 index 0000000000..0cbd88b665 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.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{ + + 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>(); + + + 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> 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 new file mode 100644 index 0000000000..17e42b4396 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java @@ -0,0 +1,99 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; +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 int 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 int 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(int 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 new file mode 100644 index 0000000000..b4f2e85e55 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoAllottedResource.java @@ -0,0 +1,146 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + } +} 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 new file mode 100644 index 0000000000..6ceac935f1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java @@ -0,0 +1,91 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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-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 int quantity; + + 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 int getQuantity() { + return quantity; + } + public void setQuantity(int 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 new file mode 100644 index 0000000000..9d3aa5934b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java @@ -0,0 +1,56 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + + 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/modelinfo/ModelInfoGenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java new file mode 100644 index 0000000000..6b53272a75 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java @@ -0,0 +1,145 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + } +} 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 new file mode 100644 index 0000000000..1f02fea071 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoInstanceGroup.java @@ -0,0 +1,83 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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_NETWORK_INSTANCE_GROUP = "networkInstanceGroup"; + 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 new file mode 100644 index 0000000000..c873912922 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoMetadata.java @@ -0,0 +1,83 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.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; + } + + +} 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 new file mode 100644 index 0000000000..22233e94a5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoNetwork.java @@ -0,0 +1,169 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + } +} 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 new file mode 100644 index 0000000000..ac206d3dd0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java @@ -0,0 +1,81 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java index af429db1f2..b2494384f4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestProperties.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java @@ -18,12 +18,15 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.adapter.vnf; +package org.onap.so.bpmn.servicedecomposition.modelinfo; -import org.openecomp.mso.client.RestProperties; -public interface AdapterRestProperties extends RestProperties { +import java.io.Serializable; + + +public class ModelInfoServiceProxy extends ModelInfoMetadata implements Serializable { + + private static final long serialVersionUID = -6256897576261215926L; + - public String getAuth(); - public String getKey(); } 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 new file mode 100644 index 0000000000..593f8c2532 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVfModule.java @@ -0,0 +1,136 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java index cd98860efe..d3bf99ccb8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java @@ -18,16 +18,13 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.common.workflow.service; +package org.onap.so.bpmn.servicedecomposition.modelinfo; -import org.camunda.bpm.engine.ProcessEngineServices; -import org.camunda.bpm.engine.ProcessEngines; +import java.io.Serializable; +import com.fasterxml.jackson.annotation.JsonProperty; -public class WorkflowAsyncCommonResource extends WorkflowAsyncResource { +public class ModelInfoVolumeGroup extends ModelInfoVfModule implements Serializable { - @Override - public String getProcessEngineName() { - return "default"; - } + 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 new file mode 100644 index 0000000000..ac96aceec3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java @@ -0,0 +1,44 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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; + } +} 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 new file mode 100644 index 0000000000..aa68114011 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -0,0 +1,1586 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +import java.util.ArrayList; +import java.util.HashMap; +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; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.aai.AAICommonObjectMapperProvider; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.Relationships; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResource; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.logger.MsoLogger; +import org.onap.so.serviceinstancebeans.CloudConfiguration; +import org.onap.so.serviceinstancebeans.ModelInfo; +import org.onap.so.serviceinstancebeans.ModelType; +import org.onap.so.serviceinstancebeans.Networks; +import org.onap.so.serviceinstancebeans.RelatedInstance; +import org.onap.so.serviceinstancebeans.RelatedInstanceList; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.onap.so.serviceinstancebeans.RequestParameters; +import org.onap.so.serviceinstancebeans.Resources; +import org.onap.so.serviceinstancebeans.VfModules; +import org.onap.so.serviceinstancebeans.Vnfs; +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 MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, 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 CLOUD_OWNER = "att-aic"; + 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"; + + @Autowired + private BBInputSetupUtils bbInputSetupUtils; + + @Autowired + private BBInputSetupMapperLayer mapperLayer; + + @Autowired + private ExceptionBuilder exceptionUtil; + + private ObjectMapper mapper = new ObjectMapper(); + + public BBInputSetupUtils getBbInputSetupUtils() { + return bbInputSetupUtils; + } + + 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 = executeBB.isaLaCarte(); + boolean homing = 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); + msoLogger.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) { + msoLogger.error(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); + } + 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()); + } + + 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); + return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); + } else { + msoLogger.debug("Related Service Instance from AAI: " + aaiServiceInstance); + msoLogger.debug("Related Service Instance Model Info from AAI: " + service); + throw new Exception("Could not find relevant information for related Service Instance"); + } + } + + protected void populateObjectsOnAssignAndCreateFlows(RequestDetails requestDetails, Service service, String bbName, + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String vnfType) + throws Exception { + ModelInfo modelInfo = requestDetails.getModelInfo(); + String instanceName = requestDetails.getRequestInfo().getInstanceName(); + 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)) { + this.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, null); + } else if (modelType.equals(ModelType.vnf)) { + this.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, + lookupKeyMap, relatedInstanceList, resourceId, vnfType, null); + } else if (modelType.equals(ModelType.volumeGroup)) { + this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + relatedInstanceList, instanceName, vnfType, null); + } else if (modelType.equals(ModelType.vfModule)) { + this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration()); + } else { + return; + } + } + + protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName, + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String instanceName) { + boolean foundByName = false; + boolean foundById = false; + for (Configuration configuration : serviceInstance.getConfigurations()) { + if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null + && configuration.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) { + foundById = true; + org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()); + if(aaiConfiguration!=null){ + modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId()); + } + this.mapCatalogConfiguration(configuration, modelInfo, service); + } else if (instanceName != null && configuration.getConfigurationName().equalsIgnoreCase(instanceName)) { + foundByName = true; + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, configuration.getConfigurationId()); + org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()); + if(aaiConfiguration!=null){ + modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId()); + } + this.mapCatalogConfiguration(configuration, modelInfo, service); + } + } + if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) { + Configuration configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId); + serviceInstance.getConfigurations().add(configuration); + this.mapCatalogConfiguration(configuration, modelInfo, service); + } + } + + 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) { + ConfigurationResourceCustomization configurationResourceCustomization = findConfigurationResourceCustomization(modelInfo, service); + if (configurationResourceCustomization != null) { + configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization)); + } + } + + protected ConfigurationResourceCustomization findConfigurationResourceCustomization(ModelInfo modelInfo, Service service) { + for (ConfigurationResourceCustomization resourceCust : service.getConfigurationCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { + return resourceCust; + } + } + return null; + } + + 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 { + boolean foundByName = false; + boolean foundById = false; + 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); + for(VolumeGroup volumeGroup : tempVnf.getVolumeGroups()) { + String volumeGroupCustId = + this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER, + cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId(); + if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) { + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); + } + } + break; + } + } + if (vnf != null) { + for (VfModule vfModule : vnf.getVfModules()) { + if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null + && vfModule.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) { + foundById = true; + this.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + } else if (instanceName != null && vfModule.getVfModuleName().equalsIgnoreCase(instanceName)) { + foundByName = true; + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId()); + this.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + } + } + if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) { + VfModule vfModule = this.createVfModule(lookupKeyMap, + resourceId, instanceName, instanceParams); + this.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + vnf.getVfModules().add(vfModule); + } + } else { + msoLogger.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 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 { + boolean foundByName = false; + boolean foundById = false; + String vnfModelCustomizationUUID = null; + if (relatedInstanceList != null) { + for (RelatedInstanceList relatedInstList : relatedInstanceList) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { + vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid(); + } + } + } + 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); + break; + } + } + if (vnf != null && vnfModelCustomizationUUID != null) { + for (VolumeGroup volumeGroup : vnf.getVolumeGroups()) { + if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroup.getVolumeGroupId() + .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID))) { + foundById = true; + this.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); + } else if (instanceName != null && volumeGroup.getVolumeGroupName().equalsIgnoreCase(instanceName)) { + foundByName = true; + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); + this.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); + } + } + if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString())) { + if (vnfType == null || vnfType.isEmpty()) { + vnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); + } + VolumeGroup volumeGroup = this.createVolumeGroup(lookupKeyMap, resourceId, instanceName, vnfType, instanceParams); + vnf.getVolumeGroups().add(volumeGroup); + this.mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); + } + } else { + msoLogger.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) { + boolean foundByName = false; + boolean foundById = false; + ModelInfo instanceGroupModelInfo = null; + String instanceGroupId = null; + if (relatedInstanceList != null) { + for (RelatedInstanceList relatedInstList : relatedInstanceList) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.networkCollection)) { + instanceGroupModelInfo = relatedInstance.getModelInfo(); + instanceGroupId = relatedInstance.getInstanceId(); + } + } + } + for (GenericVnf genericVnf : serviceInstance.getVnfs()) { + if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null + && genericVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { + foundById = true; + org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId()); + if(vnf!=null){ + modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId()); + } + this.mapCatalogVnf(genericVnf, modelInfo, service); + } else if (instanceName != null && genericVnf.getVnfName().equalsIgnoreCase(instanceName)) { + foundByName = true; + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId()); + org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId()); + if(vnf!=null){ + modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId()); + } + this.mapCatalogVnf(genericVnf, modelInfo, service); + } + } + if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.VNF.toString())) { + if(vnfType == null || vnfType.isEmpty()) { + vnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName(); + } + GenericVnf genericVnf = this.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, + resourceId, vnfType, instanceParams); + serviceInstance.getVnfs().add(genericVnf); + this.mapCatalogVnf(genericVnf, modelInfo, service); + this.mapVnfcCollectionInstanceGroup(genericVnf, modelInfo, service); + if (instanceGroupId != null && instanceGroupModelInfo != null) + this.mapNetworkCollectionInstanceGroup(genericVnf, instanceGroupId); + } + } + + 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(); + instanceGroup.setModelInfoInstanceGroup(this.mapperLayer + .mapCatalogInstanceGroupToInstanceGroup(null, vnfcInstanceGroupCust.getInstanceGroup())); + 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 = this.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) { + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId); + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId(vnfId); + genericVnf.setVnfName(instanceName); + genericVnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + genericVnf.setVnfType(vnfType); + 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) { + boolean foundByName = false; + boolean foundById = false; + for (L3Network network : serviceInstance.getNetworks()) { + if (lookupKeyMap.get(ResourceKey.NETWORK_ID) != null + && network.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) { + foundById = true; + this.mapCatalogNetwork(network, modelInfo, service); + } else if (instanceName != null && network.getNetworkName().equalsIgnoreCase(instanceName)) { + foundByName = true; + lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); + this.mapCatalogNetwork(network, modelInfo, service); + } + } + if (!foundByName && !foundById + && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) + || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { + L3Network l3Network = this.createNetwork(lookupKeyMap, instanceName, resourceId, instanceParams); + serviceInstance.getNetworks().add(l3Network); + this.mapCatalogNetwork(l3Network, 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, 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) { + 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(), CLOUD_OWNER); + CloudRegion cloudRegion = mapperLayer.mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion, + CLOUD_OWNER); + outputBB.setOrchContext(orchContext); + outputBB.setRequestContext(requestContext); + outputBB.setCloudRegion(cloudRegion); + 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); + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + outputBB.setCustomer(customer); + return outputBB; + } + + 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 = this.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(); + GeneralBuildingBlock gBB = this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, + resourceId); + 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 if (requestAction.equalsIgnoreCase("deleteInstance") + || requestAction.equalsIgnoreCase("unassignInstance") + || requestAction.equalsIgnoreCase("activateInstance") + || requestAction.equalsIgnoreCase("activateFabricConfiguration")) { + return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, gBB, service, requestAction, + requestDetails.getCloudConfiguration()); + } 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(!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 { + msoLogger.debug("Could not find a network customization with key: " + key); + } + } else { + msoLogger.debug("Orchestrating on Collection Network Resource Customization"); + serviceInstance.getNetworks().add(getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId)); + } + } 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); + } else { + msoLogger.debug("Could not find a configuration customization with key: " + key); + } + } + 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 = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key); + if(collectionNetworkResourceCust != null && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) + || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { + NetworkResourceCustomization networkResourceCustomization = + mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); + L3Network l3Network = createNetwork(lookupKeyMap, null, networkId, null); + l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization)); + return l3Network; + } + 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, GeneralBuildingBlock gBB, Service service, + String requestAction, CloudConfiguration cloudConfiguration) throws Exception { + ServiceInstance serviceInstance = gBB.getServiceInstance(); + if (cloudConfiguration != null && requestAction.equalsIgnoreCase("deleteInstance")) { + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration, + CLOUD_OWNER); + CloudRegion cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion, CLOUD_OWNER); + 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); + 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 (cloudConfiguration != null) { + String volumeGroupCustomizationUUID = this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER, + cloudConfiguration.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); + 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); + } + this.populateGenericVnf(vnfs.getModelInfo(), vnfs.getInstanceName(), vnfs.getPlatform(), + vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null, vnfId, vnfType, vnfs.getInstanceParams()); + } 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()); + 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); + } else { + msoLogger.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, + CLOUD_OWNER); + return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion, CLOUD_OWNER); + } else { + msoLogger.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) { + 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); + + 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()); + this.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 new file mode 100644 index 0000000000..04f9cdcb86 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -0,0 +1,464 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +import java.util.ArrayList; +import java.util.Arrays; +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; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Entitlement; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Evc; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ForwarderEvc; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LagInterface; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; +import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.License; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResource; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.InstanceGroup; +import org.onap.so.db.catalog.beans.InstanceGroupType; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.logger.MsoLogger; +import org.onap.so.serviceinstancebeans.CloudConfiguration; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.springframework.stereotype.Component; + +@Component("BBInputSetupMapperLayer") +public class BBInputSetupMapperLayer { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, + 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())); + 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().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()); + 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())); + } + return context; + } + + protected RequestParameters mapRequestParameters(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) { + RequestParameters requestParams = new RequestParameters(); + requestParams.setaLaCarte(requestParameters.getALaCarte()); + requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType()); + requestParams.setUserParams(requestParameters.getUserParams()); + return requestParams; + } + + 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, String cloudOwner) { + CloudRegion cloudRegion = new CloudRegion(); + if(cloudConfiguration != null) + cloudRegion = modelMapper.map(cloudConfiguration, CloudRegion.class); + if(aaiCloudRegion != null) + modelMapper.map(aaiCloudRegion, cloudRegion); + if(cloudOwner != null) + cloudRegion.setCloudOwner(cloudOwner); + return cloudRegion; + } + + 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) { + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); + modelInfoConfiguration.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID()); + modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID()); + modelInfoConfiguration.setModelInvariantId(configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID()); + return modelInfoConfiguration; + } + + public NetworkResourceCustomization mapCollectionNetworkResourceCustToNetworkResourceCust( + CollectionNetworkResourceCustomization collectionNetworkResourceCust) { + return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.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 new file mode 100644 index 0000000000..14c162935a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -0,0 +1,409 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +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; +import org.onap.aai.domain.yang.GenericVnfs; +import org.onap.aai.domain.yang.InstanceGroup; +import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.L3Networks; +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.ServiceInstances; +import org.onap.aai.domain.yang.ServiceSubscription; +import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.aai.domain.yang.VolumeGroups; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.client.aai.AAIObjectPlurals; +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.db.request.RequestsDbClient; +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; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.logger.MsoLogger; +import org.onap.so.serviceinstancebeans.CloudConfiguration; +import org.onap.so.serviceinstancebeans.RequestDetails; +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; + +@Component("BBInputSetupUtils") +public class BBInputSetupUtils { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, 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 { + msoLogger.debug(REQUEST_ERROR); + } + } + + public void updateInfraActiveRequestVfModuleId(InfraActiveRequests request, String vfModuleId) { + if(request != null) { + request.setVfModuleId(vfModuleId); + this.requestsDbClient.updateInfraActiveRequests(request); + } else { + msoLogger.debug(REQUEST_ERROR); + } + } + + public void updateInfraActiveRequestVolumeGroupId(InfraActiveRequests request, String volumeGroupId) { + if(request != null) { + request.setVolumeGroupId(volumeGroupId); + this.requestsDbClient.updateInfraActiveRequests(request); + } else { + msoLogger.debug(REQUEST_ERROR); + } + } + + public void updateInfraActiveRequestNetworkId(InfraActiveRequests request, String networkId) { + if(request != null) { + request.setNetworkId(networkId); + this.requestsDbClient.updateInfraActiveRequests(request); + } else { + msoLogger.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 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, String cloudOwner) { + if (cloudConfiguration != null) { + String cloudRegionId = cloudConfiguration.getLcpCloudRegionId(); + if (cloudRegionId != null && !cloudRegionId.isEmpty()) { + return injectionHelper.getAaiClient().get(CloudRegion.class, + AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, + cloudConfiguration.getLcpCloudRegionId())).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(() -> { + msoLogger.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(() -> { + msoLogger.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(() -> { + msoLogger.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(() -> { + msoLogger.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(() -> { + msoLogger.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(() -> { + msoLogger.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(() -> { + msoLogger.debug("No Generic Vnf matched by id"); + return null; + }); + + } + + 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()) { + msoLogger.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()) { + msoLogger.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()) { + msoLogger.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 vfModuleId, String volumeGroupName) throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, 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()) { + msoLogger.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/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java new file mode 100644 index 0000000000..7a56ab88ab --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.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; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class ExecuteBuildingBlockRainyDay { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExecuteBuildingBlockRainyDay.class); + + @Autowired + private CatalogDbClient catalogDbClient; + private static final String ASTERISK = "ASTERISK"; + + public void setRetryTimer(DelegateExecution execution) { + try { + int retryCount = (int) execution.getVariable("retryCount"); + int retryTimeToWait = (int) Math.pow(5, retryCount); + String RetryDuration = "PT" + retryTimeToWait + "M"; + execution.setVariable("RetryDuration", RetryDuration); + } catch (Exception e) { + msoLogger.error(e); + throw new BpmnError("Unknown error incrementing retry counter"); + } + } + + public void queryRainyDayTable(DelegateExecution execution) { + try { + ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock"); + String bbName = ebb.getBuildingBlock().getBpmnFlowName(); + GeneralBuildingBlock gBBInput = (GeneralBuildingBlock) execution.getVariable("gBBInput"); + Map<ResourceKey, String> lookupKeyMap = (Map<ResourceKey, String>) execution.getVariable("lookupKeyMap"); + String serviceType = ASTERISK; + 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 + } + WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); + String errorCode = ASTERISK; + try { + errorCode = "" + workflowException.getErrorCode(); + } catch (Exception ex) { + // keep default errorCode value + } + String workStep = ASTERISK; + try { + workStep = workflowException.getWorkStep(); + } catch (Exception ex) { + // keep default workStep value + } + //Extract error data to be returned to WorkflowAction + execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage()); + RainyDayHandlerStatus rainyDayHandlerStatus; + String handlingCode = ""; + rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,serviceType,vnfType,errorCode,workStep); + if(rainyDayHandlerStatus==null){ + rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,ASTERISK,ASTERISK,ASTERISK,ASTERISK); + if(rainyDayHandlerStatus==null){ + handlingCode = "Abort"; + }else{ + handlingCode = rainyDayHandlerStatus.getPolicy(); + } + }else{ + handlingCode = rainyDayHandlerStatus.getPolicy(); + } + msoLogger.debug("RainyDayHandler Status Code is: " + handlingCode); + execution.setVariable("handlingCode", handlingCode); + } catch (Exception e) { + msoLogger.debug("RainyDayHandler Status Code is: Abort"); + execution.setVariable("handlingCode", "Abort"); + } + } +} 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 new file mode 100644 index 0000000000..a212668fec --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java @@ -0,0 +1,137 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.tasks; + +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; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.logger.MsoLogger; +import org.springframework.stereotype.Component; + +import com.google.common.base.CaseFormat; + +@Component +public class ExtractPojosForBB { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExtractPojosForBB.class); + + 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, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(serviceInstance.getVnfs(), value); + break; + case NETWORK_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(serviceInstance.getNetworks(), value); + break; + case VOLUME_GROUP_ID: + vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + result = lookupObjectInList(vnf.getVolumeGroups(), value); + break; + case VF_MODULE_ID: + vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + result = lookupObjectInList(vnf.getVfModules(), value); + break; + case ALLOTTED_RESOURCE_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(serviceInstance.getAllottedResources(), value); + break; + case CONFIGURATION_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(serviceInstance.getConfigurations(), value); + break; + case VPN_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(gBBInput.getCustomer().getVpnBindings(), value); + break; + case VPN_BONDING_LINK_ID: + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + result = lookupObjectInList(serviceInstance.getVpnBondingLinks(),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 + msoLogger.warnSimple("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; + + } + + 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(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java index 3c00627bff..9feee14640 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java @@ -18,25 +18,22 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.appc; +package org.onap.so.client.appc; import java.util.HashMap; import java.util.List; - -import org.openecomp.mso.client.appc.ApplicationControllerSupport.StatusCategory; -import org.openecomp.mso.bpmn.appc.payload.PayloadClient; -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.client.appc.ApplicationControllerOrchestrator; import java.util.Optional; + import org.onap.appc.client.lcm.model.Action; import org.onap.appc.client.lcm.model.Status; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.att.eelf.configuration.EELFLogger.Level; -import java.lang.NoSuchMethodError; +import org.onap.so.bpmn.appc.payload.PayloadClient; +import org.onap.so.bpmn.core.json.JsonUtils; +import org.onap.so.client.appc.ApplicationControllerSupport.StatusCategory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -44,14 +41,16 @@ public class ApplicationControllerAction { protected ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator(); private String errorCode = "1002"; private String errorMessage = "Unable to reach App C Servers"; - protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); + 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; + 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: @@ -63,7 +62,7 @@ public class ApplicationControllerAction { break; case Unlock: case Lock: - appCStatus = client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), controllerType); + appCStatus = client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), Optional.empty(), controllerType); break; case QuiesceTraffic: appCStatus = quiesceTrafficAction(msoRequestId, vnfId, payload, vnfName, controllerType); @@ -73,13 +72,18 @@ public class ApplicationControllerAction { 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); - appCStatus = snapshotAction(msoRequestId, vnfId, vmId, identityUrl, controllerType); + vserverId = vserverIdJsonList.get(i); + Optional<String> vserverIdString = Optional.of(vserverId); + appCStatus = snapshotAction(msoRequestId, vnfId, vmId, vserverIdString, identityUrl, controllerType); i++; } break; @@ -107,20 +111,20 @@ public class ApplicationControllerAction { } } catch(JsonProcessingException e){ - auditLogger.log(Level.ERROR, "Incorrect Payload format for action request" + action.toString(),e, e.getMessage()); + logger.error("Incorrect Payload format for action request: {}", action.toString(),e); errorMessage = e.getMessage(); } catch(ApplicationControllerOrchestratorException e){ - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); + logger.error("Error building Appc request: {}",e.getMessage(), e); errorCode = "1002"; errorMessage = e.getMessage(); } catch (NoSuchMethodError e) { - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); + logger.error( "Error building Appc request: {}", e.getMessage(), e); errorMessage = e.getMessage(); } catch(Exception e){ - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); + logger.error("Error building Appc request: {}", e.getMessage(), e); errorMessage = e.getMessage(); } } @@ -129,7 +133,7 @@ public class ApplicationControllerAction { if(!(payload.isPresent())){ throw new IllegalArgumentException("Payload is not present for " + action.toString()); } - return client.vnfCommand(action, msoRequestId, vnfId, payload, controllerType); + 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{ @@ -137,7 +141,7 @@ public class ApplicationControllerAction { throw new IllegalArgumentException("Payload is not present for " + Action.QuiesceTraffic.toString()); } payload = PayloadClient.quiesceTrafficFormat(payload, vnfName); - return client.vnfCommand(Action.QuiesceTraffic, msoRequestId, vnfId, payload, controllerType); + 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{ @@ -145,27 +149,27 @@ public class ApplicationControllerAction { throw new IllegalArgumentException("Payload is not present for " + action.toString()); } payload = PayloadClient.upgradeFormat(payload, vnfName); - return client.vnfCommand(action, msoRequestId, vnfId, payload, controllerType); + 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, payload, controllerType); + 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, payload, controllerType); + 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, payload, controllerType); + return client.vnfCommand(Action.HealthCheck, msoRequestId, vnfId, Optional.empty(), payload, controllerType); } - private Status snapshotAction(String msoRequestId, String vnfId, String vmId, String identityUrl, String controllerType) throws JsonProcessingException, ApplicationControllerOrchestratorException{ + 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, payload, controllerType); + return client.vnfCommand(Action.Snapshot, msoRequestId, vnfId, vserverId, payload, controllerType); } public String getErrorMessage(){ diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerCallback.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerCallback.java index 1bb4dc7eed..cb3f144cd1 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerCallback.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerCallback.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.appc; +package org.onap.so.client.appc; import org.onap.appc.client.lcm.api.ResponseHandler; import org.onap.appc.client.lcm.exceptions.AppcClientException; @@ -27,13 +27,13 @@ public class ApplicationControllerCallback<T> implements ResponseHandler<T> { @Override public void onResponse(T response) { - System.out.println("ON RESPONSE"); + } @Override public void onException(AppcClientException exception) { - System.out.println("ON EXCEPTION"); + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java index c9e2e880e7..f87ec91440 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,16 +18,18 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.appc; +package org.onap.so.client.appc; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.time.Instant; -import java.util.Map; 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; import org.onap.appc.client.lcm.api.AppcClientServiceFactoryProvider; import org.onap.appc.client.lcm.api.AppcLifeCycleManagerServiceFactory; import org.onap.appc.client.lcm.api.ApplicationContext; @@ -42,26 +44,19 @@ import org.onap.appc.client.lcm.model.Flags.Mode; import org.onap.appc.client.lcm.model.Payload; import org.onap.appc.client.lcm.model.Status; import org.onap.appc.client.lcm.model.ZULU; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.springframework.beans.factory.annotation.Autowired; - -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFLogger.Level; -import com.att.eelf.configuration.EELFManager; public class ApplicationControllerClient { - - public static final String DEFAULT_CONTROLLER_TYPE = "SDNC"; + + 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; - protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); + private static Logger logger = LoggerFactory.getLogger(ApplicationControllerClient.class); - @Autowired - public ApplicationControllerSupport appCSupport; + 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 @@ -92,7 +87,7 @@ public class ApplicationControllerClient { this.controllerType = controllerType.toUpperCase(); appCSupport = new ApplicationControllerSupport(); } - + /** * Gets the controller type. * @return the controllertype @@ -119,7 +114,7 @@ public class ApplicationControllerClient { return AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class) .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType)); } catch (AppcClientException e) { - auditLogger.log(Level.ERROR, "Error in getting LifeCycleManagerStateful: ", e, e.getMessage()); + 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; @@ -129,7 +124,8 @@ public class ApplicationControllerClient { 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 = createRequest(action, actionIdentifiers, payload, requestID); + Object requestObject; + requestObject = createRequest(action, actionIdentifiers, payload, requestID); appCSupport.logLCMMessage(requestObject); LifeCycleManagerStateful client = getAppCClient(); Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, false); @@ -147,21 +143,19 @@ public class ApplicationControllerClient { protected Properties getLCMProperties(String controllerType) { Properties properties = new Properties(); - Map<String, String> globalProperties = PropertyConfiguration.getInstance() - .getProperties("mso.bpmn.urn.properties"); - - properties.put("topic.read", globalProperties.get("appc.client.topic.read")); - properties.put("topic.write", globalProperties.get("appc.client.topic.write")); - properties.put("SDNC-topic.read", globalProperties.get("appc.client.topic.sdnc.read")); - properties.put("SDNC-topic.write", globalProperties.get("appc.client.topic.sdnc.write")); - properties.put("topic.read.timeout", globalProperties.get("appc.client.topic.read.timeout")); - properties.put("client.response.timeout", globalProperties.get("appc.client.response.timeout")); - properties.put("poolMembers", globalProperties.get("appc.client.poolMembers")); + + 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", globalProperties.get("appc.client.key")); - properties.put("client.secret", globalProperties.get("appc.client.secret")); + 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", globalProperties.get("appc.client.service")); + properties.put("service", UrnPropertiesReader.getVariable("appc.client.service")); return properties; } @@ -178,7 +172,7 @@ public class ApplicationControllerClient { requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload); } } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); + logger.error("Error building Appc request", e); } return requestObject; } 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 new file mode 100644 index 0000000000..d4599a5248 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClientV2.java @@ -0,0 +1,154 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.appc; + +import org.onap.appc.client.lcm.api.AppcClientServiceFactoryProvider; +import org.onap.appc.client.lcm.api.AppcLifeCycleManagerServiceFactory; +import org.onap.appc.client.lcm.api.ApplicationContext; +import org.onap.appc.client.lcm.api.LifeCycleManagerStateful; +import org.onap.appc.client.lcm.exceptions.AppcClientException; +import org.onap.appc.client.lcm.model.*; +import org.onap.appc.client.lcm.model.Flags.Force; +import org.onap.appc.client.lcm.model.Flags.Mode; +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; +import java.time.Instant; +import java.util.Properties; +import java.util.UUID; + +@Component +@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); + + //@Autowired + ApplicationControllerConfiguration applicationControllerConfiguration; + + //@Autowired + private ApplicationControllerSupport appCSupport; + + private static LifeCycleManagerStateful client; + + //@PostConstruct + public void buildClient() { + client = this.getAppCClient(""); + } + + //@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 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; + } + + 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; + } + + 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 new file mode 100644 index 0000000000..430767f24a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.appc; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Service; + +@Configuration +public class ApplicationControllerConfiguration { + @Value("${appc.client.topic.read.name}") + private String readTopic; + + @Value("${appc.client.topic.read.timeout}") + private String readTimeout; + + @Value("${appc.client.response.timeout}") + private String responseTimeout; + + @Value("${appc.client.topic.write}") + private String write; + + @Value("${appc.client.poolMembers}") + private String poolMembers; + + @Value("${appc.client.key}") + private String clientKey; + + @Value("${appc.client.secret}") + private String clientSecret; + + @Value("${appc.client.service}") + private String service; + + public String getClientKey() { + return clientKey; + } + + public String getClientSecret() { + return clientSecret; + } + + public String getPoolMembers() { + return poolMembers; + } + + public String getReadTimeout() { + return readTimeout; + } + + public String getResponseTimeout() { + return responseTimeout; + } + + public String getReadTopic() { + return readTopic; + } + + public String getService() { + return service; + } + + public String getWrite() { + return write; + } +} + diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestrator.java index 744be5f28f..84e0f93294 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestrator.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,11 +18,11 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.appc; +package org.onap.so.client.appc; import java.util.Optional; -import org.openecomp.mso.client.appc.ApplicationControllerSupport.StatusCategory; +import org.onap.so.client.appc.ApplicationControllerSupport.StatusCategory; import org.onap.appc.client.lcm.model.Action; import org.onap.appc.client.lcm.model.ActionIdentifiers; @@ -31,11 +31,14 @@ import org.onap.appc.client.lcm.model.Status; public class ApplicationControllerOrchestrator { - public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> request, String controllerType) throws ApplicationControllerOrchestratorException { + 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()); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestratorException.java index 4692f1dcc2..2532e485ed 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorException.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerOrchestratorException.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,19 +18,19 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.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;
- }
-}
+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; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java index e3ed432dfc..ef8749ece9 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.appc; +package org.onap.so.client.appc; import java.beans.BeanInfo; import java.beans.IntrospectionException; @@ -32,15 +32,15 @@ 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 com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.att.eelf.configuration.EELFLogger.Level; +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; import com.fasterxml.jackson.databind.ObjectWriter; +import org.springframework.stereotype.Service; -@Component public class ApplicationControllerSupport { private static final int ACCEPT_SERIES = 100; @@ -52,7 +52,7 @@ public class ApplicationControllerSupport { private static final int PARTIAL_SUCCESS_STATUS = PARTIAL_SERIES; private static final int PARTIAL_FAILURE_STATUS = PARTIAL_SERIES + 1; - protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); + private static Logger logger = LoggerFactory.getLogger(ApplicationControllerSupport.class); private String lcmModelPackage = "org.onap.appc.client.lcm.model"; /** @@ -105,7 +105,7 @@ public class ApplicationControllerSupport { try { return (Status) statusReader.invoke(response); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - auditLogger.log(Level.ERROR, "Unable to obtain status from LCM Kit response", e, e.getMessage()); + logger.error("Unable to obtain status from LCM Kit response", e); } } return new Status(); @@ -207,9 +207,9 @@ public class ApplicationControllerSupport { String inputAsJSON; try { inputAsJSON = writer.writeValueAsString(message); - auditLogger.log(Level.INFO, "\nLCM Kit input message follows: \n" + inputAsJSON, null); + logger.info("LCM Kit input message follows: {}" , inputAsJSON); } catch (JsonProcessingException e) { - auditLogger.log(Level.ERROR, "Error in logging LCM Message: ", e, e.getMessage()); + 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 new file mode 100644 index 0000000000..fff818f09b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AVPNDmaapBean.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.avpn.dmaap.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class AVPNDmaapBean { + + @JsonProperty("asyncRequestStatus") + private 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 new file mode 100644 index 0000000000..13206e8c92 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/AsyncRequestStatus.java @@ -0,0 +1,119 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.avpn.dmaap.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; +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; + } +} 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 new file mode 100644 index 0000000000..322f41bf75 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/InstanceReferences.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.avpn.dmaap.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName(value = "instanceReferences") +public class InstanceReferences { + + @JsonProperty("serviceInstanceId") + private String serviceInstanceId; + + public String getServiceInstanceId() { + return 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 new file mode 100644 index 0000000000..edc8be7bfe --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/avpn/dmaap/beans/RequestStatus.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.avpn.dmaap.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; +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; + } + + 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/db/request/RequestsDbClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java new file mode 100644 index 0000000000..61869ca322 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java @@ -0,0 +1,86 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.db.request; + +import java.io.IOException; +import java.net.URI; + +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpRequest; +import org.springframework.http.client.ClientHttpRequestExecution; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.http.client.ClientHttpResponse; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import uk.co.blackpepper.bowman.Client; +import uk.co.blackpepper.bowman.ClientFactory; +import uk.co.blackpepper.bowman.Configuration; +import uk.co.blackpepper.bowman.RestTemplateConfigurer; + +@Component("RequestDbClient") +public class RequestsDbClient { + + private Client<InfraActiveRequests> infraActiveRequestClient; + + @Value("${mso.adapters.db.spring.endpoint}") + private String endpoint; + + @Value("${mso.db.auth}") + private String msoAdaptersAuth; + + public RequestsDbClient() { + ClientFactory clientFactory = Configuration.builder().setRestTemplateConfigurer(new RestTemplateConfigurer() { + + public void configure(RestTemplate restTemplate) { + + restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() { + + public ClientHttpResponse intercept(HttpRequest request, byte[] body, + ClientHttpRequestExecution execution) throws IOException { + + request.getHeaders().add("Authorization", msoAdaptersAuth); + return execution.execute(request, body); + } + }); + } + }).build().buildClientFactory(); + infraActiveRequestClient = clientFactory.create(InfraActiveRequests.class); + + } + + public InfraActiveRequests getInfraActiveRequestbyRequestId(String requestId) { + return this.getSingleInfraActiveRequests(this.getUri(endpoint + "/infraActiveRequests/" + requestId)); + } + + protected InfraActiveRequests getSingleInfraActiveRequests(URI uri) { + return infraActiveRequestClient.get(uri); + } + + public void updateInfraActiveRequests(InfraActiveRequests request) { + infraActiveRequestClient.put(request); + } + + protected URI getUri(String uri) { + return URI.create(uri); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaaproperties/DefaultDmaapPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DefaultDmaapPropertiesImpl.java index c3bf53cfde..c5f08d4809 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaaproperties/DefaultDmaapPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DefaultDmaapPropertiesImpl.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,22 +18,23 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.dmaaproperties; +package org.onap.so.client.dmaapproperties; -import java.util.Map; +import org.onap.so.client.dmaap.DmaapProperties; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.dmaap.DmaapProperties; +import java.util.Map; public class DefaultDmaapPropertiesImpl implements DmaapProperties { private final Map<String, String> properties; + public DefaultDmaapPropertiesImpl() { - this.properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); + this.properties = new DmaapPropertiesMap(); } + @Override public Map<String, String> getProperties() { - return this.properties; + 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 new file mode 100644 index 0000000000..af7c608fee --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClient.java @@ -0,0 +1,115 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.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; +import org.onap.so.client.avpn.dmaap.beans.RequestStatus; +import org.onap.so.client.exception.MapperException; +import org.onap.so.logger.MsoLogger; +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 MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, 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) { + msoLogger.error(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 new file mode 100644 index 0000000000..796ccf18b7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/DmaapPropertiesMap.java @@ -0,0 +1,48 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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 + * @param <K> Key for Map Entry + * @param <V> Value for Map Entry + */ +public class DmaapPropertiesMap<K,V> extends HashMap<K,V> { + + @Override + public V get(Object 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; + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterRestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java index 62d78d423c..382852886e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterRestProperties.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,40 +17,48 @@ * limitations under the License. * ============LICENSE_END========================================================= */ +package org.onap.so.client.dmaapproperties; -package org.openecomp.mso.client.adapter.network; +import java.io.IOException; +import java.util.Optional; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.dmaap.DmaapPublisher; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.adapter.vnf.AdapterRestProperties; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; -public class NetworkAdapterRestProperties implements AdapterRestProperties { +@Component +@Scope("prototype") +public class GlobalDmaapPublisher extends DmaapPublisher { - private final Map<String, String> props; - public NetworkAdapterRestProperties() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); + public GlobalDmaapPublisher() throws IOException { + super(); } @Override - public String getAuth() { - return props.get("mso.adapters.po.auth"); + public String getUserName() { + + return UrnPropertiesReader.getVariable("mso.global.dmaap.username"); } + + + @Override - public String getKey() { - return props.get("mso.msoKey"); + public String getPassword() { + + return UrnPropertiesReader.getVariable("mso.global.dmaap.password"); } + @Override - public URL getEndpoint() throws MalformedURLException { - return new URL(props.get("mso.adapters.network.rest.endpoint")); + public String getTopic() { + + return UrnPropertiesReader.getVariable("mso.global.dmaap.publisher.topic"); } @Override - public String getSystemName() { - return "MSO"; + 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 new file mode 100644 index 0000000000..26c8d80075 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BBObjectNotFoundException.java @@ -0,0 +1,45 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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 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 ResourceKey getResourceKey() { + return resourceKey; + } + + public String getResourceValue() { + return resourceValue; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/ResponseStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java index cc00fd1ff2..ac8ff9efe4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/ResponseStatus.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java @@ -18,16 +18,15 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.adapter.requests.db.entities; +package org.onap.so.client.exception; +public class BadResponseException extends Exception{ + public BadResponseException() {} + + public BadResponseException(String message) + { + super(message); + } -/* - * Enum for Status values returned by API Handler to Tail-F -*/ -public enum ResponseStatus { - SENDING_FINAL_NOTIFY, - SUCCESS, - FAILED, - TIMEOUT } 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 new file mode 100644 index 0000000000..c74e81506c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -0,0 +1,90 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.exception; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.stereotype.Component; + +@Component +public class ExceptionBuilder { + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExceptionBuilder.class); + + public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception) { + String msg = "Exception in %s.%s "; + try{ + msoLogger.error(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; + } + } + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, msg.toString()); + execution.setVariable(errorVariable, exception.getMessage()); + } catch (Exception ex){ + //log trace, allow process to complete gracefully + msoLogger.error(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); + msoLogger.info("Building a WorkflowException for Subflow"); + + WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage); + execution.setVariable("WorkflowException", exception); + msoLogger.info("Outgoing WorkflowException is " + exception); + msoLogger.info("Throwing MSOWorkflowException"); + throw new BpmnError("MSOWorkflowException"); + } + + 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/openecomp/mso/bpmn/common/adapter/vnf/package-info.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java index c6ee6ca015..3f3beadb92 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/package-info.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java @@ -18,5 +18,15 @@ * ============LICENSE_END========================================================= */ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp.mso/vnfNotify") -package org.openecomp.mso.bpmn.common.adapter.vnf; +package org.onap.so.client.exception; + +public class MapperException extends Exception{ + + public MapperException() {} + + 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 new file mode 100644 index 0000000000..fe7b079568 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/OrchestrationStatusValidationException.java @@ -0,0 +1,29 @@ +/*- + * ============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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.exception; + +public class OrchestrationStatusValidationException extends Exception{ + public OrchestrationStatusValidationException() {} + + public OrchestrationStatusValidationException(String message) { + super(message); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java index a1ef35a49d..b7164e327e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java @@ -18,28 +18,27 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.restproperties; +package org.onap.so.client.restproperties; import java.net.MalformedURLException; import java.net.URL; -import java.util.Map; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.aai.AAIProperties; -import org.openecomp.mso.client.aai.AAIVersion; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.aai.AAIProperties; +import org.onap.so.client.aai.AAIVersion; +import org.springframework.stereotype.Component; +@Component public class AAIPropertiesImpl implements AAIProperties { - final Map<String, String> props; - - public AAIPropertiesImpl() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - - } + 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(props.get("aai.endpoint")); + return new URL(reader.getVariable(AAI_ENDPOINT)); } @Override @@ -54,11 +53,11 @@ public class AAIPropertiesImpl implements AAIProperties { @Override public String getAuth() { - return props.get("aai.auth"); + return reader.getVariable(AAI_AUTH); } @Override public String getKey() { - return props.get("mso.msoKey"); + return reader.getVariable(MSO_MSO_KEY); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AaiPropertiesConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AaiPropertiesConfiguration.java new file mode 100644 index 0000000000..b7582922b1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AaiPropertiesConfiguration.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.restproperties; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +@Service +public class AaiPropertiesConfiguration { + + @Value("${aai.endpoint}") + private String endpoint; + + @Value("${aai.auth}") + private String auth; + + public String getEndpoint() { + return endpoint; + } + + public String getAuth() { + return auth; + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/PolicyRestPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/PolicyRestPropertiesImpl.java index eccf87c09d..1e43adceba 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/PolicyRestPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/PolicyRestPropertiesImpl.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,27 +18,28 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.client.restproperties; +package org.onap.so.client.restproperties; import java.net.MalformedURLException; import java.net.URL; -import java.util.Map; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.policy.PolicyRestProperties; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.policy.PolicyRestProperties; public class PolicyRestPropertiesImpl implements PolicyRestProperties { - - final Map<String, String> props; - public PolicyRestPropertiesImpl() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); + 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(props.getOrDefault("policy.endpoint", "")); + return new URL(UrnPropertiesReader.getVariable(POLICY_ENDPOINT)); } catch (MalformedURLException e) { return null; } @@ -50,15 +51,15 @@ public class PolicyRestPropertiesImpl implements PolicyRestProperties { } public String getClientAuth() { - return props.get("policy.client.auth"); + return UrnPropertiesReader.getVariable(POLICY_CLIENT_AUTH); } public String getAuth() { - return props.get("policy.auth"); + return UrnPropertiesReader.getVariable(POLICY_AUTH); } public String getEnvironment() { - return props.get("policy.environment"); + return UrnPropertiesReader.getVariable(POLICY_ENVIRONMENT); } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/package-info.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/UrnPropertiesReaderWrapper.java index 42f4ce374f..030eff92e2 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/package-info.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/UrnPropertiesReaderWrapper.java @@ -18,5 +18,13 @@ * ============LICENSE_END========================================================= */ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package org.openecomp.mso.bpmn.common.adapter.sdnc; +package org.onap.so.client.restproperties; + +import org.onap.so.bpmn.core.UrnPropertiesReader; + +public class UrnPropertiesReaderWrapper { + + public String getVariable(String key) { + return UrnPropertiesReader.getVariable(key); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java deleted file mode 100644 index 67109d5578..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java +++ /dev/null @@ -1,139 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common.adapter.sdnc; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="ResponseCode" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="ResponseMessage" type="{http://www.w3.org/2001/XMLSchema}string"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "responseCode", - "responseMessage" -}, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") -@XmlRootElement(name = "CallbackHeader") -public class CallbackHeader { - - @XmlElement(name = "RequestId", required = true, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected String requestId; - @XmlElement(name = "ResponseCode", required = true,namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected String responseCode; - @XmlElement(name = "ResponseMessage", required = true,namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected String responseMessage; - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - /** - * Gets the value of the responseCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseCode() { - return responseCode; - } - - /** - * Sets the value of the responseCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseCode(String value) { - this.responseCode = value; - } - - /** - * Gets the value of the responseMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseMessage() { - return responseMessage; - } - - /** - * Sets the value of the responseMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseMessage(String value) { - this.responseMessage = value; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java deleted file mode 100644 index 1835fbe41c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java +++ /dev/null @@ -1,91 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.adapter.sdnc;
-
-import javax.xml.bind.annotation.XmlRegistry;
-
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 package.
- * <p>An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.domain2.workflow.sdnc.adapter.schema.v1
- *
- */
- public ObjectFactory() {
- }
-
- /**
- * Create an instance of {@link RequestHeader }
- *
- */
- public RequestHeader createRequestHeader() {
- return new RequestHeader();
- }
-
- /**
- * Create an instance of {@link SDNCAdapterResponse }
- *
- */
- public SDNCAdapterResponse createSDNCAdapterResponse() {
- return new SDNCAdapterResponse();
- }
-
- /**
- * Create an instance of {@link SDNCAdapterCallbackRequest }
- *
- */
- public SDNCAdapterCallbackRequest createSDNCAdapterCallbackRequest() {
- return new SDNCAdapterCallbackRequest();
- }
-
- /**
- * Create an instance of {@link CallbackHeader }
- *
- */
- public CallbackHeader createCallbackHeader() {
- return new CallbackHeader();
- }
-
- /**
- * Create an instance of {@link SDNCAdapterRequest }
- *
- */
- public SDNCAdapterRequest createSDNCAdapterRequest() {
- return new SDNCAdapterRequest();
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java deleted file mode 100644 index 12f2fef668..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java +++ /dev/null @@ -1,223 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.adapter.sdnc;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="SvcInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="SvcAction" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="SvcOperation" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="CallbackUrl" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="MsoAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "requestId",
- "svcInstanceId",
- "svcAction",
- "svcOperation",
- "callbackUrl",
- "msoAction"
-})
-@XmlRootElement(name = "RequestHeader")
-public class RequestHeader {
-
- @XmlElement(name = "RequestId", required = true)
- protected String requestId;
- @XmlElement(name = "SvcInstanceId")
- protected String svcInstanceId;
- @XmlElement(name = "SvcAction", required = true)
- protected String svcAction;
- @XmlElement(name = "SvcOperation", required = true)
- protected String svcOperation;
- @XmlElement(name = "CallbackUrl", required = true)
- protected String callbackUrl;
- @XmlElement(name = "MsoAction")
- protected String msoAction;
-
- /**
- * Gets the value of the requestId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getRequestId() {
- return requestId;
- }
-
- /**
- * Sets the value of the requestId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setRequestId(String value) {
- this.requestId = value;
- }
-
- /**
- * Gets the value of the svcInstanceId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSvcInstanceId() {
- return svcInstanceId;
- }
-
- /**
- * Sets the value of the svcInstanceId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSvcInstanceId(String value) {
- this.svcInstanceId = value;
- }
-
- /**
- * Gets the value of the svcAction property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSvcAction() {
- return svcAction;
- }
-
- /**
- * Sets the value of the svcAction property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSvcAction(String value) {
- this.svcAction = value;
- }
-
- /**
- * Gets the value of the svcOperation property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSvcOperation() {
- return svcOperation;
- }
-
- /**
- * Sets the value of the svcOperation property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSvcOperation(String value) {
- this.svcOperation = value;
- }
-
- /**
- * Gets the value of the callbackUrl property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getCallbackUrl() {
- return callbackUrl;
- }
-
- /**
- * Sets the value of the callbackUrl property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setCallbackUrl(String value) {
- this.callbackUrl = value;
- }
-
- /**
- * Gets the value of the msoAction property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMsoAction() {
- return msoAction;
- }
-
- /**
- * Sets the value of the msoAction property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMsoAction(String value) {
- this.msoAction = value;
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java deleted file mode 100644 index 8c9d4e2a50..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java +++ /dev/null @@ -1,130 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common.adapter.sdnc; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}CallbackHeader"/> - * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1", propOrder = { - "callbackHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterCallbackRequest", namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") -public class SDNCAdapterCallbackRequest { - - @XmlElement(name = "CallbackHeader", required = true, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected CallbackHeader callbackHeader; - @XmlElement(name = "RequestData", required=false, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected Object requestData; - - /** - * Gets the value of the callbackHeader property. - * - * @return - * possible object is - * {@link CallbackHeader } - * - */ - public CallbackHeader getCallbackHeader() { - return callbackHeader; - } - - /** - * Sets the value of the callbackHeader property. - * - * @param value - * allowed object is - * {@link CallbackHeader } - * - */ - public void setCallbackHeader(CallbackHeader value) { - this.callbackHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - - @Override - public String toString() { - StringWriter writer = new StringWriter(); - try { - JAXBContext context = JAXBContext - .newInstance(SDNCAdapterCallbackRequest.class); - Marshaller m = context.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - m.marshal(this, writer); - return writer.getBuffer().toString(); - } catch (JAXBException e) { - return ""; - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java deleted file mode 100644 index 1043b48944..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java +++ /dev/null @@ -1,111 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common.adapter.sdnc; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}RequestHeader"/> - * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterRequest") -public class SDNCAdapterRequest { - - @XmlElement(name = "RequestHeader", required = true) - protected RequestHeader requestHeader; - @XmlElement(name = "RequestData", required = true) - protected Object requestData; - - /** - * Gets the value of the requestHeader property. - * - * @return - * possible object is - * {@link RequestHeader } - * - */ - public RequestHeader getRequestHeader() { - return requestHeader; - } - - /** - * Sets the value of the requestHeader property. - * - * @param value - * allowed object is - * {@link RequestHeader } - * - */ - public void setRequestHeader(RequestHeader value) { - this.requestHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java deleted file mode 100644 index 34e68d68ef..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java +++ /dev/null @@ -1,51 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.adapter.sdnc;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "")
-@XmlRootElement(name = "SDNCAdapterResponse")
-public class SDNCAdapterResponse {
-
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java deleted file mode 100644 index c2f68ff6a4..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common.adapter.sdnc; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; - - -/** - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.2.4-b01 - * Generated source version: 2.2 - * - */ -@WebService(name = "SDNCCallbackAdapterPortType", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1") -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -public interface SDNCCallbackAdapterPortType { - - - /** - * - * @param sdncAdapterCallbackRequest - * @return - * returns org.openecomp.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterResponse - */ - @WebMethod(operationName = "SDNCAdapterCallback") - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") - public SDNCAdapterResponse sdncAdapterCallback( - @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest") - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest); - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java deleted file mode 100644 index 1b5c080045..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java +++ /dev/null @@ -1,462 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common.adapter.vnf; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for createVnfNotification complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="createVnfNotification"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> - * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="outputs" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * <element name="rollback" type="{http://org.openecomp.mso/vnfNotify}vnfRollback" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "createVnfNotification1", propOrder = { - "messageId", - "completed", - "exception", - "errorMessage", - "vnfId", - "outputs", - "rollback" -}) -public class CreateVnfNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - protected String vnfId; - protected CreateVnfNotification.Outputs outputs; - protected VnfRollback rollback; - - /** - * Gets the value of the messageId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return - * possible object is - * {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value - * allowed object is - * {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = value; - } - - /** - * Gets the value of the errorMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the value of the errorMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setErrorMessage(String value) { - this.errorMessage = value; - } - - /** - * Gets the value of the vnfId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVnfId() { - return vnfId; - } - - /** - * Sets the value of the vnfId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVnfId(String value) { - this.vnfId = value; - } - - /** - * Gets the value of the outputs property. - * - * @return - * possible object is - * {@link CreateVnfNotification.Outputs } - * - */ - public CreateVnfNotification.Outputs getOutputs() { - return outputs; - } - - /** - * Sets the value of the outputs property. - * - * @param value - * allowed object is - * {@link CreateVnfNotification.Outputs } - * - */ - public void setOutputs(CreateVnfNotification.Outputs value) { - this.outputs = value; - } - - /** - * Gets the value of the rollback property. - * - * @return - * possible object is - * {@link VnfRollback } - * - */ - public VnfRollback getRollback() { - return rollback; - } - - /** - * Sets the value of the rollback property. - * - * @param value - * allowed object is - * {@link VnfRollback } - * - */ - public void setRollback(VnfRollback value) { - this.rollback = value; - } - - - /** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "entry" - }) - public static class Outputs { - - protected List<CreateVnfNotification.Outputs.Entry> entry; - - /** - * Gets the value of the entry property. - * - * <p> - * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a <CODE>set</CODE> method for the entry property. - * - * <p> - * For example, to add a new item, do as follows: - * <pre> - * getEntry().add(newItem); - * </pre> - * - * - * <p> - * Objects of the following type(s) are allowed in the list - * {@link CreateVnfNotification.Outputs.Entry } - * - * - */ - public List<CreateVnfNotification.Outputs.Entry> getEntry() { - if (entry == null) { - entry = new ArrayList<>(); - } - return this.entry; - } - - // Not a generated method - @Override - public String toString() { - StringBuilder out = new StringBuilder(); - out.append("<outputs>\n"); - if (entry != null) { - for (Entry e : entry) { - out.append(e.toString()); - out.append('\n'); - } - } - out.append("</outputs>"); - return out.toString(); - } - - /** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "key", - "value" - }) - public static class Entry { - - protected String key; - protected String value; - - /** - * Gets the value of the key property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getKey() { - return key; - } - - /** - * Sets the value of the key property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setKey(String value) { - this.key = value; - } - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setValue(String value) { - this.value = value; - - } - - // Not a generated method - @Override - public String toString() { - String entrystr; - entrystr = - "<entry>"+ '\n' + - " <key>"+key+"</key>" + '\n' + - " <value>"+value+"</value>" + '\n' + - "</entry>"; - return entrystr; - } - - } - - } - - // Not a generated method - @Override - public String toString() { - String createVnfNotification; - if (exception==null) { - createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - " <vnfId>"+vnfId+"</vnfId>" + '\n' + - (outputs == null ? "" : outputs.toString() + '\n') + - " <rollback>"+rollback+"</rollback>" + '\n' + - "</ns2:createVnfNotification>"; - } else { - createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - (outputs == null ? "" : outputs.toString() + '\n') + - " <exception>"+exception+"</exception>" + '\n' + - " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' + - "</ns2:createVnfNotification>"; - } - return createVnfNotification; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java deleted file mode 100644 index 651fd1aca7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java +++ /dev/null @@ -1,198 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.adapter.vnf;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for deleteVnfNotification complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="deleteVnfNotification">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/>
- * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "deleteVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage"
-})
-public class DeleteVnfNotification {
-
- @XmlElement(required = true)
- protected String messageId;
- protected boolean completed;
- protected MsoExceptionCategory exception;
- protected String errorMessage;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the completed property.
- *
- */
- public boolean isCompleted() {
- return completed;
- }
-
- /**
- * Sets the value of the completed property.
- *
- */
- public void setCompleted(boolean value) {
- this.completed = value;
- }
-
- /**
- * Gets the value of the exception property.
- *
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
- */
- public MsoExceptionCategory getException() {
- return exception;
- }
-
- /**
- * Sets the value of the exception property.
- *
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
- */
- public void setException(MsoExceptionCategory value) {
- this.exception = value;
- }
-
- /**
- * Gets the value of the errorMessage property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Sets the value of the errorMessage property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setErrorMessage(String value) {
- this.errorMessage = value;
- }
-
- /**
- * Overrides toString() method
- * @return String type (deleteVnfNotification)
- */
-
- @Override
- public String toString() {
- String deleteVnfNotification;
- if (exception == null) {
- deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- "</ns2:deleteVnfNotification>";
- } else {
- deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:deleteVnfNotification>";
- }
- return deleteVnfNotification;
- }
-
-/*
- public String toString() {
- StringWriter writer = new StringWriter();
- try {
- JAXBContext context = JAXBContext
- .newInstance(DeleteVnfNotification.class);
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- m.marshal(this, writer);
- //System.out.println("toString() - " + writer.getBuffer().toString());
- return writer.getBuffer().toString();
- } catch (JAXBException e) {
- //System.out.println("JAXBException - " + e.getStackTrace());
- return "";
- }
- }
-*/
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java deleted file mode 100644 index 02dc1edcb7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java +++ /dev/null @@ -1,61 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.adapter.vnf;
-
-import javax.xml.bind.annotation.XmlEnum;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for msoExceptionCategory.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- * <p>
- * <pre>
- * <simpleType name="msoExceptionCategory">
- * <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- * <enumeration value="OPENSTACK"/>
- * <enumeration value="IO"/>
- * <enumeration value="INTERNAL"/>
- * <enumeration value="USERDATA"/>
- * </restriction>
- * </simpleType>
- * </pre>
- *
- */
-@XmlType(name = "msoExceptionCategory")
-@XmlEnum
-public enum MsoExceptionCategory {
-
- OPENSTACK,
- IO,
- INTERNAL,
- USERDATA;
-
- public String value() {
- return name();
- }
-
- public static MsoExceptionCategory fromValue(String v) {
- return valueOf(v);
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java deleted file mode 100644 index eabd465934..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java +++ /dev/null @@ -1,112 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common.adapter.vnf; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for msoRequest complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="msoRequest"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="requestId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="serviceInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "msoRequest", propOrder = { - "requestId", - "serviceInstanceId" -}) -public class MsoRequest { - - protected String requestId; - protected String serviceInstanceId; - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - /** - * Gets the value of the serviceInstanceId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getServiceInstanceId() { - return serviceInstanceId; - } - - /** - * Sets the value of the serviceInstanceId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setServiceInstanceId(String value) { - this.serviceInstanceId = value; - } - - @Override - public String toString() { - return "<requestId>" + requestId + "</requestId>" + '\n' + "<serviceInstanceId>" + serviceInstanceId - + "</serviceInstanceId>"; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java deleted file mode 100644 index c22fd286cf..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java +++ /dev/null @@ -1,208 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common.adapter.vnf; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlElementDecl; -import javax.xml.bind.annotation.XmlRegistry; -import javax.xml.namespace.QName; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the org.openecomp.mso.adapters.vnf.async.client package. - * <p>An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - private final static QName _RollbackVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "rollbackVnfNotification"); - private final static QName _DeleteVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "deleteVnfNotification"); - private final static QName _CreateVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "createVnfNotification"); - private final static QName _UpdateVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "updateVnfNotification"); - private final static QName _QueryVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "queryVnfNotification"); - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.adapters.vnf.async.client - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link UpdateVnfNotification } - * - */ - public UpdateVnfNotification createUpdateVnfNotification() { - return new UpdateVnfNotification(); - } - - /** - * Create an instance of {@link UpdateVnfNotification.Outputs } - * - */ - public UpdateVnfNotification.Outputs createUpdateVnfNotificationOutputs() { - return new UpdateVnfNotification.Outputs(); - } - - /** - * Create an instance of {@link QueryVnfNotification } - * - */ - public QueryVnfNotification createQueryVnfNotification() { - return new QueryVnfNotification(); - } - - /** - * Create an instance of {@link QueryVnfNotification.Outputs } - * - */ - public QueryVnfNotification.Outputs createQueryVnfNotificationOutputs() { - return new QueryVnfNotification.Outputs(); - } - - /** - * Create an instance of {@link CreateVnfNotification } - * - */ - public CreateVnfNotification createCreateVnfNotification() { - return new CreateVnfNotification(); - } - - /** - * Create an instance of {@link CreateVnfNotification.Outputs } - * - */ - public CreateVnfNotification.Outputs createCreateVnfNotificationOutputs() { - return new CreateVnfNotification.Outputs(); - } - - /** - * Create an instance of {@link DeleteVnfNotification } - * - */ - public DeleteVnfNotification createDeleteVnfNotification() { - return new DeleteVnfNotification(); - } - - /** - * Create an instance of {@link RollbackVnfNotification } - * - */ - public RollbackVnfNotification createRollbackVnfNotification() { - return new RollbackVnfNotification(); - } - - /** - * Create an instance of {@link MsoRequest } - * - */ - public MsoRequest createMsoRequest() { - return new MsoRequest(); - } - - /** - * Create an instance of {@link VnfRollback } - * - */ - public VnfRollback createVnfRollback() { - return new VnfRollback(); - } - - /** - * Create an instance of {@link UpdateVnfNotification.Outputs.Entry } - * - */ - public UpdateVnfNotification.Outputs.Entry createUpdateVnfNotificationOutputsEntry() { - return new UpdateVnfNotification.Outputs.Entry(); - } - - /** - * Create an instance of {@link QueryVnfNotification.Outputs.Entry } - * - */ - public QueryVnfNotification.Outputs.Entry createQueryVnfNotificationOutputsEntry() { - return new QueryVnfNotification.Outputs.Entry(); - } - - /** - * Create an instance of {@link CreateVnfNotification.Outputs.Entry } - * - */ - public CreateVnfNotification.Outputs.Entry createCreateVnfNotificationOutputsEntry() { - return new CreateVnfNotification.Outputs.Entry(); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link RollbackVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "rollbackVnfNotification") - public JAXBElement<RollbackVnfNotification> createRollbackVnfNotification(RollbackVnfNotification value) { - return new JAXBElement<>(_RollbackVnfNotification_QNAME, RollbackVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link DeleteVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "deleteVnfNotification") - public JAXBElement<DeleteVnfNotification> createDeleteVnfNotification(DeleteVnfNotification value) { - return new JAXBElement<>(_DeleteVnfNotification_QNAME, DeleteVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link CreateVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "createVnfNotification") - public JAXBElement<CreateVnfNotification> createCreateVnfNotification(CreateVnfNotification value) { - return new JAXBElement<>(_CreateVnfNotification_QNAME, CreateVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link UpdateVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "updateVnfNotification") - public JAXBElement<UpdateVnfNotification> createUpdateVnfNotification(UpdateVnfNotification value) { - return new JAXBElement<>(_UpdateVnfNotification_QNAME, UpdateVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link QueryVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "queryVnfNotification") - public JAXBElement<QueryVnfNotification> createQueryVnfNotification(QueryVnfNotification value) { - return new JAXBElement<>(_QueryVnfNotification_QNAME, QueryVnfNotification.class, null, value); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java deleted file mode 100644 index 4e84234c81..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java +++ /dev/null @@ -1,488 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.adapter.vnf;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for queryVnfNotification complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="queryVnfNotification">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/>
- * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="vnfExists" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- * <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="status" type="{http://org.openecomp.mso/vnfNotify}vnfStatus" minOccurs="0"/>
- * <element name="outputs" minOccurs="0">
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="entry" maxOccurs="unbounded" minOccurs="0">
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </element>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </element>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "queryVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage",
- "vnfExists",
- "vnfId",
- "status",
- "outputs"
-})
-public class QueryVnfNotification {
-
- @XmlElement(required = true)
- protected String messageId;
- protected boolean completed;
- protected MsoExceptionCategory exception;
- protected String errorMessage;
- protected Boolean vnfExists;
- protected String vnfId;
- protected VnfStatus status;
- protected QueryVnfNotification.Outputs outputs;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the completed property.
- *
- */
- public boolean isCompleted() {
- return completed;
- }
-
- /**
- * Sets the value of the completed property.
- *
- */
- public void setCompleted(boolean value) {
- this.completed = value;
- }
-
- /**
- * Gets the value of the exception property.
- *
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
- */
- public MsoExceptionCategory getException() {
- return exception;
- }
-
- /**
- * Sets the value of the exception property.
- *
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
- */
- public void setException(MsoExceptionCategory value) {
- this.exception = value;
- }
-
- /**
- * Gets the value of the errorMessage property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Sets the value of the errorMessage property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setErrorMessage(String value) {
- this.errorMessage = value;
- }
-
- /**
- * Gets the value of the vnfExists property.
- *
- * @return
- * possible object is
- * {@link Boolean }
- *
- */
- public Boolean isVnfExists() {
- return vnfExists;
- }
-
- /**
- * Sets the value of the vnfExists property.
- *
- * @param value
- * allowed object is
- * {@link Boolean }
- *
- */
- public void setVnfExists(Boolean value) {
- this.vnfExists = value;
- }
-
- /**
- * Gets the value of the vnfId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getVnfId() {
- return vnfId;
- }
-
- /**
- * Sets the value of the vnfId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setVnfId(String value) {
- this.vnfId = value;
- }
-
- /**
- * Gets the value of the status property.
- *
- * @return
- * possible object is
- * {@link VnfStatus }
- *
- */
- public VnfStatus getStatus() {
- return status;
- }
-
- /**
- * Sets the value of the status property.
- *
- * @param value
- * allowed object is
- * {@link VnfStatus }
- *
- */
- public void setStatus(VnfStatus value) {
- this.status = value;
- }
-
- /**
- * Gets the value of the outputs property.
- *
- * @return
- * possible object is
- * {@link QueryVnfNotification.Outputs }
- *
- */
- public QueryVnfNotification.Outputs getOutputs() {
- return outputs;
- }
-
- /**
- * Sets the value of the outputs property.
- *
- * @param value
- * allowed object is
- * {@link QueryVnfNotification.Outputs }
- *
- */
- public void setOutputs(QueryVnfNotification.Outputs value) {
- this.outputs = value;
- }
-
-
- /**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="entry" maxOccurs="unbounded" minOccurs="0">
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </element>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "entry"
- })
- public static class Outputs {
-
- protected List<QueryVnfNotification.Outputs.Entry> entry;
-
- /**
- * Gets the value of the entry property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the entry property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getEntry().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link QueryVnfNotification.Outputs.Entry }
- *
- *
- */
- public List<QueryVnfNotification.Outputs.Entry> getEntry() {
- if (entry == null) {
- entry = new ArrayList<>();
- }
- return this.entry;
- }
-
- // Not a generated method
- public String toString() {
- StringBuilder out = new StringBuilder();
- out.append("<outputs>\n");
- if (entry != null) {
- for (Entry e : entry) {
- out.append(e.toString());
- out.append('\n');
- }
- }
- out.append("</outputs>");
- return out.toString();
- }
-
-
- /**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "key",
- "value"
- })
- public static class Entry {
-
- protected String key;
- protected String value;
-
- /**
- * Gets the value of the key property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getKey() {
- return key;
- }
-
- /**
- * Sets the value of the key property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setKey(String value) {
- this.key = value;
- }
-
- /**
- * Gets the value of the value property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets the value of the value property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setValue(String value) {
- this.value = value;
- }
-
- // Not a generated method
- public String toString() {
- String entry = "";
- entry =
- "<entry>"+ '\n' +
- " <key>"+key+"</key>" + '\n' +
- " <value>"+value+"</value>" + '\n' +
- "</entry>";
- return entry;
- }
-
- }
-
- }
-
- // Not a generated method
- public String toString() {
- String queryVnfNotification = "";
- if (exception==null) {
- queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <vnfExists>"+vnfExists+"</vnfExists>" + '\n' +
- " <vnfId>"+vnfId+"</vnfId>" + '\n' +
- " <status>"+status+"</status>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- "</ns2:queryVnfNotification>";
- } else {
- queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:queryVnfNotification>";
- }
- return queryVnfNotification;
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java deleted file mode 100644 index 0cf088d023..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java +++ /dev/null @@ -1,175 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common.adapter.vnf; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for rollbackVnfNotification complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="rollbackVnfNotification"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> - * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "rollbackVnfNotification1", propOrder = { - "messageId", - "completed", - "exception", - "errorMessage" -}) -public class RollbackVnfNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - - /** - * Gets the value of the messageId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return - * possible object is - * {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value - * allowed object is - * {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = value; - } - - /** - * Gets the value of the errorMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the value of the errorMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setErrorMessage(String value) { - this.errorMessage = value; - } - - public String toString() { - String rollbackVnfNotification = ""; - if (exception==null) { - rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - "</ns2:rollbackVnfNotification>"; - } else { - rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - " <exception>"+exception+"</exception>" + '\n' + - " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' + - "</ns2:rollbackVnfNotification>"; - } - return rollbackVnfNotification; - - } - - } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java deleted file mode 100644 index 79188e77b6..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java +++ /dev/null @@ -1,412 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common.adapter.vnf; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for updateVnfNotification complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="updateVnfNotification"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> - * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="outputs" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * <element name="rollback" type="{http://org.openecomp.mso/vnfNotify}vnfRollback" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "updateVnfNotification1", propOrder = { - "messageId", - "completed", - "exception", - "errorMessage", - "outputs", - "rollback" -}) -public class UpdateVnfNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - protected UpdateVnfNotification.Outputs outputs; - protected VnfRollback rollback; - - /** - * Gets the value of the messageId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return - * possible object is - * {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value - * allowed object is - * {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = value; - } - - /** - * Gets the value of the errorMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the value of the errorMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setErrorMessage(String value) { - this.errorMessage = value; - } - - /** - * Gets the value of the outputs property. - * - * @return - * possible object is - * {@link UpdateVnfNotification.Outputs } - * - */ - public UpdateVnfNotification.Outputs getOutputs() { - return outputs; - } - - /** - * Sets the value of the outputs property. - * - * @param value - * allowed object is - * {@link UpdateVnfNotification.Outputs } - * - */ - public void setOutputs(UpdateVnfNotification.Outputs value) { - this.outputs = value; - } - - /** - * Gets the value of the rollback property. - * - * @return - * possible object is - * {@link VnfRollback } - * - */ - public VnfRollback getRollback() { - return rollback; - } - - /** - * Sets the value of the rollback property. - * - * @param value - * allowed object is - * {@link VnfRollback } - * - */ - public void setRollback(VnfRollback value) { - this.rollback = value; - } - - - /** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "entry" - }) - public static class Outputs { - - protected List<UpdateVnfNotification.Outputs.Entry> entry; - - /** - * Gets the value of the entry property. - * - * <p> - * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a <CODE>set</CODE> method for the entry property. - * - * <p> - * For example, to add a new item, do as follows: - * <pre> - * getEntry().add(newItem); - * </pre> - * - * - * <p> - * Objects of the following type(s) are allowed in the list - * {@link UpdateVnfNotification.Outputs.Entry } - * - * - */ - public List<UpdateVnfNotification.Outputs.Entry> getEntry() { - if (entry == null) { - entry = new ArrayList<>(); - } - return this.entry; - } - - - /** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "key", - "value" - }) - public static class Entry { - - protected String key; - protected String value; - - /** - * Gets the value of the key property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getKey() { - return key; - } - - /** - * Sets the value of the key property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setKey(String value) { - this.key = value; - } - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setValue(String value) { - this.value = value; - } - - public String toString() { - String entry = ""; - entry = - " <key>"+key+"</key>" + '\n' + - " <value>"+value+"</value>"; - return entry; - } - } - - } - - public String toString(){ - String updateVnfNotification = ""; - if (exception==null) { - updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - " <rollback>"+rollback+"</rollback>" + '\n' + - "</ns2:updateVnfNotification>"; - } else { - updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - " <exception>"+exception+"</exception>" + '\n' + - " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' + - "</ns2:updateVnfNotification>"; - } - - return updateVnfNotification; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java deleted file mode 100644 index d192bb34a9..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java +++ /dev/null @@ -1,177 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common.adapter.vnf; - -import javax.jws.Oneway; -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebService; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.ws.Action; -import javax.xml.ws.RequestWrapper; - - -/** - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.2.8 - * Generated source version: 2.2 - * - */ -@WebService(name = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify") -@XmlSeeAlso({ - ObjectFactory.class -}) -public interface VnfAdapterNotify { - - - /** - * - * @param errorMessage - * @param exception - * @param messageId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.RollbackVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/rollbackVnfNotificationRequest") - public void rollbackVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage); - - /** - * - * @param errorMessage - * @param vnfExists - * @param status - * @param exception - * @param outputs - * @param messageId - * @param vnfId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/queryVnfNotificationRequest") - public void queryVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage, - @WebParam(name = "vnfExists", targetNamespace = "") - Boolean vnfExists, - @WebParam(name = "vnfId", targetNamespace = "") - String vnfId, - @WebParam(name = "status", targetNamespace = "") - VnfStatus status, - @WebParam(name = "outputs", targetNamespace = "") - org.openecomp.mso.bpmn.common.adapter.vnf.QueryVnfNotification.Outputs outputs); - - /** - * - * @param errorMessage - * @param exception - * @param rollback - * @param outputs - * @param messageId - * @param vnfId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/createVnfNotificationRequest") - public void createVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage, - @WebParam(name = "vnfId", targetNamespace = "") - String vnfId, - @WebParam(name = "outputs", targetNamespace = "") - org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs outputs, - @WebParam(name = "rollback", targetNamespace = "") - VnfRollback rollback); - - /** - * - * @param errorMessage - * @param exception - * @param rollback - * @param outputs - * @param messageId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest") - public void updateVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage, - @WebParam(name = "outputs", targetNamespace = "") - org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs outputs, - @WebParam(name = "rollback", targetNamespace = "") - VnfRollback rollback); - - /** - * - * @param errorMessage - * @param exception - * @param messageId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.DeleteVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/deleteVnfNotificationRequest") - public void deleteVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage); - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java deleted file mode 100644 index 38385fbe9c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java +++ /dev/null @@ -1,108 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common.adapter.vnf; - -import java.net.URL; -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceException; -import javax.xml.ws.WebServiceFeature; - - -/** - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.2.8 - * Generated source version: 2.2 - * - */ -@WebServiceClient(name = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify", wsdlLocation = "/VnfAdapterNotify.wsdl") -public class VnfAdapterNotify_Service extends Service -{ - - private final static URL VNFADAPTERNOTIFY_WSDL_LOCATION; - private final static WebServiceException VNFADAPTERNOTIFY_EXCEPTION; - private final static QName VNFADAPTERNOTIFY_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "vnfAdapterNotify"); - - static { - VNFADAPTERNOTIFY_WSDL_LOCATION = org.openecomp.mso.bpmn.common.adapter.vnf.VnfAdapterNotify_Service.class.getResource("/VnfAdapterNotify.wsdl"); - WebServiceException e = null; - if (VNFADAPTERNOTIFY_WSDL_LOCATION == null) { - e = new WebServiceException("Cannot find '/VnfAdapterNotify.wsdl' wsdl. Place the resource correctly in the classpath."); - } - VNFADAPTERNOTIFY_EXCEPTION = e; - } - - public VnfAdapterNotify_Service() { - super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME); - } - - public VnfAdapterNotify_Service(WebServiceFeature... features) { - super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME, features); - } - - public VnfAdapterNotify_Service(URL wsdlLocation) { - super(wsdlLocation, VNFADAPTERNOTIFY_QNAME); - } - - public VnfAdapterNotify_Service(URL wsdlLocation, WebServiceFeature... features) { - super(wsdlLocation, VNFADAPTERNOTIFY_QNAME, features); - } - - public VnfAdapterNotify_Service(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public VnfAdapterNotify_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { - super(wsdlLocation, serviceName, features); - } - - /** - * - * @return - * returns VnfAdapterNotify - */ - @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") - public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort() { - return super.getPort(new QName("http://org.openecomp.mso/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class); - } - - /** - * - * @param features - * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. - * @return - * returns VnfAdapterNotify - */ - @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") - public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort(WebServiceFeature... features) { - return super.getPort(new QName("http://org.openecomp.mso/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class, features); - } - - private static URL __getWsdlLocation() { - if (VNFADAPTERNOTIFY_EXCEPTION!= null) { - throw VNFADAPTERNOTIFY_EXCEPTION; - } - return VNFADAPTERNOTIFY_WSDL_LOCATION; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java deleted file mode 100644 index a546b82325..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java +++ /dev/null @@ -1,210 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common.adapter.vnf; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for vnfRollback complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="vnfRollback"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="cloudSiteId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="msoRequest" type="{http://org.openecomp.mso/vnfNotify}msoRequest" minOccurs="0"/> - * <element name="tenantCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="tenantId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="vnfCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "vnfRollback", propOrder = { - "cloudSiteId", - "msoRequest", - "tenantCreated", - "tenantId", - "vnfCreated", - "vnfId" -}) -public class VnfRollback { - - protected String cloudSiteId; - protected MsoRequest msoRequest; - protected boolean tenantCreated; - protected String tenantId; - protected boolean vnfCreated; - protected String vnfId; - - /** - * Gets the value of the cloudSiteId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCloudSiteId() { - return cloudSiteId; - } - - /** - * Sets the value of the cloudSiteId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCloudSiteId(String value) { - this.cloudSiteId = value; - } - - /** - * Gets the value of the msoRequest property. - * - * @return - * possible object is - * {@link MsoRequest } - * - */ - public MsoRequest getMsoRequest() { - return msoRequest; - } - - /** - * Sets the value of the msoRequest property. - * - * @param value - * allowed object is - * {@link MsoRequest } - * - */ - public void setMsoRequest(MsoRequest value) { - this.msoRequest = value; - } - - /** - * Gets the value of the tenantCreated property. - * - */ - public boolean isTenantCreated() { - return tenantCreated; - } - - /** - * Sets the value of the tenantCreated property. - * - */ - public void setTenantCreated(boolean value) { - this.tenantCreated = value; - } - - /** - * Gets the value of the tenantId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTenantId() { - return tenantId; - } - - /** - * Sets the value of the tenantId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTenantId(String value) { - this.tenantId = value; - } - - /** - * Gets the value of the vnfCreated property. - * - */ - public boolean isVnfCreated() { - return vnfCreated; - } - - /** - * Sets the value of the vnfCreated property. - * - */ - public void setVnfCreated(boolean value) { - this.vnfCreated = value; - } - - /** - * Gets the value of the vnfId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVnfId() { - return vnfId; - } - - /** - * Sets the value of the vnfId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVnfId(String value) { - this.vnfId = value; - } - - public String toString() { - String msoRequestElement = msoRequest == null ? "" - : "<msoRequest>"+msoRequest+"</msoRequest>" + '\n'; - - return - "<cloudSiteId>"+cloudSiteId+"</cloudSiteId>" + '\n' + - msoRequestElement + - "<tenantCreated>"+tenantCreated+"</tenantCreated>" + '\n' + - "<tenantId>"+tenantId+"</tenantId>" + '\n' + - "<vnfCreated>"+vnfCreated+"</vnfCreated>" + '\n' + - "<vnfId>"+vnfId+"</vnfId>"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java deleted file mode 100644 index aef85470a7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java +++ /dev/null @@ -1,61 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.adapter.vnf;
-
-import javax.xml.bind.annotation.XmlEnum;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for vnfStatus.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- * <p>
- * <pre>
- * <simpleType name="vnfStatus">
- * <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- * <enumeration value="ACTIVE"/>
- * <enumeration value="FAILED"/>
- * <enumeration value="NOTFOUND"/>
- * <enumeration value="UNKNOWN"/>
- * </restriction>
- * </simpleType>
- * </pre>
- *
- */
-@XmlType(name = "vnfStatus")
-@XmlEnum
-public enum VnfStatus {
-
- ACTIVE,
- FAILED,
- NOTFOUND,
- UNKNOWN;
-
- public String value() {
- return name();
- }
-
- public static VnfStatus fromValue(String v) {
- return valueOf(v);
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java deleted file mode 100644 index 846b87aba8..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java +++ /dev/null @@ -1,98 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.util;
-
-
-import java.security.GeneralSecurityException;
-import java.security.NoSuchAlgorithmException;
-
-import javax.crypto.Cipher;
-import javax.crypto.spec.SecretKeySpec;
-
-//Need to add BPM error handler
-
-/**
- * CryptoUtils adapted from RTTP client.
- *
- */
-public class CryptoUtils {
-
- public static final String AES = "AES";
-
- /**
- * encrypt a value and generate a keyfile
- * if the keyfile is not found then a new one is created
- * @throws GeneralSecurityException
- * */
- public static String encrypt(String value, String keyString) throws GeneralSecurityException
- {
- SecretKeySpec sks = getSecretKeySpec(keyString);
- Cipher cipher = Cipher.getInstance(CryptoUtils.AES);
- cipher.init(Cipher.ENCRYPT_MODE, sks, cipher.getParameters());
- byte[] encrypted = cipher.doFinal(value.getBytes());
- return byteArrayToHexString(encrypted);
- }
-
- /**
- * decrypt a value
- * @throws GeneralSecurityException
- */
- public static String decrypt(String message, String keyString) throws GeneralSecurityException
- {
- SecretKeySpec sks = getSecretKeySpec(keyString);
- Cipher cipher = Cipher.getInstance(CryptoUtils.AES);
- cipher.init(Cipher.DECRYPT_MODE, sks);
- byte[] decrypted = cipher.doFinal(hexStringToByteArray(message));
- return new String(decrypted);
- }
-
- private static SecretKeySpec getSecretKeySpec(String keyString) throws NoSuchAlgorithmException
- {
- byte [] key = hexStringToByteArray(keyString);
- SecretKeySpec sks = new SecretKeySpec(key, CryptoUtils.AES);
- return sks;
- }
-
-
- private static String byteArrayToHexString(byte[] b){
- StringBuilder sb = new StringBuilder(b.length * 2);
- for (byte aB : b) {
- int v = aB & 0xff;
- if (v < 16) {
- sb.append('0');
- }
- sb.append(Integer.toHexString(v));
- }
- return sb.toString().toUpperCase();
- }
-
- private static byte[] hexStringToByteArray(String s) {
- byte[] b = new byte[s.length() / 2];
- for (int i = 0; i < b.length; i++){
- int index = i * 2;
- int v = Integer.parseInt(s.substring(index, index + 2), 16);
- b[i] = (byte)v;
- }
- return b;
- }
-
-}
-
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java deleted file mode 100644 index f61c692775..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java +++ /dev/null @@ -1,421 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.workflow.service;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.camunda.bpm.BpmPlatform;
-import org.camunda.bpm.engine.MismatchingMessageCorrelationException;
-import org.camunda.bpm.engine.OptimisticLockingException;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.runtime.Execution;
-import org.camunda.bpm.engine.runtime.MessageCorrelationResult;
-import org.openecomp.mso.bpmn.core.PropertyConfiguration;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * Abstract base class for callback services.
- */
-public abstract class AbstractCallbackService extends ProcessEngineAwareService {
- public static final long DEFAULT_TIMEOUT_SECONDS = 60;
- public static final long FAST_POLL_DUR_SECONDS = 5;
- public static final long FAST_POLL_INT_MS = 100;
- public static final long SLOW_POLL_INT_MS = 1000;
-
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- /**
- * Parameterized callback handler.
- */
- protected CallbackResult handleCallback(String method, Object message,
- String messageEventName, String messageVariable,
- String correlationVariable, String correlationValue,
- String logMarker) {
-
- return handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker, null);
- }
-
- /**
- * Parameterized callback handler.
- */
- protected CallbackResult handleCallback(String method, Object message,
- String messageEventName, String messageVariable,
- String correlationVariable, String correlationValue,
- String logMarker, Map<String, Object> injectedVariables) {
-
- long startTime = System.currentTimeMillis();
-
- LOGGER.debug(logMarker + " " + method + " received message: "
- + (message == null ? "" : System.lineSeparator()) + message);
-
- try {
- Map<String, Object> variables = new HashMap<>();
-
- if (injectedVariables != null) {
- variables.putAll(injectedVariables);
- }
-
- variables.put(correlationVariable, correlationValue);
- variables.put(messageVariable, message == null ? null : message.toString());
-
- boolean ok = correlate(messageEventName, correlationVariable,
- correlationValue, variables, logMarker);
-
- if (!ok) {
- String msg = "No process is waiting for " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue + "'";
- logCallbackError(method, startTime, msg);
- return new CallbackError(msg);
- }
-
- logCallbackSuccess(method, startTime);
- return new CallbackSuccess();
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- String msg = "Caught " + e.getClass().getSimpleName()
- + " processing " + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "'";
- logCallbackError(method, startTime, msg);
- return new CallbackError(msg);
- }
- }
-
- /**
- * Performs message correlation. Waits a limited amount of time for
- * a process to become ready for correlation. The return value indicates
- * whether or not a process was found to receive the message. Due to the
- * synchronous nature of message injection in Camunda, by the time this
- * method returns, one of 3 things will have happened: (1) the process
- * received the message and ended, (2) the process received the message
- * and reached an activity that suspended, or (3) an exception occurred
- * during correlation or while the process was executing. Correlation
- * exceptions are handled differently from process execution exceptions.
- * Correlation exceptions are thrown so the client knows something went
- * wrong with the delivery of the message. Process execution exceptions
- * are logged but not thrown.
- * @param messageEventName the message event name
- * @param correlationVariable the process variable used as the correlator
- * @param correlationValue the correlation value
- * @param variables variables to inject into the process
- * @param logMarker a marker for debug logging
- * @return true if a process could be found, false if not
- * @throws Exception for correlation errors
- */
- protected boolean correlate(String messageEventName, String correlationVariable,
- String correlationValue, Map<String, Object> variables, String logMarker)
- throws Exception {
- try{
- LOGGER.debug(logMarker + " Attempting to find process waiting"
- + " for " + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "'");
-
- RuntimeService runtimeService =
- getProcessEngineServices().getRuntimeService();
-
- Map<String, String> properties =
- PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties");
-
- long timeout = DEFAULT_TIMEOUT_SECONDS;
-
- // The code is here in case we ever need to change the default.
- String s = properties.get("mso.correlation.timeout");
- if (s != null) {
- try {
- timeout = Long.parseLong(s);
- } catch (NumberFormatException e) {
- // Ignore
- }
- }
-
- long now = System.currentTimeMillis();
- long fastPollEndTime = now + (FAST_POLL_DUR_SECONDS * 1000);
- long endTime = now + (timeout * 1000);
- long sleep = FAST_POLL_INT_MS;
-
- List<Execution> waitingProcesses = null;
- Exception queryException = null;
- int queryCount = 0;
- int queryFailCount = 0;
-
- while (true) {
- try {
- ++queryCount;
- waitingProcesses = runtimeService.createExecutionQuery()
- .messageEventSubscriptionName(messageEventName)
- .processVariableValueEquals(correlationVariable, correlationValue)
- .list();
- } catch (Exception e) {
- ++queryFailCount;
- queryException = e;
- }
-
- if (waitingProcesses != null && waitingProcesses.size() > 0) {
- break;
- }
-
- if (now > endTime - sleep) {
- break;
- }
-
- Thread.sleep(sleep);
- now = System.currentTimeMillis();
-
- if (now > fastPollEndTime) {
- sleep = SLOW_POLL_INT_MS;
- }
- }
-
- if (waitingProcesses == null) {
- waitingProcesses = new ArrayList<Execution>(0);
- }
-
- int count = waitingProcesses.size();
-
- List<ExecInfo> execInfoList = new ArrayList<>(count);
- for (Execution execution : waitingProcesses) {
- execInfoList.add(new ExecInfo(execution));
- }
-
- LOGGER.debug(logMarker + " Found " + count + " process(es) waiting"
- + " for " + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "': " + execInfoList);
-
- if (count == 0) {
- if (queryFailCount > 0) {
- String msg = queryFailCount + "/" + queryCount
- + " execution queries failed attempting to correlate "
- + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "'; last exception was:"
- + queryException;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, queryException);
- }
-
- return false;
- }
-
- if (count > 1) {
- // Only one process should be waiting. Throw an exception back to the client.
- throw new MismatchingMessageCorrelationException(messageEventName,
- "more than 1 process is waiting with " + correlationVariable
- + " = '" + correlationValue + "'");
- }
-
- // We prototyped an asynchronous solution, i.e. resuming the process
- // flow in a separate thread, but this affected too many existing tests,
- // and we went back to the synchronous solution. The synchronous solution
- // has some troublesome characteristics though. For example, the
- // resumed flow may send request #2 to a remote system before MSO has
- // acknowledged the notification associated with request #1.
-
- try {
- LOGGER.debug(logMarker + " Running " + execInfoList.get(0) + " to receive "
- + messageEventName + " with " + correlationVariable + " = '"
- + correlationValue + "'");
-
- @SuppressWarnings("unused")
- MessageCorrelationResult result = runtimeService
- .createMessageCorrelation(messageEventName)
- .setVariables(variables)
- .processInstanceVariableEquals(correlationVariable, correlationValue)
- .correlateWithResult();
-
- } catch (MismatchingMessageCorrelationException e) {
- // A correlation exception occurred even after we identified
- // one waiting process. Throw it back to the client.
- throw e;
- } catch (OptimisticLockingException ole) {
-
- String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue
- + "': " + ole;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, ole);
-
- //Retry for OptimisticLocking Exceptions
- int retryCount = 0;
- String retryStr = properties.get("mso.bpmn.optimisticlockingexception.retrycount");
- if (retryStr != null) {
- try {
- retryCount = Integer.parseInt(retryStr);
- } catch (NumberFormatException e) {
- // Ignore
- }
- }
-
- LOGGER.debug("Retry correlate for OptimisticLockingException, retryCount:" + retryCount);
-
- for (; retryCount >0 ; retryCount--) {
-
- try{
- Thread.sleep(SLOW_POLL_INT_MS);
-
- @SuppressWarnings("unused")
- MessageCorrelationResult result = runtimeService
- .createMessageCorrelation(messageEventName)
- .setVariables(variables)
- .processInstanceVariableEquals(correlationVariable, correlationValue)
- .correlateWithResult();
- retryCount = 0;
- LOGGER.debug("OptimisticLockingException retry was successful, seting retryCount: " + retryCount);
- } catch (OptimisticLockingException olex) {
- //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
- String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex;
- LOGGER.debug(strMsg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, strMsg, olex);
- } catch (Exception excep) {
- retryCount = 0;
- //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
- String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep;
- LOGGER.debug(strMsg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, strMsg, excep);
- }
-
- }
-
- }catch (Exception e) {
- // This must be an exception from the flow itself. Log it, but don't
- // report it back to the client.
- String msg = "Caught " + e.getClass().getSimpleName() + " running "
- + execInfoList.get(0) + " after receiving " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue
- + "': " + e;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, e);
- }
- } catch (Exception e) {
- // This must be an exception from the flow itself. Log it, but don't
- // report it back to the client.
- String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue
- + "': " + e;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, e);
- }
-
- return true;
- }
-
- /**
- * Records audit and metric events in the log for a callback success.
- * @param method the method name
- * @param startTime the request start time
- */
- protected void logCallbackSuccess(String method, long startTime) {
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.Suc, "Completed " + method);
-
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.Suc, "Completed " + method,
- "BPMN", MsoLogger.getServiceName(), null);
- }
-
- /**
- * Records error, audit and metric events in the log for a callback
- * internal error.
- * @param method the method name
- * @param startTime the request start time
- * @param msg the error message
- */
- protected void logCallbackError(String method, long startTime, String msg) {
- logCallbackError(method, startTime, msg, null);
- }
-
- /**
- * Records error, audit and metric events in the log for a callback
- * internal error.
- * @param method the method name
- * @param startTime the request start time
- * @param msg the error message
- * @param e the exception
- */
- protected void logCallbackError(String method, long startTime, String msg, Exception e) {
- if (e == null) {
- LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg);
- } else {
- LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, e);
- }
-
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.InternalError, "Completed " + method);
-
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.InternalError, "Completed " + method,
- "BPMN", MsoLogger.getServiceName(), null);
- }
-
- /**
- * Abstract callback result object.
- */
- protected abstract class CallbackResult {
- }
-
- /**
- * Indicates that callback handling was successful.
- */
- protected class CallbackSuccess extends CallbackResult {
- }
-
- /**
- * Indicates that callback handling failed.
- */
- protected class CallbackError extends CallbackResult {
- private final String errorMessage;
-
- public CallbackError(String errorMessage) {
- this.errorMessage = errorMessage;
- }
-
- /**
- * Gets the error message.
- */
- public String getErrorMessage() {
- return errorMessage;
- }
- }
-
- private static class ExecInfo {
- private final Execution execution;
-
- public ExecInfo(Execution execution) {
- this.execution = execution;
- }
-
- @Override
- public String toString() {
- return "Process[" + execution.getProcessInstanceId()
- + ":" + execution.getId() + "]";
- }
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java deleted file mode 100644 index dbb6674a64..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.common.workflow.service; - -import java.util.Optional; - -import org.camunda.bpm.engine.ProcessEngineServices; -import org.camunda.bpm.engine.ProcessEngines; - -/** - * Base class for services that must be process-engine aware. The only - * process engine currently supported is the "default" process engine. - */ -public class ProcessEngineAwareService { - - private final String processEngineName = "default"; - private volatile Optional<ProcessEngineServices> pes4junit = Optional.empty(); - - /** - * Gets the process engine name. - * @return the process engine name - */ - public String getProcessEngineName() { - return processEngineName; - } - - /** - * Gets process engine services. - * @return process engine services - */ - public ProcessEngineServices getProcessEngineServices() { - return pes4junit.orElse(ProcessEngines.getProcessEngine( - getProcessEngineName())); - } - - /** - * Allows a particular process engine to be specified, overriding the - * usual process engine lookup by name. Intended primarily for the - * unit test environment. - * @param pes process engine services - */ - public void setProcessEngineServices4junit(ProcessEngineServices pes) { - pes4junit = Optional.ofNullable(pes); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java deleted file mode 100644 index c5f0d02dff..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java +++ /dev/null @@ -1,83 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.workflow.service;
-
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebResult;
-import javax.jws.WebService;
-import javax.ws.rs.core.Context;
-import javax.xml.ws.WebServiceContext;
-
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse;
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * Implementation of SDNCAdapterCallbackService.
- */
-@WebService(serviceName="SDNCAdapterCallbackService", targetNamespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1")
-public class SDNCAdapterCallbackServiceImpl extends AbstractCallbackService implements SDNCCallbackAdapterPortType {
-
- private final String logMarker = "[SDNC-CALLBACK]";
-
- @Context WebServiceContext wsContext;
-
- @WebMethod(operationName = "SDNCAdapterCallback")
- @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse")
- public SDNCAdapterResponse sdncAdapterCallback(
- @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest")
- SDNCAdapterCallbackRequest sdncAdapterCallbackRequest) {
-
- String method = "sdncAdapterCallback";
- Object message = sdncAdapterCallbackRequest;
- String messageEventName = "sdncAdapterCallbackRequest";
- String messageVariable = "sdncAdapterCallbackRequest";
- String correlationVariable = "SDNCA_requestId";
- String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId();
-
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlationValue, "N/A");
-
- CallbackResult result = handleCallback(method, message, messageEventName,
- messageVariable, correlationVariable, correlationValue, logMarker);
-
- if (result instanceof CallbackError) {
- return new SDNCAdapterErrorResponse(((CallbackError)result).getErrorMessage());
- } else {
- return new SDNCAdapterResponse();
- }
- }
-
- // This subclass allows unit tests to extract the error
- public class SDNCAdapterErrorResponse extends SDNCAdapterResponse {
- private String error;
-
- public SDNCAdapterErrorResponse(String error) {
- this.error = error;
- }
-
- public String getError() {
- return error;
- }
- }
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java deleted file mode 100644 index 621e35e57d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java +++ /dev/null @@ -1,249 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.workflow.service;
-
-import javax.jws.Oneway;
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebService;
-import javax.ws.rs.core.Context;
-import javax.xml.ws.Action;
-import javax.xml.ws.RequestWrapper;
-import javax.xml.ws.WebServiceContext;
-
-import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.DeleteVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.MsoExceptionCategory;
-import org.openecomp.mso.bpmn.common.adapter.vnf.QueryVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.RollbackVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.VnfAdapterNotify;
-import org.openecomp.mso.bpmn.common.adapter.vnf.VnfRollback;
-import org.openecomp.mso.bpmn.common.adapter.vnf.VnfStatus;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * Implementation of the VnfAdapterNotify service.
- */
-@WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify")
-public class VnfAdapterNotifyServiceImpl extends AbstractCallbackService implements VnfAdapterNotify{
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private final String logMarker = "[VNF-NOTIFY]";
-
- @Context WebServiceContext wsContext;
-
- @WebMethod(operationName = "rollbackVnfNotification")
- @Oneway
- @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.RollbackVnfNotification")
- @Action(input = "http://org.openecomp.mso/notify/adapterNotify/rollbackVnfNotificationRequest") - public void rollbackVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage) {
-
- RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification();
-
- rollbackVnfNotification.setMessageId(messageId);
- rollbackVnfNotification.setCompleted(completed);
- rollbackVnfNotification.setException(exception);
- rollbackVnfNotification.setErrorMessage(errorMessage);
-
- String method = "rollbackVnfNotification";
- Object message = rollbackVnfNotification;
- String messageEventName = "rollbackVnfNotificationCallback";
- String messageVariable = "rollbackVnfNotificationCallback";
- String correlationVariable = "VNFRB_messageId";
- String correlationValue = messageId;
-
- handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-
- @WebMethod(operationName = "queryVnfNotification")
- @Oneway
- @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/queryVnfNotificationRequest") - public void queryVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "vnfExists", targetNamespace = "")
- Boolean vnfExists,
- @WebParam(name = "vnfId", targetNamespace = "")
- String vnfId,
- @WebParam(name = "status", targetNamespace = "")
- VnfStatus status,
- @WebParam(name = "outputs", targetNamespace = "")
- QueryVnfNotification.Outputs outputs){
-
- String method = "queryVnfNotification";
- String messageEventName = "queryVnfNotificationCallback";
- String messageVariable = "queryVnfNotificationCallback";
- String correlationVariable = "VNFQ_messageId";
- String correlationValue = messageId;
-
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlationValue, "N/A");
-
- QueryVnfNotification message = new QueryVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
- message.setVnfExists(vnfExists);
- message.setVnfId(vnfId);
- message.setStatus(status);
- message.setOutputs(outputs);
-
- handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-
- @WebMethod(operationName = "createVnfNotification")
- @Oneway
- @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/createVnfNotificationRequest") - public void createVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "vnfId", targetNamespace = "")
- String vnfId,
- @WebParam(name = "outputs", targetNamespace = "")
- CreateVnfNotification.Outputs outputs,
- @WebParam(name = "rollback", targetNamespace = "")
- VnfRollback rollback){
-
- String method = "createVnfNotification";
- String messageEventName = "createVnfNotificationCallback";
- String messageVariable = "createVnfNotificationCallback";
- String correlationVariable = "VNFC_messageId";
- String correlationValue = messageId;
-
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlationValue, "N/A");
-
- CreateVnfNotification message = new CreateVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
- message.setVnfId(vnfId);
- message.setOutputs(outputs);
- message.setRollback(rollback);
-
- handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-
- @WebMethod(operationName = "updateVnfNotification")
- @Oneway
- @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest") - public void updateVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "outputs", targetNamespace = "")
- UpdateVnfNotification.Outputs outputs,
- @WebParam(name = "rollback", targetNamespace = "")
- VnfRollback rollback){
-
- String method = "updateVnfNotification";
- String messageEventName = "updateVnfNotificationCallback";
- String messageVariable = "updateVnfNotificationCallback";
- String correlationVariable = "VNFU_messageId";
- String correlationValue = messageId;
-
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlationValue, "N/A");
-
- UpdateVnfNotification message = new UpdateVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
- message.setOutputs(outputs);
- message.setRollback(rollback);
-
- handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-
- @WebMethod(operationName = "deleteVnfNotification")
- @Oneway
- @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.DeleteVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/deleteVnfNotificationRequest") - public void deleteVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage) {
-
- String method = "deleteVnfNotification";
- String messageEventName = "deleteVnfACallback";
- String messageVariable = "deleteVnfACallback";
- String correlationVariable = "VNFDEL_uuid";
- String correlationValue = messageId;
-
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlationValue, "N/A");
-
- DeleteVnfNotification message = new DeleteVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
-
- handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java deleted file mode 100644 index b4543b1445..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java +++ /dev/null @@ -1,289 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.bpmn.common.workflow.service;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.UUID;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
-import org.jboss.resteasy.annotations.Suspend;
-import org.jboss.resteasy.spi.AsynchronousResponse;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.slf4j.MDC;
-
-/**
- *
- * @version 1.0
- * Asynchronous Workflow processing using JAX RS RESTeasy implementation
- * Both Synchronous and Asynchronous BPMN process can benefit from this implementation since the workflow gets executed in the background
- * and the server thread is freed up, server scales better to process more incoming requests
- *
- * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the response
- * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process
- */
-@Path("/async")
-public class WorkflowAsyncResource extends ProcessEngineAwareService {
-
- private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
- protected Optional<ProcessEngineServices> pes4junit = Optional.empty();
-
- private final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private static final String logMarker = "[WRKFLOW-RESOURCE]";
- private static final long DEFAULT_WAIT_TIME = 30000; //default wait time
-
- /**
- * Asynchronous JAX-RS method that starts a process instance.
- * @param asyncResponse an object that will receive the asynchronous response
- * @param processKey the process key
- * @param variableMap input variables to the process
- */
- @POST
- @Path("/services/{processKey}")
- @Produces("application/json")
- @Consumes("application/json")
- public void startProcessInstanceByKey(final @Suspend(180000) AsynchronousResponse asyncResponse,
- @PathParam("processKey") String processKey, VariableMapImpl variableMap) {
-
- long startTime = System.currentTimeMillis();
- Map<String, Object> inputVariables = null;
- WorkflowContext workflowContext = null;
-
- try {
- inputVariables = getInputVariables(variableMap);
- setLogContext(processKey, inputVariables);
-
- // This variable indicates that the flow was invoked asynchronously
- inputVariables.put("isAsyncProcess", "true");
-
- workflowContext = new WorkflowContext(processKey, getRequestId(inputVariables),
- asyncResponse, getWaitTime(inputVariables));
-
- msoLogger.debug("Adding the workflow context into holder: "
- + workflowContext.getProcessKey() + ":"
- + workflowContext.getRequestId() + ":"
- + workflowContext.getTimeout());
-
- contextHolder.put(workflowContext);
-
- ProcessThread processThread = new ProcessThread(processKey, inputVariables);
- processThread.start();
- } catch (Exception e) {
- setLogContext(processKey, inputVariables);
-
- if (workflowContext != null) {
- contextHolder.remove(workflowContext);
- }
-
- msoLogger.debug(logMarker + "Exception in startProcessInstance by key");
- WorkflowResponse response = new WorkflowResponse();
- response.setMessage("Fail" );
- response.setContent("Error occurred while executing the process: " + e);
- response.setMessageCode(500);
- recordEvents(processKey, response, startTime);
-
- msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logMarker
- + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent());
-
- Response errorResponse = Response.serverError().entity(response).build();
- asyncResponse.setResponse(errorResponse);
- }
- }
-
- /**
- *
- * @version 1.0
- *
- */
- class ProcessThread extends Thread {
- private final String processKey;
- private final Map<String,Object> inputVariables;
-
- public ProcessThread(String processKey, Map<String, Object> inputVariables) {
- this.processKey = processKey;
- this.inputVariables = inputVariables;
- }
-
- public void run() {
-
- String processInstanceId = null;
- long startTime = System.currentTimeMillis();
-
- try {
- setLogContext(processKey, inputVariables);
-
- // Note: this creates a random businessKey if it wasn't specified.
- String businessKey = getBusinessKey(inputVariables);
-
- msoLogger.debug(logMarker + "***Received MSO startProcessInstanceByKey with processKey: "
- + processKey + " and variables: " + inputVariables);
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
- + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with processKey:"
- + processKey + " and variables: " + inputVariables);
-
- RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
- ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(
- processKey, businessKey, inputVariables);
- processInstanceId = processInstance.getId();
-
- msoLogger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " " +
- (processInstance.isEnded() ? "ENDED" : "RUNNING"));
- } catch (Exception e) {
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
- logMarker + "Error in starting the process: "+ e.getMessage());
-
- WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
- callbackResponse.setStatusCode(500);
- callbackResponse.setMessage("Fail");
- callbackResponse.setResponse("Error occurred while executing the process: " + e);
-
- // TODO: is the processInstanceId used by the API handler? I don't think so.
- // It may be null here.
- WorkflowContextHolder.getInstance().processCallback(
- processKey, processInstanceId,
- getRequestId(inputVariables),
- callbackResponse);
- }
- }
- }
-
-
- /**
- * Callback resource which is invoked from BPMN to process to send the workflow response
- *
- * @param processKey
- * @param processInstanceId
- * @param requestId
- * @param callbackResponse
- * @return
- */
- @POST
- @Path("/services/callback/{processKey}/{processInstanceId}/{requestId}")
- @Produces("application/json")
- @Consumes("application/json")
- public Response processWorkflowCallback(
- @PathParam("processKey") String processKey,
- @PathParam("processInstanceId") String processInstanceId,
- @PathParam("requestId")String requestId,
- WorkflowCallbackResponse callbackResponse) {
-
- msoLogger.debug(logMarker + "Process instance ID:" + processInstanceId + ":" + requestId + ":" + processKey + ":" + isProcessEnded(processInstanceId));
- msoLogger.debug(logMarker + "About to process the callback request:" + callbackResponse.getResponse() + ":" + callbackResponse.getMessage() + ":" + callbackResponse.getStatusCode());
- return contextHolder.processCallback(processKey, processInstanceId, requestId, callbackResponse);
- }
-
- private static String getOrCreate(Map<String, Object> inputVariables, String key) {
- String value = Objects.toString(inputVariables.get(key), null);
- if (value == null) {
- value = UUID.randomUUID().toString();
- inputVariables.put(key, value);
- }
- return value;
- }
-
- // Note: the business key is used to identify the process in unit tests
- private static String getBusinessKey(Map<String, Object> inputVariables) {
- return getOrCreate(inputVariables, "mso-business-key");
- }
-
- private static String getRequestId(Map<String, Object> inputVariables) {
- return getOrCreate(inputVariables, "mso-request-id");
- }
-
- private long getWaitTime(Map<String, Object> inputVariables)
- {
-
- String timeout = Objects.toString(inputVariables.get("mso-service-request-timeout"), null);
-
- if (timeout != null) {
- try {
- return Long.parseLong(timeout)*1000;
- } catch (NumberFormatException nex) {
- msoLogger.debug("Invalid input for mso-service-request-timeout");
- }
- }
-
- return DEFAULT_WAIT_TIME;
- }
-
- private void recordEvents(String processKey, WorkflowResponse response,
- long startTime) {
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + response.getMessage() + "for processKey: " + processKey + " with content: " + response.getContent());
-
- }
-
- private static void setLogContext(String processKey,
- Map<String, Object> inputVariables) {
- MsoLogger.setServiceName("MSO." + processKey);
- if (inputVariables != null) {
- MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"mso-service-instance-id"));
- }
- }
-
- private static String getKeyValueFromInputVariables(Map<String,Object> inputVariables, String key) {
- if (inputVariables == null) {
- return "";
- }
-
- return Objects.toString(inputVariables.get(key), "N/A");
- }
-
- private boolean isProcessEnded(String processInstanceId) {
- ProcessEngineServices pes = getProcessEngineServices();
- return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null;
- }
-
- private static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
- Map<String, Object> inputVariables = new HashMap<>();
- @SuppressWarnings("unchecked")
- Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (Map.Entry<String, Object> entry : vMap.entrySet()) {
- String vName = entry.getKey();
- Object value = entry.getValue();
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String,Object>)value; // value, type
- inputVariables.put(vName, valueMap.get("value"));
- }
- return inputVariables;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java deleted file mode 100644 index 4ba35907b9..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java +++ /dev/null @@ -1,108 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.workflow.service;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * Generalized REST interface that injects a message event into a waiting BPMN process.
- * Examples:
- * <pre>
- * /WorkflowMessage/SDNCAResponse/6d10d075-100c-42d0-9d84-a52432681cae-1478486185286
- * /WorkflowMessage/SDNCAEvent/USOSTCDALTX0101UJZZ01
- * </pre>
- */
-@Path("/")
-public class WorkflowMessageResource extends AbstractCallbackService {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- private static final String LOGMARKER = "[WORKFLOW-MESSAGE]";
-
- @POST
- @Path("/WorkflowMessage/{messageType}/{correlator}")
- @Consumes("*/*")
- @Produces(MediaType.TEXT_PLAIN)
- public Response deliver(
- @HeaderParam("Content-Type") String contentType,
- @PathParam("messageType") String messageType,
- @PathParam("correlator") String correlator,
- String message) {
-
- String method = "receiveWorkflowMessage";
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlator, "N/A");
-
- LOGGER.debug(LOGMARKER + " Received workflow message"
- + " type='" + messageType + "'"
- + " correlator='" + correlator + "'"
- + (contentType == null ? "" : " contentType='" + contentType + "'")
- + " message=" + System.lineSeparator() + message);
-
- if (messageType == null || messageType.isEmpty()) {
- String msg = "Missing message type";
- LOGGER.debug(LOGMARKER + " " + msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg);
- return Response.status(400).entity(msg).build();
- }
-
- if (correlator == null || correlator.isEmpty()) {
- String msg = "Missing correlator";
- LOGGER.debug(LOGMARKER + " " + msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg);
- return Response.status(400).entity(msg).build();
- }
-
- String messageEventName = "WorkflowMessage";
- String messageVariable = messageType + "_MESSAGE";
- String correlationVariable = messageType + "_CORRELATOR";
- String correlationValue = correlator;
- String contentTypeVariable = messageType + "_CONTENT_TYPE";
-
- Map<String, Object> variables = new HashMap<>();
-
- if (contentType != null) {
- variables.put(contentTypeVariable, contentType);
- }
-
- CallbackResult result = handleCallback(method, message, messageEventName,
- messageVariable, correlationVariable, correlationValue, LOGMARKER, variables);
-
- if (result instanceof CallbackError) {
- return Response.status(500).entity(((CallbackError)result).getErrorMessage()).build();
- } else {
- return Response.status(204).build();
- }
- }
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java deleted file mode 100644 index 25c67fed63..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java +++ /dev/null @@ -1,615 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.workflow.service;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.camunda.bpm.engine.HistoryService;
-import org.camunda.bpm.engine.ProcessEngineException;
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.history.HistoricVariableInstance;
-import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.camunda.bpm.engine.variable.VariableMap;
-import org.camunda.bpm.engine.variable.Variables;
-import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats;
-import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
-import org.openecomp.mso.bpmn.core.WorkflowException;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.slf4j.MDC;
-
-@Path("/workflow")
-public class WorkflowResource extends ProcessEngineAwareService {
-
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- private static final String LOGMARKER = "[WRKFLOW-RESOURCE]";
-
- private static final int DEFAULT_WAIT_TIME = 30000;
-
- @Context
- private UriInfo uriInfo = null;
-
- /**
- * Starts the process instance and responds to client synchronously
- * If the request does not contain mso-service-request-timeout then it waits for the value specified in DEFAULT_WAIT_TIME
- * Note: value specified in mso-service-request-timeout is in seconds
- * During polling time, if there is an exception encountered in the process execution then polling is stopped and the error response is
- * returned to the client
- * @param processKey
- * @param variableMap
- * @return
- */
- @POST
- @Path("/services/{processKey}")
- @Produces("application/json")
- @Consumes("application/json")
- public Response startProcessInstanceByKey(@PathParam("processKey") String processKey,
- VariableMapImpl variableMap) {
-
- Map<String, Object> inputVariables = getInputVariables(variableMap);
- setLogContext(processKey, inputVariables);
-
- WorkflowResponse workflowResponse = new WorkflowResponse();
- long startTime = System.currentTimeMillis();
- ProcessInstance processInstance = null;
-
- try {
- //Kickoff the process
- ProcessThread thread = new ProcessThread(inputVariables,processKey,msoLogger);
- thread.start();
-
- Map<String, Object> responseMap = null;
-
- //wait for process to be completed
- long waitTime = getWaitTime(inputVariables);
- long now = System.currentTimeMillis();
- long start = now;
- long endTime = start + waitTime;
- long pollingInterval = 500;
-
- // TEMPORARY LOGIC FOR UNIT TEST REFACTORING
- // If this is a unit test (method is invoked directly), wait a max
- // of 5 seconds after process ended for a result. In production,
- // wait up to 60 seconds.
- long timeToWaitAfterProcessEnded = uriInfo == null ? 5000 : 60000;
- AtomicLong timeProcessEnded = new AtomicLong(0);
- boolean endedWithNoResponse = false;
-
- while (now <= endTime) {
- Thread.sleep(pollingInterval);
-
- now = System.currentTimeMillis();
-
- // Increase the polling interval over time
-
- long elapsed = now - start;
-
- if (elapsed > 60000) {
- pollingInterval = 5000;
- } else if (elapsed > 10000) {
- pollingInterval = 1000;
- }
- Exception exception = thread.getException();
- if (exception != null) {
- throw new Exception(exception);
- }
-
- processInstance = thread.getProcessInstance();
-
- if (processInstance == null) {
- msoLogger.debug(LOGMARKER + processKey + " process has not been created yet");
- continue;
- }
-
- String processInstanceId = processInstance.getId();
- workflowResponse.setProcessInstanceId(processInstanceId);
-
- responseMap = getResponseMap(processInstance, processKey, timeProcessEnded);
-
- if (responseMap == null) {
- msoLogger.debug(LOGMARKER + processKey + " has not produced a response yet");
-
- if (timeProcessEnded.longValue() != 0) {
- long elapsedSinceEnded = System.currentTimeMillis() - timeProcessEnded.longValue();
-
- if (elapsedSinceEnded > timeToWaitAfterProcessEnded) {
- endedWithNoResponse = true;
- break;
- }
- }
- } else {
- processResponseMap(workflowResponse, responseMap);
- recordEvents(processKey, workflowResponse, startTime);
- return Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build();
- }
- }
-
- //if we dont get response after waiting then send timeout response
-
- String state;
- String processInstanceId;
-
- if (processInstance == null) {
- processInstanceId = "N/A";
- state = "NOT STARTED";
- } else {
- processInstanceId = processInstance.getProcessInstanceId();
- state = isProcessEnded(processInstanceId) ? "ENDED" : "NOT ENDED";
- }
-
- workflowResponse.setMessage("Fail");
- if (endedWithNoResponse) {
- workflowResponse.setContent("Process ended without producing a response");
- } else {
- workflowResponse.setContent("Request timed out, process state: " + state);
- }
- workflowResponse.setProcessInstanceId(processInstanceId);
- recordEvents(processKey, workflowResponse, startTime);
- workflowResponse.setMessageCode(500);
- return Response.status(500).entity(workflowResponse).build();
- } catch (Exception ex) {
- msoLogger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex);
- workflowResponse.setMessage("Fail" );
- workflowResponse.setContent("Error occurred while executing the process: " + ex.getMessage());
- if (processInstance != null) workflowResponse.setProcessInstanceId(processInstance.getId());
-
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey),
- MsoLogger.ErrorCode.UnknownError, LOGMARKER + workflowResponse.getMessage()
- + " for processKey: " + processKey + " with content: " + workflowResponse.getContent());
-
- workflowResponse.setMessageCode(500);
- recordEvents(processKey, workflowResponse, startTime);
- return Response.status(500).entity(workflowResponse).build();
- }
- }
-
- /**
- * Returns the wait time, this is used by the resource on how long it should wait to send a response
- * If none specified DEFAULT_WAIT_TIME is used
- * @param inputVariables
- * @return
- */
- private int getWaitTime(Map<String, Object> inputVariables)
- {
- String timeout = inputVariables.get("mso-service-request-timeout") == null
- ? null : inputVariables.get("mso-service-request-timeout").toString();
-
- if (timeout != null) {
- try {
- return Integer.parseInt(timeout)*1000;
- } catch (NumberFormatException nex) {
- msoLogger.debug("Invalid input for mso-service-request-timeout");
- }
- }
- return DEFAULT_WAIT_TIME;
- }
-
- private void recordEvents(String processKey, WorkflowResponse response, long startTime) {
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent());
- }
-
- private void setLogContext(String processKey, Map<String, Object> inputVariables) {
- MsoLogger.setServiceName("MSO." + processKey);
- if (inputVariables != null) {
- MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "mso-request-id"),
- getValueFromInputVariables(inputVariables, "mso-service-instance-id"));
- }
- }
-
- private String getValueFromInputVariables(Map<String,Object> inputVariables, String key) {
- Object value = inputVariables.get(key);
- if (value == null) {
- return "N/A";
- } else {
- return value.toString();
- }
- }
-
- /**
- * Checks to see if the specified process is ended.
- * @param processInstanceId the process instance ID
- * @return true if the process is ended
- */
- private boolean isProcessEnded(String processInstanceId) {
- ProcessEngineServices pes = getProcessEngineServices();
- try {
- return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ;
- } catch (Exception e) {
- msoLogger.debug("Exception :",e);
- return true;
- }
- }
-
- private void processResponseMap(WorkflowResponse workflowResponse, Map<String, Object> responseMap) {
- Object object = responseMap.get("Response");
- String content = object == null ? null : String.valueOf(object);
- if (content == null){
- object = responseMap.get("WorkflowResponse");
- content = object == null ? null : String.valueOf(object);
- }
-
- workflowResponse.setContent(content);
-
- object = responseMap.get("ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
-
- try {
- workflowResponse.setMessageCode(Integer.parseInt(responseCode));
- } catch(NumberFormatException nex) {
- msoLogger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode);
- workflowResponse.setMessageCode(-1);
- }
-
- Object status = responseMap.get("Status");
-
- if ("Success".equalsIgnoreCase(String.valueOf(status))) {
- workflowResponse.setMessage("Success");
- } else if ("Fail".equalsIgnoreCase(String.valueOf(status))) {
- workflowResponse.setMessage("Fail");
- } else {
- msoLogger.debug(LOGMARKER + "Unrecognized Status: " + responseCode);
- workflowResponse.setMessage("Fail");
- }
- }
-
- /**
- * @version 1.0
- * Triggers the workflow in a separate thread
- */
- private class ProcessThread extends Thread {
- private final Map<String,Object> inputVariables;
- private final String processKey;
- private final MsoLogger msoLogger;
- private final String businessKey;
- private ProcessInstance processInstance = null;
- private Exception exception = null;
-
- public ProcessThread(Map<String, Object> inputVariables, String processKey, MsoLogger msoLogger) {
- this.inputVariables = inputVariables;
- this.processKey = processKey;
- this.msoLogger = msoLogger;
- this.businessKey = UUID.randomUUID().toString();
- }
-
- /**
- * If an exception occurs when starting the process instance, it may
- * be obtained by calling this method. Note that exceptions are only
- * recorded while the process is executing in its original thread.
- * Once a process is suspended, exception recording stops.
- * @return the exception, or null if none has occurred
- */
- public Exception getException() {
- return exception;
- }
-
-
- public ProcessInstance getProcessInstance() {
- return this.processInstance;
- }
-
- /**
- * Sets the process instance exception.
- * @param exception the exception
- */
- private void setException(Exception exception) {
- this.exception = exception;
- }
-
- public void run() {
- setLogContext(processKey, inputVariables);
-
- long startTime = System.currentTimeMillis();
-
- try {
- msoLogger.debug(LOGMARKER + "***Received MSO startProcessInstanceByKey with processKey:"
- + processKey + " and variables: " + inputVariables);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER
- + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with"
- + " processKey:" + processKey
- + " businessKey:" + businessKey
- + " variables: " + inputVariables);
-
- RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
-
- // Note that this method doesn't return until the process suspends
- // itself or finishes. We provide a business key so we can identify
- // the process instance immediately.
- processInstance = runtimeService.startProcessInstanceByKey(
- processKey, inputVariables);
-
- } catch (Exception e) {
- msoLogger.debug(LOGMARKER + "ProcessThread caught an exception executing "
- + processKey + ": " + e);
- setException(e);
- }
- }
-
- }
-
- private Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
- VariableMap inputVariables = Variables.createVariables();
- @SuppressWarnings("unchecked")
- Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (String key : vMap.keySet()) { //variabe name vn
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String,Object>)vMap.get(key); //value, type
- inputVariables.putValueTyped(key, Variables
- .objectValue(valueMap.get("value"))
- .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value
- .create());
- }
- return inputVariables;
- }
-
- /**
- * Attempts to get a response map from the specified process instance.
- * @return the response map, or null if it is unavailable
- */
- private Map<String, Object> getResponseMap(ProcessInstance processInstance,
- String processKey, AtomicLong timeProcessEnded) {
-
- String responseMapVariable = processKey + "ResponseMap";
- String processInstanceId = processInstance.getId();
-
- // Query the runtime service to see if a response map is ready.
-
-/* RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
- List<Execution> executions = runtimeService.createExecutionQuery()
- .processInstanceId(processInstanceId).list();
-
- for (Execution execution : executions) {
- @SuppressWarnings("unchecked")
- Map<String, Object> responseMap = (Map<String, Object>)
- getVariableFromExecution(runtimeService, execution.getId(),
- responseMapVariable);
-
- if (responseMap != null) {
- msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable
- + " from process " + processInstanceId + " execution "
- + execution.getId());
- return responseMap;
- }
- }
-*/
- //Querying history seem to return consistent results compared to querying the runtime service
-
- boolean alreadyEnded = timeProcessEnded.longValue() != 0;
-
- if (alreadyEnded || isProcessEnded(processInstance.getId())) {
- if (!alreadyEnded) {
- timeProcessEnded.set(System.currentTimeMillis());
- }
-
- // Query the history service to see if a response map exists.
-
- HistoryService historyService = getProcessEngineServices().getHistoryService();
- @SuppressWarnings("unchecked")
- Map<String, Object> responseMap = (Map<String, Object>)
- getVariableFromHistory(historyService, processInstance.getId(),
- responseMapVariable);
-
- if (responseMap != null) {
- msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable
- + " from process " + processInstanceId + " history");
- return responseMap;
- }
-
- // Query the history service for old-style response variables.
-
- String prefix = (String) getVariableFromHistory(historyService, processInstanceId, "prefix");
-
- if (prefix != null) {
-
- // Check for 'WorkflowResponse' variable
- Object workflowResponseObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowResponse");
- String workflowResponse = workflowResponseObject == null ? null : String.valueOf(workflowResponseObject);
- msoLogger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse);
-
- if (workflowResponse != null) {
- Object responseCodeObject = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject);
- msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
- responseMap = new HashMap<>();
- responseMap.put("WorkflowResponse", workflowResponse);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Success");
- return responseMap;
- }
-
-
- // Check for 'WorkflowException' variable
- WorkflowException workflowException = null;
- String workflowExceptionText = null;
-
- Object workflowExceptionObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowException");
- if(workflowExceptionObject != null) {
- if(workflowExceptionObject instanceof WorkflowException) {
- workflowException = (WorkflowException) workflowExceptionObject;
- workflowExceptionText = workflowException.toString();
- responseMap = new HashMap<>();
- responseMap.put("WorkflowException", workflowExceptionText);
- responseMap.put("ResponseCode", workflowException.getErrorCode());
- responseMap.put("Status", "Fail");
- return responseMap;
- }
- else if (workflowExceptionObject instanceof String) {
- Object object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- workflowExceptionText = (String) workflowExceptionObject;
- responseMap = new HashMap<>();
- responseMap.put("WorkflowException", workflowExceptionText);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Fail");
- return responseMap;
- }
-
- }
- msoLogger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText);
-
- // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE
- Object object = getVariableFromHistory(historyService, processInstanceId, processKey + "Response");
- String response = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + processKey + "Response: " + response);
-
- if (response != null) {
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
- responseMap = new HashMap<>();
- responseMap.put("Response", response);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Success");
- return responseMap;
- }
-
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ErrorResponse");
- String errorResponse = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse);
-
- if (errorResponse != null) {
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
- responseMap = new HashMap<>();
- responseMap.put("Response", errorResponse);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Fail");
- return responseMap;
- }
- // END LEGACY SUPPORT. TODO: REMOVE THIS CODE
- }
- }
- return null;
- }
-
- /**
- * Gets a variable value from the specified execution.
- * @return the variable value, or null if the variable could not be
- * obtained
- */
- private Object getVariableFromExecution(RuntimeService runtimeService,
- String executionId, String variableName) {
- try {
- return runtimeService.getVariable(executionId, variableName);
- } catch (ProcessEngineException e) {
- // Most likely cause is that the execution no longer exists.
- msoLogger.debug("Error retrieving execution " + executionId
- + " variable " + variableName + ": " + e);
- return null;
- }
- }
- /**
- * Gets a variable value from specified historical process instance.
- * @return the variable value, or null if the variable could not be
- * obtained
- */
- private Object getVariableFromHistory(HistoryService historyService,
- String processInstanceId, String variableName) {
- try {
- HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery()
- .processInstanceId(processInstanceId).variableName(variableName).singleResult();
- return v == null ? null : v.getValue();
- } catch (Exception e) {
- msoLogger.debug("Error retrieving process " + processInstanceId
- + " variable " + variableName + " from history: " + e);
- return null;
- }
- }
-
- @POST
- @Path("/services/{processKey}/{processInstanceId}")
- @Produces("application/json")
- @Consumes("application/json")
- public WorkflowResponse getProcessVariables(@PathParam("processKey") String processKey, @PathParam("processInstanceId") String processInstanceId) {
- //TODO filter only set of variables
- WorkflowResponse response = new WorkflowResponse();
-
- long startTime = System.currentTimeMillis();
- try {
- ProcessEngineServices engine = getProcessEngineServices();
- List<HistoricVariableInstance> variables = engine.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).list();
- Map<String,String> variablesMap = new HashMap<>();
- for (HistoricVariableInstance variableInstance: variables) {
- variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString());
- }
-
- msoLogger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " + variablesMap.toString());
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER
- + "Call to MSO workflow/services in Camunda. Received MSO getProcessVariables with processKey:"
- + processKey + " and variables: "
- + variablesMap.toString());
-
-
- response.setVariables(variablesMap);
- response.setMessage("Success");
- response.setContent("Successfully retrieved the variables");
- response.setProcessInstanceId(processInstanceId);
-
- msoLogger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with content: " + response.getContent());
- } catch (Exception ex) {
- response.setMessage("Fail");
- response.setContent("Failed to retrieve the variables," + ex.getMessage());
- response.setProcessInstanceId(processInstanceId);
-
- msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), MsoLogger.ErrorCode.UnknownError, LOGMARKER
- + response.getMessage()
- + " for processKey: "
- + processKey
- + " with content: "
- + response.getContent());
- msoLogger.debug("Exception :",ex);
- }
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent());
-
- return response;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClient.java deleted file mode 100644 index 5e3aca5613..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClient.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.adapter.network;
-
-import org.openecomp.mso.adapters.nwrest.CreateNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.CreateNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.DeleteNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.DeleteNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.QueryNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.RollbackNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.RollbackNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.UpdateNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.UpdateNetworkResponse;
-
-public interface NetworkAdapterClient {
-
- CreateNetworkResponse createNetwork(CreateNetworkRequest req);
-
- DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req);
-
- RollbackNetworkResponse rollbackNetwork(String aaiNetworkId, RollbackNetworkRequest req);
-
- QueryNetworkResponse queryNetwork(String aaiNetworkId, String cloudSiteId, String tenantId, String networkStackId, boolean skipAAI, String requestId, String serviceInstanceId);
-
- UpdateNetworkResponse updateNetwork(String aaiNetworkId, UpdateNetworkRequest req);
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientImpl.java deleted file mode 100644 index 6a1c862a66..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientImpl.java +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.adapter.network; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.UriBuilder; - -import org.openecomp.mso.adapters.nwrest.CreateNetworkRequest; -import org.openecomp.mso.adapters.nwrest.CreateNetworkResponse; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkRequest; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkResponse; -import org.openecomp.mso.adapters.nwrest.QueryNetworkResponse; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkRequest; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkResponse; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkRequest; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkResponse; -import org.openecomp.mso.client.adapter.vnf.AdapterRestClient; - -public class NetworkAdapterClientImpl implements NetworkAdapterClient { - - private final NetworkAdapterRestProperties props; - public NetworkAdapterClientImpl() { - this.props = new NetworkAdapterRestProperties(); - } - @Override - public CreateNetworkResponse createNetwork(CreateNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("").build()).post(req, - CreateNetworkResponse.class); - } - - @Override - public DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req, - DeleteNetworkResponse.class); - } - - @Override - public RollbackNetworkResponse rollbackNetwork(String aaiNetworkId, RollbackNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req, - RollbackNetworkResponse.class); - } - - @Override - public QueryNetworkResponse queryNetwork(String aaiNetworkId, String cloudSiteId, String tenantId, - String networkStackId, boolean skipAAI, String requestId, String serviceInstanceId) { - UriBuilder builder = this.getUri("/" + aaiNetworkId); - if (cloudSiteId != null) { - builder.queryParam("cloudSiteId", cloudSiteId); - } - if (tenantId != null) { - builder.queryParam("tenantId", tenantId); - } - if (networkStackId != null) { - builder.queryParam("networkStackId", networkStackId); - } - - builder.queryParam("skipAAI", skipAAI); - - if (requestId != null) { - builder.queryParam("msoRequest.requestId", requestId); - } - if (serviceInstanceId != null) { - builder.queryParam("msoRequest.serviceInstanceId", serviceInstanceId); - } - return new AdapterRestClient(this.props, builder.build(), MediaType.TEXT_XML, MediaType.TEXT_XML) - .get(QueryNetworkResponse.class); - } - - @Override - public UpdateNetworkResponse updateNetwork(String aaiNetworkId, UpdateNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).put(req, - UpdateNetworkResponse.class); - } - - protected UriBuilder getUri(String path) { - return UriBuilder.fromPath(path); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapter.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapter.java deleted file mode 100644 index c3ba8e16ea..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapter.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.adapter.requests.db; - -import org.openecomp.mso.client.adapter.requests.db.entities.MsoRequestsDbException; -import org.openecomp.mso.client.adapter.requests.db.entities.UpdateInfraRequest; -import org.openecomp.mso.requestsdb.InfraActiveRequests; - -public interface MsoRequestsDbAdapter { - - public void updateInfraRequest(UpdateInfraRequest request) throws MsoRequestsDbException; - - public InfraActiveRequests getInfraRequest(String requestId) throws MsoRequestsDbException; - - public boolean getSiteStatus(String siteName); - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java deleted file mode 100644 index 2443169151..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java +++ /dev/null @@ -1,300 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.client.adapter.requests.db;
-
-import java.sql.Timestamp;
-
-import org.hibernate.HibernateException;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.openecomp.mso.client.adapter.requests.db.entities.MsoRequestsDbException;
-import org.openecomp.mso.client.adapter.requests.db.entities.RequestStatusType;
-import org.openecomp.mso.client.adapter.requests.db.entities.UpdateInfraRequest;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.requestsdb.InfraActiveRequests;
-import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
-import org.openecomp.mso.requestsdb.SiteStatus;
-import org.openecomp.mso.utils.UUIDChecker;
-
-public class MsoRequestsDbAdapterClient implements MsoRequestsDbAdapter {
-
- protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
-
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
-
- @Override
- public void updateInfraRequest(UpdateInfraRequest request) throws MsoRequestsDbException {
- Session session = requestsDbSessionFactoryManager.getSessionFactory().openSession();
- int result = 0;
- long startTime = System.currentTimeMillis();
- if (request.getRequestId() != null && request.getLastModifiedBy() != null) {
- MsoLogger.setLogContext(request.getRequestId(), null);
- try {
- session.beginTransaction();
- StringBuilder queryString = new StringBuilder("update InfraActiveRequests set ");
- String statusMessage = null;
- String responseBody = null;
- RequestStatusType requestStatus = null;
- String progress = null;
- String vnfOutputs = null;
- String serviceInstanceId = null;
- String networkId = null;
- String vnfId = null;
- String vfModuleId = null;
- String volumeGroupId = null;
- String serviceInstanceName = null;
- String vfModuleName = null;
- String configurationId = null;
- String configurationName = null;
- if (request.getStatusMessage() != null) {
- queryString.append("statusMessage = :statusMessage, ");
- statusMessage = request.getStatusMessage();
- }
- if (request.getResponseBody() != null) {
- queryString.append("responseBody = :responseBody, ");
- responseBody = request.getResponseBody();
- }
- if (request.getRequestStatus() != null) {
- queryString.append("requestStatus = :requestStatus, ");
- requestStatus = request.getRequestStatus();
- }
- if (request.getProgress() != null) {
- queryString.append("progress = :progress, ");
- progress = request.getProgress();
- }
- if (request.getVnfOutputs() != null) {
- queryString.append("vnfOutputs = :vnfOutputs, ");
- vnfOutputs = request.getVnfOutputs();
- }
- if (request.getServiceInstanceId() != null) {
- queryString.append("serviceInstanceId = :serviceInstanceId, ");
- serviceInstanceId = request.getServiceInstanceId();
- }
- if (request.getNetworkId() != null) {
- queryString.append("networkId = :networkId, ");
- networkId = request.getNetworkId();
- }
- if (request.getVnfId() != null) {
- queryString.append("vnfId = :vnfId, ");
- vnfId = request.getVnfId();
- }
- if (request.getVfModuleId() != null) {
- queryString.append("vfModuleId = :vfModuleId, ");
- vfModuleId = request.getVfModuleId();
- }
- if (request.getVolumeGroupId() != null) {
- queryString.append("volumeGroupId = :volumeGroupId, ");
- volumeGroupId = request.getVolumeGroupId();
- }
- if (request.getServiceInstanceName() != null) {
- queryString.append("serviceInstanceName = :serviceInstanceName, ");
- serviceInstanceName = request.getServiceInstanceName();
- }
- if (request.getVfModuleName() != null) {
- queryString.append("vfModuleName = :vfModuleName, ");
- vfModuleName = request.getVfModuleName();
- }
- if (request.getConfigurationId() != null) {
- queryString.append("configurationId = :configurationId, ");
- configurationId = request.getConfigurationId();
- }
- if (request.getConfigurationName() != null) {
- queryString.append("configurationName = :configurationName, ");
- configurationName = request.getConfigurationName();
- }
- if (request.getRequestStatus() == RequestStatusType.COMPLETE
- || request.getRequestStatus() == RequestStatusType.FAILED) {
- queryString.append("endTime = :endTime, ");
- } else {
- queryString.append("modifyTime = :modifyTime, ");
- }
- queryString.append("lastModifiedBy = :lastModifiedBy where requestId = :requestId OR clientRequestId = :requestId");
-
- LOGGER.debug("Executing update: " + queryString.toString());
-
- Query query = session.createQuery(queryString.toString());
- query.setParameter("requestId", request.getRequestId());
- if (statusMessage != null) {
- query.setParameter("statusMessage", statusMessage);
- LOGGER.debug("StatusMessage in updateInfraRequest is set to: " + statusMessage);
- }
- if (responseBody != null) {
- query.setParameter("responseBody", responseBody);
- LOGGER.debug("ResponseBody in updateInfraRequest is set to: " + responseBody);
- }
- if (requestStatus != null) {
- query.setParameter("requestStatus", requestStatus.toString());
- LOGGER.debug("RequestStatus in updateInfraRequest is set to: " + requestStatus.toString());
- }
-
- if (progress != null) {
- query.setParameter("progress", Long.parseLong(progress));
- LOGGER.debug("Progress in updateInfraRequest is set to: " + progress);
- }
- if (vnfOutputs != null) {
- query.setParameter("vnfOutputs", vnfOutputs);
- LOGGER.debug("VnfOutputs in updateInfraRequest is set to: " + vnfOutputs);
- }
- if (serviceInstanceId != null) {
- query.setParameter("serviceInstanceId", serviceInstanceId);
- LOGGER.debug("ServiceInstanceId in updateInfraRequest is set to: " + serviceInstanceId);
- }
- if (networkId != null) {
- query.setParameter("networkId", networkId);
- LOGGER.debug("NetworkId in updateInfraRequest is set to: " + networkId);
- }
- if (vnfId != null) {
- query.setParameter("vnfId", vnfId);
- LOGGER.debug("VnfId in updateInfraRequest is set to: " + vnfId);
- }
- if (vfModuleId != null) {
- query.setParameter("vfModuleId", vfModuleId);
- LOGGER.debug("vfModuleId in updateInfraRequest is set to: " + vfModuleId);
- }
- if (volumeGroupId != null) {
- query.setParameter("volumeGroupId", volumeGroupId);
- LOGGER.debug("VolumeGroupId in updateInfraRequest is set to: " + volumeGroupId);
- }
- if (serviceInstanceName != null) {
- query.setParameter("serviceInstanceName", serviceInstanceName);
- LOGGER.debug("ServiceInstanceName in updateInfraRequest is set to: " + serviceInstanceName);
- }
- if (configurationId != null) {
- query.setParameter("configurationId", configurationId);
- LOGGER.debug("configurationId in updateInfraRequest is set to: " + configurationId);
- }
- if (configurationName != null) {
- query.setParameter("configurationName", configurationName);
- LOGGER.debug("configurationName in updateInfraRequest is set to: " + configurationName);
- }
- if (vfModuleName != null) {
- query.setParameter("vfModuleName", vfModuleName);
- LOGGER.debug("vfModuleName in updateInfraRequest is set to: " + vfModuleName);
- }
- Timestamp nowTimeStamp = new Timestamp(System.currentTimeMillis());
- if (request.getRequestStatus() == RequestStatusType.COMPLETE
- || request.getRequestStatus() == RequestStatusType.FAILED) {
- query.setParameter("endTime", nowTimeStamp);
- LOGGER.debug("EndTime in updateInfraRequest is set to: " + nowTimeStamp);
- } else {
- query.setParameter("modifyTime", nowTimeStamp);
- LOGGER.debug("ModifyTime in updateInfraRequest is set to: " + nowTimeStamp);
- }
- query.setParameter("lastModifiedBy", request.getLastModifiedBy());
- LOGGER.debug("LastModifiedBy in updateInfraRequest is set to: " + request.getLastModifiedBy());
- result = query.executeUpdate();
- checkIfExists(result, request.getRequestId(), startTime);
- session.getTransaction().commit();
- } catch (HibernateException e) {
- String error = "Unable to update MSO Requests DB: " + e.getMessage();
- LOGGER.error(MessageEnum.RA_CANT_UPDATE_REQUEST, "infra request parameters", request.getRequestId(), "",
- "", MsoLogger.ErrorCode.BusinessProcesssError, "HibernateException - " + error, e);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
- error);
- throw new MsoRequestsDbException(error, e);
- } finally {
- if (session != null && session.isOpen()) {
- session.close();
- }
- }
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- } else {
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest,
- "Required fields: requestId and lastModifiedBy");
- }
- }
-
- private void checkIfExists(int result, String requestId, long startTime) throws MsoRequestsDbException {
- if (result == 0) {
- String error = "Request ID does not exist in MSO Requests DB: " + requestId;
- LOGGER.error(MessageEnum.RA_DB_REQUEST_NOT_EXIST, requestId, "", "", MsoLogger.ErrorCode.DataError, error);
- throw new MsoRequestsDbException(error);
- }
- }
-
- @Override
- public InfraActiveRequests getInfraRequest(String requestId) throws MsoRequestsDbException {
- long startTime = System.currentTimeMillis();
- MsoLogger.setLogContext(requestId, null);
- Session session = requestsDbSessionFactoryManager.getSessionFactory().openSession();
-
- LOGGER.debug("Call to MSO Infra RequestsDb adapter get method with request Id: " + requestId);
-
- InfraActiveRequests request = null;
- try {
- session.beginTransaction();
- Query query = session.createQuery(
- "FROM InfraActiveRequests where requestId = :requestId OR clientRequestId = :requestId");
- query.setParameter("requestId", requestId);
- request = (InfraActiveRequests) query.uniqueResult();
- } catch (HibernateException e) {
- String error = "Unable to retrieve MSO Infra Requests DB for Request ID " + requestId;
- LOGGER.error(MessageEnum.RA_DB_REQUEST_NOT_EXIST, "Get Infra request", requestId, "", "",
- MsoLogger.ErrorCode.BusinessProcesssError, "HibernateException - " + error, e);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error);
- throw new MsoRequestsDbException(error, e);
- } finally {
- if (session != null && session.isOpen()) {
- session.close();
- }
- }
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- return request;
- }
-
- /**
- * Get SiteStatus by SiteName.
- *
- * @param siteName
- * The unique name of the site
- * @return Status of that site
- */
- public boolean getSiteStatus(String siteName) {
- UUIDChecker.generateUUID(LOGGER);
- Session session = requestsDbSessionFactoryManager.getSessionFactory().openSession();
-
- long startTime = System.currentTimeMillis();
- SiteStatus siteStatus = null;
- LOGGER.debug("Request database - get Site Status with Site name:" + siteName);
- try {
- String hql = "FROM SiteStatus WHERE siteName = :site_name";
- Query query = session.createQuery(hql);
- query.setParameter("site_name", siteName);
-
- siteStatus = (SiteStatus) query.uniqueResult();
- } finally {
- if (session != null && session.isOpen()) {
- session.close();
- }
- }
- if (siteStatus == null) {
- // if not exist in DB, it means the site is not disabled, thus
- // return true
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- return true;
- } else {
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- return siteStatus.getStatus();
- }
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbException.java deleted file mode 100644 index a495d0eac1..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbException.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.adapter.requests.db.entities; - - - -import javax.xml.ws.WebFault; - -/** - * This class simply extends Exception (without addition additional functionality) - * to provide an identifier for RequestsDB related exceptions on create, delete, query. - * - * - */ -@WebFault (name="MsoRequestsDbException", faultBean="org.openecomp.mso.adapters.requestsdb.exceptions.MsoRequestsDbExceptionBean", targetNamespace="http://org.openecomp.mso/requestsdb") -public class MsoRequestsDbException extends Exception { - - private static final long serialVersionUID = 1L; - - private MsoRequestsDbExceptionBean faultInfo; - - public MsoRequestsDbException (String msg) { - super(msg); - faultInfo = new MsoRequestsDbExceptionBean (msg); - } - - public MsoRequestsDbException (Throwable e) { - super(e); - faultInfo = new MsoRequestsDbExceptionBean (e.getMessage()); - } - - public MsoRequestsDbException (String msg, Throwable e) { - super (msg, e); - faultInfo = new MsoRequestsDbExceptionBean (msg); - } - - public MsoRequestsDbExceptionBean getFaultInfo() { - return faultInfo; - } - - public void setFaultInfo(MsoRequestsDbExceptionBean faultInfo) { - this.faultInfo = faultInfo; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/RequestStatusType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/RequestStatusType.java deleted file mode 100644 index 2fa6f2b6a2..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/RequestStatusType.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.07.24 at 11:49:17 AM EDT -// - - -package org.openecomp.mso.client.adapter.requests.db.entities; - - - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for request-status-type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * <p> - * <pre> - * <simpleType name="request-status-type"> - * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> - * <enumeration value="COMPLETE"/> - * <enumeration value="FAILED"/> - * <enumeration value="IN_PROGRESS"/> - * </restriction> - * </simpleType> - * </pre> - * - */ -@XmlType(name = "request-status-type") -@XmlEnum -public enum RequestStatusType { - - COMPLETE, - FAILED, - IN_PROGRESS; - - public String value() { - return name(); - } - - public static RequestStatusType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequest.java deleted file mode 100644 index 15c57253f3..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequest.java +++ /dev/null @@ -1,138 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.adapter.requests.db.entities;
-
-public class UpdateInfraRequest {
-
- private String requestId;
- private String lastModifiedBy;
- private String statusMessage;
- private String responseBody;
- private RequestStatusType requestStatus;
- private String progress;
- private String vnfOutputs;
- private String serviceInstanceId;
- private String networkId;
- private String vnfId;
- private String vfModuleId;
- private String volumeGroupId;
- private String serviceInstanceName;
- private String configurationId;
- private String configurationName;
- private String vfModuleName;
-
- public String getRequestId() {
- return requestId;
- }
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
- public String getLastModifiedBy() {
- return lastModifiedBy;
- }
- public void setLastModifiedBy(String lastModifiedBy) {
- this.lastModifiedBy = lastModifiedBy;
- }
- public String getStatusMessage() {
- return statusMessage;
- }
- public void setStatusMessage(String statusMessage) {
- this.statusMessage = statusMessage;
- }
- public String getResponseBody() {
- return responseBody;
- }
- public void setResponseBody(String responseBody) {
- this.responseBody = responseBody;
- }
- public RequestStatusType getRequestStatus() {
- return requestStatus;
- }
- public void setRequestStatus(RequestStatusType requestStatus) {
- this.requestStatus = requestStatus;
- }
- public String getProgress() {
- return progress;
- }
- public void setProgress(String progress) {
- this.progress = progress;
- }
- public String getVnfOutputs() {
- return vnfOutputs;
- }
- public void setVnfOutputs(String vnfOutputs) {
- this.vnfOutputs = vnfOutputs;
- }
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
- public String getNetworkId() {
- return networkId;
- }
- public void setNetworkId(String networkId) {
- this.networkId = networkId;
- }
- public String getVnfId() {
- return vnfId;
- }
- public void setVnfId(String vnfId) {
- this.vnfId = vnfId;
- }
- public String getVfModuleId() {
- return vfModuleId;
- }
- public void setVfModuleId(String vfModuleId) {
- this.vfModuleId = vfModuleId;
- }
- public String getVolumeGroupId() {
- return volumeGroupId;
- }
- public void setVolumeGroupId(String volumeGroupId) {
- this.volumeGroupId = volumeGroupId;
- }
- public String getServiceInstanceName() {
- return serviceInstanceName;
- }
- public void setServiceInstanceName(String serviceInstanceName) {
- this.serviceInstanceName = serviceInstanceName;
- }
- public String getConfigurationId() {
- return configurationId;
- }
- public void setConfigurationId(String configurationId) {
- this.configurationId = configurationId;
- }
- public String getConfigurationName() {
- return configurationName;
- }
- public void setConfigurationName(String configurationName) {
- this.configurationName = configurationName;
- }
- public String getVfModuleName() {
- return vfModuleName;
- }
- public void setVfModuleName(String vfModuleName) {
- this.vfModuleName = vfModuleName;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java deleted file mode 100644 index 16fd351b43..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.adapter.vnf; - -import java.net.URI; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; - -import javax.ws.rs.client.ClientResponseFilter; -import javax.ws.rs.ext.ContextResolver; - -import org.openecomp.mso.client.ResponseExceptionMapperImpl; -import org.openecomp.mso.client.policy.JettisonStyleMapperProvider; -import org.openecomp.mso.client.policy.RestClient; - -import com.fasterxml.jackson.databind.ObjectMapper; - -public class AdapterRestClient extends RestClient { - - private final AdapterRestProperties props; - public AdapterRestClient(AdapterRestProperties props, URI uri) { - super(props, UUID.randomUUID(), Optional.of(uri)); - this.props = props; - } - - public AdapterRestClient(AdapterRestProperties props, URI uri, String accept, String contentType) { - super(props, UUID.randomUUID(), Optional.of(uri), accept, contentType); - this.props = props; - } - - @Override - protected void initializeHeaderMap(Map<String, String> headerMap) { - addBasicAuthHeader(props.getAuth(), props.getKey()); - } - - @Override - protected Optional<ClientResponseFilter> addResponseFilter() { - return Optional.of(new ResponseExceptionMapperImpl()); - } - - @Override - public RestClient addRequestId(UUID requestId) { - return null; - } - - @Override - protected ContextResolver<ObjectMapper> getMapper() { - return new JettisonStyleMapperProvider(); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClient.java deleted file mode 100644 index 5ee38fe0fb..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClient.java +++ /dev/null @@ -1,48 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.client.adapter.vnf;
-
-import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.CreateVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.QueryVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleResponse;
-
-public interface VnfAdapterClient {
-
- CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req);
-
- RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, RollbackVfModuleRequest req);
-
- DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req);
-
- UpdateVfModuleResponse updateVfModule(String aaiVnfId, String aaiVfModuleId, UpdateVfModuleRequest req);
-
- QueryVfModuleResponse queryVfModule(String aaiVnfId, String aaiVfModuleId, String cloudSiteId, String tenantId,
- String vfModuleName, boolean skipAAI, String requestId, String serviceInstanceId);
-
- String healthCheck();
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientImpl.java deleted file mode 100644 index 2b391d302d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.adapter.vnf; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.UriBuilder; - -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.QueryVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleResponse; - -public class VnfAdapterClientImpl implements VnfAdapterClient { - - private static final String VF_MODULES = "/vf-modules/"; - - private final VnfAdapterRestProperties props; - public VnfAdapterClientImpl() { - this.props = new VnfAdapterRestProperties(); - } - - @Override - public CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + "/vf-modules").build()).post(req, - CreateVfModuleResponse.class); - } - - @Override - public RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, - RollbackVfModuleRequest req) { - return new AdapterRestClient(this.props, - this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId + "/rollback").build()).delete(req, - RollbackVfModuleResponse.class); - } - - @Override - public DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build()) - .delete(req, DeleteVfModuleResponse.class); - } - - @Override - public UpdateVfModuleResponse updateVfModule(String aaiVnfId, String aaiVfModuleId, UpdateVfModuleRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build()) - .put(req, UpdateVfModuleResponse.class); - } - - @Override - public QueryVfModuleResponse queryVfModule(String aaiVnfId, String aaiVfModuleId, String cloudSiteId, - String tenantId, String vfModuleName, boolean skipAAI, String requestId, String serviceInstanceId) { - UriBuilder builder = this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId); - if (cloudSiteId != null) { - builder.queryParam("cloudSiteId", cloudSiteId); - } - if (tenantId != null) { - builder.queryParam("tenantId", tenantId); - } - if (vfModuleName != null) { - builder.queryParam("vfModuleName", vfModuleName); - } - - builder.queryParam("skipAAI", skipAAI); - - if (requestId != null) { - builder.queryParam("msoRequest.requestId", requestId); - } - if (serviceInstanceId != null) { - builder.queryParam("msoRequest.serviceInstanceId", serviceInstanceId); - } - return new AdapterRestClient(this.props, builder.build(), MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON) - .get(QueryVfModuleResponse.class); - } - - @Override - public String healthCheck() { - return new AdapterRestClient(this.props, this.getUri("/healthcheck").build()).get(String.class); - } - - public UriBuilder getUri(String path) { - return UriBuilder.fromPath(path); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterRestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterRestProperties.java deleted file mode 100644 index e342aeedac..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterRestProperties.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.adapter.vnf; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; - -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.adapter.vnf.AdapterRestProperties; - -public class VnfAdapterRestProperties implements AdapterRestProperties { - - private final Map<String, String> props; - - public VnfAdapterRestProperties() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - } - - @Override - public String getAuth() { - return props.get("mso.adapters.po.auth"); - } - @Override - public String getKey() { - return props.get("mso.msoKey"); - } - @Override - public URL getEndpoint() throws MalformedURLException { - return new URL(props.get("mso.adapters.vnf.rest.endpoint")); - } - - @Override - public String getSystemName() { - return "MSO"; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/AAIOrchestrator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/AAIOrchestrator.java deleted file mode 100644 index 73bad21c87..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/AAIOrchestrator.java +++ /dev/null @@ -1,114 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.orchestration; - -import java.util.Optional; -import java.util.logging.Logger; - -import org.modelmapper.ModelMapper; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.client.aai.AAIResourcesClient; -import org.openecomp.mso.client.aai.entities.AAIEntityObject; -import org.openecomp.mso.client.aai.objects.AAIOwningEntity; -import org.openecomp.mso.client.aai.objects.AAIProject; -import org.openecomp.mso.client.aai.objects.AAIServiceInstance; - -public class AAIOrchestrator { - - private static Logger LOGGER = Logger.getLogger("AAIOrchestrator"); - - public void createServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(serviceInstance.getUri(), Optional.of(serviceInstance)); - }catch(Exception ex) { - String msg = "Failed to create service instance in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void deleteServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.delete(serviceInstance.getUri()); - } catch (Exception ex) { - String msg = "Failed to delete service instance in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void createProject(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject project = modelMapper.map(serviceDecomp.getProject(), AAIProject.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(project.getUri(), Optional.of(project)); - }catch(Exception ex) { - String msg = "Failed to create project in A&AI."; - throw new IllegalStateException(msg); } - } - - public void createProjectandConnectServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject project = modelMapper.map(serviceDecomp.getProject(), AAIProject.class); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(project.getUri(), Optional.of(project)).connect(project.getUri(), serviceInstance.getUri()); - } catch(Exception ex) { - String msg = "Failed to create project and connect service instance in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void createOwningEntity(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject owningEntity = modelMapper.map(serviceDecomp.getOwningEntity(), AAIOwningEntity.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(owningEntity.getUri(), Optional.of(owningEntity)); - }catch(Exception ex) { - String msg = "Failed to create owning entity in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void createOwningEntityandConnectServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject owningEntity = modelMapper.map(serviceDecomp.getOwningEntity(), AAIOwningEntity.class); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(owningEntity.getUri(), Optional.of(owningEntity)).connect(owningEntity.getUri(), serviceInstance.getUri()); - }catch(Exception ex) { - String msg = "Failed to create owning entity and connect service instance in A&AI."; - throw new IllegalStateException(msg); } - } - - protected AAIResourcesClient getClient() { - return new AAIResourcesClient(); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/SDNCOrchestrator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/SDNCOrchestrator.java deleted file mode 100644 index 4cefad2a3b..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/SDNCOrchestrator.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.orchestration;
-
-import java.util.Optional;
-import java.util.logging.Logger;
-
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
-import org.openecomp.mso.client.sdnc.beans.SDNCRequest;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation;
-import org.openecomp.mso.client.sdnc.mapper.ServiceTopologyOperationRequestMapper;
-import org.openecomp.mso.client.sdnc.sync.SDNCSyncRpcClient;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-public class SDNCOrchestrator {
-
- private static MsoPropertiesFactory msoPF = new MsoPropertiesFactory();
-
- public void createServiceInstance (ServiceDecomposition serviceDecomp) {
-
- try{
- msoPF.initializeMsoProperties("MSO_PROP_SDNC_ADAPTER", "mso.sdnc.properties");
- Optional<String> msoAction = getMSOAction(serviceDecomp);
- ServiceTopologyOperationRequestMapper sdncRM = new ServiceTopologyOperationRequestMapper(msoAction, SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, "CreateServiceInstance");
- SDNCRequest request = sdncRM.reqMapper(serviceDecomp);
- SDNCSyncRpcClient sdncRC = new SDNCSyncRpcClient (request, msoPF);
- sdncRC.run();
- } catch (Exception ex) {
- throw new IllegalStateException();
- }
- }
-
- private Optional<String> getMSOAction (ServiceDecomposition serviceDecomp){
- String serviceType = serviceDecomp.getServiceInstance().getServiceType();
- if(serviceType == null || serviceType.equals("")){
- return Optional.empty();
- }
-
- return Optional.of(serviceType);
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCRequest.java deleted file mode 100644 index cd04fc5ef0..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCRequest.java +++ /dev/null @@ -1,95 +0,0 @@ -/*-
- * ============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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.client.sdnc.beans;
-
-public class SDNCRequest {
- private String requestId;
- private String svcInstanceId;
- private SDNCSvcAction svcAction;
- private SDNCSvcOperation svcOperation;
- private String callbackUrl;
- private String msoAction;
- private String requestData;
-
- public SDNCRequest(String requestId, String svcInstanceId, SDNCSvcAction svcAction, SDNCSvcOperation svcOperation,
- String callbackUrl, String msoAction, String requestData) {
- this.requestId = requestId;
- this.svcInstanceId = svcInstanceId;
- this.svcAction = svcAction;
- this.svcOperation = svcOperation;
- this.callbackUrl = callbackUrl;
- this.msoAction = msoAction;
- this.requestData = requestData;
- }
- public SDNCRequest(){
-
- }
-
- public String getRequestId() {
- return requestId;
- }
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
- public String getSvcInstanceId() {
- return svcInstanceId;
- }
- public void setSvcInstanceId(String svcInstanceId) {
- this.svcInstanceId = svcInstanceId;
- }
- public SDNCSvcAction getSvcAction() {
- return svcAction;
- }
- public void setSvcAction(SDNCSvcAction svcAction) {
- this.svcAction = svcAction;
- }
- public SDNCSvcOperation getSvcOperation() {
- return svcOperation;
- }
- public void setSvcOperation(SDNCSvcOperation svcOperation) {
- this.svcOperation = svcOperation;
- }
- public String getCallbackUrl() {
- return callbackUrl;
- }
- public void setCallbackUrl(String callbackUrl) {
- this.callbackUrl = callbackUrl;
- }
- public String getMsoAction() {
- return msoAction;
- }
- public void setMsoAction(String msoAction) {
- this.msoAction = msoAction;
- }
-
- public String getRequestData() {
- return requestData;
- }
- public void setRequestData(String requestData) {
- this.requestData = requestData;
- }
- @Override
- public String toString() {
- return "SDNCRequest [requestId=" + requestId + ", svcInstanceId=" + svcInstanceId + ", svcAction=" + svcAction
- + ", svcOperation=" + svcOperation + ", callbackUrl=" + callbackUrl + ", msoAction=" + msoAction
- + ", requestData=" + requestData + "]";
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcOperation.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcOperation.java deleted file mode 100644 index 8cf1052064..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcOperation.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.beans;
-
-public enum SDNCSvcOperation {
-
- VF_MODULE_TOPOLOGY_OPERATION("vf-module-topology-operation"),
- NETWORK_TOPOLOGY_OPERATION("network-topology-operation"),
- VNF_TOPOLOGY_OPERATION("vnf-topology-operation"),
- CONTRAIL_ROUTE_TOPOLOGY_OPERATION("contrail-route-topology-operation"),
- SECURITY_ZONE_TOPOLOGY_OPERATION("security-zone-topology-operation"),
- PORT_MIRROR_TOPOLOGY_OPERATION("port-mirror-topology-operation"),
- SERVICE_TOPOLOGY_OPERATION("service-topology-operation");
-
- private final String name;
-
- private SDNCSvcOperation(String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- return name;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/SDNCRequestMapper.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/SDNCRequestMapper.java deleted file mode 100644 index 3e714e901d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/SDNCRequestMapper.java +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.mapper;
-
-import java.util.Optional;
-
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
-import org.openecomp.mso.client.sdnc.beans.SDNCRequest;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation;
-
-public abstract class SDNCRequestMapper {
-
- protected final Optional<String> msoAction;
- protected final SDNCSvcOperation svcOperation;
- protected final SDNCSvcAction svcAction;
- protected final String requestAction;
-
- public SDNCRequestMapper (Optional<String> msoAction, SDNCSvcOperation svcOperation,
- SDNCSvcAction svcAction, String requestAction) {
- this.msoAction = msoAction;
- this.svcOperation = svcOperation;
- this.svcAction = svcAction;
- this.requestAction = requestAction;
- }
-
- public abstract SDNCRequest reqMapper (ServiceDecomposition serviceDecomp);
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/ServiceTopologyOperationRequestMapper.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/ServiceTopologyOperationRequestMapper.java deleted file mode 100644 index b87ed00650..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/ServiceTopologyOperationRequestMapper.java +++ /dev/null @@ -1,98 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.mapper;
-
-import java.io.StringWriter;
-import java.util.Optional;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
-import org.openecomp.mso.client.sdnc.beans.SDNCRequest;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation;
-
-import openecomp.org.mso.workflow.schema.v1.EcompModelInformation;
-import openecomp.org.mso.workflow.schema.v1.RequestInformation;
-import openecomp.org.mso.workflow.schema.v1.SDNCServiceInstanceRequestData;
-import openecomp.org.mso.workflow.schema.v1.ServiceInformation;
-import openecomp.org.mso.workflow.schema.v1.ServiceRequestInput;
-
-public class ServiceTopologyOperationRequestMapper extends SDNCRequestMapper{
-
- public ServiceTopologyOperationRequestMapper(Optional<String> msoAction, SDNCSvcOperation svcOperation,
- SDNCSvcAction svcAction, String requestAction) {
- super(msoAction, svcOperation, svcAction, requestAction);
- }
-
- @Override
- public SDNCRequest reqMapper (ServiceDecomposition serviceDecomp) {
- SDNCRequest req = new SDNCRequest();
- req.setCallbackUrl(serviceDecomp.getCallbackURN());
- if(msoAction.isPresent()){
- req.setMsoAction(msoAction.get());
- }
- req.setRequestId(serviceDecomp.getRequest().getSdncRequestId());
- req.setSvcInstanceId(serviceDecomp.getServiceInstance().getInstanceId());
- req.setSvcAction(svcAction);
- req.setSvcOperation(svcOperation);
- String reqData ="";
-
- RequestInformation reqInfo = new RequestInformation();
- reqInfo.setRequestAction(requestAction);
- reqInfo.setSource("MSO");
- reqInfo.setRequestId(serviceDecomp.getRequest().getRequestId());
- ServiceInformation servInfo = new ServiceInformation();
- EcompModelInformation emi = new EcompModelInformation();
- emi.setModelInvariantUuid(serviceDecomp.getRequest().getModelInfo().getModelInvariantUuid());
- emi.setModelName(serviceDecomp.getRequest().getModelInfo().getModelName());
- emi.setModelVersion(serviceDecomp.getRequest().getModelInfo().getModelVersion() );
- servInfo.setEcompModelInformation(emi);
- servInfo.setServiceId(serviceDecomp.getServiceInstance().getServiceId());
- servInfo.setSubscriptionServiceType(serviceDecomp.getCustomer().getSubscriptionServiceType());
- servInfo.setServiceInstanceId(serviceDecomp.getServiceInstance().getInstanceName());
- servInfo.setGlobalCustomerId(serviceDecomp.getCustomer().getGlobalSubscriberId());
- ServiceRequestInput servReqInput = new ServiceRequestInput();
- servReqInput.setServiceInstanceName(serviceDecomp.getServiceInstance().getInstanceName());
- SDNCServiceInstanceRequestData sdncSIRD = new SDNCServiceInstanceRequestData();
- sdncSIRD.setRequestInformation(reqInfo);
- sdncSIRD.setServiceInformation(servInfo);
- sdncSIRD.setServiceRequestInput(servReqInput);
-
- try {
- JAXBContext context = JAXBContext.newInstance(SDNCServiceInstanceRequestData.class);
-
- Marshaller jaxbMarshaller = context.createMarshaller();
- jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
-
- StringWriter sw = new StringWriter();
- jaxbMarshaller.marshal(sdncSIRD, sw);
- reqData = sw.toString();
- req.setRequestData(reqData);
- } catch (JAXBException e) {
- e.printStackTrace();
- }
-
- return req;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/CallbackHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/CallbackHeader.java deleted file mode 100644 index 2ddafc1c17..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/CallbackHeader.java +++ /dev/null @@ -1,154 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.sync; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="ResponseCode" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="ResponseMessage" type="{http://www.w3.org/2001/XMLSchema}string"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -//SDNCAdapter to BPEL Async response header -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "responseCode", - "responseMessage" -}) -@XmlRootElement(name = "CallbackHeader") -public class CallbackHeader { - - @XmlElement(name = "RequestId", required = true) - protected String requestId; - @XmlElement(name = "ResponseCode", required = true) - protected String responseCode; - @XmlElement(name = "ResponseMessage", required = true) - protected String responseMessage; - - public CallbackHeader() { - } - - public CallbackHeader(String reqId, String respCode, String respMsg) { - this.requestId = reqId; - this.responseCode = respCode; - this.responseMessage = respMsg; - } - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - /** - * Gets the value of the responseCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseCode() { - return responseCode; - } - - /** - * Sets the value of the responseCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseCode(String value) { - this.responseCode = value; - } - - /** - * Gets the value of the responseMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseMessage() { - return responseMessage; - } - - /** - * Sets the value of the responseMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseMessage(String value) { - this.responseMessage = value; - } - - @Override - public String toString() { - return "CallbackHeader [requestId=" + requestId + ", responseCode=" - + responseCode + ", responseMessage=" + responseMessage + "]"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Constants.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Constants.java deleted file mode 100644 index 331fefa677..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Constants.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.sync; - - -public interface Constants { - - public static final String BPEL_REST_URL_PROP = "org.openecomp.mso.adapters.sdnc.rest.bpelurl"; - public static final String BPEL_URL_PROP = "org.openecomp.mso.adapters.sdnc.bpelurl"; - public static final String DEFAULT_BPEL_URL = "http://localhost:8080//active-bpel/services/SDNCAdapterCallbackV1"; - - public static final String MY_URL_PROP = "org.openecomp.mso.adapters.sdnc.myurl"; - public static final String DEFAULT_MY_URL = "https://localhost:8443/adapters/rest/SDNCNotify"; - - public static final String SDNC_AUTH_PROP = "org.openecomp.mso.adapters.sdnc.sdncauth"; - public static final String DEFAULT_SDNC_AUTH = "406B2AE613211B6FB52466DE6E1769AC"; - - public static final String DEFAULT_BPEL_AUTH = "05FDA034C27D1CA51AAB8FAE512EDE45241E16FC8C137D292AA3A964431C82DB"; - public static final String BPEL_AUTH_PROP = "org.openecomp.mso.adapters.sdnc.bpelauth"; - - - public static final String SDNC_SVCCFGRESP_ROOT = "input"; - public static final String SDNC_REQ_ID = "/svc-request-id"; - public static final String SDNC_RESP_CODE = "/response-code"; - public static final String SDNC_RESP_MSG = "/response-message"; - public static final String SDNC_CONNECTTIME_PROP = "org.openecomp.mso.adapters.sdnc.sdncconnecttime"; - public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; - - public static final String REQUEST_TUNABLES = "org.openecomp.mso.adapters.sdnc"; -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/ObjectFactory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/ObjectFactory.java deleted file mode 100644 index 3ddfdb2925..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/ObjectFactory.java +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.sync; - - -import javax.xml.bind.annotation.XmlRegistry; - - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the org.openecomp.mso.adapters.sdnc package. - * <p>An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.adapters.sdnc - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link RequestHeader } - * - */ - public RequestHeader createRequestHeader() { - return new RequestHeader(); - } - - /** - * Create an instance of {@link SDNCAdapterResponse } - * - */ - public SDNCAdapterResponse createSDNCAdapterResponse() { - return new SDNCAdapterResponse(); - } - - /** - * Create an instance of {@link SDNCAdapterRequest } - * - */ - public SDNCAdapterRequest createSDNCAdapterRequest() { - return new SDNCAdapterRequest(); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestHeader.java deleted file mode 100644 index dee79898fa..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestHeader.java +++ /dev/null @@ -1,219 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.sync; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="SvcInstanceId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="SvcAction" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="SvcOperation" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="CallbackUrl" type="{http://www.w3.org/2001/XMLSchema}string"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -//BPEL to SDNCAdapter request header -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "svcInstanceId", - "svcAction", - "svcOperation", - "callbackUrl", - "msoAction" -}) -@XmlRootElement(name = "RequestHeader") -public class RequestHeader { - - @XmlElement(name = "RequestId", required = true) - protected String requestId; - @XmlElement(name = "SvcInstanceId") - protected String svcInstanceId; - @XmlElement(name = "SvcAction", required = true) - protected String svcAction; - @XmlElement(name = "SvcOperation", required = true) - protected String svcOperation; - @XmlElement(name = "CallbackUrl", required = true) - protected String callbackUrl; - @XmlElement(name = "MsoAction") - protected String msoAction; - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - public String getSvcInstanceId() { - return svcInstanceId; - } - - public void setSvcInstanceId(String svcInstanceId) { - this.svcInstanceId = svcInstanceId; - } - - /** - * Gets the value of the svcAction property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSvcAction() { - return svcAction; - } - - /** - * Sets the value of the svcAction property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSvcAction(String value) { - this.svcAction = value; - } - - /** - * Gets the value of the svcOperation property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSvcOperation() { - return svcOperation; - } - - /** - * Sets the value of the svcOperation property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSvcOperation(String value) { - this.svcOperation = value; - } - - /** - * Gets the value of the callbackUrl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCallbackUrl() { - return callbackUrl; - } - - /** - * Sets the value of the callbackUrl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCallbackUrl(String value) { - this.callbackUrl = value; - } - - /** - * Gets the value of the callbackUrl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMsoAction() { - return msoAction; - } - - /** - * Sets the value of the callbackUrl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMsoAction(String value) { - this.msoAction = value; - } - - - @Override - public String toString() { - return "RequestHeader [requestId=" + requestId + - ", svcInstanceId=" + svcInstanceId + - ", svcAction=" + svcAction + - ", svcOperation=" + svcOperation + - ", callbackUrl=" + callbackUrl + - ", msoAction=" + msoAction + "]"; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestTunables.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestTunables.java deleted file mode 100644 index 55d42df6e1..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestTunables.java +++ /dev/null @@ -1,222 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.sync; - - -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -import org.openecomp.mso.logger.MessageEnum; -public class RequestTunables { - - private MsoPropertiesFactory msoPropertiesFactory; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER"; - - //criteria - private String reqId = ""; - private String msoAction = ""; - private String operation = ""; - private String action = ""; - - //tunables - private String reqMethod = "POST"; - private String sdncUrl = null; - private String timeout = "60000"; - private String headerName = "sdnc-request-header"; - private String namespace = ""; - private String asyncInd = "N"; //future use - - private String sdncaNotificationUrl = null; - - public RequestTunables(String reqId, String msoAction, String operation, String action, MsoPropertiesFactory msoPropFactory) { - super(); - msoPropertiesFactory = msoPropFactory; - if (reqId != null) { - this.reqId = reqId; - } - if (msoAction != null) { - this.msoAction = msoAction; - } - if (operation != null) { - this.operation = operation; - } - if (action != null) { - this.action = action; - } - } - - public String getReqId() { - return reqId; - } - public void setReqId(String reqId) { - this.reqId = reqId; - } - public String getReqMethod() { - return reqMethod; - } - public void setReqMethod(String reqMethod) { - this.reqMethod = reqMethod; - } - public String getMsoAction() { - return msoAction; - } - public void setMsoAction(String msoAction) { - this.msoAction = msoAction; - } - public String getAction() { - return action; - } - public void setAction(String action) { - this.action = action; - } - public String getOperation() { - return operation; - } - public void setOperation(String operation) { - this.operation = operation; - } - public String getSdncUrl() { - return sdncUrl; - } - public void setSdncUrl(String sdncUrl) { - this.sdncUrl = sdncUrl; - } - public String getTimeout() { - return timeout; - } - public void setTimeout(String timeout) { - this.timeout = timeout; - } - public String getAsyncInd() { - return asyncInd; - } - public void setAsyncInd(String asyncInd) { - this.asyncInd = asyncInd; - } - public String getHeaderName() { - return headerName; - } - public void setHeaderName(String headerName) { - this.headerName = headerName; - } - - - public String getSdncaNotificationUrl() { - return sdncaNotificationUrl; - } - - public void setSdncaNotificationUrl(String sdncaNotificationUrl) { - this.sdncaNotificationUrl = sdncaNotificationUrl; - } - - public String getNamespace() { - return namespace; - } - - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - @Override - public String toString() { - return "RequestTunables [reqId=" + reqId + ", msoAction=" + msoAction - + ", operation=" + operation + ", action=" + action - + ", reqMethod=" + reqMethod + ", sdncUrl=" + sdncUrl - + ", timeout=" + timeout + ", headerName=" + headerName - + ", sdncaNotificationUrl=" + sdncaNotificationUrl - + ", namespace=" + namespace + "]"; - } - - public void setTunables() - { - String error = null; - String key = null; - if ("query".equals(action)) { //due to variable format for operation eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9 - key = Constants.REQUEST_TUNABLES + "." + msoAction + ".." + action; - msoLogger.debug("Generated key: " + key); - } - else if ("put".equals(action) || "restdelete".equals(action)) { //due to variable format for operation eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9 - key = Constants.REQUEST_TUNABLES + "..." + action; - msoLogger.debug("Generated key: " + key); - } else { - key = Constants.REQUEST_TUNABLES + "." + msoAction + "." + operation +"." + action; - msoLogger.debug("Generated key: " + key); - } - - String value; - try { - value = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getProperty(key, ""); - } catch (MsoPropertiesException e) { - msoLogger.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Mso Properties ID not found in cache: " + MSO_PROP_SDNC_ADAPTER, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - value=""; - } - - if (value != null && value.length() > 0) { - - String[] parts = value.split("\\|"); //escape pipe - if (parts.length < 3) { - msoLogger.warn(MessageEnum.RA_SDNC_INVALID_CONFIG, key, value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config"); - } - - for (int i = 0; i < parts.length; i++) { - if (i == 0) { - reqMethod = parts[i]; - msoLogger.debug("Request Method is set to: " + reqMethod); - } else if (i == 1) { - timeout = parts[i]; - msoLogger.debug("Timeout is set to: " + timeout); - } else if (i == 2) { - sdncUrl = SDNCAdapterPortTypeImpl.getProperty(Constants.REQUEST_TUNABLES + "." + parts[i], "",msoPropertiesFactory); - if (operation != null && sdncUrl != null) { - sdncUrl = sdncUrl + operation; - } - msoLogger.debug("SDNC Url is set to: " + sdncUrl); - } else if (i == 3) { - headerName = parts[i]; - msoLogger.debug("HeaderName is set to: " + headerName); - } else if (i == 4) { - namespace = parts[i]; - msoLogger.debug("NameSpace is set to: " + namespace); - } else if (i == 5) { - asyncInd = parts[i]; - msoLogger.debug("AsyncInd is set to: " + asyncInd); - } - } - if (sdncUrl == null) { - error = "Invalid configuration, sdncUrl required for:" + key + " value:" + value; - } - } else { - error = "Missing configuration for:" + key; - } - if (error != null) { - msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, key, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param"); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - } - msoLogger.debug ("RequestTunables Key:" + key + " Value:" + value + " Tunables:" + this.toString()); - return; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequest.java deleted file mode 100644 index 6e9d6757ad..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequest.java +++ /dev/null @@ -1,136 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.sync; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import java.io.StringWriter; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}CallbackHeader"/> - * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -//SDNCAdapter to BPEL Async response -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "callbackHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterCallbackRequest") -public class SDNCAdapterCallbackRequest { - - @XmlElement(name = "CallbackHeader", required = true) - protected CallbackHeader callbackHeader; - @XmlElement(name = "RequestData") - protected Object requestData; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - /** - * Gets the value of the callbackHeader property. - * - * @return - * possible object is - * {@link CallbackHeader } - * - */ - public CallbackHeader getCallbackHeader() { - return callbackHeader; - } - - /** - * Sets the value of the callbackHeader property. - * - * @param value - * allowed object is - * {@link CallbackHeader } - * - */ - public void setCallbackHeader(CallbackHeader value) { - this.callbackHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - - @Override - public String toString() { - try { - JAXBContext ctx = JAXBContext.newInstance("org.openecomp.mso.adapters.sdnc.client"); - Marshaller m = ctx.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); - StringWriter w = new StringWriter(); - m.marshal(this, w); - return (w.toString()); - } - catch (Exception e) - { - msoLogger.error(MessageEnum.RA_MARSHING_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception - MARSHING_ERROR", e); - } - return(""); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortType.java deleted file mode 100644 index 8b56932769..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortType.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.sync; - - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.bind.annotation.XmlSeeAlso; - -import org.openecomp.mso.client.sdnc.beans.SDNCRequest; - - -/** - * This class was generated by Apache CXF 2.7.11.redhat-3 - * 2015-01-27T18:25:50.914-05:00 - * Generated source version: 2.7.11.redhat-3 - * - */ -//BPEL SDNCAdapter SOAP WebService - impl class in impl pkg -@WebService(targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/wsdl/v1", name = "SDNCAdapterPortType") -@XmlSeeAlso({ObjectFactory.class}) -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -public interface SDNCAdapterPortType { - - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterResponse") - @WebMethod(operationName = "SDNCAdapter") - public SDNCAdapterResponse sdncAdapter( - @WebParam(partName = "SDNCAdapterRequest", name = "SDNCAdapterRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1") - SDNCAdapterRequest sdncAdapterRequest - ); - - @WebMethod - public void healthCheck(); - - SDNCAdapterResponse sdncAdapter(SDNCRequest bpelRequest); -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortTypeImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortTypeImpl.java deleted file mode 100644 index 3d9aab666a..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortTypeImpl.java +++ /dev/null @@ -1,108 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.sync; - -import javax.annotation.PostConstruct; -import javax.jws.WebService; -import javax.servlet.http.HttpServletResponse; - -import org.openecomp.mso.client.sdnc.beans.SDNCRequest; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -//BPEL SDNCAdapter SOAP Web Service implementation -@WebService(serviceName = "SDNCAdapterService", endpointInterface = "org.openecomp.mso.client.sdnc.sync.SDNCAdapterPortType", targetNamespace = "http://org.openecomp/workflow/sdnc/ad") -public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { - - private MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory(); - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - private static final String LOG_SERVICE_NAME = "MSO-BPMN:MSO-SDNCAdapter."; - private static final String LOG_REPLY_NAME = "MSO-SDNCAdapter:MSO-BPMN."; - public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER"; - - @PostConstruct - public void init () { - msoLogger.info(MessageEnum.RA_INIT_SDNC_ADAPTER, "SDNC", "SDNCAdapterPortType"); - } - - /** - * Health Check web method. Does nothing but return to show the adapter is deployed. - */ - @Override - public void healthCheck () - { - msoLogger.debug("Health check call in SDNC Adapter"); - } - - public static String getProperty(String key, String defaultValue, MsoPropertiesFactory msoPropertiesFactoryp) { - String value; - try { - value = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getProperty(key, defaultValue); - } catch (MsoPropertiesException e) { - msoLogger.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: " + MSO_PROP_SDNC_ADAPTER, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - return null; - } - msoLogger.debug("Config read for " + MSO_PROP_SDNC_ADAPTER + " - key:" + key + " value:" + value); - return value; - } - - @Override - public SDNCAdapterResponse sdncAdapter(SDNCRequest bpelRequest) { - String bpelReqId = bpelRequest.getRequestId(); - String callbackUrl = bpelRequest.getCallbackUrl(); - long startTime = System.currentTimeMillis (); - MsoLogger.setLogContext(SDNCRequestIdUtil.getSDNCOriginalRequestId (bpelReqId), bpelRequest.getSvcInstanceId()); - MsoLogger.setServiceName (bpelRequest.getSvcAction().toString()); - msoLogger.info(MessageEnum.RA_RECEIVE_BPEL_REQUEST, bpelReqId, callbackUrl, "SDNC", ""); - - SDNCSyncRpcClient sdncClient = new SDNCSyncRpcClient(bpelRequest,msoPropertiesFactory); - long subStartTime = System.currentTimeMillis (); - try { - Thread sdncClientThread = new Thread(sdncClient); - sdncClientThread.start(); - } - catch (Exception e){ - String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage(); - msoLogger.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception sending request to SDNC. Failed to start SDNC Client thread", e); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg); - SDNCResponse sdncResp = new SDNCResponse(bpelReqId); - sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - sdncResp.setRespMsg(respMsg); - } - - msoLogger.debug("Sending synchronous response to BPEL"); - SDNCAdapterResponse wsResp = new SDNCAdapterResponse(); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - return (wsResp); - } - - @Override - public org.openecomp.mso.client.sdnc.sync.SDNCAdapterResponse sdncAdapter( - org.openecomp.mso.client.sdnc.sync.SDNCAdapterRequest sdncAdapterRequest) { - // TODO Auto-generated method stub - return null; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequest.java deleted file mode 100644 index 5beedb12be..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequest.java +++ /dev/null @@ -1,128 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.sync; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}RequestHeader"/> - * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -//BPEL to SDNCAdapter request -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterRequest") -public class SDNCAdapterRequest { - - @XmlElement(name = "RequestHeader", required = true) - protected RequestHeader requestHeader; - @XmlElement(name = "RequestData", required = true) - protected Object requestData; - - /** - * Gets the value of the requestHeader property. - * - * @return - * possible object is - * {@link RequestHeader } - * - */ - public RequestHeader getRequestHeader() { - return requestHeader; - } - - /** - * Sets the value of the requestHeader property. - * - * @param value - * allowed object is - * {@link RequestHeader } - * - */ - public void setRequestHeader(RequestHeader value) { - this.requestHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - - @Override - public String toString() { - - String rd = ""; - if (requestData != null) - { - Node node = (Node) requestData; - Document doc = node.getOwnerDocument(); - rd = Utils.domToStr(doc); - } - return "SDNCAdapterRequest [requestHeader=" + requestHeader.toString() - + ", requestData=" + rd + "]"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterPortType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterPortType.java deleted file mode 100644 index 08d3bdbad7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterPortType.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.sync; - - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.bind.annotation.XmlSeeAlso; - - - -//SDNCAdapter to BPEL Async response WEB Service -@WebService(targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", name = "SDNCCallbackAdapterPortType") -@XmlSeeAlso({ObjectFactory.class}) -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -public interface SDNCCallbackAdapterPortType { - - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") - @WebMethod(operationName = "SDNCAdapterCallback") - public SDNCAdapterResponse sdncAdapterCallback( - @WebParam(partName = "SDNCAdapterCallbackRequest", name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1") - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest - ); -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterService.java deleted file mode 100644 index 0e65a3080f..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterService.java +++ /dev/null @@ -1,126 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.sync; - - -import java.net.URL; - -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceFeature; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * This class was generated by Apache CXF 2.7.11.redhat-3 - * 2015-01-28T11:07:02.074-05:00 - * Generated source version: 2.7.11.redhat-3 - * - */ -//SDNCAdapter to BPEL Async response WEB Service -@WebServiceClient(name = "SDNCCallbackAdapterService", - wsdlLocation = "main/resources/SDNCCallbackAdapter.wsdl", - targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1") -public class SDNCCallbackAdapterService extends Service { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - public final static URL WSDL_LOCATION; - public final static QName SERVICE = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterService"); - public final static QName SDNCCallbackAdapterSoapHttpPort = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterSoapHttpPort"); - static { - URL wsdlUrl = null; - try { - wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCCallbackAdapter.wsdl"); - //wsdlUrl = SDNCCallbackAdapterService.class.getClassLoader().getResource("SDNCCallbackAdapter.wsdl"); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e); - } - if(wsdlUrl == null) { - msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "WSDL not found"); - } else { - try { - msoLogger.info(MessageEnum.RA_PRINT_URL, "SDNCCallbackAdapter.wsdl", wsdlUrl.toURI().toString(), "SDNC", ""); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - URL convention problem", e); - } - } - WSDL_LOCATION = wsdlUrl; - } - - public SDNCCallbackAdapterService(URL wsdlLocation) { - super(wsdlLocation, SERVICE); - } - - public SDNCCallbackAdapterService(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public SDNCCallbackAdapterService() { - super(WSDL_LOCATION, SERVICE); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCCallbackAdapterService(WebServiceFeature ... features) { - super(WSDL_LOCATION, SERVICE, features); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCCallbackAdapterService(URL wsdlLocation, WebServiceFeature ... features) { - super(wsdlLocation, SERVICE, features); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCCallbackAdapterService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) { - super(wsdlLocation, serviceName, features); - } - - /** - * - * @return - * returns SDNCCallbackAdapterPortType - */ - @WebEndpoint(name = "SDNCCallbackAdapterSoapHttpPort") - public SDNCCallbackAdapterPortType getSDNCCallbackAdapterSoapHttpPort() { - return super.getPort(SDNCCallbackAdapterSoapHttpPort, SDNCCallbackAdapterPortType.class); - } - - /** - * - * @param features - * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. - * @return - * returns SDNCCallbackAdapterPortType - */ - @WebEndpoint(name = "SDNCCallbackAdapterSoapHttpPort") - public SDNCCallbackAdapterPortType getSDNCCallbackAdapterSoapHttpPort(WebServiceFeature... features) { - return super.getPort(SDNCCallbackAdapterSoapHttpPort, SDNCCallbackAdapterPortType.class, features); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCRequestIdUtil.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCRequestIdUtil.java deleted file mode 100644 index d905748591..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCRequestIdUtil.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.sync; - - -public class SDNCRequestIdUtil { - // Add private constructor to prevent instance creation. - private SDNCRequestIdUtil () {} - - public static String getSDNCOriginalRequestId (String newRequestId) { - - // Camunda scripts will add postfix, such as -1, -2, on the original requestID, to make sure requestID is unique while sending request to SDNC - // In order to use the unique requestID in logging, need to remove the postfix added by the Camunda scripts - // Verify whether the requestId is a valid UUID with postfix (-1, -2). If yes, it should contain 5 times char '-', since valid UUID contains 4 times '-' - // If the requestId is not a valid UUID with postfix, we do nothing - if (newRequestId.split("-").length == 6) { - return newRequestId.substring(0, newRequestId.lastIndexOf('-')); - } - return newRequestId; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCResponse.java deleted file mode 100644 index 850f5b4734..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCResponse.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.sync; - - -import java.io.Serializable; - -public class SDNCResponse implements Serializable { - - private static final long serialVersionUID = 1L; - private String reqId = null; - private int respCode = 0; - private String respMsg = null; - private String sdncResp = null; - - public SDNCResponse(String reqId) { - this.reqId = reqId; - } - public SDNCResponse(String reqId, int respCode, String respMsg) { - this.reqId = reqId; - this.respCode = respCode; - this.respMsg = respMsg; - } - - public String getReqId() { - return reqId; - } - public void setReqId(String reqId) { - this.reqId = reqId; - } - public int getRespCode() { - return respCode; - } - public void setRespCode(int respCode) { - this.respCode = respCode; - } - public String getRespMsg() { - return respMsg; - } - public void setRespMsg(String respMsg) { - this.respMsg = respMsg; - } - public String getSdncResp() { - return sdncResp; - } - public void setSdncResp(String sdncResp) { - this.sdncResp = sdncResp; - } - - @Override - public String toString() { - return "SDNCResponse [reqId=" + reqId + ", respCode=" + respCode - + ", respMsg=" + respMsg + ", sdncResp=" + sdncResp + "]"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCSyncRpcClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCSyncRpcClient.java deleted file mode 100644 index ce9b706760..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCSyncRpcClient.java +++ /dev/null @@ -1,317 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.sync; - - -import java.io.BufferedReader; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.XMLConstants; -import javax.xml.bind.DatatypeConverter; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.ws.BindingProvider; -import javax.xml.ws.handler.MessageContext; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.json.JSONArray; -import org.json.JSONObject; -import org.openecomp.mso.client.sdnc.beans.SDNCRequest; -import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction; -import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -//SDNCAdapter to SDNC Rest Client -public class SDNCSyncRpcClient implements Runnable { - - private MsoPropertiesFactory msoPropertiesFactory; - - private SDNCRequest bpelRequest; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER"; - - - public SDNCSyncRpcClient(SDNCRequest bpelRequest,MsoPropertiesFactory msoPropFactory) { - this.bpelRequest = bpelRequest; - msoPropertiesFactory = msoPropFactory; - } - - @Override - public void run() - { - String action = bpelRequest.getSvcAction().toString(); - String operation = bpelRequest.getSvcOperation().toString(); - String bpelReqId = bpelRequest.getRequestId(); - String msoAction = bpelRequest.getMsoAction(); - MsoLogger.setLogContext(SDNCRequestIdUtil.getSDNCOriginalRequestId (bpelReqId), bpelRequest.getSvcInstanceId()); - MsoLogger.setServiceName("SDNCRestClient"); - String sdncReqBody = ""; - - msoLogger.debug("BPEL Request:" + bpelRequest.toString()); - RequestTunables rt = new RequestTunables(bpelReqId, msoAction, operation, action, msoPropertiesFactory); - rt.setTunables(); - rt.setSdncaNotificationUrl(SDNCAdapterPortTypeImpl.getProperty(Constants.MY_URL_PROP, Constants.DEFAULT_MY_URL,msoPropertiesFactory)); - - if ("POST".equals(rt.getReqMethod())) { - try { - DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - InputSource is = new InputSource(); - is.setCharacterStream(new StringReader(bpelRequest.getRequestData())); - Document reqDoc = db.parse(is); - sdncReqBody = Utils.genSdncReq(reqDoc, rt); - }catch(Exception ex) { - throw new IllegalStateException(); - } - } else if("PUT".equals(rt.getReqMethod())) { - try { - DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - InputSource is = new InputSource(); - is.setCharacterStream(new StringReader(bpelRequest.getRequestData())); - Document reqDoc = db.parse(is); - sdncReqBody = Utils.genSdncPutReq(reqDoc, rt); - }catch(Exception ex) { - throw new IllegalStateException(); - } - } - long sdncStartTime = System.currentTimeMillis(); - SDNCResponse sdncResp = getSdncResp(sdncReqBody, rt, msoPropertiesFactory); - msoLogger.recordMetricEvent (sdncStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from SDNC", "SDNC", action + "." + operation, null); - msoLogger.debug ("Got the SDNC Code : " + sdncResp.getRespCode()); - msoLogger.debug ("Got the SDNC Response Message:" + sdncResp.getRespMsg()); - validateSDNCResponse(sdncResp.getSdncResp()); - return; - } - - public static SDNCResponse getSdncResp(String sdncReqBody, RequestTunables rt, MsoPropertiesFactory msoPropertiesFactoryp) { - URL url; - HttpURLConnection con = null; - DataOutputStream out = null; - BufferedReader in = null; - SDNCResponse sdncResp = new SDNCResponse(rt.getReqId()); - StringBuffer response = new StringBuffer(); - - msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, rt.toString(), "SDNC", ""); - msoLogger.debug("SDNC Request Body:\n" + sdncReqBody); - - try { - msoLogger.debug("url is: " + rt.getSdncUrl()); - url = new URL(rt.getSdncUrl()); - con = (HttpURLConnection) url.openConnection(); - con.setConnectTimeout(Integer.parseInt(SDNCAdapterPortTypeImpl.getProperty(Constants.SDNC_CONNECTTIME_PROP, "2000",msoPropertiesFactoryp))); - con.setReadTimeout(Integer.parseInt(rt.getTimeout())); - con.setRequestProperty("Accept", "application/json"); - String userCredentials = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getEncryptedProperty(Constants.SDNC_AUTH_PROP, Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); - - String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); - con.setRequestProperty ("Authorization", basicAuth); - con.setRequestMethod(rt.getReqMethod()); - - if ("POST".equals(rt.getReqMethod()) || "PUT".equals(rt.getReqMethod())) { - con.setRequestProperty("Content-type", "application/json"); - con.setRequestProperty("Content-length",String.valueOf(sdncReqBody.length())); - con.setDoOutput(true); - out = new DataOutputStream(con.getOutputStream()); - out.writeBytes(sdncReqBody); - out.flush(); - out.close(); - } - - //Get response - sdncResp.setRespCode(con.getResponseCode()); - sdncResp.setRespMsg(con.getResponseMessage()); - - if (con.getResponseCode()>= 200 && con.getResponseCode()<=299) { - in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - //Not parsing the response -it contains a responseHdr section and data section - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - } - - sdncResp.setSdncResp(response.toString()); - msoLogger.info(MessageEnum.RA_RESPONSE_FROM_SDNC, sdncResp.toString(), "SDNC", ""); - return(sdncResp); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception processing request to SDNC", e); - //default - sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR); - String respMsg = "Error processing request to SDNC. "; - String sdncErrMsg = null; - - if (e instanceof java.net.SocketTimeoutException ) { - sdncResp.setRespCode(HttpURLConnection.HTTP_CLIENT_TIMEOUT); - respMsg = "Request to SDNC timed out. "; - } - if (con != null) { - try { //e1 - if (con.getResponseCode() != HttpURLConnection.HTTP_OK) //seen in SocketException connection reset - sdncResp.setRespCode(con.getResponseCode()); - respMsg = respMsg + con.getResponseMessage() + ". "; - InputStream is = con.getErrorStream(); - if (is != null) { - XPathFactory xpathFactory = XPathFactory.newInstance(); - XPath xpath = xpathFactory.newXPath(); - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true); - DocumentBuilder db; - Document doc = null; - try { //e2 - db = dbf.newDocumentBuilder(); - doc = db.parse(is); - NodeList errors = (NodeList)xpath.evaluate("errors/error", doc, XPathConstants.NODESET); - for (int i = 0; i < errors.getLength(); i++) { - Element error = (Element) errors.item(i); - String eType = null; - try { - eType = xpath.evaluate("error-type", error); - sdncErrMsg = ". SDNC Returned-[error-type:" + eType; - } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); - } - - String eTag = null; - try { - eTag = xpath.evaluate( "error-tag", error); - sdncErrMsg = sdncErrMsg + ", error-tag:" + eTag; - } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); - } - - String eMsg = null; - try { - eMsg = xpath.evaluate("error-message", error); - sdncErrMsg = sdncErrMsg + ", error-message:" + eMsg + "]"; - } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); - } - } - } catch (Exception e2) { - msoLogger.error (MessageEnum.RA_ANALYZE_ERROR_EXC, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while analyse error", e2); - } - } //is != null - } catch (Exception e1) { - msoLogger.error (MessageEnum.RA_ERROR_GET_RESPONSE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while get SDNC response", e1); - } - } //con != null - - if (e.getMessage() != null) { - respMsg = respMsg + e.getMessage(); - } - if (sdncErrMsg != null) { - respMsg = respMsg + sdncErrMsg; - } - - sdncResp.setRespMsg(respMsg); - - msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with SDNC", e); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg); - return(sdncResp); - } - finally { - if (con != null) { - con.disconnect(); - } - } - } - public void validateSDNCResponse (String sdncResponse){ - String msg; - msoLogger.debug ("Starting validate sdnc response"); - String responseMessage = ""; - String responseCode = ""; - if (sdncResponse != null || !sdncResponse.equals("")){ - try{ - msoLogger.debug ("Got the SDNC Response: " + sdncResponse); - JSONObject jsonObj = new JSONObject(sdncResponse); - msoLogger.debug ("jsonObj has been created"); - - JSONObject requestData = jsonObj.getJSONObject("v1:RequestData"); - JSONObject output = requestData.getJSONObject("output"); - try{ - responseMessage = output.getString("response-message"); - responseCode = output.getString("response-code"); - } catch (Exception ex) { - msoLogger.debug("Response not in lower hyphen"); - } - if(responseMessage.equals("")&&responseCode.equals("")){ - try{ - responseMessage = output.getString("ResponseMessage"); - responseCode = output.getString("ResponseCode"); - } catch (Exception ex) { - msoLogger.debug("Response does not exist"); - } - } - msoLogger.debug("ResponseMessage is: " + responseMessage); - msoLogger.debug("Response Code is: " + responseCode); - if(responseMessage.equals("")){ - msg = "Error from SDNC: Response Message is empty."; - msoLogger.debug(msg); - throw new IllegalStateException(msg); - } - - if(responseCode.equals("")){ - responseCode = "0"; - } - - int code = Integer.parseInt(responseCode); - if(code >=200 && code <=299 || code ==0){ - msoLogger.debug ("Successful Response from SDNC"); - - } else { - msg = "Error from SDNC: Code is not 200-299 or 0."; - msoLogger.debug(msg); - throw new IllegalStateException(msg); - } - } catch (Exception ex) { - msg = "Validate SDNC Response has failed."; - msoLogger.debug(msg); - throw new IllegalStateException(msg); - } - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Utils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Utils.java deleted file mode 100644 index 7457b59390..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Utils.java +++ /dev/null @@ -1,195 +0,0 @@ -/*- - * ============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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.client.sdnc.sync; - - -import java.io.StringWriter; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -public class Utils { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - public static String genSdncReq(Document reqDoc, RequestTunables rt) { - try { - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - //NewDoc for output - //Root - Document newdoc = db.newDocument(); - Element root = newdoc.createElementNS(rt.getNamespace(), "input"); - newdoc.appendChild(root); - - //Header - Element hdr = newdoc.createElement(rt.getHeaderName()); - root.appendChild(hdr); - - String elemData = rt.getReqId(); - Element hdrChild; - if (elemData != null && elemData.length() > 0) - { - hdrChild = newdoc.createElement("svc-request-id"); - hdrChild.appendChild(newdoc.createTextNode(elemData)); - hdr.appendChild(hdrChild); - } - - elemData = rt.getAction(); - if (elemData != null && elemData.length() > 0) - { - hdrChild = newdoc.createElement("svc-action"); - hdrChild.appendChild(newdoc.createTextNode(elemData)); - hdr.appendChild(hdrChild); - } - - elemData = rt.getSdncaNotificationUrl(); - if (elemData != null && elemData.length() > 0) - { - hdrChild = newdoc.createElement("svc-notification-url"); - hdrChild.appendChild(newdoc.createTextNode(elemData)); - hdr.appendChild(hdrChild); - } - - //RequestData - NodeList nodes = reqDoc.getDocumentElement().getChildNodes(); - for (int i = 0; i < nodes.getLength(); i++) { - Node n = nodes.item(i); - Node newNode = newdoc.importNode(n, true); - root.appendChild(newNode); - } - - String s = domToStr(newdoc); - msoLogger.debug("Formatted SdncReq:\n" + s); - return (s); - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in genSdncReq", e); - } - return(null); - } - - public static String genSdncPutReq(Document reqDoc, RequestTunables rt) { - try { - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - //NewDoc for output - //Root - Document newdoc = db.newDocument(); - - //RequestData - NodeList nodes = reqDoc.getDocumentElement().getChildNodes(); - - - Element root = newdoc.createElement(nodes.item(0).getNodeName()); - newdoc.appendChild(root); - - NodeList childNodes = nodes.item(0).getChildNodes(); - for (int i = 0; i < childNodes.getLength(); i++) { - Node n = childNodes.item(i); - Node newNode = newdoc.importNode(n, true); - root.appendChild(newNode); - } - - String s = domToStr(newdoc); - msoLogger.debug("Formatted SdncPutReq:\n" + s); - return (s); - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genSdncPutReq", e); - } - return(null); - } - - public static String genMsoFailResp(SDNCResponse resp) { - try { - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - //NewDoc for output - //Root - Document newdoc = db.newDocument(); - Element root = newdoc.createElement("output"); - newdoc.appendChild(root); - - Element elem1 = newdoc.createElement("svc-request-id"); - elem1.appendChild(newdoc.createTextNode(resp.getReqId())); - root.appendChild(elem1); - - Element elem2 = newdoc.createElement("response-code"); - elem2.appendChild(newdoc.createTextNode(String.valueOf(resp.getRespCode()))); - root.appendChild(elem2); - - Element elem3 = newdoc.createElement("response-message"); - elem3.appendChild(newdoc.createTextNode(String.valueOf(resp.getRespMsg()))); - root.appendChild(elem3); - - String s = domToStr(newdoc); - msoLogger.debug("Formatted SdncReq:" + s); - return (s); - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genMsoFailResp", e); - } - return(null); - } - - - public static String domToStr(Document doc) - { - if (doc != null) - { - try { - DOMSource ds = new DOMSource(doc); - StringWriter sw = new StringWriter(); - StreamResult sr = new StreamResult(sw); - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer t = tf.newTransformer(); - //t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");//<?xml version="1.0" encoding="UTF-8"?> - t.transform(ds, sr); - String s = sw.toString(); - - // This is an awful fix for now but we don't want that xmlns="" to be generated - s = s.replaceAll("xmlns=\"\"", ""); - return(s); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CONVERT_XML2STR, "", "", MsoLogger.ErrorCode.DataError, "Exception - domToStr", e); - } - } - return(null); - } -} |