diff options
author | AndrewLamb <andrew.a.lamb@est.tech> | 2020-10-07 14:12:44 +0100 |
---|---|---|
committer | AndrewLamb <andrew.a.lamb@est.tech> | 2020-10-13 16:38:58 +0100 |
commit | 1d12326d47c541934fd0ee3376844a159941a9ef (patch) | |
tree | 7fa730f6e793229ead98068f65993d7e1ccf586d /so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src | |
parent | 33fb2c6e36d763fd9d24f55debc55c458dab6780 (diff) |
SO-ETSI-NFVO Get NS Operation Status Backend Service
Issue-ID: SO-2871
Change-Id: I1b17bbc5750abb38bf017df4088c4b40db3552ab
Signed-off-by: AndrewLamb <andrew.a.lamb@est.tech>
Diffstat (limited to 'so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src')
4 files changed, 62 insertions, 15 deletions
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/CancelModeType.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/CancelModeType.java new file mode 100644 index 0000000000..627250535e --- /dev/null +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/CancelModeType.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.etsi.nfvo.ns.lcm.database.beans; + +/** + * @author Andrew Lamb (andrew.a.lamb@est.tech) + * + */ +public enum CancelModeType { + GRACEFUL, FORCEFUL; +} diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java index 19fe969366..4846e5a361 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java @@ -62,8 +62,8 @@ public class NsLcmOpOcc { @Column(name = "OPERATION", nullable = false) private NsLcmOpType operation; - @Column(name = "IS_AUTO_INNOVATION", nullable = false) - private boolean isAutoInnovation; + @Column(name = "IS_AUTO_INVOCATION", nullable = false) + private boolean isAutoInvocation; @Column(name = "OPERATION_PARAMS", columnDefinition = "LONGTEXT", nullable = false) private String operationParams; @@ -71,6 +71,10 @@ public class NsLcmOpOcc { @Column(name = "IS_CANCEL_PENDING", nullable = false) private boolean isCancelPending; + @Enumerated(EnumType.STRING) + @Column(name = "CANCEL_MODE") + private CancelModeType cancelMode; + public NsLcmOpOcc() { this.id = UUID.randomUUID().toString(); } @@ -153,16 +157,29 @@ public class NsLcmOpOcc { return this; } - public boolean getIsAutoInnovation() { - return isAutoInnovation; + public boolean getIsAutoInvocation() { + return isAutoInvocation; + } + + public void setIsAutoInvocation(final boolean isAutoInvocation) { + this.isAutoInvocation = isAutoInvocation; + } + + public NsLcmOpOcc isAutoInvocation(final boolean isAutoInvocation) { + this.isAutoInvocation = isAutoInvocation; + return this; + } + + public CancelModeType getCancelMode() { + return cancelMode; } - public void setIsAutoInnovation(final boolean isAutoInnovation) { - this.isAutoInnovation = isAutoInnovation; + public void setCancelMode(final CancelModeType cancelMode) { + this.cancelMode = cancelMode; } - public NsLcmOpOcc isAutoInnovation(final boolean isAutoInnovation) { - this.isAutoInnovation = isAutoInnovation; + public NsLcmOpOcc cancelMode(final CancelModeType cancelMode) { + this.cancelMode = cancelMode; return this; } @@ -203,16 +220,16 @@ public class NsLcmOpOcc { && Objects.equals(stateEnteredTime, that.stateEnteredTime) && Objects.equals(startTime, that.startTime) && (nfvoNsInst == null ? that.nfvoNsInst == null : that.nfvoNsInst != null && Objects.equals(nfvoNsInst, that.nfvoNsInst)) - && Objects.equals(operation, that.operation) && Objects.equals(isAutoInnovation, that.isAutoInnovation) + && Objects.equals(operation, that.operation) && Objects.equals(isAutoInvocation, that.isAutoInvocation) && Objects.equals(operationParams, that.operationParams) - && Objects.equals(isCancelPending, that.isCancelPending); + && Objects.equals(isCancelPending, that.isCancelPending) && Objects.equals(cancelMode, that.cancelMode); } @Override public int hashCode() { return Objects.hash(id, operationState, stateEnteredTime, startTime, - nfvoNsInst != null ? nfvoNsInst.getNsInstId() : 0, operation, isAutoInnovation, operationParams, - isCancelPending); + nfvoNsInst != null ? nfvoNsInst.getNsInstId() : 0, operation, isAutoInvocation, operationParams, + isCancelPending, cancelMode); } @Override @@ -226,9 +243,10 @@ public class NsLcmOpOcc { sb.append(" nfvoNsInst: ").append(nfvoNsInst != null ? toIndentedString(nfvoNsInst.getNsInstId()) : null) .append("\n"); sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); - sb.append(" isAutoInnovation: ").append(toIndentedString(isAutoInnovation)).append("\n"); + sb.append(" isAutoInvocation: ").append(toIndentedString(isAutoInvocation)).append("\n"); sb.append(" operationParams: ").append(toIndentedString(operationParams)).append("\n"); sb.append(" isCancelPending: ").append(toIndentedString(isCancelPending)).append("\n"); + sb.append(" cancelMode: ").append(toIndentedString(cancelMode)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/resources/db/migration/V1_1__create_nfvo_tables.sql b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/resources/db/migration/V1_1__create_nfvo_tables.sql index f41a8206e0..85a732b83e 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/resources/db/migration/V1_1__create_nfvo_tables.sql +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/resources/db/migration/V1_1__create_nfvo_tables.sql @@ -64,9 +64,10 @@ CREATE TABLE IF NOT EXISTS `NS_LCM_OP_OCCS` ( `START_TIME` DATETIME DEFAULT NULL, `NS_INST_ID` varchar(255) NOT NULL, `OPERATION` varchar(255) NOT NULL, - `IS_AUTO_INNOVATION` varchar(255) NOT NULL, + `IS_AUTO_INVOCATION` varchar(255) NOT NULL, `OPERATION_PARAMS` longtext NOT NULL, `IS_CANCEL_PENDING` varchar(255) NOT NULL, + `CANCEL_MODE` varchar(255) DEFAULT NULL, PRIMARY KEY (`ID`), FOREIGN KEY (NS_INST_ID) REFERENCES NS_INST(NS_INST_ID) diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/DatabaseServiceProviderTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/DatabaseServiceProviderTest.java index 8070036791..fcf7f9c373 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/DatabaseServiceProviderTest.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/DatabaseServiceProviderTest.java @@ -164,7 +164,7 @@ public class DatabaseServiceProviderTest { databaseServiceProvider.saveNfvoNsInst(nsInst); final NsLcmOpOcc nsLcmOpOcc = new NsLcmOpOcc().nfvoNsInst(nsInst).operationState(OperationStateEnum.PROCESSING) - .isCancelPending(false).isAutoInnovation(false).operation(NsLcmOpType.INSTANTIATE) + .isCancelPending(false).isAutoInvocation(false).operation(NsLcmOpType.INSTANTIATE) .startTime(CURRENT_DATE_TIME).stateEnteredTime(CURRENT_DATE_TIME).operationParams(""); |