2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.so.adapters.etsi.sol003.adapter.lcm.jobmanagement;
24 * Represents an operation on a VNFM.
26 public class VnfmOperation {
28 private final String vnfmId;
29 private final String operationId;
30 private NotificationStatus notificationStatus;
31 private boolean vnfDeleted;
33 public VnfmOperation(final String vnfmId, final String operationId, final boolean waitForNotificationForSuccess) {
35 this.operationId = operationId;
36 this.notificationStatus = waitForNotificationForSuccess ? NotificationStatus.NOTIFICATION_PROCESSING_PENDING
37 : NotificationStatus.NOTIFICATION_PROCESSING_NOT_REQUIRED;
41 * Get the ID of the operation on the VNFM.
43 * @return the ID of the operation on the VNFM
45 public String getOperationId() {
50 * Get the ID of the VNFM the operation is carried out by.
52 * @return the ID of the VNFM
54 public String getVnfmId() {
59 * Set the required notification has been processed for the operation.
61 * @param notificationProcessingWasSuccessful <code>true</code> if the notification processing was successful,
62 * <code>false<code> otherwise
64 public void setNotificationProcessed(final boolean notificationProcessingWasSuccessful) {
65 this.notificationStatus =
66 notificationProcessingWasSuccessful ? NotificationStatus.NOTIFICATION_PROCEESING_SUCCESSFUL
67 : NotificationStatus.NOTIFICATION_PROCESSING_FAILED;
71 * Get the notification status for the operation.
73 * @return the notification status
75 public NotificationStatus getNotificationStatus() {
76 return notificationStatus;
80 * Set the VNF has been deleted from the VNFM.
82 public void setVnfDeleted() {
83 this.vnfDeleted = true;
87 * Check if the VNF has been deleted from the VNFM
89 * @return <code>true</code> of the VNF has been deleted from the VNFM, <code>false</code> otherwise
91 public boolean isVnfDeleted() {
96 public enum NotificationStatus {
98 * No notification handling is required to determine the status of the operation
100 NOTIFICATION_PROCESSING_NOT_REQUIRED,
102 * A notification must be processed before the notification can be considered to be completed
104 NOTIFICATION_PROCESSING_PENDING,
106 * A notification has been successfully handled for the operation
108 NOTIFICATION_PROCEESING_SUCCESSFUL,
110 * An error occurred processing a notification for the operation
112 NOTIFICATION_PROCESSING_FAILED;
116 public String toString() {
117 return "VnfmOperation [vnfmId=" + vnfmId + ", operationId=" + operationId + ", notificationStatus="
118 + notificationStatus + "]";