aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters
diff options
context:
space:
mode:
authorSmokowski, Steven <steve.smokowski@att.com>2019-05-15 14:19:49 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-05-15 14:19:58 -0400
commite4687eeb77d9fddf14935894026aec0b1c9e3ac9 (patch)
tree47c85cd95c71d36a404da6c83fbbb5d11fb0fb2c /adapters/mso-openstack-adapters
parentf9c309fb9e789225ccd6b02ec9ab4777bbd4021c (diff)
store openstack request status in requestdb
Openstack request status now stored in request db Change-Id: Ida8f4f613d406c2b834ab190e01d5aaf2f16dd3d Issue-ID: SO-1867 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-openstack-adapters')
-rw-r--r--adapters/mso-openstack-adapters/pom.xml30
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java21
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java32
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java52
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java26
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java32
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java32
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java23
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java7
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json4
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json4
13 files changed, 179 insertions, 90 deletions
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index d174de7e2f..922716425b 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -147,13 +147,22 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>original</id>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
<pluginManagement>
<plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings
- only. It has no influence on the Maven build itself. -->
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build
+ itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
@@ -164,14 +173,14 @@
<pluginExecution>
<pluginExecutionFilter>
<groupId>
- org.jvnet.jax-ws-commons
- </groupId>
+ org.jvnet.jax-ws-commons
+ </groupId>
<artifactId>
- jaxws-maven-plugin
- </artifactId>
+ jaxws-maven-plugin
+ </artifactId>
<versionRange>
- [2.3,)
- </versionRange>
+ [2.3,)
+ </versionRange>
<goals>
<goal>wsgen</goal>
</goals>
@@ -219,11 +228,6 @@
<version>${cxf.version}</version>
</dependency>
<dependency>
- <groupId>org.webjars</groupId>
- <artifactId>swagger-ui</artifactId>
- <version>3.5.0</version>
- </dependency>
- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
index 2e62beb083..5060e554eb 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+
package org.onap.so.adapters.audit;
import java.util.Optional;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
index b12d2397f9..df2c3a2973 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
@@ -24,11 +24,6 @@
package org.onap.so.adapters.network;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -47,6 +42,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
import org.apache.http.HttpStatus;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.network.exceptions.NetworkException;
import org.onap.so.adapters.nwrest.ContrailNetwork;
import org.onap.so.adapters.nwrest.CreateNetworkError;
@@ -74,9 +70,15 @@ import org.onap.so.openstack.beans.RouteTarget;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
@Path("/v1/networks")
@Api(value = "/v1/networks", description = "root of network adapters restful web service")
@@ -160,6 +162,11 @@ public class NetworkAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("CreateNetworkTask start");
try {
// Synchronous Web Service Outputs
@@ -317,6 +324,11 @@ public class NetworkAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("DeleteNetworkTask start");
try {
Holder<Boolean> networkDeleted = new Holder<>();
@@ -462,6 +474,11 @@ public class NetworkAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getNetworkRollback().getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("RollbackNetworkTask start");
try {
NetworkRollback nwr = req.getNetworkRollback();
@@ -550,6 +567,11 @@ public class NetworkAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("UpdateNetworkTask start");
try {
Holder<Map<String, String>> subnetIdMap = new Holder<>();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
index 20ce4170af..686410f14c 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
@@ -41,6 +41,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
import org.apache.http.HttpStatus;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
@@ -61,6 +62,7 @@ import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -86,19 +88,10 @@ public class VnfAdapterRest {
@Autowired
private MsoVnfAdapterImpl vnfAdapter;
- // TODO Logging, SkipAAI, CREATED flags, Integrate with BPEL, Auth,
@Autowired
private Provider<BpelRestClient> bpelRestClientProvider;
-
- /*
- * URL:http://localhost:8080/vnfs/rest/v1/vnfs/<aaivnfid>/vf-modules/<aaimodid> REQUEST: {"deleteVfModuleRequest":
- * {"cloudSiteId": "DAN", "tenantId": "214b428a1f554c02935e66330f6a5409", "vnfId": "somevnfid", "vfModuleId":
- * "somemodid", "vfModuleStackId": "4e567676-e266-4594-a3a6-131c8a2baf73", "messageId": "ra.1", "notificationUrl":
- * "http://localhost:8089/vnfmock", "skipAAI": true, "msoRequest": { "requestId": "ra1", "serviceInstanceId": "sa1"
- * }} }
- */
@DELETE
@Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@@ -176,11 +169,14 @@ public class VnfAdapterRest {
@Override
public void run() {
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
String cloudsite = req.getCloudSiteId();
Holder<Map<String, String>> outputs = new Holder<>();
if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) {
- // vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(),
- // req.getMsoRequest());
vnfAdapter.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
req.getVfModuleStackId(), req.getMsoRequest(), outputs);
}
@@ -200,13 +196,7 @@ public class VnfAdapterRest {
}
}
- /*
- * URL:http://localhost:8080/vnfs/rest/v1/vnfs/<aaiVnfId>/vf-modules/<aaiVfModuleId>?cloudSiteId=DAN&tenantId=
- * vfModule?&skipAAI=TRUE&msoRequest.requestId=ra1&msoRequest.serviceInstanceId=si1&vfModuleName=T2N2S1 RESP:
- * {"queryVfModuleResponse": { "vfModuleId": "AvfmodId", "vfModuleOutputs": {"entry": { "key":
- * "server_private_ip_1", "value": "10.100.1.25" }}, "vfModuleStackId":
- * "RaaVnf1/abfa8a6d-feb1-40af-aea3-109403b1cf6b", "vnfId": "AvnfID", "vnfStatus": "ACTIVE" }}
- */
+
@GET
@Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@@ -340,6 +330,11 @@ public class VnfAdapterRest {
public void run() {
logger.debug("CreateVfModuleTask start");
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
// Synchronous Web Service Outputs
Holder<String> vfModuleStackId = new Holder<>();
Holder<Map<String, String>> outputs = new Holder<>();
@@ -449,9 +444,11 @@ public class VnfAdapterRest {
@Override
public void run() {
try {
- // MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
-
- // Synchronous Web Service Outputs
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
Holder<String> vfModuleStackId = new Holder<>();
Holder<Map<String, String>> outputs = new Holder<>();
Holder<VnfRollback> vnfRollback = new Holder<>();
@@ -481,13 +478,7 @@ public class VnfAdapterRest {
}
}
- /*
- * URL:http://localhost:8080/vnfs/rest/v1/vnfs/<aaivnfid>/vf-modules/<aaimodid>/rollback REQUEST:
- * {"deleteVfModuleRequest": {"cloudSiteId": "DAN", "tenantId": "214b428a1f554c02935e66330f6a5409", "vnfId":
- * "somevnfid", "vfModuleId": "somemodid", "vfModuleStackId": "4e567676-e266-4594-a3a6-131c8a2baf73", "messageId":
- * "ra.1", "notificationUrl": "http://localhost:8089/vnfmock", "skipAAI": true, "msoRequest": { "requestId": "ra1",
- * "serviceInstanceId": "sa1" }} }
- */
+
@DELETE
@Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}/rollback")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@@ -557,6 +548,11 @@ public class VnfAdapterRest {
@Override
public void run() {
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVfModuleRollback().getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
VfModuleRollback vmr = req.getVfModuleRollback();
VnfRollback vrb = new VnfRollback(vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudOwner(),
vmr.getCloudSiteId(), true, true, vmr.getMsoRequest(), null, null, null, null);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
index 7c6d251263..5b831047ad 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
@@ -40,6 +40,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
import org.apache.http.HttpStatus;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
@@ -60,6 +61,7 @@ import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import io.swagger.annotations.Api;
@@ -132,6 +134,7 @@ public class VnfAdapterRestV2 {
// This is an asynchronous request
try {
Thread t1 = new Thread(task);
+ MDC.getCopyOfContextMap();
t1.start();
} catch (Exception e) {
// problem handling delete, send generic failure as sync resp to caller
@@ -178,6 +181,11 @@ public class VnfAdapterRestV2 {
@Override
public void run() {
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
String cloudsite = req.getCloudSiteId();
Holder<Map<String, String>> outputs = new Holder<>();
if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) {
@@ -201,6 +209,7 @@ public class VnfAdapterRestV2 {
bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
}
logger.debug("Delete vfModule exit: code=" + getStatusCode() + RESP + getResponse());
+ MDC.clear();
}
}
@@ -353,6 +362,11 @@ public class VnfAdapterRestV2 {
public void run() {
logger.debug("CreateVfModuleTask start");
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
// Synchronous Web Service Outputs
Holder<String> vfModuleStackId = new Holder<>();
Holder<Map<String, String>> outputs = new Holder<>();
@@ -467,8 +481,11 @@ public class VnfAdapterRestV2 {
@Override
public void run() {
try {
- // MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
-
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
// Synchronous Web Service Outputs
Holder<String> vfModuleStackId = new Holder<>();
Holder<Map<String, String>> outputs = new Holder<>();
@@ -577,6 +594,11 @@ public class VnfAdapterRestV2 {
@Override
public void run() {
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVfModuleRollback().getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
VfModuleRollback vmr = req.getVfModuleRollback();
VnfRollback vrb = new VnfRollback(vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudOwner(),
vmr.getCloudSiteId(), true, vmr.isVfModuleCreated(), vmr.getMsoRequest(), null, null, null,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java
index c02a872a85..87df7fdc37 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java
@@ -25,11 +25,6 @@
package org.onap.so.adapters.vnf;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
import java.util.HashMap;
import java.util.Map;
import javax.inject.Provider;
@@ -47,6 +42,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
import org.apache.http.HttpStatus;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
@@ -67,8 +63,14 @@ import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
/**
* This class services calls to the REST interface for VNF Volumes (http://host:port/vnfs/rest/v1/volume-groups) Both
@@ -155,6 +157,11 @@ public class VolumeAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("CreateVFModule VolumesTask start");
try {
// Synchronous Web Service Outputs
@@ -302,6 +309,11 @@ public class VolumeAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("DeleteVNFVolumesTask start");
try {
if (!req.getCloudSiteId().equals(TESTING_KEYWORD)) {
@@ -394,6 +406,11 @@ public class VolumeAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVolumeGroupRollback().getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("DeleteVNFVolumesTask start");
try {
VolumeGroupRollback vgr = req.getVolumeGroupRollback();
@@ -487,6 +504,11 @@ public class VolumeAdapterRest {
public void run() {
logger.debug("UpdateVNFVolumesTask start");
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
Holder<Map<String, String>> outputs = new Holder<>();
Holder<VnfRollback> vnfRollback = new Holder<>();
String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
index 0ceba20051..77c9b1e2f5 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
@@ -24,11 +24,6 @@
package org.onap.so.adapters.vnf;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
import java.util.HashMap;
import java.util.Map;
import javax.inject.Provider;
@@ -46,6 +41,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
import org.apache.http.HttpStatus;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
@@ -66,8 +62,14 @@ import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
/**
* This class services calls to the REST interface for VNF Volumes (http://host:port/vnfs/rest/v1/volume-groups) Both
@@ -158,6 +160,11 @@ public class VolumeAdapterRestV2 {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("CreateVFModule VolumesTask start");
try {
// Synchronous Web Service Outputs
@@ -288,6 +295,11 @@ public class VolumeAdapterRestV2 {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("DeleteVNFVolumesTask start");
String cloudSiteId = req.getCloudSiteId();
try {
@@ -383,6 +395,11 @@ public class VolumeAdapterRestV2 {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVolumeGroupRollback().getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("RollbackVNFVolumesTask start");
try {
VolumeGroupRollback vgr = req.getVolumeGroupRollback();
@@ -480,6 +497,11 @@ public class VolumeAdapterRestV2 {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("UpdateVNFVolumesTask start");
try {
Holder<Map<String, String>> outputs = new Holder<>();
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
index e481f0d03f..1a44934187 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
@@ -67,7 +67,7 @@ public class TenantAdapterRestTest extends BaseRestTestUtils {
public void testCreateTenantCreated() throws JsonParseException, JsonMappingException, IOException {
CreateTenantRequest request = new CreateTenantRequest();
- String cloudSiteId = "MTN13";
+ String cloudSiteId = "mtn13";
String requestId = "62265093-277d-4388-9ba6-449838ade586";
String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a";
String tenantName = "testingTenantName";
@@ -117,7 +117,7 @@ public class TenantAdapterRestTest extends BaseRestTestUtils {
public void testCreateTenantExists() throws JsonParseException, JsonMappingException, IOException {
CreateTenantRequest request = new CreateTenantRequest();
- String cloudSiteId = "MTN13";
+ String cloudSiteId = "mtn13";
String requestId = "62265093-277d-4388-9ba6-449838ade586";
String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a";
String tenantName = "testingTenantName";
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
index 102d748d56..92bac7a14b 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
@@ -30,7 +30,6 @@ import java.io.IOException;
import javax.ws.rs.core.MediaType;
import org.apache.http.HttpStatus;
import org.junit.Before;
-import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.adapters.openstack.MsoOpenstackAdaptersApplication;
import org.onap.so.cloud.CloudConfig;
@@ -39,7 +38,6 @@ import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.ServerType;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
@@ -70,7 +68,6 @@ public abstract class BaseRestTestUtils {
CloudConfig cloudConfig;
@Autowired
- @Qualifier("JettisonStyle")
protected TestRestTemplate restTemplate;
protected HttpHeaders headers = new HttpHeaders();
@@ -118,9 +115,10 @@ public abstract class BaseRestTestUtils {
wireMockServer.resetAll();
mapper = new ObjectMapper();
CloudIdentity identity = new CloudIdentity();
- identity.setId("MTN13");
+ identity.setId("DEFAULT");
identity.setMsoId("m93945");
- identity.setMsoPass("93937EA01B94A10A49279D4572B48369");
+ identity.setMsoPass(
+ "89C9F27833AC49FE4164F3608CADE7BCF40357977607A7E4B899F9A046C0071C75F7347A47308EF9FB6620214264B1");
identity.setAdminTenant("admin");
identity.setMemberRole("admin");
identity.setTenantMetadata(new Boolean(true));
@@ -137,29 +135,14 @@ public abstract class BaseRestTestUtils {
identity.setIdentityServerType(ServerType.KEYSTONE);
cloudSite.setIdentityService(identity);
- wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/MTN13"))
- .willReturn(aResponse().withBody(getBody(mapper.writeValueAsString(cloudSite), wireMockPort, ""))
- .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT"))
.willReturn(aResponse().withBody(getBody(mapper.writeValueAsString(cloudSite), wireMockPort, ""))
.withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
- wireMockServer.stubFor(get(urlPathEqualTo("/cloudIdentity/MTN13"))
- .willReturn(aResponse().withBody(getBody(mapper.writeValueAsString(identity), wireMockPort, ""))
- .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .withStatus(HttpStatus.SC_OK)));
- cloudConfig.getCloudSite("MTN13").get().getIdentityService()
- .setIdentityUrl("http://localhost:" + wireMockPort + cloudEndpoint);
}
protected static String getBody(String body, int port, String urlPath) throws IOException {
return body.replaceAll("port", "http://localhost:" + port + urlPath);
}
- @Test
- public void testNothing() {
-
- }
-
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
index 0c56222558..651e2c9a73 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
@@ -36,12 +36,10 @@ import java.util.Map;
import java.util.Set;
import javax.xml.ws.Holder;
import org.apache.http.HttpStatus;
-import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.mockito.MockitoAnnotations;
import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnf.exceptions.VnfNotFound;
@@ -58,7 +56,6 @@ import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import com.github.tomakehurst.wiremock.client.WireMock;
public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@@ -92,7 +89,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "",
+ instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "",
"VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(),
new Holder<Map<String, String>>(), new Holder<VnfRollback>());
@@ -514,7 +511,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>());
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.updateVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
"b4ea86b4-253f-11e7-93ae-92361f002671", map, msoRequest, new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
index be565deb9e..7ec8e51892 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
@@ -93,7 +93,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "",
+ msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "",
vnfName, "", "VFMOD", null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(),
new Holder<Map<String, String>>(), new Holder<VnfRollback>());
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json
index b78f700fd9..934e075220 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json
@@ -1,11 +1,11 @@
{
"createTenantResponse": {
- "cloudSiteId": "MTN13",
+ "cloudSiteId": "mtn13",
"tenantId": "tenantId",
"tenantCreated": true,
"tenantRollback": {
"tenantId": "tenantId",
- "cloudId": "MTN13",
+ "cloudId": "mtn13",
"tenantCreated": true,
"msoRequest": {
"requestId": "62265093-277d-4388-9ba6-449838ade586",
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json
index 977aa542b3..6f81ebcd36 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json
@@ -1,10 +1,10 @@
{
"createTenantResponse": {
- "cloudSiteId": "MTN13",
+ "cloudSiteId": "mtn13",
"tenantId": "tenantId",
"tenantCreated": false,
"tenantRollback": {
- "cloudId": "MTN13",
+ "cloudId": "mtn13",
"tenantCreated": false,
"msoRequest": {
"requestId": "62265093-277d-4388-9ba6-449838ade586",