diff options
76 files changed, 2280 insertions, 112 deletions
diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml index aa9a1cea9e..b8dec73f80 100644 --- a/adapters/mso-adapter-utils/pom.xml +++ b/adapters/mso-adapter-utils/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>adapters</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <groupId>org.onap.so.adapters</groupId> <artifactId>mso-adapter-utils</artifactId> diff --git a/adapters/mso-adapters-rest-interface/pom.xml b/adapters/mso-adapters-rest-interface/pom.xml index 5f987e61ce..584c47fea6 100644 --- a/adapters/mso-adapters-rest-interface/pom.xml +++ b/adapters/mso-adapters-rest-interface/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>adapters</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <groupId>org.onap.so.adapters</groupId> <artifactId>mso-adapters-rest-interface</artifactId> diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml index 9745935925..bcc523ab98 100644 --- a/adapters/mso-catalog-db-adapter/pom.xml +++ b/adapters/mso-catalog-db-adapter/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>adapters</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <groupId>org.onap.so.adapters</groupId> diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml index f0c066aa05..a668b42106 100644 --- a/adapters/mso-openstack-adapters/pom.xml +++ b/adapters/mso-openstack-adapters/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>adapters</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>mso-openstack-adapters</artifactId> <packaging>jar</packaging> diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml index 366a207d60..2354272756 100644 --- a/adapters/mso-requests-db-adapter/pom.xml +++ b/adapters/mso-requests-db-adapter/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>adapters</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <groupId>org.onap.so.adapters</groupId> diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml index 07c8ed5eab..7fd1aa62d4 100644 --- a/adapters/mso-sdnc-adapter/pom.xml +++ b/adapters/mso-sdnc-adapter/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>adapters</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>mso-sdnc-adapter</artifactId> <properties> diff --git a/adapters/mso-ve-vnfm-adapter/pom.xml b/adapters/mso-ve-vnfm-adapter/pom.xml index d58f183ab0..3d054d9eca 100644 --- a/adapters/mso-ve-vnfm-adapter/pom.xml +++ b/adapters/mso-ve-vnfm-adapter/pom.xml @@ -8,7 +8,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>adapters</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <groupId>org.onap.so.adapters</groupId> diff --git a/adapters/mso-vfc-adapter/pom.xml b/adapters/mso-vfc-adapter/pom.xml index 09dd512629..451831f966 100644 --- a/adapters/mso-vfc-adapter/pom.xml +++ b/adapters/mso-vfc-adapter/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>adapters</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <groupId>org.onap.so.adapters</groupId> <artifactId>mso-vfc-adapter</artifactId> diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml index bf293e5f4b..bb322eb1d8 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml +++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so.adapters</groupId> <artifactId>mso-vnfm-adapter</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>mso-vnfm-adapter-api</artifactId> <properties> diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml index 8e2cfd2be4..a643aaa5b8 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml +++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so.adapters</groupId> <artifactId>mso-vnfm-adapter</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>mso-vnfm-adapter-ext-clients</artifactId> <properties> diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml index bc491a6fc5..66b1d2e12e 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so.adapters</groupId> <artifactId>mso-vnfm-adapter</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>mso-vnfm-etsi-adapter</artifactId> <properties> diff --git a/adapters/mso-vnfm-adapter/pom.xml b/adapters/mso-vnfm-adapter/pom.xml index 962b3b4fb7..3e295aa184 100644 --- a/adapters/mso-vnfm-adapter/pom.xml +++ b/adapters/mso-vnfm-adapter/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>adapters</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <groupId>org.onap.so.adapters</groupId> <artifactId>mso-vnfm-adapter</artifactId> diff --git a/adapters/pom.xml b/adapters/pom.xml index b96c3744c3..8acc7012ba 100644 --- a/adapters/pom.xml +++ b/adapters/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>so</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>adapters</artifactId> diff --git a/adapters/so-appc-orchestrator/pom.xml b/adapters/so-appc-orchestrator/pom.xml index 717bcee3fc..e8e5808eca 100644 --- a/adapters/so-appc-orchestrator/pom.xml +++ b/adapters/so-appc-orchestrator/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>adapters</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <groupId>org.onap.so.adapters</groupId> diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml index 6ae05896df..1059e89da9 100644 --- a/asdc-controller/pom.xml +++ b/asdc-controller/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>so</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <groupId>org.onap.so</groupId> diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/ErrorCode.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/ErrorCode.java new file mode 100644 index 0000000000..1714e24a27 --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/ErrorCode.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.etsi.pkg.processor; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public enum ErrorCode { + + NORMAL("0"), PACKAGE_EXIST("1"), CATALOG_EXCEPTION("2"), SYSTEM_ERROR("3"), UNKNOWN("-1"); + + private String code; + + private ErrorCode(final String code) { + this.code = code; + } + + public String getCode() { + return code; + } + + public static ErrorCode getErrorCode(final String code) { + for (final ErrorCode errorCode : ErrorCode.values()) { + if (errorCode.getCode().equalsIgnoreCase(code)) { + return errorCode; + } + + } + return UNKNOWN; + } + +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboadingJobStatus.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboadingJobStatus.java new file mode 100644 index 0000000000..772f81a7fe --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboadingJobStatus.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.etsi.pkg.processor; + +import java.io.Serializable; +import javax.xml.bind.annotation.XmlElement; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class EtsiCatalogPackageOnboadingJobStatus implements Serializable { + + private static final long serialVersionUID = 1L; + + @XmlElement(name = "jobId") + private String jobId; + + @XmlElement(name = "responseDescriptor") + private EtsiCatalogPackageOnboardingJobDescriptor responseDescriptor; + + public String getJobId() { + return jobId; + } + + public void setJobId(final String jobId) { + this.jobId = jobId; + } + + public EtsiCatalogPackageOnboardingJobDescriptor getResponseDescriptor() { + return responseDescriptor; + } + + public void setResponseDescriptor(final EtsiCatalogPackageOnboardingJobDescriptor responseDescriptor) { + this.responseDescriptor = responseDescriptor; + } + + @Override + public String toString() { + return "EtsiCatalogPackageOnboadingJobStatus [jobId=" + jobId + ", responseDescriptor=" + responseDescriptor + + "]"; + } + + + +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingJob.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingJob.java new file mode 100644 index 0000000000..0c7bba6751 --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingJob.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.etsi.pkg.processor; + +import java.io.Serializable; +import javax.xml.bind.annotation.XmlElement; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class EtsiCatalogPackageOnboardingJob implements Serializable { + + private static final long serialVersionUID = 1L; + + @XmlElement(name = "jobId") + private String jobId; + + public String getJobId() { + return jobId; + } + + public void setJobId(final String jobId) { + this.jobId = jobId; + } + + @Override + public String toString() { + return "EtsiCatalogPackageOnboardingJob [jobId=" + jobId + "]"; + } + +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingJobDescriptor.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingJobDescriptor.java new file mode 100644 index 0000000000..b0c07d6f24 --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingJobDescriptor.java @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.etsi.pkg.processor; + +import java.io.Serializable; +import javax.xml.bind.annotation.XmlElement; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class EtsiCatalogPackageOnboardingJobDescriptor implements Serializable { + + private static final long serialVersionUID = 1L; + + @XmlElement(name = "status") + private String status; + + @XmlElement(name = "statusDescription") + private String statusDescription; + + @XmlElement(name = "errorCode") + private String errorCode; + + public String getStatus() { + return status; + } + + public void setStatus(final String status) { + this.status = status; + } + + public String getStatusDescription() { + return statusDescription; + } + + public void setStatusDescription(final String statusDescription) { + this.statusDescription = statusDescription; + } + + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(final String errorCode) { + this.errorCode = errorCode; + } + + @Override + public String toString() { + return "EtsiCatalogPackageOnboardingJobDescriptor [status=" + status + ", statusDescription=" + + statusDescription + ", errorCode=" + errorCode + "]"; + } + + + +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingRequest.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingRequest.java new file mode 100644 index 0000000000..79fd1398a0 --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingRequest.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.etsi.pkg.processor; + +import java.io.Serializable; +import javax.xml.bind.annotation.XmlElement; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class EtsiCatalogPackageOnboardingRequest implements Serializable { + + private static final long serialVersionUID = 1L; + + @XmlElement(name = "csarId") + private String csarId; + + public EtsiCatalogPackageOnboardingRequest csarId(final String csarId) { + this.csarId = csarId; + return this; + } + + public String getCsarId() { + return csarId; + } + + public void setCsarId(final String csarId) { + this.csarId = csarId; + } + + @Override + public String toString() { + return "EtsiCatalogPackageOnboardingRequest [csarId=" + csarId + "]"; + } + +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogServiceProvider.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogServiceProvider.java new file mode 100644 index 0000000000..f6a303291f --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogServiceProvider.java @@ -0,0 +1,112 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.etsi.pkg.processor; + +import static org.onap.so.asdc.etsi.pkg.processor.HttpRestServiceProviderConfiguration.ETSI_CATALOG_HTTP_REST_SERVICE_PROVIDER_BEAN; +import org.onap.so.asdc.etsi.pkg.processor.exceptions.EtsiCatalogManagerRequestFailureException; +import org.onap.so.rest.exceptions.InvalidRestRequestException; +import org.onap.so.rest.exceptions.RestProcessingException; +import org.onap.so.rest.service.HttpRestServiceProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@Service +public class EtsiCatalogServiceProvider { + + private static final Logger LOGGER = LoggerFactory.getLogger(EtsiCatalogServiceProvider.class); + + private final HttpRestServiceProvider httpServiceProvider; + + @Value("${etsi-catalog-manager.endpoint:http://modeling-etsicatalog.onap:8806/api/catalog/v1}") + private String etsiCatalogManagerEndpoint; + + @Autowired + public EtsiCatalogServiceProvider( + @Qualifier(ETSI_CATALOG_HTTP_REST_SERVICE_PROVIDER_BEAN) final HttpRestServiceProvider httpServiceProvider) { + this.httpServiceProvider = httpServiceProvider; + } + + public EtsiCatalogPackageOnboardingJob onBoardResource( + final EtsiCatalogPackageOnboardingRequest packageOnboardingRequest) { + try { + final String url = etsiCatalogManagerEndpoint + "/vnfpackages"; + final ResponseEntity<EtsiCatalogPackageOnboardingJob> responseEntity = httpServiceProvider.postHttpRequest( + packageOnboardingRequest, url, getHeaders(), EtsiCatalogPackageOnboardingJob.class); + + if (responseEntity.getStatusCode().is2xxSuccessful()) { + if (responseEntity.hasBody()) { + return responseEntity.getBody(); + } + LOGGER.error("Received response without body"); + } + final String message = "Unexpected status code received " + responseEntity.getStatusCode(); + LOGGER.error(message); + throw new EtsiCatalogManagerRequestFailureException(message); + + } catch (final InvalidRestRequestException | RestProcessingException exception) { + final String message = "Unable to process onboarding request"; + LOGGER.error(message, exception); + throw new EtsiCatalogManagerRequestFailureException(message); + } + + } + + public EtsiCatalogPackageOnboadingJobStatus getJobStatus(final String jobId) { + try { + final String url = etsiCatalogManagerEndpoint + "/jobs/" + jobId; + + final ResponseEntity<EtsiCatalogPackageOnboadingJobStatus> responseEntity = + httpServiceProvider.getHttpResponse(url, getHeaders(), EtsiCatalogPackageOnboadingJobStatus.class); + + if (responseEntity.getStatusCode().is2xxSuccessful()) { + if (responseEntity.hasBody()) { + return responseEntity.getBody(); + } + LOGGER.error("Received response without body"); + } + final String message = + "Unexpected status code received while getting job status " + responseEntity.getStatusCode(); + LOGGER.error(message); + throw new EtsiCatalogManagerRequestFailureException(message); + } catch (final InvalidRestRequestException | RestProcessingException exception) { + final String message = "Unable to get job status"; + LOGGER.error(message, exception); + throw new EtsiCatalogManagerRequestFailureException(message); + } + + } + + private HttpHeaders getHeaders() { + final HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + return headers; + } +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiResourcePackageProcessor.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiResourcePackageProcessor.java new file mode 100644 index 0000000000..bb7197b7a4 --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiResourcePackageProcessor.java @@ -0,0 +1,175 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.etsi.pkg.processor; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.time.Instant; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import org.onap.so.asdc.etsi.pkg.processor.exceptions.SOL004ResourcePackageFailureException; +import org.onap.so.asdc.etsi.pkg.processor.exceptions.SOL004ResourcePackageProcessingException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import com.google.common.collect.ImmutableSet; + + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@Service +public class EtsiResourcePackageProcessor { + + private final static Logger LOGGER = LoggerFactory.getLogger(EtsiResourcePackageProcessor.class); + private static final String ONBOARDED_PACKAGE_DIR_PATH = "Artifacts/Deployment/ONBOARDED_PACKAGE"; + private final SdcResourceProvider sdcResourceProvider; + private final EtsiCatalogServiceProvider catalogServiceProvider; + private static final int SLEEP_TIME_IN_SECONDS = 5; + + private static final ImmutableSet<JobStatus> JOB_FINISHED_STATES = + ImmutableSet.of(JobStatus.FINISHED, JobStatus.ERROR, JobStatus.TIMEOUT); + + @Value("${etsi-catalog-manager.rest.timeoutInSeconds:300}") + private int timeOutInSeconds; + + @Autowired + public EtsiResourcePackageProcessor(final SdcResourceProvider sdcResourceProvider, + final EtsiCatalogServiceProvider catalogServiceProvider) { + this.sdcResourceProvider = sdcResourceProvider; + this.catalogServiceProvider = catalogServiceProvider; + } + + public void processPackageIfExists(final String vnfUuid) { + LOGGER.debug("Processing vnf with UUID: {} ", vnfUuid); + try { + final Optional<byte[]> optional = sdcResourceProvider.getVnfResource(vnfUuid); + if (optional.isPresent()) { + final byte[] resourceContent = optional.get(); + + if (containsOnBoardedSol004Package(resourceContent)) { + final EtsiCatalogPackageOnboardingJob onboardingJob = catalogServiceProvider + .onBoardResource(new EtsiCatalogPackageOnboardingRequest().csarId(vnfUuid)); + LOGGER.debug("Successfully created job with id: {} to onboard vnf with UUID: {}", + onboardingJob.getJobId(), vnfUuid); + + if (onboardingJob.getJobId() == null) { + throw new SOL004ResourcePackageFailureException( + "Received invalid jobId " + onboardingJob.getJobId()); + } + + final Optional<EtsiCatalogPackageOnboadingJobStatus> jobStatusOptional = + waitForJobToFinish(onboardingJob); + + if (!jobStatusOptional.isPresent()) { + final String message = "Job status timeout reached failed to onboard vnf with UUID: " + vnfUuid; + LOGGER.debug(message, vnfUuid); + throw new SOL004ResourcePackageFailureException(message); + } + + final EtsiCatalogPackageOnboadingJobStatus onboadingJobStatus = jobStatusOptional.get(); + final JobStatus jobStatus = getJobStatus(onboadingJobStatus); + final ErrorCode errorCode = getErrorCode(onboadingJobStatus); + + LOGGER.debug("Final job status: {}, error code: {}", jobStatus, errorCode); + if (!JobStatus.FINISHED.equals(jobStatus) && !ErrorCode.PACKAGE_EXIST.equals(errorCode)) { + final String message = "Failed to onboard vnf with UUID: " + vnfUuid + " job status: " + + jobStatus + " errorCode: " + errorCode; + LOGGER.debug(message, vnfUuid); + throw new SOL004ResourcePackageFailureException(message); + } + LOGGER.debug("Successfully onboarded package in ETSI catalog .. "); + } + + } + } catch (final Exception exception) { + final String message = "Unable to process resource received from SDC"; + LOGGER.error(message, exception); + throw new SOL004ResourcePackageProcessingException(message, exception); + } + + } + + private Optional<EtsiCatalogPackageOnboadingJobStatus> waitForJobToFinish( + final EtsiCatalogPackageOnboardingJob onboardingJob) throws InterruptedException { + JobStatus currentJobStatus = null; + final long startTimeInMillis = System.currentTimeMillis(); + final long timeOutTime = startTimeInMillis + TimeUnit.SECONDS.toMillis(timeOutInSeconds); + + LOGGER.debug("Will wait till {} for {} job to finish", Instant.ofEpochMilli(timeOutTime).toString(), + onboardingJob.getJobId()); + + while (timeOutTime > System.currentTimeMillis()) { + + final EtsiCatalogPackageOnboadingJobStatus onboadingJobStatus = + catalogServiceProvider.getJobStatus(onboardingJob.getJobId()); + LOGGER.debug("Current job status {} ", onboadingJobStatus); + + currentJobStatus = getJobStatus(onboadingJobStatus); + if (JOB_FINISHED_STATES.contains(currentJobStatus)) { + return Optional.of(onboadingJobStatus); + } + + LOGGER.debug("Onboarding not finished yet, will try again in {} seconds", SLEEP_TIME_IN_SECONDS); + TimeUnit.SECONDS.sleep(SLEEP_TIME_IN_SECONDS); + + } + LOGGER.warn("Timeout current job status: {}", currentJobStatus); + return Optional.empty(); + } + + private boolean containsOnBoardedSol004Package(final byte[] resourceContent) throws IOException { + try (final ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream(resourceContent))) { + ZipEntry entry; + while ((entry = zipStream.getNextEntry()) != null) { + if (entry.getName() != null && entry.getName().contains(ONBOARDED_PACKAGE_DIR_PATH)) { + LOGGER.debug("Found entry: {} that contains {} in name", entry.getName(), + ONBOARDED_PACKAGE_DIR_PATH); + return true; + } + } + + } + LOGGER.debug("Unable to find {} dir in downloaded package", ONBOARDED_PACKAGE_DIR_PATH); + return false; + } + + private JobStatus getJobStatus(final EtsiCatalogPackageOnboadingJobStatus onboadingJobStatus) { + if (onboadingJobStatus.getResponseDescriptor() != null) { + return JobStatus.getJobStatus(onboadingJobStatus.getResponseDescriptor().getStatus()); + } + LOGGER.warn("Found null ResponseDescriptor {}", onboadingJobStatus); + return JobStatus.UNKNOWN; + } + + private ErrorCode getErrorCode(final EtsiCatalogPackageOnboadingJobStatus onboadingJobStatus) { + if (onboadingJobStatus.getResponseDescriptor() != null) { + return ErrorCode.getErrorCode(onboadingJobStatus.getResponseDescriptor().getErrorCode()); + } + LOGGER.warn("Found null ResponseDescriptor {}", onboadingJobStatus); + return ErrorCode.UNKNOWN; + } + +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/HttpRestServiceProviderConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/HttpRestServiceProviderConfiguration.java new file mode 100644 index 0000000000..1afda0d29f --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/HttpRestServiceProviderConfiguration.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.etsi.pkg.processor; + +import static org.onap.so.asdc.etsi.pkg.processor.SslBasedHttpClientConfiguration.SSL_BASED_CONFIGURABLE_REST_TEMPLATE; +import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE; +import org.onap.so.rest.service.HttpRestServiceProvider; +import org.onap.so.rest.service.HttpRestServiceProviderImpl; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@Configuration +public class HttpRestServiceProviderConfiguration { + + public static final String ETSI_CATALOG_HTTP_REST_SERVICE_PROVIDER_BEAN = "etsiCatalogHttpRestServiceProviderBean"; + public static final String SDC_HTTP_REST_SERVICE_PROVIDER_BEAN = "sdcHttpRestServiceProviderBean"; + + @Bean + @Qualifier(ETSI_CATALOG_HTTP_REST_SERVICE_PROVIDER_BEAN) + public HttpRestServiceProvider etsiCataloghttpRestServiceProvider( + @Qualifier(CONFIGURABLE_REST_TEMPLATE) final RestTemplate restTemplate) { + return new HttpRestServiceProviderImpl(restTemplate); + } + + @Bean + @Qualifier(SDC_HTTP_REST_SERVICE_PROVIDER_BEAN) + public HttpRestServiceProvider sdchttpRestServiceProvider( + @Qualifier(SSL_BASED_CONFIGURABLE_REST_TEMPLATE) final RestTemplate restTemplate) { + return new HttpRestServiceProviderImpl(restTemplate); + } + +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/JobStatus.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/JobStatus.java new file mode 100644 index 0000000000..cf09b15539 --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/JobStatus.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.etsi.pkg.processor; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public enum JobStatus { + + STARTED("started"), + TIMEOUT("timeout"), + FINISHED("finished"), + PARTLY_FINISHED("partly_finished"), + PROCESSING("processing"), + ERROR("error"), + UNKNOWN("unknown"); + + private String value; + + private JobStatus(final String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return this.value; + } + + public static JobStatus getJobStatus(final String jobStatus) { + for (final JobStatus status : JobStatus.values()) { + if (status.getValue().equalsIgnoreCase(jobStatus)) { + return status; + } + } + return JobStatus.UNKNOWN; + } + +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SdcBasicHttpConfigurationProvider.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SdcBasicHttpConfigurationProvider.java new file mode 100644 index 0000000000..19375e265f --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SdcBasicHttpConfigurationProvider.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.etsi.pkg.processor; + +import java.nio.charset.StandardCharsets; +import java.security.GeneralSecurityException; +import org.apache.commons.codec.binary.Base64; +import org.onap.so.utils.CryptoUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@Configuration +public class SdcBasicHttpConfigurationProvider { + + @Value("${sdc.endpoint:https://sdc-be.onap:8443}") + private String endPoint; + + @Value("${sdc.username:mso}") + private String username; + + @Value(value = "${sdc.password:76966BDD3C7414A03F7037264FF2E6C8EEC6C28F2B67F2840A1ED857C0260FEE731D73F47F828E5527125D29FD25D3E0DE39EE44C058906BF1657DE77BF897EECA93BDC07FA64F}") + private String password; + + @Value(value = "${sdc.key:566B754875657232314F5548556D3665}") + private String key; + + + public String getBasicAuthorization() throws GeneralSecurityException { + final String auth = username + ":" + CryptoUtils.decrypt(password, key); + final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1)); + return "Basic " + new String(encodedAuth); + } + + public String getEndPoint() { + return endPoint; + } + + +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SdcResourceProvider.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SdcResourceProvider.java new file mode 100644 index 0000000000..0cd0aba9c3 --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SdcResourceProvider.java @@ -0,0 +1,96 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.etsi.pkg.processor; + +import static org.onap.so.asdc.etsi.pkg.processor.HttpRestServiceProviderConfiguration.SDC_HTTP_REST_SERVICE_PROVIDER_BEAN; +import static org.springframework.http.HttpHeaders.ACCEPT; +import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM_VALUE; +import java.security.GeneralSecurityException; +import java.util.Optional; +import org.onap.so.rest.service.HttpRestServiceProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.http.HttpHeaders; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; + + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@Service +public class SdcResourceProvider { + private final static Logger LOGGER = LoggerFactory.getLogger(SdcResourceProvider.class); + + private static final String SERVICE_NAME = "SO-SDC-CONTROLLER"; + + private final HttpRestServiceProvider httpRestServiceProvider; + + private final SdcBasicHttpConfigurationProvider sdcBasicHttpConfigurationProvider; + + @Autowired + public SdcResourceProvider( + @Qualifier(SDC_HTTP_REST_SERVICE_PROVIDER_BEAN) final HttpRestServiceProvider httpRestServiceProvider, + final SdcBasicHttpConfigurationProvider sdcBasicHttpConfigurationProvider) { + this.httpRestServiceProvider = httpRestServiceProvider; + this.sdcBasicHttpConfigurationProvider = sdcBasicHttpConfigurationProvider; + } + + public Optional<byte[]> getVnfResource(final String resourceId) { + LOGGER.debug("Will get resource from SDC using resource id: {}", resourceId); + try { + final HttpHeaders headers = getHttpHeaders(); + headers.add(ACCEPT, APPLICATION_OCTET_STREAM_VALUE); + final String url = getSdcResourceEndPoint(resourceId); + LOGGER.debug("will invoke url: {} to get resource ", url); + final ResponseEntity<byte[]> responseEntity = + httpRestServiceProvider.getHttpResponse(url, headers, byte[].class); + + if (responseEntity.getStatusCode().is2xxSuccessful()) { + if (responseEntity.hasBody()) { + return Optional.of(responseEntity.getBody()); + } + LOGGER.error("Received response without body"); + } + LOGGER.error("Unexpected Status code received : {}", responseEntity.getStatusCode()); + return Optional.empty(); + } catch (final Exception exception) { + LOGGER.error("Unable to get {} resource from SDC", resourceId, exception); + return Optional.empty(); + } + } + + private String getSdcResourceEndPoint(final String resourceId) { + return sdcBasicHttpConfigurationProvider.getEndPoint() + "/sdc/v1/catalog/resources/" + resourceId + + "/toscaModel"; + } + + + private HttpHeaders getHttpHeaders() throws GeneralSecurityException { + final HttpHeaders headers = new HttpHeaders(); + headers.add(HttpHeaders.AUTHORIZATION, sdcBasicHttpConfigurationProvider.getBasicAuthorization()); + headers.add("X-ECOMP-InstanceID", SERVICE_NAME); + headers.add("X-FromAppId", SERVICE_NAME); + return headers; + } +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SslBasedHttpClientConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SslBasedHttpClientConfiguration.java new file mode 100644 index 0000000000..88c21524e9 --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SslBasedHttpClientConfiguration.java @@ -0,0 +1,93 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.etsi.pkg.processor; + +import java.security.NoSuchAlgorithmException; +import java.util.concurrent.TimeUnit; +import javax.net.ssl.SSLContext; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.onap.logging.filter.spring.SpringClientPayloadFilter; +import org.onap.so.configuration.rest.HttpClientConnectionConfiguration; +import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.BufferingClientHttpRequestFactory; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +@Configuration +public class SslBasedHttpClientConfiguration { + private final static Logger LOGGER = LoggerFactory.getLogger(EtsiResourcePackageProcessor.class); + + + public static final String SSL_BASED_CONFIGURABLE_REST_TEMPLATE = "sslBasedConfigurableRestTemplate"; + private final HttpClientConnectionConfiguration clientConnectionConfiguration; + + @Autowired + public SslBasedHttpClientConfiguration(final HttpClientConnectionConfiguration clientConnectionConfiguration) { + this.clientConnectionConfiguration = clientConnectionConfiguration; + } + + @Bean + @Qualifier(SSL_BASED_CONFIGURABLE_REST_TEMPLATE) + public RestTemplate sslBasedConfigurableRestTemplate() { + final RestTemplate restTemplate = + new RestTemplate(new BufferingClientHttpRequestFactory(httpComponentsClientHttpRequestFactory())); + restTemplate.getInterceptors().add(new SOSpringClientFilter()); + restTemplate.getInterceptors().add((new SpringClientPayloadFilter())); + return restTemplate; + } + + private HttpComponentsClientHttpRequestFactory httpComponentsClientHttpRequestFactory() { + try { + LOGGER.debug("Setting up HttpComponentsClientHttpRequestFactory with default SSL Context"); + return new HttpComponentsClientHttpRequestFactory(HttpClientBuilder.create() + .setConnectionManager(getConnectionManager()) + .setMaxConnPerRoute(clientConnectionConfiguration.getMaxConnectionsPerRoute()) + .setMaxConnTotal(clientConnectionConfiguration.getMaxConnections()) + .setDefaultRequestConfig(getRequestConfig()).setSSLContext(SSLContext.getDefault()).build()); + + } catch (final NoSuchAlgorithmException exception) { + LOGGER.error("Failed to create HttpComponentsClientHttpRequestFactory with default SSL Context", exception); + throw new RuntimeException(exception); + } + } + + private PoolingHttpClientConnectionManager getConnectionManager() { + return new PoolingHttpClientConnectionManager(clientConnectionConfiguration.getTimeToLiveInMins(), + TimeUnit.MINUTES); + } + + private RequestConfig getRequestConfig() { + return RequestConfig.custom().setSocketTimeout(clientConnectionConfiguration.getSocketTimeOutInMiliSeconds()) + .setConnectTimeout(clientConnectionConfiguration.getConnectionTimeOutInMilliSeconds()).build(); + } + +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/EtsiCatalogManagerRequestFailureException.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/EtsiCatalogManagerRequestFailureException.java new file mode 100644 index 0000000000..4f2e5039d7 --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/EtsiCatalogManagerRequestFailureException.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.etsi.pkg.processor.exceptions; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class EtsiCatalogManagerRequestFailureException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + public EtsiCatalogManagerRequestFailureException(final String message) { + super(message); + } + + @Override + public synchronized Throwable fillInStackTrace() { + return this; + } + + +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/SOL004ResourcePackageFailureException.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/SOL004ResourcePackageFailureException.java new file mode 100644 index 0000000000..8e05a50f32 --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/SOL004ResourcePackageFailureException.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.etsi.pkg.processor.exceptions; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class SOL004ResourcePackageFailureException extends RuntimeException { + + private static final long serialVersionUID = 5834657185124807797L; + + public SOL004ResourcePackageFailureException(final String message) { + super(message); + + } + + @Override + public synchronized Throwable fillInStackTrace() { + return this; + } + +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/SOL004ResourcePackageProcessingException.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/SOL004ResourcePackageProcessingException.java new file mode 100644 index 0000000000..0e9f1ea9dc --- /dev/null +++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/SOL004ResourcePackageProcessingException.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.etsi.pkg.processor.exceptions; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class SOL004ResourcePackageProcessingException extends RuntimeException { + + private static final long serialVersionUID = 4860501744379116092L; + + public SOL004ResourcePackageProcessingException(final String message, final Throwable cause) { + super(message, cause); + + } +} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 240bb83862..263118d1b3 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -39,7 +39,6 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; -import org.onap.so.logger.LoggingAnchor; import org.hibernate.exception.ConstraintViolationException; import org.hibernate.exception.LockAcquisitionException; import org.onap.sdc.api.notification.IArtifactInfo; @@ -63,6 +62,7 @@ import org.onap.sdc.toscaparser.api.parameters.Input; import org.onap.sdc.utils.DistributionStatusEnum; import org.onap.so.asdc.client.ASDCConfiguration; import org.onap.so.asdc.client.exceptions.ArtifactInstallerException; +import org.onap.so.asdc.etsi.pkg.processor.EtsiResourcePackageProcessor; import org.onap.so.asdc.installer.ASDCElementInfo; import org.onap.so.asdc.installer.BigDecimalVersion; import org.onap.so.asdc.installer.IVfModuleData; @@ -113,7 +113,6 @@ import org.onap.so.db.catalog.data.repository.CollectionResourceCustomizationRep import org.onap.so.db.catalog.data.repository.CollectionResourceRepository; import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.ConfigurationResourceRepository; -import org.onap.so.db.catalog.data.repository.CvnfcConfigurationCustomizationRepository; import org.onap.so.db.catalog.data.repository.CvnfcCustomizationRepository; import org.onap.so.db.catalog.data.repository.ExternalServiceToInternalServiceRepository; import org.onap.so.db.catalog.data.repository.HeatEnvironmentRepository; @@ -140,6 +139,7 @@ import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatu import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository; import org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository; import org.onap.so.logger.ErrorCode; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -147,9 +147,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.orm.ObjectOptimisticLockingFailureException; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.springframework.util.CollectionUtils; @Component public class ToscaResourceInstaller { @@ -273,6 +273,9 @@ public class ToscaResourceInstaller { @Autowired protected WorkflowResource workflowResource; + @Autowired + protected EtsiResourcePackageProcessor etsiResourcePackageProcessor; + protected static final Logger logger = LoggerFactory.getLogger(ToscaResourceInstaller.class); public boolean isCsarAlreadyDeployed(ToscaResourceStructure toscaResourceStructure) @@ -456,6 +459,8 @@ public class ToscaResourceInstaller { if (ALLOTTED_RESOURCE.equalsIgnoreCase(category)) { arEntityDetails.add(vfEntityDetails); } + final String vnfUuid = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID); + etsiResourcePackageProcessor.processPackageIfExists(vnfUuid); processVfModules(vfEntityDetails, toscaResourceStruct, vfResourceStructure, service, metadata); } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java b/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java index e25de9c3d4..1a2e385121 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java @@ -31,12 +31,14 @@ import org.springframework.context.annotation.Profile; @SpringBootApplication @Profile("test") -@ComponentScan(basePackages = {"org.onap.so.asdc", "org.onap.so.security"}, +@ComponentScan( + basePackages = {"org.onap.so.asdc", "org.onap.so.security", "org.onap.so.rest.service", + "org.onap.so.configuration.rest", "org.onap.so.client"}, excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class)}) public class TestApplication { - public static void main(String... args) { + public static void main(final String... args) { SpringApplication.run(TestApplication.class, args); System.getProperties().setProperty("mso.db", "MARIADB"); System.getProperties().setProperty("server.name", "Springboot"); diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/SdcNotificationWithSol004PackageTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/SdcNotificationWithSol004PackageTest.java new file mode 100644 index 0000000000..cb5bd0f51a --- /dev/null +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/SdcNotificationWithSol004PackageTest.java @@ -0,0 +1,358 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Ericsson. 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.asdc.client; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor; +import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static com.github.tomakehurst.wiremock.client.WireMock.okJson; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.verify; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; +import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_ERROR; +import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_OK; +import static org.springframework.http.HttpHeaders.ACCEPT; +import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM_VALUE; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.asdc.BaseTest; +import org.onap.so.asdc.client.exceptions.ASDCControllerException; +import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator; +import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; +import org.onap.so.db.catalog.data.repository.ServiceRepository; +import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; +import org.onap.so.db.request.beans.WatchdogComponentDistributionStatusId; +import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import com.google.gson.GsonBuilder; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class SdcNotificationWithSol004PackageTest extends BaseTest { + + private final static Logger LOGGER = LoggerFactory.getLogger(SdcNotificationWithSol004PackageTest.class); + private static final String ETSI_CATALOG_PACKAGE_ONBOARDING_URL = "/api/catalog/v1/vnfpackages"; + private static final String COMPONENT_NAME = "SO"; + private static final String CSAR_ID = "8f0b72e1-b6d6-42b6-a808-c60b17f04d7a"; + private static final String SDC_GET_RESOURCE_URL = "/sdc/v1/catalog/resources/" + CSAR_ID + "/toscaModel"; + private static final String ETSI_CATALOG_PACKAGE_ONBOARDING_REQUEST = "{\"csarId\": \"" + CSAR_ID + "\"}"; + private static final String DISTRIBUTION_ID = "35f20eb9-238a-4cc2-96dc-0a08f71bc209"; + private static final String VGW_RESOURCE_PATH = "src/test/resources/resource-examples/vgw"; + private static final String SERVICE_UUID = "e051ff77-fb79-451c-8457-1cbf94e4db8f"; + private static final String SERVICE_INVARIANT_UUID = "c2ce924f-0aa1-4777-9b42-c0fec006a883"; + private static final String JOB_ID = "57c13120-0a03-4d2e-837a-7c41d61e4a30"; + private static final String ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL = "/api/catalog/v1/jobs/" + JOB_ID; + private static final String ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_RESPONSE = "{\"jobId\": \"" + JOB_ID + "\"}"; + + @Autowired + private ASDCController asdcController; + + private DistributionClientEmulator distributionClient; + + @Autowired + private WatchdogComponentDistributionStatusRepository watchdogComponentDistributionStatusRepository; + + @Autowired + protected ServiceRepository serviceRepository; + + @Before + public void setUp() { + distributionClient = new DistributionClientEmulator(); + distributionClient.setResourcePath(getAbsolutePath(VGW_RESOURCE_PATH)); + asdcController.setDistributionClient(distributionClient); + try { + asdcController.initASDC(); + } catch (final ASDCControllerException controllerException) { + LOGGER.error(controllerException.getMessage(), controllerException); + fail(controllerException.getMessage()); + } + } + + @After + public void shutDown() { + try { + if (serviceRepository.existsById(SERVICE_UUID)) { + LOGGER.debug("Deleting existing service using {} ", SERVICE_UUID); + serviceRepository.deleteById(SERVICE_UUID); + } + + final WatchdogComponentDistributionStatusId distributionId = new WatchdogComponentDistributionStatusId(); + distributionId.setDistributionId(DISTRIBUTION_ID); + distributionId.setComponentName(COMPONENT_NAME); + if (watchdogComponentDistributionStatusRepository.existsById(distributionId)) { + LOGGER.debug("Deleting existing WatchdogComponentDistributionStatus using {} ", distributionId); + watchdogComponentDistributionStatusRepository.deleteById(distributionId); + } + asdcController.closeASDC(); + } catch (final ASDCControllerException asdcControllerException) { + LOGGER.error(asdcControllerException.getMessage(), asdcControllerException); + fail(asdcControllerException.getMessage()); + } + } + + @Test + public void testTreatNotification_vgwServiceContainingSol004Package_successfullyOnboard() throws IOException { + initMockAaiServer(SERVICE_UUID, SERVICE_INVARIANT_UUID); + + wireMockServer.stubFor(get(SDC_GET_RESOURCE_URL) + .willReturn(aResponse().withBody(getFileContent( + Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), "SDC_RESOURCE_CSAR", "vgw_sdc_resource.csar")))) + .withHeader(ACCEPT, equalTo(APPLICATION_OCTET_STREAM_VALUE))); + + wireMockServer.stubFor(post(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL)) + .willReturn(okJson(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_RESPONSE))); + + wireMockServer.stubFor(get(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL)) + .willReturn(okJson(new String(getFileContent(Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), + "etsi-catalog-package-onboading-job-status-successful.json")))))); + + asdcController.treatNotification(getNotificationDataImplObject()); + + final List<WatchdogComponentDistributionStatus> distributionList = + watchdogComponentDistributionStatusRepository.findByDistributionId(DISTRIBUTION_ID); + assertNotNull(distributionList); + assertEquals(1, distributionList.size()); + final WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0); + assertEquals(COMPONENT_DONE_OK.toString(), distributionStatus.getComponentDistributionStatus()); + assertEquals(COMPONENT_NAME, distributionStatus.getComponentName()); + + verify(postRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL)) + .withRequestBody(equalToJson(ETSI_CATALOG_PACKAGE_ONBOARDING_REQUEST))); + + verify(getRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL))); + } + + @Test + public void testTreatNotification_vgwServiceUnableToGeSdcResource_successfullyOnboard() throws IOException { + initMockAaiServer(SERVICE_UUID, SERVICE_INVARIANT_UUID); + + wireMockServer + .stubFor(get(SDC_GET_RESOURCE_URL).willReturn(aResponse().withStatus(HttpStatus.NOT_FOUND.value())) + .withHeader(ACCEPT, equalTo(APPLICATION_OCTET_STREAM_VALUE))); + + asdcController.treatNotification(getNotificationDataImplObject()); + + final List<WatchdogComponentDistributionStatus> distributionList = + watchdogComponentDistributionStatusRepository.findByDistributionId(DISTRIBUTION_ID); + assertNotNull(distributionList); + assertEquals(1, distributionList.size()); + final WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0); + assertEquals(COMPONENT_DONE_OK.toString(), distributionStatus.getComponentDistributionStatus()); + assertEquals(COMPONENT_NAME, distributionStatus.getComponentName()); + } + + @Test + public void testTreatNotification_vgwServiceContainingNonEtsiSdcResource_successfullyOnboard() throws IOException { + + initMockAaiServer(SERVICE_UUID, SERVICE_INVARIANT_UUID); + + wireMockServer.stubFor(get(SDC_GET_RESOURCE_URL) + .willReturn(aResponse().withBody(getFileContent( + Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), "service-Vgwservicev1-csar.csar")))) + .withHeader(ACCEPT, equalTo(APPLICATION_OCTET_STREAM_VALUE))); + + asdcController.treatNotification(getNotificationDataImplObject()); + + final List<WatchdogComponentDistributionStatus> distributionList = + watchdogComponentDistributionStatusRepository.findByDistributionId(DISTRIBUTION_ID); + assertNotNull(distributionList); + assertEquals(1, distributionList.size()); + final WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0); + assertEquals(COMPONENT_DONE_OK.toString(), distributionStatus.getComponentDistributionStatus()); + assertEquals(COMPONENT_NAME, distributionStatus.getComponentName()); + + } + + @Test + public void testTreatNotification_vgwServiceContainingSol004Package_onnboardRequestToEtsiCatalogReturnsBadGatway_distributionStatusError() + throws IOException { + initMockAaiServer(SERVICE_UUID, SERVICE_INVARIANT_UUID); + + wireMockServer.stubFor(get(SDC_GET_RESOURCE_URL) + .willReturn(aResponse().withBody(getFileContent( + Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), "SDC_RESOURCE_CSAR", "vgw_sdc_resource.csar")))) + .withHeader(ACCEPT, equalTo(APPLICATION_OCTET_STREAM_VALUE))); + + wireMockServer.stubFor(post(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL)) + .willReturn(aResponse().withStatus(HttpStatus.BAD_GATEWAY.value()))); + + asdcController.treatNotification(getNotificationDataImplObject()); + + final List<WatchdogComponentDistributionStatus> distributionList = + watchdogComponentDistributionStatusRepository.findByDistributionId(DISTRIBUTION_ID); + assertNotNull(distributionList); + assertEquals(1, distributionList.size()); + final WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0); + assertEquals(COMPONENT_DONE_ERROR.toString(), distributionStatus.getComponentDistributionStatus()); + assertEquals(COMPONENT_NAME, distributionStatus.getComponentName()); + + verify(postRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL)) + .withRequestBody(equalToJson(ETSI_CATALOG_PACKAGE_ONBOARDING_REQUEST))); + + } + + @Test + public void testTreatNotification_vgwServiceContainingSol004Package_getJobStatusReturnsBadGatway_distributionStatusError() + throws IOException { + initMockAaiServer(SERVICE_UUID, SERVICE_INVARIANT_UUID); + + wireMockServer.stubFor(get(SDC_GET_RESOURCE_URL) + .willReturn(aResponse().withBody(getFileContent( + Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), "SDC_RESOURCE_CSAR", "vgw_sdc_resource.csar")))) + .withHeader(ACCEPT, equalTo(APPLICATION_OCTET_STREAM_VALUE))); + + wireMockServer.stubFor(post(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL)) + .willReturn(okJson(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_RESPONSE))); + + wireMockServer.stubFor(get(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL)) + .willReturn(aResponse().withStatus(HttpStatus.BAD_GATEWAY.value()))); + + asdcController.treatNotification(getNotificationDataImplObject()); + + final List<WatchdogComponentDistributionStatus> distributionList = + watchdogComponentDistributionStatusRepository.findByDistributionId(DISTRIBUTION_ID); + assertNotNull(distributionList); + assertEquals(1, distributionList.size()); + final WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0); + assertEquals(COMPONENT_DONE_ERROR.toString(), distributionStatus.getComponentDistributionStatus()); + assertEquals(COMPONENT_NAME, distributionStatus.getComponentName()); + + verify(postRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL)) + .withRequestBody(equalToJson(ETSI_CATALOG_PACKAGE_ONBOARDING_REQUEST))); + + verify(getRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL))); + + } + + @Test + public void testTreatNotification_vgwServiceContainingSol004Package_getJobStatusBodyWithStatusError_distributionStatusError() + throws IOException { + + initMockAaiServer(SERVICE_UUID, SERVICE_INVARIANT_UUID); + + wireMockServer.stubFor(get(SDC_GET_RESOURCE_URL) + .willReturn(aResponse().withBody(getFileContent( + Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), "SDC_RESOURCE_CSAR", "vgw_sdc_resource.csar")))) + .withHeader(ACCEPT, equalTo(APPLICATION_OCTET_STREAM_VALUE))); + + wireMockServer.stubFor(post(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL)) + .willReturn(okJson(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_RESPONSE))); + + wireMockServer.stubFor(get(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL)) + .willReturn(okJson(new String(getFileContent(Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), + "etsi-catalog-package-onboading-job-status-error.json")))))); + + asdcController.treatNotification(getNotificationDataImplObject()); + + final List<WatchdogComponentDistributionStatus> distributionList = + watchdogComponentDistributionStatusRepository.findByDistributionId(DISTRIBUTION_ID); + assertNotNull(distributionList); + assertEquals(1, distributionList.size()); + final WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0); + assertEquals(COMPONENT_DONE_ERROR.toString(), distributionStatus.getComponentDistributionStatus()); + assertEquals(COMPONENT_NAME, distributionStatus.getComponentName()); + + verify(postRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL)) + .withRequestBody(equalToJson(ETSI_CATALOG_PACKAGE_ONBOARDING_REQUEST))); + + verify(getRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL))); + + + } + + @Test + public void testTreatNotification_vgwServiceContainingSol004PackageAndPackageAlreadyExistsInEtsiCatalog_successfullyOnboard() + throws IOException { + initMockAaiServer(SERVICE_UUID, SERVICE_INVARIANT_UUID); + + wireMockServer.stubFor(get(SDC_GET_RESOURCE_URL) + .willReturn(aResponse().withBody(getFileContent( + Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), "SDC_RESOURCE_CSAR", "vgw_sdc_resource.csar")))) + .withHeader(ACCEPT, equalTo(APPLICATION_OCTET_STREAM_VALUE))); + + wireMockServer.stubFor(post(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL)) + .willReturn(okJson(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_RESPONSE))); + + wireMockServer.stubFor(get(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL)) + .willReturn(okJson(new String(getFileContent(Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), + "etsi-catalog-package-onboading-job-status-error-package-exists.json")))))); + + asdcController.treatNotification(getNotificationDataImplObject()); + + final List<WatchdogComponentDistributionStatus> distributionList = + watchdogComponentDistributionStatusRepository.findByDistributionId(DISTRIBUTION_ID); + assertNotNull(distributionList); + assertEquals(1, distributionList.size()); + final WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0); + assertEquals(COMPONENT_DONE_OK.toString(), distributionStatus.getComponentDistributionStatus()); + assertEquals(COMPONENT_NAME, distributionStatus.getComponentName()); + + verify(postRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL)) + .withRequestBody(equalToJson(ETSI_CATALOG_PACKAGE_ONBOARDING_REQUEST))); + + verify(getRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL))); + } + + + private byte[] getFileContent(final Path path) throws IOException { + return Files.readAllBytes(path); + } + + private NotificationDataImpl getNotificationDataImplObject() throws IOException { + final Path filePath = Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), "dmaap-notification-message.json"); + final byte[] bytes = Files.readAllBytes(filePath); + + return new GsonBuilder().setPrettyPrinting().create().fromJson(new String(bytes), NotificationDataImpl.class); + } + + /** + * Mock the AAI using wireshark. + */ + private void initMockAaiServer(final String serviceUuid, final String serviceInvariantUuid) { + final String modelEndpoint = "/aai/v19/service-design-and-creation/models/model/" + serviceInvariantUuid + + "/model-vers/model-ver/" + serviceUuid + "?depth=0"; + + wireMockServer.stubFor(post(urlEqualTo(modelEndpoint)).willReturn(ok())); + } + + private String getAbsolutePath(final String path) { + final File file = new File(path); + return file.getAbsolutePath(); + } +} diff --git a/asdc-controller/src/test/resources/application-test.yaml b/asdc-controller/src/test/resources/application-test.yaml index 9fa20550db..60cd2d9f2a 100644 --- a/asdc-controller/src/test/resources/application-test.yaml +++ b/asdc-controller/src/test/resources/application-test.yaml @@ -102,3 +102,11 @@ mso: endpoint: http://localhost:${wiremock.server.port} config: defaultpath: src/test/resources + +sdc: + endpoint: http://localhost:${wiremock.server.port} + +etsi-catalog-manager: + endpoint: http://localhost:${wiremock.server.port}/api/catalog/v1 + rest: + timeoutInSeconds: 5 diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VENDOR_LICENSE/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VENDOR_LICENSE/vendor-license-model.xml new file mode 100644 index 0000000000..6499a58fab --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VENDOR_LICENSE/vendor-license-model.xml @@ -0,0 +1 @@ +<vendor-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>VLM</vendor-name><entitlement-pool-list><entitlement-pool><entitlement-pool-invariant-uuid>d6dea4a3db6b415ba50f17cb3311d046</entitlement-pool-invariant-uuid><entitlement-pool-uuid>04B01ABDE6CA4A9FBA75ACC023C6FEDA</entitlement-pool-uuid><version>1.0</version><name>EP</name><description/><increments/><manufacturer-reference-number>2345</manufacturer-reference-number><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit/><value/></threshold-value><sp-limits/><vendor-limits/></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><version>1.0</version><name>LKG</name><description/><type>Unique</type><increments/><manufacturerReferenceNumber/><license-key-group-invariant-uuid>55ddeb1a87be4fbb95a9bd74b4d745ca</license-key-group-invariant-uuid><license-key-group-uuid>81117C9B092C4C70AFF76833373CE7F4</license-key-group-uuid><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit>Absolute</unit><value>23456789</value></threshold-value><sp-limits/><vendor-limits/></license-key-group></license-key-group-list></vendor-license-model>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VF_LICENSE/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VF_LICENSE/vf-license-model.xml new file mode 100644 index 0000000000..581a3acb7f --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VF_LICENSE/vf-license-model.xml @@ -0,0 +1 @@ +<vf-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>VLM</vendor-name><vf-id>fa87b9536b704787981357393f36b3fc</vf-id><feature-group-list><feature-group><entitlement-pool-list><entitlement-pool><name>EP</name><description/><increments/><entitlement-pool-invariant-uuid>d6dea4a3db6b415ba50f17cb3311d046</entitlement-pool-invariant-uuid><entitlement-pool-uuid>04B01ABDE6CA4A9FBA75ACC023C6FEDA</entitlement-pool-uuid><manufacturer-reference-number>2345</manufacturer-reference-number><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit/><value/></threshold-value><version>1.0</version><sp-limits/><vendor-limits/></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><name>LKG</name><description/><type>Unique</type><increments/><license-key-group-invariant-uuid>55ddeb1a87be4fbb95a9bd74b4d745ca</license-key-group-invariant-uuid><license-key-group-uuid>81117C9B092C4C70AFF76833373CE7F4</license-key-group-uuid><manufacturer-reference-number/><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit>Absolute</unit><value>23456789</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/></license-key-group></license-key-group-list><name>FG</name><feature-group-uuid>2218d90f94944a94952be83354847631</feature-group-uuid><description/><part-number>234594</part-number></feature-group></feature-group-list></vf-license-model>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/vgw6.csar b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/vgw6.csar Binary files differnew file mode 100644 index 0000000000..56dbb2bce0 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/vgw6.csar diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/SDC_RESOURCE_CSAR/vgw_sdc_resource.csar b/asdc-controller/src/test/resources/resource-examples/vgw/SDC_RESOURCE_CSAR/vgw_sdc_resource.csar Binary files differnew file mode 100644 index 0000000000..7ddfb6ef51 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vgw/SDC_RESOURCE_CSAR/vgw_sdc_resource.csar diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/VENDOR_LICENSE/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vgw/VENDOR_LICENSE/vendor-license-model.xml new file mode 100644 index 0000000000..6499a58fab --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vgw/VENDOR_LICENSE/vendor-license-model.xml @@ -0,0 +1 @@ +<vendor-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>VLM</vendor-name><entitlement-pool-list><entitlement-pool><entitlement-pool-invariant-uuid>d6dea4a3db6b415ba50f17cb3311d046</entitlement-pool-invariant-uuid><entitlement-pool-uuid>04B01ABDE6CA4A9FBA75ACC023C6FEDA</entitlement-pool-uuid><version>1.0</version><name>EP</name><description/><increments/><manufacturer-reference-number>2345</manufacturer-reference-number><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit/><value/></threshold-value><sp-limits/><vendor-limits/></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><version>1.0</version><name>LKG</name><description/><type>Unique</type><increments/><manufacturerReferenceNumber/><license-key-group-invariant-uuid>55ddeb1a87be4fbb95a9bd74b4d745ca</license-key-group-invariant-uuid><license-key-group-uuid>81117C9B092C4C70AFF76833373CE7F4</license-key-group-uuid><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit>Absolute</unit><value>23456789</value></threshold-value><sp-limits/><vendor-limits/></license-key-group></license-key-group-list></vendor-license-model>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/VF_LICENSE/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vgw/VF_LICENSE/vf-license-model.xml new file mode 100644 index 0000000000..581a3acb7f --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vgw/VF_LICENSE/vf-license-model.xml @@ -0,0 +1 @@ +<vf-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>VLM</vendor-name><vf-id>fa87b9536b704787981357393f36b3fc</vf-id><feature-group-list><feature-group><entitlement-pool-list><entitlement-pool><name>EP</name><description/><increments/><entitlement-pool-invariant-uuid>d6dea4a3db6b415ba50f17cb3311d046</entitlement-pool-invariant-uuid><entitlement-pool-uuid>04B01ABDE6CA4A9FBA75ACC023C6FEDA</entitlement-pool-uuid><manufacturer-reference-number>2345</manufacturer-reference-number><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit/><value/></threshold-value><version>1.0</version><sp-limits/><vendor-limits/></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><name>LKG</name><description/><type>Unique</type><increments/><license-key-group-invariant-uuid>55ddeb1a87be4fbb95a9bd74b4d745ca</license-key-group-invariant-uuid><license-key-group-uuid>81117C9B092C4C70AFF76833373CE7F4</license-key-group-uuid><manufacturer-reference-number/><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit>Absolute</unit><value>23456789</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/></license-key-group></license-key-group-list><name>FG</name><feature-group-uuid>2218d90f94944a94952be83354847631</feature-group-uuid><description/><part-number>234594</part-number></feature-group></feature-group-list></vf-license-model>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/dmaap-notification-message.json b/asdc-controller/src/test/resources/resource-examples/vgw/dmaap-notification-message.json new file mode 100644 index 0000000000..d936cd1144 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vgw/dmaap-notification-message.json @@ -0,0 +1,66 @@ +{ + "distributionID": "35f20eb9-238a-4cc2-96dc-0a08f71bc209", + "serviceName": "VgwServiceV1", + "serviceVersion": "1.0", + "serviceUUID": "e051ff77-fb79-451c-8457-1cbf94e4db8f", + "serviceDescription": "Test VGW Service", + "serviceInvariantUUID": "c2ce924f-0aa1-4777-9b42-c0fec006a883", + "resources": [ + { + "resourceInstanceName": "VgwVspV1 0", + "resourceName": "VgwVspV1", + "resourceVersion": "1.0", + "resourceType": "VF", + "resourceUUID": "655aa939-d589-4333-8cc6-8fcb15db858a", + "resourceInvariantUUID": "c53a0c91-35f6-40ff-bcda-f75030cfaf2d", + "resourceCustomizationUUID": "db1673e1-351a-4d04-8e2f-84b2b4c52cc7", + "category": "Generic", + "subcategory": "Network Service", + "artifacts": [ + { + "artifactName": "vf-license-model.xml", + "artifactType": "VF_LICENSE", + "artifactURL": "/VF_LICENSE/vf-license-model.xml", + "artifactChecksum": "NjMwZDc0YzhiNDRlZDAyYjIxMmFlM2M0MWRkZjFmNDA\u003d", + "artifactDescription": "VF license file", + "artifactTimeout": 120, + "artifactUUID": "8dda263d-90bb-4b3d-b8e0-0048222dc658", + "artifactVersion": "1" + }, + { + "artifactName": "vgw6.csar", + "artifactType": "ONBOARDED_PACKAGE", + "artifactURL": "/ONBOARDED_PACKAGE/vgw6.csar", + "artifactChecksum": "NjdmNGU3ZDlkODQ0YTUzMTU5NjZmOThiYjMxNTJiNGI\u003d", + "artifactDescription": "Artifact created from csar", + "artifactTimeout": 120, + "artifactUUID": "9e9930b8-898e-4b8b-999e-66c43e1611f4", + "artifactVersion": "1" + }, + { + "artifactName": "vendor-license-model.xml", + "artifactType": "VENDOR_LICENSE", + "artifactURL": "/VENDOR_LICENSE/vendor-license-model.xml", + "artifactChecksum": "NGNmNzU4MDhjN2FjMTJkNWIxMjNkZDZhOWQyYzU0ZjA\u003d", + "artifactDescription": " Vendor license file", + "artifactTimeout": 120, + "artifactUUID": "b3f7a4cf-6a35-4f66-b800-cd4a9a0e9719", + "artifactVersion": "1" + } + ] + } + ], + "serviceArtifacts": [ + { + "artifactName": "service-Vgwservicev1-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "/service-Vgwservicev1-csar.csar", + "artifactChecksum": "MzcxNTMwMDhmNGY0MjRkMjFkNzk1MDNjOTVhNjQzMmE\u003d", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactUUID": "0cc70c6e-6ddc-4ecc-8052-d9f1433c14b8", + "artifactVersion": "1" + } + ], + "workloadContext": "Production" +} diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error-package-exists.json b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error-package-exists.json new file mode 100644 index 0000000000..8dc07b9613 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error-package-exists.json @@ -0,0 +1,20 @@ +{ + "jobId": "57c13120-0a03-4d2e-837a-7c41d61e4a30", + "responseDescriptor": + { + "status": "error", + "progress": "255", + "statusDescription": "VNF package() already exists.", + "errorCode": "1", + "responseId": "2", + "responseHistoryList": [ + { + "status": "processing", + "progress": "5", + "statusDescription": "Start CSAR(8f0b72e1-b6d6-42b6-a808-c60b17f04d7a) distribute.", + "errorCode": "0", + "responseId": "1" + } + ] + } +} diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error.json b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error.json new file mode 100644 index 0000000000..13f346fb7a --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error.json @@ -0,0 +1,20 @@ +{ + "jobId": "57c13120-0a03-4d2e-837a-7c41d61e4a30", + "responseDescriptor": + { + "status": "error", + "progress": "255", + "statusDescription": "Failed to query artifacts(resources) from sdc.", + "errorCode": "0", + "responseId": "2", + "responseHistoryList": [ + { + "status": "processing", + "progress": "5", + "statusDescription": "Start CSAR(8f0b72e1-b6d6-42b6-a808-c60b17f04d7a) distribute.", + "errorCode": "0", + "responseId": "1" + } + ] + } +} diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-successful.json b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-successful.json new file mode 100644 index 0000000000..b5dc1fe4f2 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-successful.json @@ -0,0 +1,27 @@ +{ + "jobId": "57c13120-0a03-4d2e-837a-7c41d61e4a30", + "responseDescriptor": + { + "status": "finished", + "progress": "100", + "statusDescription": "CSAR(8f0b72e1-b6d6-42b6-a808-c60b17f04d7a) distribute successfully.", + "errorCode": "0", + "responseId": "3", + "responseHistoryList": [ + { + "status": "processing", + "progress": "30", + "statusDescription": "Save CSAR(8f0b72e1-b6d6-42b6-a808-c60b17f04d7a) to database.", + "errorCode": "0", + "responseId": "2" + }, + { + "status": "processing", + "progress": "5", + "statusDescription": "Start CSAR(8f0b72e1-b6d6-42b6-a808-c60b17f04d7a) distribute.", + "errorCode": "0", + "responseId": "1" + } + ] + } +} diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/service-Vgwservicev1-csar.csar b/asdc-controller/src/test/resources/resource-examples/vgw/service-Vgwservicev1-csar.csar Binary files differnew file mode 100644 index 0000000000..51a9e19466 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vgw/service-Vgwservicev1-csar.csar diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index e233e6a7c6..c817874fb6 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>bpmn</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>MSOCommonBPMN</artifactId> <name>MSOCommonBPMN</name> diff --git a/bpmn/MSOCoreBPMN/pom.xml b/bpmn/MSOCoreBPMN/pom.xml index fd239562e2..47254e75f2 100644 --- a/bpmn/MSOCoreBPMN/pom.xml +++ b/bpmn/MSOCoreBPMN/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>bpmn</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>MSOCoreBPMN</artifactId> diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml index c3c26ef5e7..04a291af8c 100644 --- a/bpmn/mso-infrastructure-bpmn/pom.xml +++ b/bpmn/mso-infrastructure-bpmn/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>bpmn</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>mso-infrastructure-bpmn</artifactId> diff --git a/bpmn/pom.xml b/bpmn/pom.xml index 65af2fd8d5..6b81bab4df 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>so</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>bpmn</artifactId> diff --git a/bpmn/so-bpmn-building-blocks/pom.xml b/bpmn/so-bpmn-building-blocks/pom.xml index a867613890..52c5502b32 100644 --- a/bpmn/so-bpmn-building-blocks/pom.xml +++ b/bpmn/so-bpmn-building-blocks/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>bpmn</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>so-bpmn-building-blocks</artifactId> diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml index 74df3a2c2e..0df3fbe704 100644 --- a/bpmn/so-bpmn-infrastructure-common/pom.xml +++ b/bpmn/so-bpmn-infrastructure-common/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>bpmn</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>so-bpmn-infrastructure-common</artifactId> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy new file mode 100644 index 0000000000..3233bfff61 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy @@ -0,0 +1,333 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # Licensed under the Apache License, Version 2.0 (the "License") + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.RequestDBUtil +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.db.request.beans.OperationStatus +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import java.util.concurrent.TimeUnit + +import static org.apache.commons.lang3.StringUtils.isBlank + +class CheckServiceProcessStatus extends AbstractServiceTaskProcessor { + + + String Prefix="CSPS_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + RequestDBUtil requestDBUtil = new RequestDBUtil() + + JsonUtils jsonUtil = new JsonUtils() + + AAIResourcesClient client = getAAIClient() + + private static final Logger logger = LoggerFactory.getLogger(CheckServiceProcessStatus.class) + + @Override + void preProcessRequest(DelegateExecution execution) { + logger.debug(Prefix + "CheckServiceProcessStatus preProcessRequest Start") + execution.setVariable("prefix", Prefix) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") + String parentOperationId = execution.getVariable("parentOperationId") + + if (isBlank(serviceInstanceId) || isBlank(operationId)) { + String msg = "Exception in" + Prefix + "preProcessRequest: Input serviceInstanceId or operationId is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + if (isBlank(parentServiceInstanceId) || isBlank(parentOperationId)) { + execution.setVariable("isNeedUpdateParentStatus", false) + } + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + if (isBlank(globalSubscriberId)) { + execution.setVariable("globalSubscriberId", "5GCustomer") + } + + // serviceType: type of service + String serviceType = execution.getVariable("processServiceType") + if (isBlank(serviceType)) { + execution.setVariable("processServiceType", "service") + } + + // operationType: type of service + String operationType = execution.getVariable("operationType") + if (isBlank(operationType)) { + execution.setVariable("operationType", "CREATE") + } + + //successConditions: processing end success conditions + List<String> successConditions = execution.getVariable("successConditions") as List + + //errorConditions: processing end error conditions + List<String> errorConditions = execution.getVariable("errorConditions") as List + + if ((successConditions == null || successConditions.size() < 1) + && (errorConditions == null || errorConditions.size() < 1)) { + String msg = "Exception in" + Prefix + "preProcessRequest: conditions is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + for (int i = 0; i < successConditions.size(); i++) { + String condition = successConditions.get(i) + successConditions.set(i, condition.toLowerCase()) + } + for (int i = 0; i < errorConditions.size(); i++) { + String condition = errorConditions.get(i) + errorConditions.set(i, condition.toLowerCase()) + } + } + + execution.setVariable("startTime", System.currentTimeMillis()) + + String initProgress = execution.getVariable("initProgress") + + if (isBlank(initProgress)) { + execution.setVariable("initProgress", 0) + } + + String endProgress = execution.getVariable("endProgress") + + if (isBlank(endProgress)) { + execution.setVariable("endProgress", 100) + } + + execution.setVariable("progress", 0) + logger.debug(Prefix + "preProcessRequest Exit") + } + + + /** + * check service status through request operation id, update operation status + */ + def preCheckServiceStatusReq = { DelegateExecution execution -> + logger.trace(Prefix + "preCheckServiceStatusReq Start") + String serviceInstanceId = execution.getVariable("serviceInstanceId") as String + String operationId = execution.getVariable("operationId") as String + requestDBUtil.getOperationStatus(execution, serviceInstanceId, operationId) + logger.trace(Prefix + "preCheckServiceStatusReq Exit") + } + + + /** + * handle service status, if service status is finished or error, set the service status + * @param execution + */ + def handlerServiceStatusResp = { DelegateExecution execution -> + logger.trace(Prefix + "handlerServiceStatusResp Start") + String msg + try { + def dbResponseCode = execution.getVariable("dbResponseCode") as Integer + if (dbResponseCode >= 200 && dbResponseCode < 400) { + String dbResponse = execution.getVariable("dbResponse") + def dbResponseJson = jsonUtil.xml2json(dbResponse) as String + + String result = jsonUtil.getJsonValue(dbResponseJson, + "Envelope.Body.getServiceOperationStatusResponse.return.result") + + if (isSuccessCompleted(execution, result)) { + + handlerSuccess(execution, result) + execution.setVariable("isAllFinished", "true") + + logger.debug(Prefix + "handlerServiceStatusResp: service success finished, dbResponse_result: " + + result) + + } else if (isErrorCompleted(execution, result)) { + + handlerError(execution, result) + execution.setVariable("isAllFinished", "true") + + logger.debug(Prefix + "handlerServiceStatusResp: service error finished, dbResponse_result: " + + result) + + } else { + String progress = jsonUtil.getJsonValue(dbResponseJson, + "Envelope.Body.getServiceOperationStatusResponse.return.progress") + + String oldProgress = execution.getVariable("progress") + + if (progress == oldProgress) { + execution.setVariable("isNeedUpdateDB", false) + } else { + execution.setVariable("progress", progress) + execution.setVariable("isNeedUpdateDB", true) + } + execution.setVariable("isAllFinished", "false") + TimeUnit.SECONDS.sleep(10) + } + } else { + execution.setVariable("isAllFinished", "false") + //todo: retry + TimeUnit.MILLISECONDS.sleep(10) + } + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in " + Prefix + "handlerServiceStatusResp: " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.trace(Prefix + "handlerServiceStatusResp Exit") + } + + + def timeWaitDelay = { DelegateExecution execution -> + + Long startTime = execution.getVariable("startTime") as Long + Long timeOut = execution.getVariable("timeOut") as Long + + timeOut = timeOut == null ? 3 * 60 * 60 * 1000 : timeOut + + if (System.currentTimeMillis() - startTime > timeOut) { + + handlerTimeOut(execution) + execution.setVariable("isTimeOut", "YES") + + } else { + execution.setVariable("isTimeOut", "NO") + } + } + + + private handlerTimeOut = { DelegateExecution execution -> + + Map<String, Object> paramMap = execution.getVariable("timeOutParamMap") as Map + + handlerProcess(execution, "error", paramMap, "error", "with timeout") + } + + + private handlerSuccess = { DelegateExecution execution, String result -> + + Map<String, Object> paramMap = execution.getVariable("successParamMap") as Map + + handlerProcess(execution, result, paramMap, "deactivated", "success") + } + + + private handlerError = { DelegateExecution execution, String result -> + + Map<String, Object> paramMap = execution.getVariable("errorParamMap") as Map + + handlerProcess(execution, result, paramMap, "error", "with error") + } + + + private handlerProcess = { DelegateExecution execution, String result, def paramMap, def status, def msg -> + + if (paramMap != null) { + for (Map.Entry<String, Object> entry : paramMap.entrySet()) { + execution.setVariable(entry.getKey(), entry.getValue()) + } + } + + + if (isBlank(execution.getVariable("operationStatus") as String)) { + execution.setVariable("operationStatus", result) + } + + + if (isBlank(execution.getVariable("operationContent") as String)) { + String operationContent = execution.getVariable("processServiceType") + " " + + execution.getVariable("operationType") + " operation finished " + msg + execution.setVariable("operationContent", operationContent) + } + + if (isBlank(execution.getVariable("orchestrationStatus") as String)) { + execution.setVariable("orchestrationStatus", status) + } + + } + + + /** + * judge if the service processing success finished + */ + private isSuccessCompleted = { DelegateExecution execution, String result -> + + //successConditions: processing end success conditions + List<String> successConditions = execution.getVariable("successConditions") as List + + result = result.toLowerCase() + if (successConditions.contains(result)) { + return true + } + return false + } + + + /** + * judge if the service processing error finished + */ + private isErrorCompleted = { DelegateExecution execution, String result -> + + //errorConditions: processing end error conditions + List<String> errorConditions = execution.getVariable("errorConditions") as List + + result = result.toLowerCase() + if (errorConditions.contains(result)) { + return true + } + return false + } + + + def preUpdateOperationProgress = { DelegateExecution execution -> + logger.trace(Prefix + "prepareUpdateOperationStatus Start") + + def progress = execution.getVariable("progress") as Integer + def initProgress = execution.getVariable("initProgress") as Integer + def endProgress = execution.getVariable("endProgress") as Integer + + def resProgress = (initProgress + (endProgress - initProgress) / 100 * progress) as Integer + + def operationType = execution.getVariable("operationType") + def operationContent = execution.getVariable("processServiceType") + " " + + operationType + " operation processing " + resProgress + + // update status creating + OperationStatus status = new OperationStatus() + status.setServiceId(execution.getVariable("parentServiceInstanceId") as String) + status.setOperationId(execution.getVariable("parentOperationId") as String) + status.setOperation(operationType as String) + status.setResult("processing") + status.setProgress(resProgress as String) + status.setOperationContent(operationContent as String) + status.setUserId(execution.getVariable("globalSubscriberId") as String) + + requestDBUtil.prepareUpdateOperationStatus(execution, status) + logger.trace(Prefix + "prepareUpdateOperationStatus Exit") + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml index d0c16fc1cc..c7d4f3f894 100644 --- a/bpmn/so-bpmn-infrastructure-flows/pom.xml +++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>bpmn</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>so-bpmn-infrastructure-flows</artifactId> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/CheckServiceProcessStatus.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/CheckServiceProcessStatus.bpmn new file mode 100644 index 0000000000..279dd2a4ad --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/CheckServiceProcessStatus.bpmn @@ -0,0 +1,225 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0lf96js" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> + <bpmn:process id="CheckServiceProcessStatus" name="CheckServiceProcessStatus" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1" name="start check processing status"> + <bpmn:outgoing>SequenceFlow_1g4lx01</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="ScriptTask_1mlave2" name="Prepare service Check Process status Req " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0e29y0f</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1n5nl53</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0r1x26k</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CheckServiceProcessStatus() +csi.preCheckServiceStatusReq(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_0w5fmqn" name="get service Operation Status "> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${getOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0r1x26k</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_009p8v1</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:scriptTask id="ScriptTask_0z37e29" name="handler service status Response " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_009p8v1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0yws8fh</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CheckServiceProcessStatus() +csi.handlerServiceStatusResp(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0gk7p3l" name="Is service process finished? " default="SequenceFlow_01o92x6"> + <bpmn:incoming>SequenceFlow_0yws8fh</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18jgpa8</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_01o92x6</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:scriptTask id="ScriptTask_1ao91w3" name="Time Delay" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1pxnqsp</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1ktr440</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0e29y0f</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CheckServiceProcessStatus() +csi.timeWaitDelay(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0e29y0f" sourceRef="ScriptTask_1ao91w3" targetRef="ScriptTask_1mlave2" /> + <bpmn:sequenceFlow id="SequenceFlow_0r1x26k" sourceRef="ScriptTask_1mlave2" targetRef="ServiceTask_0w5fmqn" /> + <bpmn:sequenceFlow id="SequenceFlow_009p8v1" sourceRef="ServiceTask_0w5fmqn" targetRef="ScriptTask_0z37e29" /> + <bpmn:sequenceFlow id="SequenceFlow_0yws8fh" sourceRef="ScriptTask_0z37e29" targetRef="ExclusiveGateway_0gk7p3l" /> + <bpmn:sequenceFlow id="SequenceFlow_18jgpa8" name="yes" sourceRef="ExclusiveGateway_0gk7p3l" targetRef="EndEvent_0a3w3xw"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAllFinished") == "true") || (execution.getVariable("isTimeOut") == "YES")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:endEvent id="EndEvent_0a3w3xw"> + <bpmn:incoming>SequenceFlow_18jgpa8</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1g4lx01" sourceRef="StartEvent_1" targetRef="Task_1djj44q" /> + <bpmn:sequenceFlow id="SequenceFlow_1n5nl53" sourceRef="Task_1djj44q" targetRef="ScriptTask_1mlave2" /> + <bpmn:scriptTask id="Task_1djj44q" name="Prepare request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1g4lx01</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1n5nl53</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CheckServiceProcessStatus() +csi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0oic8cv" name="prepare Update Service Operation progress" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0591ght</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1q8dls4</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new CheckServiceProcessStatus() +csi.preUpdateOperationProgress(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1q8dls4" sourceRef="ScriptTask_0oic8cv" targetRef="ServiceTask_1b60rre" /> + <bpmn:serviceTask id="ServiceTask_1b60rre" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1q8dls4</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1pxnqsp</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_1pxnqsp" sourceRef="ServiceTask_1b60rre" targetRef="ScriptTask_1ao91w3" /> + <bpmn:sequenceFlow id="SequenceFlow_01o92x6" sourceRef="ExclusiveGateway_0gk7p3l" targetRef="ExclusiveGateway_1pdfjh4" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_1pdfjh4" name="isNeedUpdateDB? " default="SequenceFlow_1ktr440"> + <bpmn:incoming>SequenceFlow_01o92x6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0591ght</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1ktr440</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0591ght" name="yes" sourceRef="ExclusiveGateway_1pdfjh4" targetRef="ScriptTask_0oic8cv"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNeedUpdateDB" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1ktr440" name="no" sourceRef="ExclusiveGateway_1pdfjh4" targetRef="ScriptTask_1ao91w3" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CheckServiceProcessStatus"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="179" y="159" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="156" y="202" width="87" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1mlave2_di" bpmnElement="ScriptTask_1mlave2"> + <dc:Bounds x="460" y="137" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0w5fmqn_di" bpmnElement="ServiceTask_0w5fmqn"> + <dc:Bounds x="610" y="137" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0z37e29_di" bpmnElement="ScriptTask_0z37e29"> + <dc:Bounds x="770" y="137" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0gk7p3l_di" bpmnElement="ExclusiveGateway_0gk7p3l" isMarkerVisible="true"> + <dc:Bounds x="955" y="152" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="944" y="122" width="89" height="40" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1ao91w3_di" bpmnElement="ScriptTask_1ao91w3"> + <dc:Bounds x="460" y="290" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0e29y0f_di" bpmnElement="SequenceFlow_0e29y0f"> + <di:waypoint x="510" y="290" /> + <di:waypoint x="510" y="217" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0r1x26k_di" bpmnElement="SequenceFlow_0r1x26k"> + <di:waypoint x="560" y="177" /> + <di:waypoint x="610" y="177" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_009p8v1_di" bpmnElement="SequenceFlow_009p8v1"> + <di:waypoint x="710" y="177" /> + <di:waypoint x="770" y="177" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0yws8fh_di" bpmnElement="SequenceFlow_0yws8fh"> + <di:waypoint x="870" y="177" /> + <di:waypoint x="955" y="177" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_18jgpa8_di" bpmnElement="SequenceFlow_18jgpa8"> + <di:waypoint x="1005" y="177" /> + <di:waypoint x="1132" y="177" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1024" y="159" width="17" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_0a3w3xw_di" bpmnElement="EndEvent_0a3w3xw"> + <dc:Bounds x="1132" y="159" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1g4lx01_di" bpmnElement="SequenceFlow_1g4lx01"> + <di:waypoint x="215" y="177" /> + <di:waypoint x="270" y="177" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1n5nl53_di" bpmnElement="SequenceFlow_1n5nl53"> + <di:waypoint x="370" y="177" /> + <di:waypoint x="460" y="177" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1di7x3h_di" bpmnElement="Task_1djj44q"> + <dc:Bounds x="270" y="137" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0oic8cv_di" bpmnElement="ScriptTask_0oic8cv"> + <dc:Bounds x="930" y="430" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1q8dls4_di" bpmnElement="SequenceFlow_1q8dls4"> + <di:waypoint x="930" y="470" /> + <di:waypoint x="780" y="470" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1b60rre_di" bpmnElement="ServiceTask_1b60rre"> + <dc:Bounds x="680" y="430" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1pxnqsp_di" bpmnElement="SequenceFlow_1pxnqsp"> + <di:waypoint x="680" y="470" /> + <di:waypoint x="510" y="470" /> + <di:waypoint x="510" y="370" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01o92x6_di" bpmnElement="SequenceFlow_01o92x6"> + <di:waypoint x="980" y="202" /> + <di:waypoint x="980" y="305" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="964" y="243" width="13" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1pdfjh4_di" bpmnElement="ExclusiveGateway_1pdfjh4" isMarkerVisible="true"> + <dc:Bounds x="955" y="305" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1007" y="310" width="86" height="40" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0591ght_di" bpmnElement="SequenceFlow_0591ght"> + <di:waypoint x="980" y="355" /> + <di:waypoint x="980" y="430" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="987" y="390" width="17" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ktr440_di" bpmnElement="SequenceFlow_1ktr440"> + <di:waypoint x="955" y="330" /> + <di:waypoint x="560" y="330" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="751" y="312" width="13" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml index d37120b452..14081960e6 100644 --- a/bpmn/so-bpmn-tasks/pom.xml +++ b/bpmn/so-bpmn-tasks/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>bpmn</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>so-bpmn-tasks</artifactId> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index 8a6c4c2796..33b60a9ed3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -6,6 +6,7 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * Modifications Copyright (c) 2019 Bell Canada. + * Modifications Copyright (c) 2020 Nokia * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,43 +71,21 @@ public class AAIUpdateTasks { /** * BPMN access method to update the status of Service to Assigned in AAI - * - * @param execution */ public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) { - try { - ServiceInstance serviceInstance = - extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, - OrchestrationStatus.ASSIGNED); - execution.setVariable("aaiServiceInstanceRollback", true); - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedService", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } + updateOrchestrationStatusForService(execution, OrchestrationStatus.ASSIGNED); + execution.setVariable("aaiServiceInstanceRollback", true); } /** * BPMN access method to update status of Service to Active in AAI - * - * @param execution */ public void updateOrchestrationStatusActiveService(BuildingBlockExecution execution) { - try { - ServiceInstance serviceInstance = - extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, - OrchestrationStatus.ACTIVE); - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveService", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } + updateOrchestrationStatusForService(execution, OrchestrationStatus.ACTIVE); } /** * BPMN access method to update status of Pnf to Assigned in AAI - * - * @param execution */ public void updateOrchestrationStatusAssignedPnf(BuildingBlockExecution execution) { updateOrchestrationStatusForPnf(execution, OrchestrationStatus.ASSIGNED); @@ -114,8 +93,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of Pnf to Active in AAI - * - * @param execution */ public void updateOrchestrationStatusActivePnf(BuildingBlockExecution execution) { updateOrchestrationStatusForPnf(execution, OrchestrationStatus.ACTIVE); @@ -135,44 +112,18 @@ public class AAIUpdateTasks { updateOrchestrationStatusForPnf(execution, OrchestrationStatus.REGISTERED); } - private void updateOrchestrationStatusForPnf(BuildingBlockExecution execution, OrchestrationStatus status) { - try { - Pnf pnf = extractPojosForBB.extractByKey(execution, ResourceKey.PNF); - aaiPnfResources.updateOrchestrationStatusPnf(pnf, status); - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks during update Orchestration Status to {}", status, ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } - } - /** * BPMN access method to update status of Vnf to Assigned in AAI - * - * @param execution */ public void updateOrchestrationStatusAssignedVnf(BuildingBlockExecution execution) { - try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ASSIGNED); - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVnf", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } + updateOrchestrationStatusForVnf(execution, OrchestrationStatus.ASSIGNED); } /** * BPMN access method to update status of Vnf to Active in AAI - * - * @param execution */ public void updateOrchestrationStatusActiveVnf(BuildingBlockExecution execution) { - try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ACTIVE); - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVnf", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } + updateOrchestrationStatusForVnf(execution, OrchestrationStatus.ACTIVE); } /** @@ -839,4 +790,38 @@ public class AAIUpdateTasks { throw new IllegalArgumentException("Invalid action to set Orchestration status: " + action); } } + + private void updateOrchestrationStatusForService(BuildingBlockExecution execution, OrchestrationStatus status) { + try { + ServiceInstance serviceInstance = + extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, status); + } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks during update orchestration status to {} for service", + status, ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + private void updateOrchestrationStatusForPnf(BuildingBlockExecution execution, OrchestrationStatus status) { + try { + Pnf pnf = extractPojosForBB.extractByKey(execution, ResourceKey.PNF); + aaiPnfResources.updateOrchestrationStatusPnf(pnf, status); + } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks during update Orchestration Status to {}", status, ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + private void updateOrchestrationStatusForVnf(BuildingBlockExecution execution, OrchestrationStatus status) { + try { + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + aaiVnfResources.updateOrchestrationStatusVnf(vnf, status); + } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks during update orchestration status to {} for vnf", + status, ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + } diff --git a/cloudify-client/pom.xml b/cloudify-client/pom.xml index 6f4ea03ca5..6bb9357c38 100644 --- a/cloudify-client/pom.xml +++ b/cloudify-client/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>so</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <groupId>org.onap.so</groupId> diff --git a/common/pom.xml b/common/pom.xml index 04deacf129..3b33d6ed37 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>so</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>common</artifactId> <name>MSO Common classes</name> diff --git a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java index 69046a2eba..4434dce4e3 100644 --- a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java +++ b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java @@ -21,6 +21,7 @@ package org.onap.so.rest.service; import com.google.common.base.Optional; +import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; /** @@ -39,6 +40,16 @@ public interface HttpRestServiceProvider { /** * Execute the HTTP GET to the given URI template + * + * @param url the URL + * @param headers request headers + * @param clazz the type of the return value + * @return Returns the body of this entity. + */ + <T> Optional<T> get(final String url, final HttpHeaders headers, final Class<T> clazz); + + /** + * Execute the HTTP GET to the given URI template * * @param url the URL * @param clazz the type of the return value @@ -46,6 +57,15 @@ public interface HttpRestServiceProvider { */ <T> ResponseEntity<T> getHttpResponse(final String url, final Class<T> clazz); + /** + * Execute the HTTP GET to the given URI template + * + * @param url the URL + * @param headers request headers + * @param clazz the type of the return value + * @return Returns the {@link ResponseEntity}. + */ + <T> ResponseEntity<T> getHttpResponse(final String url, final HttpHeaders headers, final Class<T> clazz); /** * Execute the HTTP POST to the given URI template @@ -68,6 +88,18 @@ public interface HttpRestServiceProvider { <T> ResponseEntity<T> postHttpRequest(final Object object, final String url, final Class<T> clazz); /** + * Execute the HTTP POST to the given URI template + * + * @param object the entity (i.e. body) to write to the request + * @param url the URL + * @param clazz the type of the return value + * @param headers request headers + * @return Returns the {@link ResponseEntity}. + */ + <T> ResponseEntity<T> postHttpRequest(final Object object, final String url, final HttpHeaders headers, + final Class<T> clazz); + + /** * Execute the HTTP PUT to the given URI template * * @param object the entity (i.e. body) to write to the request diff --git a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java index 6211b76561..04dd0bbb7a 100644 --- a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java +++ b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java @@ -20,8 +20,6 @@ package org.onap.so.rest.service; -import com.google.common.base.Optional; -import org.onap.so.configuration.rest.BasicHttpHeadersProvider; import org.onap.so.configuration.rest.HttpHeadersProvider; import org.onap.so.rest.exceptions.HttpResouceNotFoundException; import org.onap.so.rest.exceptions.InvalidRestRequestException; @@ -36,6 +34,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.client.HttpStatusCodeException; import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestTemplate; +import com.google.common.base.Optional; /** * A Service to perform HTTP requests @@ -46,16 +45,27 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider { private static final Logger LOGGER = LoggerFactory.getLogger(HttpRestServiceProviderImpl.class); private final RestTemplate restTemplate; - private final HttpHeadersProvider httpHeadersProvider; + private final HttpHeaders defaultHttpHeaders; public HttpRestServiceProviderImpl(final RestTemplate restTemplate) { this.restTemplate = restTemplate; - this.httpHeadersProvider = new BasicHttpHeadersProvider(); + this.defaultHttpHeaders = new HttpHeaders(); + } + + public HttpRestServiceProviderImpl(final RestTemplate restTemplate, final HttpHeaders defaultHttpHeaders) { + this.restTemplate = restTemplate; + this.defaultHttpHeaders = defaultHttpHeaders; } + /** + * + * @deprecated this constructor is deprecated in favor of using {@link HttpRestServiceProviderImpl(RestTemplate + * restTemplate, HttpHeaders defaultHttpHeaders)} + */ + @Deprecated public HttpRestServiceProviderImpl(final RestTemplate restTemplate, final HttpHeadersProvider httpHeadersProvider) { this.restTemplate = restTemplate; - this.httpHeadersProvider = httpHeadersProvider; + this.defaultHttpHeaders = httpHeadersProvider.getHttpHeaders(); } @Override @@ -64,10 +74,21 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider { return createOptional(response, url, HttpMethod.GET); } + @Override + public <T> Optional<T> get(final String url, final HttpHeaders headers, final Class<T> clazz) { + final ResponseEntity<T> response = invokeHttpRequest(new HttpEntity<>(headers), HttpMethod.GET, url, clazz); + return createOptional(response, url, HttpMethod.GET); + } @Override public <T> ResponseEntity<T> getHttpResponse(final String url, final Class<T> clazz) { - final HttpEntity<?> request = new HttpEntity<>(getHttpHeaders()); + final HttpEntity<?> request = new HttpEntity<>(getDefaultHttpHeaders()); + return invokeHttpRequest(request, HttpMethod.GET, url, clazz); + } + + @Override + public <T> ResponseEntity<T> getHttpResponse(final String url, final HttpHeaders headers, final Class<T> clazz) { + final HttpEntity<?> request = new HttpEntity<>(headers); return invokeHttpRequest(request, HttpMethod.GET, url, clazz); } @@ -79,7 +100,14 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider { @Override public <T> ResponseEntity<T> postHttpRequest(final Object object, final String url, final Class<T> clazz) { - final HttpEntity<?> request = new HttpEntity<>(object, getHttpHeaders()); + final HttpEntity<?> request = new HttpEntity<>(object, getDefaultHttpHeaders()); + return invokeHttpRequest(request, HttpMethod.POST, url, clazz); + } + + @Override + public <T> ResponseEntity<T> postHttpRequest(final Object object, final String url, final HttpHeaders headers, + final Class<T> clazz) { + final HttpEntity<?> request = new HttpEntity<>(object, headers); return invokeHttpRequest(request, HttpMethod.POST, url, clazz); } @@ -91,7 +119,7 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider { @Override public <T> ResponseEntity<T> putHttpRequest(final Object object, final String url, final Class<T> clazz) { - final HttpEntity<?> request = new HttpEntity<>(object, getHttpHeaders()); + final HttpEntity<?> request = new HttpEntity<>(object, getDefaultHttpHeaders()); return invokeHttpRequest(request, HttpMethod.PUT, url, clazz); } @@ -140,7 +168,7 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider { @Override public <T> ResponseEntity<T> deleteHttpRequest(final String url, final Class<T> clazz) { try { - final HttpEntity<?> request = new HttpEntity<>(getHttpHeaders()); + final HttpEntity<?> request = new HttpEntity<>(getDefaultHttpHeaders()); return restTemplate.exchange(url, HttpMethod.DELETE, request, clazz); } catch (final HttpStatusCodeException httpStatusCodeException) { @@ -162,7 +190,7 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider { } } - private HttpHeaders getHttpHeaders() { - return httpHeadersProvider.getHttpHeaders(); + private HttpHeaders getDefaultHttpHeaders() { + return defaultHttpHeaders; } } diff --git a/cxf-logging/pom.xml b/cxf-logging/pom.xml index f0c969aeb1..c056daf6f8 100644 --- a/cxf-logging/pom.xml +++ b/cxf-logging/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>so</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <name>CXFLogging</name> <description>Common CXF Logging Classes</description> diff --git a/deployment-configs/pom.xml b/deployment-configs/pom.xml index 6935a15955..002cd19f81 100644 --- a/deployment-configs/pom.xml +++ b/deployment-configs/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>so</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>deployment-configs</artifactId> <name>deployment-configs</name> diff --git a/mso-api-handlers/mso-api-handler-common/pom.xml b/mso-api-handlers/mso-api-handler-common/pom.xml index a3fd37ce2b..865de7998f 100644 --- a/mso-api-handlers/mso-api-handler-common/pom.xml +++ b/mso-api-handlers/mso-api-handler-common/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>mso-api-handlers</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml index 9944984d33..3a7c7ad477 100644 --- a/mso-api-handlers/mso-api-handler-infra/pom.xml +++ b/mso-api-handlers/mso-api-handler-infra/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>mso-api-handlers</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> diff --git a/mso-api-handlers/mso-requests-db-repositories/pom.xml b/mso-api-handlers/mso-requests-db-repositories/pom.xml index 4dbf22cd87..efc81384d4 100644 --- a/mso-api-handlers/mso-requests-db-repositories/pom.xml +++ b/mso-api-handlers/mso-requests-db-repositories/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>mso-api-handlers</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>mso-requests-db-repositories</artifactId> diff --git a/mso-api-handlers/mso-requests-db/pom.xml b/mso-api-handlers/mso-requests-db/pom.xml index 031f86282a..37bb4175a5 100644 --- a/mso-api-handlers/mso-requests-db/pom.xml +++ b/mso-api-handlers/mso-requests-db/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>mso-api-handlers</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>mso-requests-db</artifactId> diff --git a/mso-api-handlers/pom.xml b/mso-api-handlers/pom.xml index b4d5c7070a..5c84ab1d77 100644 --- a/mso-api-handlers/pom.xml +++ b/mso-api-handlers/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>so</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>mso-api-handlers</artifactId> diff --git a/mso-catalog-db/pom.xml b/mso-catalog-db/pom.xml index 6a4a6774e6..7444866315 100644 --- a/mso-catalog-db/pom.xml +++ b/mso-catalog-db/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>so</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>mso-catalog-db</artifactId> diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml index c78979eccb..545fc926a8 100644 --- a/packages/docker/pom.xml +++ b/packages/docker/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>packages</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <packaging>pom</packaging> diff --git a/packages/pom.xml b/packages/pom.xml index 029fa3d446..af302405cc 100644 --- a/packages/pom.xml +++ b/packages/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>so</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>packages</artifactId> @@ -11,7 +11,7 @@ <groupId>org.onap.so</groupId> <artifactId>so</artifactId> <packaging>pom</packaging> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> <name>so</name> <description>This Maven project is responsible to build and package all child projects - contributions in the MSO project. This build can be configured to run Functional tests and to start/stop a jboss server + Mysql DB. diff --git a/so-monitoring/pom.xml b/so-monitoring/pom.xml index 243073554e..206a0f2851 100644 --- a/so-monitoring/pom.xml +++ b/so-monitoring/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>so</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <groupId>org.onap.so.monitoring</groupId> diff --git a/so-monitoring/so-monitoring-handler/pom.xml b/so-monitoring/so-monitoring-handler/pom.xml index 59546861c5..176328a434 100644 --- a/so-monitoring/so-monitoring-handler/pom.xml +++ b/so-monitoring/so-monitoring-handler/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.so.monitoring</groupId> <artifactId>so-monitoring</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>so-monitoring-handler</artifactId> <name>${project.artifactId}</name> diff --git a/so-monitoring/so-monitoring-service/pom.xml b/so-monitoring/so-monitoring-service/pom.xml index 762e3a5ee6..110c3fe863 100644 --- a/so-monitoring/so-monitoring-service/pom.xml +++ b/so-monitoring/so-monitoring-service/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.so.monitoring</groupId> <artifactId>so-monitoring</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>so-monitoring-service</artifactId> <name>${project.artifactId}</name> diff --git a/so-monitoring/so-monitoring-ui/pom.xml b/so-monitoring/so-monitoring-ui/pom.xml index c362a83a9b..6488c7d7df 100644 --- a/so-monitoring/so-monitoring-ui/pom.xml +++ b/so-monitoring/so-monitoring-ui/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.so.monitoring</groupId> <artifactId>so-monitoring</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>so-monitoring-ui</artifactId> diff --git a/so-simulator/pom.xml b/so-simulator/pom.xml index 6e0d125ddb..352a16769b 100644 --- a/so-simulator/pom.xml +++ b/so-simulator/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>so</artifactId> - <version>1.4.0-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>so-simulator</artifactId> |