summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java13
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java9
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java1
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java3
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/pom.xml2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java37
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java21
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java3
10 files changed, 58 insertions, 36 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
index 4517811494..65c850a785 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
@@ -65,7 +65,8 @@ public class CamundaVIDRequest {
@JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
private CamundaInput serviceInstanceId;
-
+ @JsonProperty(CommonConstants.OPERATION_TYPE)
+ private CamundaInput operationType;
@JsonProperty(CommonConstants.PNF_CORRELATION_ID)
private CamundaInput pnfCorrelationId;
@@ -194,6 +195,16 @@ public class CamundaVIDRequest {
this.serviceInstanceId = serviceInstanceId;
}
+ @JsonProperty(CommonConstants.OPERATION_TYPE)
+ public CamundaInput getOperationType() {
+ return operationType;
+ }
+
+ @JsonProperty(CommonConstants.OPERATION_TYPE)
+ public void setOperationType(CamundaInput operationType) {
+ this.operationType = operationType;
+ }
+
@JsonProperty(CommonConstants.PNF_CORRELATION_ID)
public CamundaInput getPnfCorrelationId() {
return pnfCorrelationId;
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
index 33e4740740..4bbfa1d067 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
@@ -90,7 +90,8 @@ public class CamundaClient {
parameterObject.getVnfType(), parameterObject.getVfModuleType(), parameterObject.getNetworkType(),
parameterObject.getRequestDetails(), parameterObject.getApiVersion(), parameterObject.isaLaCarte(),
parameterObject.getRequestUri(), parameterObject.getRecipeParamXsd(),
- parameterObject.getInstanceGroupId(), parameterObject.isGenerateIdsOnly());
+ parameterObject.getInstanceGroupId(), parameterObject.isGenerateIdsOnly(),
+ parameterObject.getOperationType());
return post(jsonReq, orchestrationURI);
}
@@ -167,7 +168,7 @@ public class CamundaClient {
String serviceInstanceId, String pnfCorrelationId, String vnfId, String vfModuleId, String volumeGroupId,
String networkId, String configurationId, String serviceType, String vnfType, String vfModuleType,
String networkType, String requestDetails, String apiVersion, boolean aLaCarte, String requestUri,
- String paramXsd, String instanceGroupId, boolean generateIdsOnly) {
+ String paramXsd, String instanceGroupId, boolean generateIdsOnly, String operationType) {
String jsonReq = null;
try {
@@ -179,6 +180,7 @@ public class CamundaClient {
CamundaIntegerInput recipeTimeoutInput = new CamundaIntegerInput();
CamundaInput requestActionInput = new CamundaInput();
CamundaInput serviceInstanceIdInput = new CamundaInput();
+ CamundaInput operationTypeInput = new CamundaInput();
CamundaInput pnfCorrelationIdInput = new CamundaInput();
CamundaInput vnfIdInput = new CamundaInput();
CamundaInput vfModuleIdInput = new CamundaInput();
@@ -196,7 +198,7 @@ public class CamundaClient {
CamundaInput instanceGroupIdInput = new CamundaInput();
CamundaBooleanInput generateIds = new CamundaBooleanInput();
-
+ operationTypeInput.setValue(StringUtils.defaultString(operationType));
requestIdInput.setValue(StringUtils.defaultString(requestId));
isBaseVfModuleInput.setValue(isBaseVfModule);
recipeTimeoutInput.setValue(recipeTimeout);
@@ -228,6 +230,7 @@ public class CamundaClient {
camundaRequest.setRecipeTimeout(recipeTimeoutInput);
camundaRequest.setRequestAction(requestActionInput);
camundaRequest.setServiceInstanceId(serviceInstanceIdInput);
+ camundaRequest.setOperationType(operationTypeInput);
camundaRequest.setPnfCorrelationId(pnfCorrelationIdInput);
camundaRequest.setVnfId(vnfIdInput);
camundaRequest.setVfModuleId(vfModuleIdInput);
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
index 6d2bbfc613..d667126afa 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
@@ -54,6 +54,7 @@ public final class CommonConstants {
public static final String RECIPE_TIMEOUT_VARIABLE = "recipeTimeout";
public static final String REQUEST_ACTION_VARIABLE = "requestAction";
public static final String SERVICE_INSTANCE_ID_VARIABLE = "serviceInstanceId";
+ public static final String OPERATION_TYPE = "operationType";
public static final String PNF_CORRELATION_ID = "pnfCorrelationId";
public static final String VNF_ID_VARIABLE = "vnfId";
public static final String VF_MODULE_ID_VARIABLE = "vfModuleId";
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
index e51f0e2412..e0f4fe3f7a 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
@@ -139,11 +139,12 @@ public class CamundaClientTest {
boolean aLaCarte = true;
String requestUri = "v7/serviceInstances/assign";
String instanceGroupId = "ff305d54-75b4-431b-adb2-eb6b9e5ff000";
+ String operationType = "activation";
String testResult = client.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction,
serviceInstanceId, pnfCorrelationId, vnfId, vfModuleId, volumeGroupId, networkId, configurationId,
serviceType, vnfType, vfModuleType, networkType, requestDetails, apiVersion, aLaCarte, requestUri, "",
- instanceGroupId, false);
+ instanceGroupId, false, operationType);
String expected = inputStream("/WrappedVIDRequest.json");
JSONAssert.assertEquals(expected, testResult, false);
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json
index 3353f8c7ce..6eebb5f703 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json
+++ b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json
@@ -95,6 +95,10 @@
"generateIdsOnly": {
"value": false,
"type": "Boolean"
+ },
+ "operationType": {
+ "value": "activation",
+ "type": "String"
}
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml
index 3a7c7ad477..a046123778 100644
--- a/mso-api-handlers/mso-api-handler-infra/pom.xml
+++ b/mso-api-handlers/mso-api-handler-infra/pom.xml
@@ -300,7 +300,7 @@
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
- <artifactId>fabric8-maven-plugin</artifactId>
+ <artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
index 8b270f8d5a..e8046a2cd9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
@@ -29,11 +29,12 @@ import org.onap.aai.domain.yang.L3Network;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
import org.onap.so.apihandlerinfra.infra.rest.exception.CloudConfigurationNotFoundException;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
@@ -56,12 +57,6 @@ public class BpmnRequestBuilder {
private static final String CLOUD_CONFIGURATION_COULD_NOT_BE_FOUND = "Cloud Configuration could not be found";
- private static final String CLOUD_REGION_ID = "cloud-region-id";
-
- private static final String CLOUD_OWNER = "cloud-owner";
-
- private static final String TENANT_ID = "tenant-id";
-
private static final String GENERIC_VNF_NOT_FOUND_IN_INVENTORY_VNF_ID =
"Generic Vnf Not Found In Inventory, VnfId: ";
@@ -283,11 +278,14 @@ public class BpmnRequestBuilder {
String lcpRegionId = null;
if (relationshipsOpt.isPresent()) {
tenantId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
- .map(item -> item.getURIKeys().get(TENANT_ID)).orElse(null);
- cloudOwner = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
- .map(item -> item.getURIKeys().get(CLOUD_OWNER)).orElse(null);
- lcpRegionId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
- .map(item -> item.getURIKeys().get(CLOUD_REGION_ID)).orElse(null);
+ .map(item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId))
+ .orElse(null);
+ cloudOwner = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst().map(
+ item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudOwner))
+ .orElse(null);
+ lcpRegionId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst().map(
+ item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudRegionId))
+ .orElse(null);
}
if (tenantId == null || cloudOwner == null || lcpRegionId == null) {
@@ -325,11 +323,14 @@ public class BpmnRequestBuilder {
String lcpRegionId = null;
if (relationshipsOpt.isPresent()) {
tenantId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
- .map(item -> item.getURIKeys().get(TENANT_ID)).orElse(null);
- cloudOwner = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
- .map(item -> item.getURIKeys().get(CLOUD_OWNER)).orElse(null);
- lcpRegionId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
- .map(item -> item.getURIKeys().get(CLOUD_REGION_ID)).orElse(null);
+ .map(item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId))
+ .orElse(null);
+ cloudOwner = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst().map(
+ item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudOwner))
+ .orElse(null);
+ lcpRegionId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst().map(
+ item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudRegionId))
+ .orElse(null);
}
if (tenantId == null || cloudOwner == null || lcpRegionId == null) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
index f0943393ed..7aa6e0f831 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
@@ -108,7 +108,6 @@ public class SDCClientHelper {
HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.SDC);
httpClient.addBasicAuthHeader(sdcClientAuth, msoKey);
httpClient.addAdditionalHeader("X-ECOMP-InstanceID", sdcActivateInstanceId);
- httpClient.addAdditionalHeader("X-ECOMP-RequestID", UUID.randomUUID().toString());
httpClient.addAdditionalHeader("Content-Type", SDCClientHelper.SDC_CONTENT_TYPE);
httpClient.addAdditionalHeader("Accept", SDCClientHelper.SDC_ACCEPT_TYPE);
httpClient.addAdditionalHeader("USER_ID", sdcActivateUserId);
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 4a244a6a7b..d4c66f62e4 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
@@ -26,8 +26,13 @@ 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.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.Relationships;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.logging.filter.base.ErrorCode;
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;
@@ -36,13 +41,9 @@ 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.ServiceModelList;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
-import org.onap.aaiclient.client.aai.entities.Relationships;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
-import org.onap.logging.filter.base.ErrorCode;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.logger.MessageEnum;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
@@ -58,7 +59,6 @@ public class ActivateVnfOperationalEnvironment {
private static final Logger logger = LoggerFactory.getLogger(ActivateVnfOperationalEnvironment.class);
private static final int DEFAULT_ACTIVATE_RETRY_COUNT = 3;
private static final String DISTRIBUTION_STATUS_SENT = "SENT";
- private static final String OPER_ENVIRONMENT_ID_KEY = "operational-environment-id";
@Autowired
private ActivateVnfDBHelper dbHelper;
@@ -97,8 +97,8 @@ public class ActivateVnfOperationalEnvironment {
List<AAIResourceUri> operationalEnvironments =
relationships.getRelatedAAIUris(AAIObjectType.OPERATIONAL_ENVIRONMENT);
if (!operationalEnvironments.isEmpty()) {
- ecompOperationalEnvironmentId =
- operationalEnvironments.get(0).getURIKeys().get(OPER_ENVIRONMENT_ID_KEY);
+ ecompOperationalEnvironmentId = operationalEnvironments.get(0).getURIKeys().get(
+ AAIFluentTypeBuilder.Types.OPERATIONAL_ENVIRONMENT.getUriParams().operationalEnvironmentId);
}
}
logger.debug(" vnfOperationalEnvironmentId : {}", vnfOperationalEnvironmentId);
@@ -123,7 +123,8 @@ public class ActivateVnfOperationalEnvironment {
.build();
throw new ValidateException.Builder(
" The ECOMP OE was not in aai record; the value of relationship.relationship-data key: "
- + OPER_ENVIRONMENT_ID_KEY,
+ + AAIFluentTypeBuilder.Types.OPERATIONAL_ENVIRONMENT
+ .getUriParams().operationalEnvironmentId,
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo)
.build();
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index 143c92861a..ef90b22b01 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -26,6 +26,7 @@ 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.urlMatching;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -1389,7 +1390,7 @@ public class ServiceInstancesTest extends BaseTest {
@Test
public void replaceVfModuleInstanceNoCloudConfigurationTest() throws IOException {
wireMockServer.stubFor(
- get(urlPathEqualTo("/aai/v19/network/generic-vnfs/generic-vnf/ff305d54-75b4-431b-adb2-eb6b9e5ff000"))
+ get(urlPathMatching("/aai/v\\d+/network/generic-vnfs/generic-vnf/ff305d54-75b4-431b-adb2-eb6b9e5ff000"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("infra/Vnf.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))