aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrian OSullivan <adrian.osullivan@huawei.com>2020-08-24 14:28:05 +0000
committerGerrit Code Review <gerrit@onap.org>2020-08-24 14:28:05 +0000
commit967b113a25e92e0b95ad4a1ac3b3966debd6d921 (patch)
tree86a8b48fd4df00b38e0cea0f375d4bbba9dace5e /src
parent417bd28022619432588cc58679e68d893c62c617 (diff)
parent1bc42e219ad96e8c61483b99d0f98e67909649b6 (diff)
Merge "Implement E2EService activation/deactivation for NetworkSlicing"
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java1
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java73
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/Service.java8
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceStateType.java53
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOE2EServiceActivationPayload.java46
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOE2EServiceActivationReponse.java35
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java25
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOGetStatusManager.java15
-rw-r--r--src/test/java/org/onap/nbi/apis/assertions/ServiceOrderExecutionTaskAssertions.java23
-rw-r--r--src/test/java/org/onap/nbi/test/ExecutionTaskTest.java35
-rw-r--r--src/test/resources/mappings/so/so_e2e_activate_service_instance.json16
11 files changed, 294 insertions, 36 deletions
diff --git a/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java b/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java
index 417fa51..eb59d31 100644
--- a/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java
+++ b/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java
@@ -64,6 +64,7 @@ public final class OnapComponentsUrlPaths {
"/onap/so/infra/serviceInstantiation/v7/serviceInstances/";
public static final String MSO_CREATE_E2ESERVICE_INSTANCE_PATH = "/onap/so/infra/e2eServiceInstances/v3";
public static final String MSO_DELETE_E2ESERVICE_INSTANCE_PATH = "/onap/so/infra/e2eServiceInstances/v3/";
+ public static final String MSO_ACTIVATION_E2ESERVICE_INSTANCE_PATH = "/onap/so/infra/e2eServiceInstances/v3/";
public static final String MSO_GET_E2EREQUEST_STATUS_PATH =
"/onap/so/infra/e2eServiceInstances/v3/$serviceId/operations/$operationId";
public static final String MSO_HEALTH_CHECK = "/globalhealthcheck";
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
index 95009b8..8e58c39 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
@@ -24,6 +24,8 @@ import org.onap.nbi.apis.serviceorder.model.consumer.GetE2ERequestStatusResponse
import org.onap.nbi.apis.serviceorder.model.consumer.GetRequestStatusResponse;
import org.onap.nbi.apis.serviceorder.model.consumer.MSODeleteE2EPayload;
import org.onap.nbi.apis.serviceorder.model.consumer.MSOE2EPayload;
+import org.onap.nbi.apis.serviceorder.model.consumer.MSOE2EServiceActivationPayload;
+import org.onap.nbi.apis.serviceorder.model.consumer.MSOE2EServiceActivationReponse;
import org.onap.nbi.apis.serviceorder.model.consumer.MSOPayload;
import org.onap.nbi.apis.serviceorder.model.consumer.ServiceResponse;
import org.onap.nbi.exceptions.BackendFunctionalException;
@@ -68,6 +70,7 @@ public class SoClient {
private String getSoStatus;
private String getE2ESoStatus;
private String deleteE2ESoUrl;
+ private String activationE2ESoUrl;
private String deleteSoUrl;
private String SoHealthCheck;
@@ -81,7 +84,9 @@ public class SoClient {
.append(OnapComponentsUrlPaths.MSO_DELETE_REQUEST_STATUS_PATH).toString();
deleteE2ESoUrl = new StringBuilder().append(soHostname)
.append(OnapComponentsUrlPaths.MSO_DELETE_E2ESERVICE_INSTANCE_PATH).toString();
- getSoStatus = new StringBuilder().append(soHostname).append(OnapComponentsUrlPaths.MSO_GET_REQUEST_STATUS_PATH)
+ activationE2ESoUrl = new StringBuilder().append(soHostname)
+ .append(OnapComponentsUrlPaths.MSO_ACTIVATION_E2ESERVICE_INSTANCE_PATH).toString();
+ getSoStatus = new StringBuilder().append(soHostname).append(OnapComponentsUrlPaths.MSO_GET_REQUEST_STATUS_PATH)
.toString();
getE2ESoStatus = new StringBuilder().append(soHostname)
.append(OnapComponentsUrlPaths.MSO_GET_E2EREQUEST_STATUS_PATH).toString();
@@ -92,7 +97,8 @@ public class SoClient {
LOGGER.info("SO create e2e service url : " + createE2ESoUrl);
LOGGER.info("SO delete service url : " + deleteSoUrl);
LOGGER.info("SO delete e2e service url : " + deleteE2ESoUrl);
- LOGGER.info("SO get so status url : " + getSoStatus);
+ LOGGER.info("SO e2e service actiavtion url : " + activationE2ESoUrl);
+ LOGGER.info("SO get so status url : " + getSoStatus);
LOGGER.info("SO get e2e so status url : " + getE2ESoStatus);
LOGGER.info("SO healthCheck : " + SoHealthCheck);
@@ -208,15 +214,8 @@ public class SoClient {
HttpMethod.DELETE, new HttpEntity<>(msoDeleteE2EPayload, buildRequestHeader()),
DeleteE2EServiceInstanceResponse.class);
- // For E2E Services , Create and Delete Service responses are different, to maintain
- // consistentcy with ServiceInstances
- // Copy contents of DeleteE2EServiceInstanceResponse to CreateE2EServiceInstanceResponse
- CreateE2EServiceInstanceResponse dummyresponse = new CreateE2EServiceInstanceResponse();
- ServiceResponse serviceResponse = new ServiceResponse();
- dummyresponse.setService(serviceResponse);
- dummyresponse.getService().setOperationId(deleteresponse.getBody().getOperationId());
- dummyresponse.getService().setServiceId(serviceInstanceId);
-
+ CreateE2EServiceInstanceResponse dummyresponse = buildDummyResponse(serviceInstanceId,
+ deleteresponse.getBody().getOperationId());
ResponseEntity<CreateE2EServiceInstanceResponse> response =
new ResponseEntity(dummyresponse, deleteresponse.getStatusCode());
logE2EResponsePost(url, response);
@@ -230,7 +229,57 @@ public class SoClient {
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
+ public ResponseEntity<CreateE2EServiceInstanceResponse> callServiceActivationE2EService(String globalSubscriberId,
+ String serviceType, String serviceInstanceId, String operation) {
+ String url = new StringBuilder(activationE2ESoUrl).append(serviceInstanceId).append("/").append(operation).toString();
+ MSOE2EServiceActivationPayload msoE2EServiceActivationPayload = new MSOE2EServiceActivationPayload();
+ msoE2EServiceActivationPayload.setGlobalSubscriberId(globalSubscriberId);
+ msoE2EServiceActivationPayload.setServiceType(serviceType);
+
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Calling SO E2E Service Activation/Deactivation with url : " + url + " MSOE2EServiceActivationPayload : "
+ + msoE2EServiceActivationPayload.toString());
+ }
+
+ try {
+ ResponseEntity<MSOE2EServiceActivationReponse> activationResponse = restTemplate.exchange(url,
+ HttpMethod.POST, new HttpEntity<>(msoE2EServiceActivationPayload, buildRequestHeader()),
+ MSOE2EServiceActivationReponse.class);
+ CreateE2EServiceInstanceResponse dummyresponse = buildDummyResponse(serviceInstanceId,
+ activationResponse.getBody().getOperationId());
+
+ ResponseEntity<CreateE2EServiceInstanceResponse> response =
+ new ResponseEntity(dummyresponse, activationResponse.getStatusCode());
+ logE2EResponsePost(url, response);
+ return response;
+
+ } catch (BackendFunctionalException e) {
+ LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
+ return new ResponseEntity<>(e.getHttpStatus());
+ } catch (ResourceAccessException e) {
+ LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
+
+ /**
+ * @param serviceInstanceId
+ * @param operationId
+ * @return
+ * For E2E Services , Create and Delete/Activate/Deactivate Service responses are different,
+ * to maintain consistentcy with ServiceInstances Copy contents of ServiceActivationE2EReponse
+ * to CreateE2EServiceInstanceResponse
+ */
+ private CreateE2EServiceInstanceResponse buildDummyResponse(String serviceInstanceId,
+ String operationId) {
+ CreateE2EServiceInstanceResponse dummyresponse = new CreateE2EServiceInstanceResponse();
+ ServiceResponse serviceResponse = new ServiceResponse();
+ dummyresponse.setService(serviceResponse);
+ dummyresponse.getService().setOperationId(operationId);
+ dummyresponse.getService().setServiceId(serviceInstanceId);
+ return dummyresponse;
+ }
private void logResponsePost(String url, ResponseEntity<CreateServiceInstanceResponse> response) {
LOGGER.info(RESPONSE_STATUS + response.getStatusCodeValue());
if (LOGGER.isDebugEnabled()) {
@@ -362,4 +411,4 @@ public class SoClient {
return httpHeaders;
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/Service.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/Service.java
index 31802f2..6b35130 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/Service.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/Service.java
@@ -68,7 +68,7 @@ public class Service {
private String name = null;
@JsonProperty("serviceState")
- private String serviceState = null;
+ private ServiceStateType serviceState = null;
@JsonProperty("@type")
private String type = null;
@@ -158,7 +158,7 @@ public class Service {
this.name = name;
}
- public Service serviceState(String serviceState) {
+ public Service serviceState(ServiceStateType serviceState) {
this.serviceState = serviceState;
return this;
}
@@ -170,11 +170,11 @@ public class Service {
**/
@JsonProperty("serviceState")
@ApiModelProperty(value = "The lifecycle state of the service")
- public String getServiceState() {
+ public ServiceStateType getServiceState() {
return serviceState;
}
- public void setServiceState(String serviceState) {
+ public void setServiceState(ServiceStateType serviceState) {
this.serviceState = serviceState;
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceStateType.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceStateType.java
new file mode 100644
index 0000000..a461080
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceStateType.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2020 Wipro Limited
+ *
+ * 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.
+ */
+
+package org.onap.nbi.apis.serviceorder.model;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+public enum ServiceStateType {
+
+ ACTIVE("active"),
+
+ INACTIVE("inactive");
+
+ private String value;
+
+ ServiceStateType(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ @JsonCreator
+ public static ServiceStateType fromValue(String text) {
+ for (ServiceStateType b : ServiceStateType.values()) {
+ if (String.valueOf(b.value).equals(text)) {
+ return b;
+ }
+ }
+ return null;
+ }
+
+ @JsonValue
+ public String value() {
+ return this.value;
+ }
+
+}
+
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOE2EServiceActivationPayload.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOE2EServiceActivationPayload.java
new file mode 100644
index 0000000..fca0a22
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOE2EServiceActivationPayload.java
@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) 2020 Wipro Limited
+ *
+ * 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.
+ */
+
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+public class MSOE2EServiceActivationPayload {
+
+ private String globalSubscriberId;
+
+ private String serviceType;
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ @Override
+ public String toString() {
+ return "MSOE2EServiceActivationPayload{" + "globalSubscriberId='" + globalSubscriberId + '\'' + ", serviceType='"
+ + serviceType + '\'' + '}';
+ }
+
+}
+
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOE2EServiceActivationReponse.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOE2EServiceActivationReponse.java
new file mode 100644
index 0000000..e74cf93
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/MSOE2EServiceActivationReponse.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) 2020 Wipro Limited
+ *
+ * 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.
+ */
+
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+public class MSOE2EServiceActivationReponse {
+
+ private String operationId;
+
+
+ public String getOperationId() {
+ return operationId;
+ }
+
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+
+ @Override
+ public String toString() {
+ return "MSOE2EServiceActivationReponse{" + "operationId='" + operationId + '\'' + '}';
+ }
+}
+
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java
index 17b72e4..4568b80 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java
@@ -29,6 +29,7 @@ import org.onap.nbi.apis.serviceorder.model.ServiceCharacteristic;
import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
import org.onap.nbi.apis.serviceorder.model.StateType;
+import org.onap.nbi.apis.serviceorder.model.ServiceStateType;
import org.onap.nbi.apis.serviceorder.model.consumer.CloudConfiguration;
import org.onap.nbi.apis.serviceorder.model.consumer.CreateE2EServiceInstanceResponse;
import org.onap.nbi.apis.serviceorder.model.consumer.CreateMacroServiceInstanceResponse;
@@ -182,20 +183,34 @@ public class PostSoProcessor {
service.getServiceType(), serviceOrderItem.getService().getId());
break;
case MODIFY:
- if (StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE == serviceOrderItem.getState()) {
+ //EXT-API supports E2E service activation/deactivation with action=modify and seviceState=active/inactive
+ boolean isActivateReq = ServiceStateType.ACTIVE == serviceOrderItem.getService().getServiceState() ||
+ ServiceStateType.INACTIVE == serviceOrderItem.getService().getServiceState();
+
+ if (ServiceStateType.ACTIVE == serviceOrderItem.getService().getServiceState()) {
+ response = soClient.callServiceActivationE2EService(service.getGlobalSubscriberId(),
+ service.getServiceType(), serviceOrderItem.getService().getId(),"activate");
+ }
+ if (ServiceStateType.INACTIVE == serviceOrderItem.getService().getServiceState()) {
+ response = soClient.callServiceActivationE2EService(service.getGlobalSubscriberId(),
+ service.getServiceType(), serviceOrderItem.getService().getId(),"deactivate");
+ }
+ //Other E2E service modification follows Deletion followed by activation.
+ //For service modification, do not send serviceState=active/inactive
+ if (!isActivateReq && StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE == serviceOrderItem.getState()) {
response = soClient.callE2ECreateServiceInstance(msoE2EPayload);
}
- if (StateType.ACKNOWLEDGED == serviceOrderItem.getState()) {
+ if (!isActivateReq && StateType.ACKNOWLEDGED == serviceOrderItem.getState()) {
response = soClient.callE2EDeleteServiceInstance(service.getGlobalSubscriberId(),
service.getServiceType(), serviceOrderItem.getService().getId());
}
break;
- default:
+ default:
break;
}
return response;
}
-
+
private ResponseEntity<CreateMacroServiceInstanceResponse> postSOMacroRequest(ServiceOrderItem serviceOrderItem,
ServiceOrderInfo serviceOrderInfo) {
@@ -660,4 +675,4 @@ public class PostSoProcessor {
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOGetStatusManager.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOGetStatusManager.java
index bbe1160..d5d12bb 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOGetStatusManager.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOGetStatusManager.java
@@ -17,6 +17,7 @@ import org.onap.nbi.apis.serviceorder.SoClient;
import org.onap.nbi.apis.serviceorder.model.ActionType;
import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
+import org.onap.nbi.apis.serviceorder.model.ServiceStateType;
import org.onap.nbi.apis.serviceorder.model.StateType;
import org.onap.nbi.apis.serviceorder.model.consumer.GetE2ERequestStatusResponse;
import org.onap.nbi.apis.serviceorder.model.consumer.GetRequestStatusResponse;
@@ -64,7 +65,8 @@ public class SOGetStatusManager {
LOGGER.debug("orderitem id {} failed, response from request status {}", orderItem.getId(),
response.getRequest().getRequestStatus().getRequestState());
} else {
- updateOrderItemIfStatusCompleted(serviceOrder, orderItem);
+ boolean e2eService = false;
+ updateOrderItemIfStatusCompleted(serviceOrder, orderItem, e2eService);
LOGGER.debug("orderitem id {} completed");
}
} else {
@@ -73,10 +75,14 @@ public class SOGetStatusManager {
}
- private void updateOrderItemIfStatusCompleted(ServiceOrder serviceOrder, ServiceOrderItem orderItem) {
+ private void updateOrderItemIfStatusCompleted(ServiceOrder serviceOrder, ServiceOrderItem orderItem,boolean e2eService) {
+ boolean serviceActivationReq = orderItem.getService().getServiceState() == ServiceStateType.ACTIVE ||
+ orderItem.getService().getServiceState() == ServiceStateType.INACTIVE;
if (orderItem.getAction() != ActionType.MODIFY) {
serviceOrderService.updateOrderItemState(serviceOrder, orderItem, StateType.COMPLETED);
- } else {
+ }else if(orderItem.getAction() == ActionType.MODIFY && serviceActivationReq && e2eService) {
+ serviceOrderService.updateOrderItemState(serviceOrder, orderItem, StateType.COMPLETED);
+ }else {
if (StateType.INPROGRESS_MODIFY_REQUEST_CREATE_SEND == orderItem.getState()) {
serviceOrderService.updateOrderItemState(serviceOrder, orderItem, StateType.COMPLETED);
} else {
@@ -105,7 +111,8 @@ public class SOGetStatusManager {
LOGGER.debug("orderitem id {} failed, response from request status {}", orderItem.getId(),
response.getOperation().getResult());
} else if (FINISHED.equals(result)) {
- updateOrderItemIfStatusCompleted(serviceOrder, orderItem);
+ boolean e2eService = true;
+ updateOrderItemIfStatusCompleted(serviceOrder, orderItem,e2eService);
LOGGER.debug("orderitem id {} completed");
}
} else {
diff --git a/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderExecutionTaskAssertions.java b/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderExecutionTaskAssertions.java
index 430cd84..57f8bce 100644
--- a/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderExecutionTaskAssertions.java
+++ b/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderExecutionTaskAssertions.java
@@ -30,6 +30,7 @@ import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
import org.onap.nbi.apis.serviceorder.model.ServiceSpecificationRef;
import org.onap.nbi.apis.serviceorder.model.StateType;
+import org.onap.nbi.apis.serviceorder.model.ServiceStateType;
import org.onap.nbi.apis.serviceorder.model.Value;
import org.onap.nbi.apis.serviceorder.model.consumer.SubscriberInfo;
import org.onap.nbi.apis.serviceorder.model.orchestrator.ExecutionTask;
@@ -65,8 +66,8 @@ public class ServiceOrderExecutionTaskAssertions {
itemA.id("A");
itemA.action(ActionType.ADD);
Service serviceA = new Service();
- serviceA.setServiceState("active");
- ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef();
+ serviceA.setServiceState(ServiceStateType.ACTIVE);
+ ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef();
serviceSpecificationRefA.setId("333");
serviceA.setServiceSpecification(serviceSpecificationRefA);
itemA.setService(serviceA);
@@ -76,8 +77,8 @@ public class ServiceOrderExecutionTaskAssertions {
itemB.id("B");
itemB.action(ActionType.ADD);
Service serviceB = new Service();
- serviceB.setServiceState("active");
- ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef();
+ serviceB.setServiceState(ServiceStateType.ACTIVE);
+ ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef();
serviceSpecificationRefB.setId("1e3feeb0-8e36-46c6-862c-236d9c626439");
serviceB.setServiceSpecification(serviceSpecificationRefB);
itemB.setService(serviceB);
@@ -131,8 +132,8 @@ public class ServiceOrderExecutionTaskAssertions {
if (actionType != ActionType.ADD) {
serviceA.setId("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb");
}
- serviceA.setServiceState("active");
- ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef();
+ serviceA.setServiceState(ServiceStateType.ACTIVE);
+ ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef();
serviceSpecificationRefA.setId("1e3feeb0-8e36-46c6-862c-236d9c626439");
serviceA.setServiceSpecification(serviceSpecificationRefA);
itemA.setService(serviceA);
@@ -145,8 +146,8 @@ public class ServiceOrderExecutionTaskAssertions {
if (actionType != ActionType.ADD) {
serviceB.setId("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb");
}
- serviceB.setServiceState("active");
- ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef();
+ serviceB.setServiceState(ServiceStateType.ACTIVE);
+ ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef();
serviceSpecificationRefB.setId("1e3feeb0-8e36-46c6-862c-236d9c626439");
serviceB.setServiceSpecification(serviceSpecificationRefB);
itemB.setService(serviceB);
@@ -269,7 +270,7 @@ public class ServiceOrderExecutionTaskAssertions {
if (actionType != ActionType.ADD) {
serviceA.setId("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb");
}
- serviceA.setServiceState("active");
+ serviceA.setServiceState(ServiceStateType.ACTIVE);
ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef();
serviceSpecificationRefA.setId("82c9fbb4-656c-4973-8c7f-172b22b5fa8f");
serviceA.setServiceSpecification(serviceSpecificationRefA);
@@ -283,7 +284,7 @@ public class ServiceOrderExecutionTaskAssertions {
if (actionType != ActionType.ADD) {
serviceB.setId("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb");
}
- serviceB.setServiceState("active");
+ serviceB.setServiceState(ServiceStateType.ACTIVE);
ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef();
serviceSpecificationRefB.setId("82c9fbb4-656c-4973-8c7f-172b22b5fa8f");
serviceB.setServiceSpecification(serviceSpecificationRefB);
@@ -1050,4 +1051,4 @@ public class ServiceOrderExecutionTaskAssertions {
executionTaskRepository.save(executionTaskB);
return executionTaskA;
}
-} \ No newline at end of file
+}
diff --git a/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java b/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java
index 2632872..b58fb1c 100644
--- a/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java
+++ b/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java
@@ -295,6 +295,41 @@ public class ExecutionTaskTest {
assertThat(executionTaskRepository.count()).isEqualTo(0);
}
+ @Test
+ public void testE2EExecutionTaskActivationSuccess() throws Exception {
+
+ ExecutionTask executionTaskA = ServiceOrderExecutionTaskAssertions
+ .setUpBddForE2EExecutionTaskSucess(serviceOrderRepository, executionTaskRepository, ActionType.MODIFY);
+ ExecutionTask executionTaskB;
+
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
+
+ executionTaskB = getExecutionTask("B");
+ assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
+ executionTaskA = getExecutionTask("A");
+ assertThat(executionTaskA).isNull();
+
+ SoTaskProcessor.processOrderItem(executionTaskB);
+ serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+
+ }
+
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
+
+ }
+
@Test
public void testE2EExecutionTaskDeleteSuccess() throws Exception {
diff --git a/src/test/resources/mappings/so/so_e2e_activate_service_instance.json b/src/test/resources/mappings/so/so_e2e_activate_service_instance.json
new file mode 100644
index 0000000..5bb8f18
--- /dev/null
+++ b/src/test/resources/mappings/so/so_e2e_activate_service_instance.json
@@ -0,0 +1,16 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "/onap/so/infra/e2eServiceInstances/v3/e4688e5f-61a0-4f8b-ae02-a2fbde623bcb/activate"
+ },
+ "response": {
+ "status": 201,
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "jsonBody": {
+ "operationId": "operationId"
+ }
+ }
+}
+