summaryrefslogtreecommitdiffstats
path: root/vid-automation/src
diff options
context:
space:
mode:
authorAmir Skalka <amir.skalka@intl.att.com>2019-11-04 14:26:17 +0200
committerIttay Stern <ittay.stern@att.com>2019-11-04 16:09:10 +0000
commit5e0e88d7c19479494215af17d23e07b26dd62dbc (patch)
tree6db3bff6bb5ccde483dc44b93ba052c0e409e848 /vid-automation/src
parentedee21ec5dcab14d4aad21894aef6a0366e82074 (diff)
Validate audit of request id on incoming requests to MSO
ServiceInstanceMsoApiTest to verify incoming requests in audit log as well to headers and outgoing requests in logs. Issue-ID: VID-253 Change-Id: I4d94e6de4e2a844f2e0104df6c45b5070465de1e Signed-off-by: Amir Skalka <amir.skalka@intl.att.com>
Diffstat (limited to 'vid-automation/src')
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java5
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java5
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java1
-rw-r--r--vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java17
4 files changed, 24 insertions, 4 deletions
diff --git a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java
index 39110c550..05d73a619 100644
--- a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java
+++ b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java
@@ -774,11 +774,12 @@ public class AaiApiTest extends BaseApiAaiTest {
new PresetAAIGetVpnsByType(),
new PresetAAIGetSubscribersGet()
),CLEAR_THEN_SET);
-
- String url = uri + "/aai_get_vpn_list";
+ String internalPath = "/aai_get_vpn_list";
+ String url = uri + internalPath;
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
final String requestId = response.getHeaders().getFirst("X-ECOMP-RequestID-echo");
LoggerFormatTest.assertHeadersAndMetricLogs(restTemplate, uri, requestId,"/network/vpn-bindings" , 1);
+ LoggerFormatTest.verifyExistenceOfIncomingReqsInAuditLogs(restTemplate, uri, requestId, internalPath);
}
@Test
diff --git a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java
index f22b6de65..858b2f8ef 100644
--- a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java
+++ b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java
@@ -220,7 +220,7 @@ public class SdcApiTest extends BaseApiTest {
public void whenCallSdc_thenRequestRecordedInMetricsLog() {
ModelInfo modelInfo = ModelInfo.transportWithPnfsService;
-
+ String internalPath = SDC_GET_SERVICE_MODEL + modelInfo.modelVersionId;
registerExpectationFromPresets(ImmutableList.of(
new PresetSDCGetServiceToscaModelGet(modelInfo),
new PresetSDCGetServiceMetadataGet(modelInfo),
@@ -228,11 +228,12 @@ public class SdcApiTest extends BaseApiTest {
), CLEAR_THEN_SET);
ResponseEntity<String> response = restTemplate.getForEntity(
- buildUri(SDC_GET_SERVICE_MODEL + modelInfo.modelVersionId), String.class);
+ buildUri(internalPath), String.class);
final String requestId = response.getHeaders().getFirst("X-ECOMP-RequestID-echo");
LoggerFormatTest.assertHeadersAndMetricLogs(restTemplate, uri, requestId, SDC_ROOT_PATH, 2);
+ LoggerFormatTest.verifyExistenceOfIncomingReqsInAuditLogs(restTemplate, uri, requestId, internalPath);
}
}
diff --git a/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java
index 28b407697..8bc2a7390 100644
--- a/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java
+++ b/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java
@@ -139,6 +139,7 @@ public class ServiceInstanceMsoApiTest extends BaseMsoApiTest{
ResponseEntity<String> responseEntity = restTemplate.postForEntity(buildUri(MSO_ACTIVATE_FABRIC_CONFIGURATION), requestBody, String.class);
String requestId = responseEntity.getHeaders().getFirst("X-ECOMP-RequestID-echo");
LoggerFormatTest.assertHeadersAndMetricLogs(restTemplate, uri, requestId, msoRootPath, 1);
+ LoggerFormatTest.verifyExistenceOfIncomingReqsInAuditLogs(restTemplate, uri, requestId, MSO_ACTIVATE_FABRIC_CONFIGURATION);
}
@Test(dataProvider = "errorCodes")
diff --git a/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java b/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java
index a233f255e..7a4eedfa9 100644
--- a/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java
+++ b/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java
@@ -131,6 +131,23 @@ public class LoggerFormatTest extends BaseApiTest {
return lines;
}
+ public static void verifyExistenceOfIncomingReqsInAuditLogs(RestTemplate restTemplate, URI uri, String requestId,
+ String path){
+ List<String> logLines = getRequestLogLines(requestId, LogName.audit2019, restTemplate, uri);
+ String requestIdPrefix = "RequestID=";
+ assertThat("request id must be found in exactly two rows - entry & exit message in audit log, and include the req path",
+ logLines,
+ containsInRelativeOrder(
+ allOf(
+ containsString(requestIdPrefix+requestId),
+ containsString("ENTRY"),
+ containsString(path)),
+ allOf(
+ containsString(requestIdPrefix+requestId),
+ containsString("EXIT"),
+ containsString(path))
+ ));
+ }
public static void assertHeadersAndMetricLogs(RestTemplate restTemplate, URI uri, String requestId, String path, int requestsSize) {
List<String> logLines =