summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-openstack-adapters/pom.xml2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java48
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java26
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml2
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java24
-rw-r--r--adapters/mso-sdnc-adapter/pom.xml6
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java24
-rw-r--r--asdc-controller/pom.xml4
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java50
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/pom.xml1
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/pom.xml2
-rw-r--r--common/src/main/java/org/onap/so/logger/MaskLogStatements.java71
-rw-r--r--common/src/test/java/org/onap/so/logging/MaskLogStatementsTest.java90
-rw-r--r--common/src/test/resources/__files/logging/openstack-payload.json26
-rw-r--r--graph-inventory/fluent-builder-maven-plugin/pom.xml4
-rw-r--r--pom.xml16
18 files changed, 294 insertions, 107 deletions
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index 32448d31dc..6dcc1a43bf 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -150,7 +150,7 @@
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
+ <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java
index 6cf42e1433..49cc0190db 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java
@@ -39,15 +39,18 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
@Path("/v1/cloud-region")
-@Api(value = "/v1/cloud-region", description = "root of cloud region adapter")
+@OpenAPIDefinition(info = @Info(title = "/v1/cloud-region", description = "root of cloud region adapter"))
@Component
public class CloudRegionRestV1 {
private static Logger logger = LoggerFactory.getLogger(CloudRegionRestV1.class);
@@ -58,13 +61,12 @@ public class CloudRegionRestV1 {
@POST
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "CreateCloudRegion", response = Response.class,
- notes = "Create a cloud site in MSO and Region In AAI")
- @ApiResponses({@ApiResponse(code = 201, message = "Cloud Region has been created"),
- @ApiResponse(code = 500, message = "Create Cloud Region has failed")})
+ @Operation(description = "CreateCloudRegion", summary = "Create a cloud site in MSO and Region In AAI")
+ @ApiResponses({@ApiResponse(responseCode = "201", description = "Cloud Region has been created"),
+ @ApiResponse(responseCode = "500", description = "Create Cloud Region has failed")})
public Response createCloudRegion(
- @ApiParam(value = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
- @ApiParam(value = "CloudSite", required = true) final CloudSite cloudSite) {
+ @Parameter(name = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
+ @Parameter(name = "CloudSite", required = true) final CloudSite cloudSite) {
cloudRestImpl.createCloudRegion(cloudSite);
return Response.status(HttpStatus.SC_CREATED).build();
}
@@ -73,12 +75,12 @@ public class CloudRegionRestV1 {
@Path("{cloud-region-id}/{cloud-owner}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "CreateCloudRegion", response = Response.class, notes = "Delete an cloud Region in SO")
- @ApiResponses({@ApiResponse(code = 204, message = "cloud Region has been deleted"),
- @ApiResponse(code = 500, message = "Cloud Region delete has failed")})
+ @Operation(description = "CreateCloudRegion", summary = "Delete an cloud Region in SO")
+ @ApiResponses({@ApiResponse(responseCode = "204", description = "cloud Region has been deleted"),
+ @ApiResponse(responseCode = "500", description = "Cloud Region delete has failed")})
public Response deleteCloudRegion(
- @ApiParam(value = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
- @ApiParam(value = "cloud-owner", required = true) @PathParam("cloud-owner") String cloudOwner) {
+ @Parameter(name = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
+ @Parameter(name = "cloud-owner", required = true) @PathParam("cloud-owner") String cloudOwner) {
cloudRestImpl.deleteCloudRegion(cloudRegionId);
return Response.status(HttpStatus.SC_NO_CONTENT).build();
}
@@ -87,13 +89,13 @@ public class CloudRegionRestV1 {
@Path("{cloud-region-id}/{cloud-owner}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "CreateCloudRegion", response = Response.class, notes = "Update an existing Cloud Region")
- @ApiResponses({@ApiResponse(code = 200, message = "Cloud Region has been updated"),
- @ApiResponse(code = 500, message = "Update Cloud Region has failed examine entity object for details")})
+ @Operation(description = "CreateCloudRegion", summary = "Update an existing Cloud Region")
+ @ApiResponses({@ApiResponse(responseCode = "200", description = "Cloud Region has been updated"), @ApiResponse(
+ responseCode = "500", description = "Update Cloud Region has failed examine entity object for details")})
public Response updateCloudRegion(
- @ApiParam(value = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
- @ApiParam(value = "cloud-owner", required = true) @PathParam("cloud-owner") String cloudOwner,
- @ApiParam(value = "CloudSite", required = true) final CloudSite cloudSite) {
+ @Parameter(name = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
+ @Parameter(name = "cloud-owner", required = true) @PathParam("cloud-owner") String cloudOwner,
+ @Parameter(name = "CloudSite", required = true) final CloudSite cloudSite) {
cloudRestImpl.updateCloudRegion(cloudSite);
return Response.status(HttpStatus.SC_OK).build();
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
index 1446047ebd..942da2937b 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
@@ -23,13 +23,14 @@
package org.onap.so.adapters.openstack;
import java.util.Arrays;
+import java.util.HashSet;
import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.feature.LoggingFeature;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
-import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
+import org.apache.cxf.jaxrs.openapi.OpenApiFeature;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.onap.so.adapters.cloudregion.CloudRegionRestV1;
@@ -101,18 +102,17 @@ public class CXFConfiguration {
return endpoint.create();
}
-
@Bean
- public Swagger2Feature createSwaggerFeature() {
- Swagger2Feature swagger2Feature = new Swagger2Feature();
- swagger2Feature.setPrettyPrint(true);
- swagger2Feature.setTitle("SO Orchestration Application");
- swagger2Feature.setContact("The ONAP SO team");
- swagger2Feature.setDescription("This project is the SO Orchestration Engine");
- swagger2Feature.setVersion("1.0.0");
- swagger2Feature.setResourcePackage(
- "org.onap.so.adapters.network,org.onap.so.adapters.tenant,org.onap.so.adapters.vnf");
- swagger2Feature.setScan(true);
- return swagger2Feature;
+ public OpenApiFeature createSwaggerFeature() {
+ OpenApiFeature openApiFeature = new OpenApiFeature();
+ openApiFeature.setPrettyPrint(true);
+ openApiFeature.setTitle("SO Orchestration Application");
+ openApiFeature.setContactName("The ONAP SO team");
+ openApiFeature.setDescription("This project is the SO Orchestration Engine");
+ openApiFeature.setVersion("1.0.0");
+ openApiFeature.setResourcePackages(
+ new HashSet<String>(Arrays.asList("org.onap.so.adapters.network,org.onap.so.adapters.vnf")));
+ openApiFeature.setScan(true);
+ return openApiFeature;
}
}
diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml
index 09e2cc26d7..45acf2484d 100644
--- a/adapters/mso-requests-db-adapter/pom.xml
+++ b/adapters/mso-requests-db-adapter/pom.xml
@@ -19,7 +19,7 @@
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
+ <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java
index 06d75befd9..2325ffaa14 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java
@@ -20,10 +20,12 @@
package org.onap.so.adapters.requestsdb.application;
+import java.util.Arrays;
+import java.util.HashSet;
import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
import org.apache.cxf.feature.LoggingFeature;
-import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
+import org.apache.cxf.jaxrs.openapi.OpenApiFeature;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.onap.so.adapters.requestsdb.MsoRequestsDbAdapter;
@@ -65,16 +67,16 @@ public class CXFConfiguration {
}
@Bean
- public Swagger2Feature createSwaggerFeature() {
- Swagger2Feature swagger2Feature = new Swagger2Feature();
- swagger2Feature.setPrettyPrint(true);
- swagger2Feature.setTitle("SO Request Adapter");
- swagger2Feature.setContact("The ONAP SO team");
- swagger2Feature.setDescription("This project is the SO Orchestration Engine");
- swagger2Feature.setVersion("1.0.0");
- swagger2Feature.setResourcePackage("org.onap.so.adapters.requestdb");
- swagger2Feature.setScan(true);
- return swagger2Feature;
+ public OpenApiFeature createSwaggerFeature() {
+ OpenApiFeature openApiFeature = new OpenApiFeature();
+ openApiFeature.setPrettyPrint(true);
+ openApiFeature.setTitle("SO Request Adapter");
+ openApiFeature.setContactName("The ONAP SO team");
+ openApiFeature.setDescription("This project is the SO Orchestration Engine");
+ openApiFeature.setVersion("1.0.0");
+ openApiFeature.setResourcePackages(new HashSet<String>(Arrays.asList("org.onap.so.adapters.requestdb")));
+ openApiFeature.setScan(true);
+ return openApiFeature;
}
}
diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml
index 358b14e37a..62ba731873 100644
--- a/adapters/mso-sdnc-adapter/pom.xml
+++ b/adapters/mso-sdnc-adapter/pom.xml
@@ -132,8 +132,8 @@
</dependencyManagement>
<dependencies>
<dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey2-jaxrs</artifactId>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-jaxrs2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -159,7 +159,7 @@
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
+ <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
index dd1da98dd8..65eb39d019 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
@@ -21,12 +21,13 @@
package org.onap.so.adapters.sdnc;
import java.util.Arrays;
+import java.util.HashSet;
import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.feature.LoggingFeature;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
-import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
+import org.apache.cxf.jaxrs.openapi.OpenApiFeature;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.onap.so.adapters.sdnc.sdncrest.SNIROResponse;
@@ -91,16 +92,15 @@ public class CXFConfiguration {
@Bean
- public Swagger2Feature createSwaggerFeature() {
- Swagger2Feature swagger2Feature = new Swagger2Feature();
- swagger2Feature.setBasePath("/services/rest");
- swagger2Feature.setPrettyPrint(true);
- swagger2Feature.setTitle("SO Orchestration Application");
- swagger2Feature.setContact("The ONAP SO team");
- swagger2Feature.setDescription("This project is the SO Orchestration Engine");
- swagger2Feature.setVersion("1.0.0");
- swagger2Feature.setResourcePackage("org.onap.so.adapters.sdnc");
- swagger2Feature.setScan(true);
- return swagger2Feature;
+ public OpenApiFeature createSwaggerFeature() {
+ OpenApiFeature openApiFeature = new OpenApiFeature();
+ openApiFeature.setPrettyPrint(true);
+ openApiFeature.setTitle("SO Orchestration Application");
+ openApiFeature.setContactName("The ONAP SO team");
+ openApiFeature.setDescription("This project is the SO Orchestration Engine");
+ openApiFeature.setVersion("1.0.0");
+ openApiFeature.setResourcePackages(new HashSet<String>(Arrays.asList("org.onap.so.adapters.sdnc")));
+ openApiFeature.setScan(true);
+ return openApiFeature;
}
}
diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml
index 4d17f5510a..0eef01d0cc 100644
--- a/asdc-controller/pom.xml
+++ b/asdc-controller/pom.xml
@@ -190,8 +190,8 @@
</build>
<dependencies>
<dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey2-jaxrs</artifactId>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-jaxrs2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java
index 22265a0cc6..9929262dbc 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java
@@ -20,41 +20,51 @@
package org.onap.so.asdc;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import javax.ws.rs.ApplicationPath;
import org.glassfish.jersey.server.ResourceConfig;
import org.onap.so.asdc.client.test.rest.ASDCRestInterface;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
-import org.springframework.core.env.Environment;
-import io.swagger.jaxrs.config.BeanConfig;
-import io.swagger.jaxrs.listing.ApiListingResource;
-import io.swagger.jaxrs.listing.SwaggerSerializers;
+import io.swagger.v3.jaxrs2.SwaggerSerializers;
+import io.swagger.v3.jaxrs2.integration.JaxrsOpenApiContextBuilder;
+import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource;
+import io.swagger.v3.oas.integration.OpenApiConfigurationException;
+import io.swagger.v3.oas.integration.SwaggerConfiguration;
+import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.oas.models.info.Info;
@Configuration
@ApplicationPath("/test")
public class JerseyConfiguration extends ResourceConfig {
- private Environment environment;
-
- @Autowired
- public JerseyConfiguration(final Environment environment) {
- this.environment = environment;
- }
+ private static final Logger logger = LoggerFactory.getLogger(JerseyConfiguration.class);
@PostConstruct
public void setUp() {
register(ASDCRestInterface.class);
- register(ApiListingResource.class);
+ register(OpenApiResource.class);
register(SwaggerSerializers.class);
- final BeanConfig beanConfig = new BeanConfig();
- beanConfig.setVersion("1.0.2");
- beanConfig.setSchemes(new String[] {"http"});
- beanConfig.setHost("localhost:" + environment.getProperty("server.port"));
- beanConfig.setBasePath("/mso");
- beanConfig.setResourcePackage("org.onap.so.apihandlerinfra");
- beanConfig.setPrettyPrint(true);
- beanConfig.setScan(true);
+ final OpenAPI openApi = new OpenAPI();
+ Info info = new Info();
+ info.setVersion("1.0.2");
+ info.setTitle("Swagger asdc-controller code");
+ openApi.setInfo(info);
+
+ SwaggerConfiguration swaggerConfig = new SwaggerConfiguration().openAPI(openApi).prettyPrint(true)
+ .resourcePackages(Stream.of("org.onap.so.asdc").collect(Collectors.toSet()));
+
+ try {
+ JaxrsOpenApiContextBuilder jaxrsConfig = new JaxrsOpenApiContextBuilder();
+ jaxrsConfig.application(this).openApiConfiguration(swaggerConfig).buildContext(true);
+ } catch (OpenApiConfigurationException e) {
+ logger.error("Error during jersey configuration", e);
+ throw new RuntimeException(e.getMessage(), e);
+ }
+
}
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml
index 9f78182811..d09442424a 100644
--- a/bpmn/so-bpmn-infrastructure-flows/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml
@@ -177,7 +177,6 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId>
- <version>3.4.2</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
index 786ee1e239..f93492bea5 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
@@ -116,6 +116,8 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
mockAai();
mockDmaapForPnf();
+ grpcNettyServer.resetList();
+
final String msoRequestId = UUID.randomUUID().toString();
executionVariables.put("mso-request-id", msoRequestId);
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java
index 1c00f3628d..35853a3794 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java
@@ -107,6 +107,8 @@ public class GenericPnfSoftwareUpgradeTest extends BaseBPMNTest {
mockRequestDb();
mockAai();
+ grpcNettyServer.resetList();
+
final String msoRequestId = UUID.randomUUID().toString();
executionVariables.put(ExecutionVariableNames.MSO_REQUEST_ID, msoRequestId);
@@ -146,7 +148,6 @@ public class GenericPnfSoftwareUpgradeTest extends BaseBPMNTest {
fail("GenericPnfSoftwareUpgrade request exception", e);
}
assertTrue(count == actionNames.length);
- grpcNettyServer.resetList();
}
private boolean isProcessInstanceEnded() {
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml
index 881cb30548..9f7d09575c 100644
--- a/bpmn/so-bpmn-tasks/pom.xml
+++ b/bpmn/so-bpmn-tasks/pom.xml
@@ -105,7 +105,7 @@
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
- <groupId>io.swagger</groupId>
+ <groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<goals>
<goal>generate</goal>
diff --git a/common/src/main/java/org/onap/so/logger/MaskLogStatements.java b/common/src/main/java/org/onap/so/logger/MaskLogStatements.java
new file mode 100644
index 0000000000..cadadcf9f3
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logger/MaskLogStatements.java
@@ -0,0 +1,71 @@
+package org.onap.so.logger;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Optional;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import ch.qos.logback.classic.PatternLayout;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+
+public class MaskLogStatements extends PatternLayout {
+
+ private String patternsProperty;
+ private String maskChar = "*";
+ private Optional<Pattern> pattern = Optional.empty();
+ private static final Pattern authPattern =
+ Pattern.compile("Authorization(?:\\:|=)\\s?(?:\"|\\[)(?:Basic|Bearer) (.*?)(?:\"|\\])");
+ private static final Pattern openstackPattern = Pattern.compile("\"password\"\\s?:\\s?\"(.*?)\"");
+
+ public String getPatternsProperty() {
+ return patternsProperty;
+ }
+
+ public void setPatternsProperty(String patternsProperty) {
+ this.patternsProperty = patternsProperty;
+ if (this.patternsProperty != null) {
+ this.pattern = Optional.of(Pattern.compile(patternsProperty, Pattern.MULTILINE));
+ }
+ }
+
+ public String getMaskChar() {
+ return maskChar;
+ }
+
+ public void setMaskChar(String maskChar) {
+ this.maskChar = maskChar;
+ }
+
+
+ protected Collection<Pattern> getPatterns() {
+ return Arrays.asList(authPattern, openstackPattern);
+ }
+
+ @Override
+ public String doLayout(ILoggingEvent event) {
+
+ final StringBuilder message = new StringBuilder(super.doLayout(event));
+ List<Pattern> patterns = new ArrayList<>(getPatterns());
+ if (pattern.isPresent()) {
+ patterns.add(pattern.get());
+ }
+ patterns.forEach(p -> {
+ Matcher matcher = p.matcher(message);
+ while (matcher.find()) {
+ int group = 1;
+ while (group <= matcher.groupCount()) {
+ if (matcher.group(group) != null) {
+ for (int i = matcher.start(group); i < matcher.end(group); i++) {
+ message.setCharAt(i, maskChar.charAt(0));
+ }
+ }
+ group++;
+ }
+ }
+ });
+ return message.toString();
+ }
+
+}
diff --git a/common/src/test/java/org/onap/so/logging/MaskLogStatementsTest.java b/common/src/test/java/org/onap/so/logging/MaskLogStatementsTest.java
new file mode 100644
index 0000000000..ba5aeb522a
--- /dev/null
+++ b/common/src/test/java/org/onap/so/logging/MaskLogStatementsTest.java
@@ -0,0 +1,90 @@
+package org.onap.so.logging;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import org.junit.Test;
+import org.onap.so.logger.MaskLogStatements;
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.classic.spi.LoggingEvent;
+
+public class MaskLogStatementsTest {
+
+ private LoggerContext lc = new LoggerContext();
+ private Logger logger = lc.getLogger(MaskLogStatementsTest.class);
+
+ @Test
+ public void verifyOpenStackPayload() throws IOException {
+ String payload =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/__files/logging/openstack-payload.json")));
+
+ ILoggingEvent event = makeLoggingEvent(payload);
+
+ MaskLogStatements mask = new MaskLogStatements();
+
+ mask.setContext(lc);
+ mask.setPattern("%m");
+ mask.start();
+ String result = mask.doLayout(event);
+
+ assertTrue(result.matches("(?s).*?\"password\"\\s?:\\s?\"\\*+\".*"));
+
+ }
+
+ @Test
+ public void maskAuthHeaderTest() {
+ String msg = "Headers : [Accept:\"application/json\", Authorization:\"Basic dklfjeaklfjdkalf\","
+ + "Content-Type:\"application/json\", Content-Length:\"10\","
+ + "X-RequestID:\"db2a0462-69d0-499f-93ec-e2a064ef1f59\", X-TransactionID:\"db2a0462-69d0-499f-93ec-e2a064ef1f59\","
+ + "X-ECOMP-RequestID:\"db2a0462-69d0-499f-93ec-e2a064ef1f59\", X-ONAP-PartnerName:\"SO.APIH\","
+ + "X-InvocationID:\"885e4f99-6f24-4f17-ab1b-584b37715b49\"]";
+
+ String expected = "Headers : [Accept:\"application/json\", Authorization:\"Basic ****************\","
+ + "Content-Type:\"application/json\", Content-Length:\"10\","
+ + "X-RequestID:\"db2a0462-69d0-499f-93ec-e2a064ef1f59\", X-TransactionID:\"db2a0462-69d0-499f-93ec-e2a064ef1f59\","
+ + "X-ECOMP-RequestID:\"db2a0462-69d0-499f-93ec-e2a064ef1f59\", X-ONAP-PartnerName:\"SO.APIH\","
+ + "X-InvocationID:\"885e4f99-6f24-4f17-ab1b-584b37715b49\"]";
+ ILoggingEvent event = makeLoggingEvent(msg);
+
+ MaskLogStatements mask = new MaskLogStatements();
+
+ mask.setContext(lc);
+ mask.setPattern("%m");
+ mask.start();
+ String result = mask.doLayout(event);
+
+ assertEquals(expected, result);
+ }
+
+ @Test
+ public void maskAuthHeaderObjectStringTest() {
+ String msg = "Headers: {Accept=[text/plain, application/json, application/*+json, */*],"
+ + "Authorization=[Basic aaaaa],"
+ + "connection=[keep-alive], Content-Length=[217], content-type=[application/xml],"
+ + "host=[mso-bpmn-infra-svc:9200], user-agent=[Java/11.0.6]}";
+ String expected = "Headers: {Accept=[text/plain, application/json, application/*+json, */*],"
+ + "Authorization=[Basic -----],"
+ + "connection=[keep-alive], Content-Length=[217], content-type=[application/xml],"
+ + "host=[mso-bpmn-infra-svc:9200], user-agent=[Java/11.0.6]}";
+ ILoggingEvent event = makeLoggingEvent(msg);
+
+ MaskLogStatements mask = new MaskLogStatements();
+
+ mask.setContext(lc);
+ mask.setPattern("%m");
+ mask.setMaskChar("-");
+ mask.start();
+ String result = mask.doLayout(event);
+
+ assertEquals(expected, result);
+ }
+
+ private ILoggingEvent makeLoggingEvent(String message) {
+ return new LoggingEvent(MaskLogStatementsTest.class.getName(), logger, Level.INFO, message, null, null);
+ }
+}
diff --git a/common/src/test/resources/__files/logging/openstack-payload.json b/common/src/test/resources/__files/logging/openstack-payload.json
new file mode 100644
index 0000000000..ac4d1639dc
--- /dev/null
+++ b/common/src/test/resources/__files/logging/openstack-payload.json
@@ -0,0 +1,26 @@
+{
+ "auth": {
+ "identity": {
+ "password": {
+ "user": {
+ "name": "j0000",
+ "domain": {
+ "name": "name"
+ },
+ "password": "my-password-wow"
+ }
+ },
+ "methods": [
+ "password"
+ ]
+ },
+ "scope": {
+ "project": {
+ "id": "ad299b37da30413391e9c28138f0b0dd",
+ "domain": {
+ "name": "name"
+ }
+ }
+ }
+ }
+}
diff --git a/graph-inventory/fluent-builder-maven-plugin/pom.xml b/graph-inventory/fluent-builder-maven-plugin/pom.xml
index 6b3fd0f8bd..bcc04efb31 100644
--- a/graph-inventory/fluent-builder-maven-plugin/pom.xml
+++ b/graph-inventory/fluent-builder-maven-plugin/pom.xml
@@ -68,9 +68,9 @@
<version>2.2.1</version>
</dependency>
<dependency>
- <groupId>io.swagger</groupId>
+ <groupId>io.swagger.parser.v3</groupId>
<artifactId>swagger-parser</artifactId>
- <version>1.0.50</version>
+ <version>2.0.24</version>
</dependency>
<dependency>
<groupId>com.squareup</groupId>
diff --git a/pom.xml b/pom.xml
index 407d692eb5..198ffbbbba 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1007,17 +1007,6 @@
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
- <version>${cxf.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.spec.javax.rmi</groupId>
- <artifactId>jboss-rmi-api_1.0_spec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId>
<version>${cxf.version}</version>
<exclusions>
@@ -1065,11 +1054,6 @@
<version>${aaf.version}</version>
<scope>runtime</scope>
</dependency>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey2-jaxrs</artifactId>
- <version>1.6.2</version>
- </dependency>
<dependency>
<groupId>ch.vorburger.mariaDB4j</groupId>
<artifactId>mariaDB4j</artifactId>