aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-03-14 21:06:49 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-03-14 21:07:03 -0400
commit1414f938b6fb86e6a15f3dfb9080f90f5d78b292 (patch)
tree424df33630c5bfc3c99898fc6af3500035be9365 /mso-api-handlers
parent1e22f36f9d682875754c927506d1d299389260eb (diff)
Saved vnfOperationalEnvironmentId to be used later
Removed unnecessary lines in junit test class. Saved vnfOperationalEnvironmentId to the model table to be used for AAI status update call later. Change-Id: I812d21d483d716bb5135c408369a160e4600efc2 Issue-ID: SO-1662 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java34
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java11
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java58
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json27
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql1
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java3
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql1
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java15
13 files changed, 153 insertions, 28 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java
index eb0721270d..de1d9e9cfb 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java
@@ -50,7 +50,8 @@ public class ActivateVnfDBHelper {
String status,
String recoveryAction,
int retryCount,
- String workloadContext) {
+ String workloadContext,
+ String vnfOperationalEnvironmentId) {
OperationalEnvServiceModelStatus serviceModelStatus = new OperationalEnvServiceModelStatus();
serviceModelStatus.setRequestId(requestId);
serviceModelStatus.setOperationalEnvId(operationalEnvironmentId);
@@ -59,6 +60,7 @@ public class ActivateVnfDBHelper {
serviceModelStatus.setRecoveryAction(recoveryAction);
serviceModelStatus.setRetryCount(new Integer(retryCount));
serviceModelStatus.setWorkloadContext(workloadContext);
+ serviceModelStatus.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
return serviceModelStatus;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
index f70fe71554..554aafc73b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
@@ -119,7 +119,7 @@ public class ActivateVnfOperationalEnvironment {
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
}
- processActivateSDCRequest(requestId, ecompOperationalEnvironmentId, serviceModelVersionIdList, workloadContext);
+ processActivateSDCRequest(requestId, ecompOperationalEnvironmentId, serviceModelVersionIdList, workloadContext, vnfOperationalEnvironmentId);
}
@@ -134,7 +134,7 @@ public class ActivateVnfOperationalEnvironment {
*/
public void processActivateSDCRequest(String requestId, String operationalEnvironmentId,
List<ServiceModelList> serviceModelVersionIdList,
- String workloadContext) throws ApiException {
+ String workloadContext, String vnfOperationalEnvironmentId) throws ApiException {
JSONObject jsonResponse = null;
int retryCount = 0;
@@ -157,7 +157,8 @@ public class ActivateVnfOperationalEnvironment {
DISTRIBUTION_STATUS_SENT,
recoveryAction,
retryCount,
- workloadContext);
+ workloadContext,
+ vnfOperationalEnvironmentId);
client.save(serviceModelStatus);
String distributionId = "";
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
index 352bf8fb0b..c12828aeb3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
@@ -24,21 +24,25 @@ package org.onap.so.apihandlerinfra.tenantisolation.process;
import java.util.List;
+import java.util.Optional;
import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.json.JSONObject;
+import org.onap.aai.domain.yang.OperationalEnvironment;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.ActivateVnfDBHelper;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.SDCClientHelper;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
import org.onap.so.logger.MessageEnum;
@@ -57,7 +61,8 @@ public class ActivateVnfStatusOperationalEnvironment {
private String errorMessage = "";
private OperationalEnvDistributionStatus queryDistributionDbResponse = null;
private OperationalEnvServiceModelStatus queryServiceModelResponse = null;
-
+ private boolean isOverallSuccess = false;
+
private final int RETRY_COUNT_ZERO = 0;
private final String ERROR_REASON_ABORTED = "ABORTED";
private final String RECOVERY_ACTION_RETRY = "RETRY";
@@ -77,6 +82,8 @@ public class ActivateVnfStatusOperationalEnvironment {
private SDCClientHelper sdcClientHelper;
@Autowired
private RequestsDbClient client;
+ @Autowired
+ private AAIClientHelper aaiHelper;
/**
* The Point-Of-Entry from APIH with activate status from SDC
@@ -107,8 +114,19 @@ public class ActivateVnfStatusOperationalEnvironment {
// to determine the OVERALL status if "COMPLETE" or "FAILURE":
checkOrUpdateOverallStatus(operationalEnvironmentId, this.origRequestId);
+ // Update AAI to ACTIVE if Overall success
+ if (isOverallSuccess) {
+ OperationalEnvironment aaiOpEnv = getAAIOperationalEnvironment(this.queryServiceModelResponse.getVnfOperationalEnvId());
+ if (aaiOpEnv != null) {
+ aaiOpEnv.setOperationalEnvironmentStatus("ACTIVE");
+ aaiHelper.updateAaiOperationalEnvironment(operationalEnvironmentId, aaiOpEnv);
+ }else {
+ requestDb.updateInfraFailureCompletion("Unable to update ACTIVATE status in AAI. ", this.origRequestId, this.queryServiceModelResponse.getVnfOperationalEnvId());
+ }
+ }
+
} catch(Exception e) {
- requestDb.updateInfraFailureCompletion(e.getMessage(), this.origRequestId, this.queryDistributionDbResponse.getOperationalEnvId());
+ requestDb.updateInfraFailureCompletion(e.getMessage(), this.origRequestId, this.queryServiceModelResponse.getVnfOperationalEnvId());
}
}
@@ -280,6 +298,7 @@ public class ActivateVnfStatusOperationalEnvironment {
if (status.equals("Completed") && queryServiceModelResponseList.size() == count) {
String messageStatus = "Overall Activation process is complete. " + status;
+ isOverallSuccess = true;
requestDb.updateInfraSuccessCompletion(messageStatus, origRequestId, operationalEnvironmentId);
} else {
if (status.equals("Failure") && queryServiceModelResponseList.size() == count) {
@@ -293,4 +312,15 @@ public class ActivateVnfStatusOperationalEnvironment {
}
}
+
+ /**
+ * Get OperationalEnvironment object
+ * @param operationalEnvironmentId - String
+ * @return operationalEnv - OperationalEnvironment object
+ */
+ private OperationalEnvironment getAAIOperationalEnvironment(String operationalEnvironmentId) {
+ AAIResultWrapper aaiResult = aaiHelper.getAaiOperationalEnvironment(operationalEnvironmentId);
+ Optional<OperationalEnvironment> operationalEnvironmentOpt = aaiResult.asBean(OperationalEnvironment.class);
+ return operationalEnvironmentOpt.isPresent() ? operationalEnvironmentOpt.get() : null;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java
index b799394b7a..78315e9fad 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java
@@ -92,6 +92,7 @@ public class AAIClientHelperTest extends BaseTest{
Map<String, String> payload = new HashMap<String, String>();
payload.put("tenant-context", "Test");
payload.put("workload-context", "ECOMPL_PSL");
+ payload.put("operational-environment-status", "ACTIVE");
try {
AAIClientHelper clientHelper = mock(AAIClientHelper.class);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java
index 3e06275fca..6fda6afc50 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java
@@ -41,6 +41,7 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
public class ActivateVnfDBHelperTest extends BaseTest{
String operationalEnvironmentId = "TEST_operationalEnvironmentId";
+ String vnfOperationalEnvironmentId = "VNF_operationalEnvironmentId";
String requestId = "TEST_requestId";
String origRequestId = "TEST_requestId";
@@ -81,6 +82,7 @@ public class ActivateVnfDBHelperTest extends BaseTest{
expectedServiceModelStatus.setRecoveryAction(recoveryActionRetry);
expectedServiceModelStatus.setRetryCount(new Integer(retryCountThree));
expectedServiceModelStatus.setWorkloadContext(workloadContext1);
+ expectedServiceModelStatus.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
}
@Test
@@ -122,7 +124,8 @@ public class ActivateVnfDBHelperTest extends BaseTest{
statusOk,
recoveryActionRetry,
retryCountThree,
- workloadContext1);
+ workloadContext1,
+ vnfOperationalEnvironmentId);
assertThat(serviceModelStatus1, sameBeanAs(expectedServiceModelStatus));
// prepare updated expected object
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java
index 18af7fbaa0..418ed4270a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java
@@ -74,6 +74,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
private final String requestId = "TEST_requestId";
private final String operationalEnvironmentId = "1dfe7154-eae0-44f2-8e7a-8e5e7882e55d";
+ private final String vnfOperationalEnvironmentId = "1dfe7154-eae0-44f2-8e7a-8e5e7882e66d";
private final CloudOrchestrationRequest request = new CloudOrchestrationRequest();
private final String workloadContext = "PVT";
String recoveryActionRetry = "RETRY";
@@ -86,7 +87,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
@Before
public void init(){
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestId\",\"operationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e55d\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":3,\"workloadContext\":\"PVT\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestId\",\"operationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e55d\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":3,\"workloadContext\":\"PVT\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e66d\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/"))
@@ -130,7 +131,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
requestParameters.setWorkloadContext(workloadContext);
requestDetails.setRequestParameters(requestParameters);
- request.setOperationalEnvironmentId(operationalEnvironmentId);
+ request.setOperationalEnvironmentId(vnfOperationalEnvironmentId);
request.setRequestDetails(requestDetails);
JSONObject jsonObject = new JSONObject();
@@ -139,7 +140,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
jsonObject.put("distributionId", sdcDistributionId);
stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironmentWithRelationship.json").withStatus(HttpStatus.SC_ACCEPTED)));
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/activateOperationalEnvironmentWithRelationship.json").withStatus(HttpStatus.SC_ACCEPTED)));
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED)));
activateVnf.execute(requestId, request);
@@ -165,7 +166,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED)));
- activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext);
+ activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext, vnfOperationalEnvironmentId);
}
@Test
@@ -205,7 +206,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
thrown.expect(ValidateException.class);
- activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext);
+ activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext, vnfOperationalEnvironmentId);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
index a26848bf21..6722941f95 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
@@ -23,6 +23,7 @@ package org.onap.so.apihandlerinfra.tenantisolation.process;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
@@ -48,6 +49,7 @@ import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Status;
+import org.onap.so.client.aai.AAIVersion;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
@@ -66,6 +68,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
private final String requestId = "TEST_requestId";
private final String requestIdOrig = "TEST_requestIdOrig";
private final String operationalEnvironmentId = "TEST_operationalEnvironmentId";
+ private final String vnfOperationalEnvironmentId = "VNF_operationalEnvironmentId";
private final CloudOrchestrationRequest request = new CloudOrchestrationRequest();
private final String workloadContext = "TEST_workloadContext";
private final String recoveryActionRetry = "RETRY";
@@ -81,6 +84,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
private final String statusOk = Status.DISTRIBUTION_COMPLETE_OK.toString();
private final String statusError = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString();
private final String statusSent = "SENT";
+ String json = "{\"operational-environment-status\" : \"INACTIVE\"}";
private final ObjectMapper mapper = new ObjectMapper();
@@ -96,6 +100,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusOk);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
serviceModelDb.setRequestId(requestIdOrig);
serviceModelDb.setServiceModelVersionId(serviceModelVersionId1);
@@ -104,6 +109,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusOk);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
InfraActiveRequests iar = new InfraActiveRequests();
iar.setRequestId(requestIdOrig);
@@ -134,6 +140,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
@@ -169,6 +176,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountTwo);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
@@ -188,6 +196,8 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusSent);
+ serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -221,7 +231,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withBody(mapper.writeValueAsString(iar))
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"RETRY\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"RETRY\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"VNF_operationalEnvironmentId\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
@@ -229,7 +239,12 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
-
+
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
activateVnfStatus.execute(requestId, request);
}
@@ -244,6 +259,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
@@ -294,10 +310,15 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":2,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":2,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"VNF_operationalEnvironmentId\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
activateVnfStatus.execute(requestId, request);
}
@@ -312,6 +333,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -360,6 +382,11 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
try {
activateVnfStatus.execute(requestId, request);
}catch(ApiException e){
@@ -382,6 +409,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -391,8 +419,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
distributionDb.setServiceModelVersionId(serviceModelVersionId);
distributionDb.setDistributionIdErrorReason(null);
-
-
// prepare distribution obj
Distribution distribution = new Distribution();
distribution.setStatus(Status.DISTRIBUTION_COMPLETE_ERROR);
@@ -428,13 +454,18 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withBody(mapper.writeValueAsString(iar))
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
- .withRequestBody(containing("operationalEnvId\":\"TEST_operationalEnvironmentId\""))
+ .withRequestBody(containing("operationalEnvId\":\"VNF_operationalEnvironmentId\""))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonMessages.toString()).withStatus(HttpStatus.SC_CONFLICT)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
try {
activateVnfStatus.execute(requestId, request);
}catch(ApiException e){
@@ -455,6 +486,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -490,7 +522,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withBody(mapper.writeValueAsString(iar))
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"SKIP\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"SKIP\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"VNF_operationalEnvironmentId\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
@@ -499,6 +531,11 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
activateVnfStatus.execute(requestId, request);
}
@@ -514,6 +551,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -558,6 +596,12 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withRequestBody(containing("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_ERROR\""))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
try {
activateVnfStatus.execute(requestId, request);
}catch(ApiException e) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json
new file mode 100644
index 0000000000..974a824467
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json
@@ -0,0 +1,27 @@
+{
+ "operational-environment-id": "1dfe7154-eae0-44f2-8e7a-8e5e7882e66d",
+ "operational-environment-name": "Test Managing ECOMP Environment",
+ "operational-environment-type": "ECOMP",
+ "operational-environment-status": "INACTIVE",
+ "tenant-context": "Test",
+ "workload-context": "PVT",
+ "resource-version": "1505228226913",
+ "relationship-list": {
+ "relationship": [{
+ "related-to": "operational-environment",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v13/cloud-infrastructure/operational-environments/operational-environment/1dfe7154-eae0-44f2-8e7a-8e5e7882e55d",
+ "relationship-data": [{
+ "relationship-key": "operational-environment.operational-environment-id",
+ "relationship-value": "1dfe7154-eae0-44f2-8e7a-8e5e7882e55d"
+ }
+ ],
+ "related-to-property": [{
+ "property-key": "operational-environment.operational-environment-name",
+ "property-value": "myOpEnv_IST_un577h_0119"
+ }
+ ]
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql
index f99f89653f..765b8cf75e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql
@@ -22,9 +22,9 @@ INSERT INTO requestdb.site_status(SITE_NAME, STATUS, CREATION_TIMESTAMP) VALUES
-INSERT INTO requestdb.activate_operational_env_service_model_distribution_status(OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID, SERVICE_MOD_VER_FINAL_DISTR_STATUS, RECOVERY_ACTION, RETRY_COUNT_LEFT, WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME) VALUES
- ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '37305814-4949-45ce-ae24-c378c7ed07d1', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'RETRY', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:45:06'),
- ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '7bfa2197-8cbb-4080-b369-56c4d53c4573', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'SKIP', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:44:56');
+INSERT INTO requestdb.activate_operational_env_service_model_distribution_status(OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID, SERVICE_MOD_VER_FINAL_DISTR_STATUS, RECOVERY_ACTION, RETRY_COUNT_LEFT, WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID) VALUES
+ ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '37305814-4949-45ce-ae24-c378c7ed07d1', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'RETRY', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:45:06', 'vnf_1234'),
+ ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '7bfa2197-8cbb-4080-b369-56c4d53c4573', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'SKIP', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:44:56', 'vnf_1235');
INSERT INTO requestdb.activate_operational_env_per_distributionid_status(DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS, DISTRIBUTION_ID_ERROR_REASON, CREATE_TIME, MODIFY_TIME, OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID) VALUES
('TEST_distributionId', 'DISTRIBUTION_COMPLETE_OK', NULL, '2018-02-02 18:44:27', '2018-02-02 18:44:56', '1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '7bfa2197-8cbb-4080-b369-56c4d53c4573', '483646fe-36cc-4e90-895a-c472f6da3f74'),
@@ -276,12 +276,12 @@ VALUES
('vfModule', 'replaceInstance', '1', 'Gr api recipe to replace vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'),
('vfModule', 'deactivateAndCloudDelete', '1', 'Gr api recipe to deactivateAndCloudDelete vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'),
('vfModule', 'scaleOut', '1', 'Gr api recipe to scale out vfModule', '/mso/async/services/WorkflowActionBB', '180', 'GR-API-DEFAULT');
-INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME)
+INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID)
VALUES
-('1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 1, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59');
-INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME)
+('1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 1, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59', 'vnf_1234');
+INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID)
VALUES
-('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59');
+('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59', 'vnf_1234');
INSERT INTO requestdb.activate_operational_env_per_distributionid_status (DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS, DISTRIBUTION_ID_ERROR_REASON, CREATE_TIME, MODIFY_TIME, OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID)
VALUES
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
index 5873e147bc..fddd7adbf4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
@@ -980,6 +980,7 @@ CREATE TABLE `activate_operational_env_service_model_distribution_status` (
`WORKLOAD_CONTEXT` varchar(80) NOT NULL,
`CREATE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`MODIFY_TIME` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+ `VNF_OPERATIONAL_ENV_ID` varchar(45) NOT NULL,
PRIMARY KEY (`OPERATIONAL_ENV_ID`,`SERVICE_MODEL_VERSION_ID`,`REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java
index 9eec860cc9..f1f26fa7cc 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java
@@ -51,12 +51,14 @@ public class OperationalEnvServiceModelStatusTest {
status.setRequestId("request-id-1");
status.setOperationalEnvId("oper-env-id-1");
status.setServiceModelVersionId("service-model-ver-id-1");
+ status.setVnfOperationalEnvId("vnf-oper-env-id-1");
status.setRetryCount(0);
repository.saveAndFlush(status);
OperationalEnvServiceModelStatus status2 = repository.findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId("oper-env-id-1", "service-model-ver-id-1", "request-id-1");
status2.setRetryCount(1);
assertEquals("request-id-1", status2.getRequestId());
+ assertEquals("vnf-oper-env-id-1", status2.getVnfOperationalEnvId());
repository.saveAndFlush(status2);
@@ -65,6 +67,7 @@ public class OperationalEnvServiceModelStatusTest {
status3.setRequestId("request-id-2");
status3.setOperationalEnvId("oper-env-id-1");
status3.setServiceModelVersionId("service-model-ver-id-2");
+ status3.setVnfOperationalEnvId("vnf-oper-env-id-2");
status3.setRetryCount(2);
repository.saveAndFlush(status3);
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
index 4ff7025dee..2bd9936b3a 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
@@ -9,6 +9,7 @@ create table ACTIVATE_OPERATIONAL_ENV_SERVICE_MODEL_DISTRIBUTION_STATUS (
WORKLOAD_CONTEXT varchar(255),
CREATE_TIME datetime,
MODIFY_TIME datetime,
+ VNF_OPERATIONAL_ENV_ID varchar(255) not null,
primary key (REQUEST_ID,OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID)
);
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java
index 588822cce0..79168f8f0b 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java
@@ -72,7 +72,9 @@ public class OperationalEnvServiceModelStatus implements Serializable {
@Column(name = "MODIFY_TIME")
@Temporal(TemporalType.TIMESTAMP)
private Date modifyTime;
-
+ @Column(name = "VNF_OPERATIONAL_ENV_ID", length=45)
+ private String vnfOperationalEnvId;
+
public OperationalEnvServiceModelStatus() {
}
@@ -146,6 +148,14 @@ public class OperationalEnvServiceModelStatus implements Serializable {
public Date getModifyTime() {
return modifyTime;
}
+
+ public String getVnfOperationalEnvId() {
+ return vnfOperationalEnvId;
+ }
+
+ public void setVnfOperationalEnvId(String vnfOperationalEnvId) {
+ this.vnfOperationalEnvId = vnfOperationalEnvId;
+ }
@PrePersist
protected void onCreate() {
@@ -183,7 +193,8 @@ public class OperationalEnvServiceModelStatus implements Serializable {
.append("serviceModelVersionDistrStatus", getServiceModelVersionDistrStatus())
.append("recoveryAction", getRecoveryAction()).append("retryCount", getRetryCount())
.append("workloadContext", getWorkloadContext()).append("createTime", getCreateTime())
- .append("modifyTime", getModifyTime()).toString();
+ .append("modifyTime", getModifyTime())
+ .append("vnfOperationalEnvId", getVnfOperationalEnvId()).toString();
}