aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogumil Zebek <bogumil.zebek@nokia.com>2020-08-13 07:35:53 +0200
committerZebek Bogumil <bogumil.zebek@nokia.com>2020-08-13 07:35:53 +0200
commitf1ea637a60bace906db5619d71a914ad601e9478 (patch)
tree47775211190c8a152b4349edd335767472f44cb2
parentf6260a26de44a9338ca998626a93c0d0fa56abc3 (diff)
StndDefined event routing
- Update WS error response - Update DPO configuration Change-Id: Id4eb5ea50af6d55c839047c4f39b9f99487e95de Issue-ID: DCAEGEN2-1771 Signed-off-by: Zebek Bogumil <bogumil.zebek@nokia.com>
-rw-r--r--Changelog.md2
-rw-r--r--dpo/data-formats/ConsulConfig.json26
-rw-r--r--dpo/data-formats/ves-dmaap-config.json56
-rw-r--r--dpo/spec/vescollector-componentspec.json24
-rw-r--r--src/main/java/org/onap/dcae/restapi/ApiException.java16
-rw-r--r--src/test/java/org/onap/dcae/restapi/VesRestControllerTest.java17
6 files changed, 131 insertions, 10 deletions
diff --git a/Changelog.md b/Changelog.md
index 216e1ce9..124e913a 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -21,3 +21,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- [DCAEGEN2-2254](https://jira.onap.org/browse/DCAEGEN2-2254) - Add new data-format for 30.2_ONAP schema version
## [1.7.2] - 04/08/2020
- [DCAEGEN2-1771](https://jira.onap.org/browse/DCAEGEN2-1771) - Add StndDefined event routing to dmaap streams defined in namespace event field - no second stage event validation.
+ - [DCAEGEN2-1771](https://jira.onap.org/browse/DCAEGEN2-1771) - Fix error response model
+ - [DCAEGEN2-1771](https://jira.onap.org/browse/DCAEGEN2-1771) - Update DPO model
diff --git a/dpo/data-formats/ConsulConfig.json b/dpo/data-formats/ConsulConfig.json
index dcfcdf63..1249afe4 100644
--- a/dpo/data-formats/ConsulConfig.json
+++ b/dpo/data-formats/ConsulConfig.json
@@ -2,7 +2,7 @@
"collector.dynamic.config.update.frequency": "5",
"event.transform.flag": "0",
"collector.schema.checkflag": "1",
- "collector.dmaap.streamid": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration|stndDefined=ves-other",
+ "collector.dmaap.streamid": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance",
"collector.service.port": "8080",
"collector.schema.file": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.2_ONAP.json\"}",
"collector.keystore.passwordfile": "/opt/app/VESCollector/etc/passwordfile",
@@ -42,6 +42,30 @@
"dmaap_info": {
"topic_url": "http://message-router:3904/events/unauthenticated.VES_NOTIFICATION_OUTPUT/"
}
+ },
+ "ves-3gpp-fault-supervision": {
+ "type": "message_router",
+ "dmaap_info": {
+ "topic_url": "http://message-router:3904/events/unauthenticated.SEC_3GPP_FAULTSUPERVISION_OUTPUT/"
+ }
+ },
+ "ves-3gpp-provisioning": {
+ "type": "message_router",
+ "dmaap_info": {
+ "topic_url": "http://message-router:3904/events/unauthenticated.SEC_3GPP_PROVISIONING_OUTPUT/"
+ }
+ },
+ "ves-3gpp-heartbeat": {
+ "type": "message_router",
+ "dmaap_info": {
+ "topic_url": "http://message-router:3904/events/unauthenticated.SEC_3GPP_HEARTBEAT_OUTPUT/"
+ }
+ },
+ "ves-3gpp-performance-assurance": {
+ "type": "message_router",
+ "dmaap_info": {
+ "topic_url": "http://message-router:3904/events/unauthenticated.SEC_3GPP_PERFORMANCEASSURANCE_OUTPUT/"
+ }
}
},
"collector.service.secure.port": "8443",
diff --git a/dpo/data-formats/ves-dmaap-config.json b/dpo/data-formats/ves-dmaap-config.json
index 53e8def1..c3b4b809 100644
--- a/dpo/data-formats/ves-dmaap-config.json
+++ b/dpo/data-formats/ves-dmaap-config.json
@@ -69,6 +69,34 @@
"topic_url": "http://dmaap-mr-hostname:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
}
},
+ "ves_3gpp_fault_supervision": {
+ "type": "message_router",
+ "dmaap_info": {
+ "location": "mtl5",
+ "topic_url": "http://dmaap-mr-hostname:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves_3gpp_provisioning": {
+ "type": "message_router",
+ "dmaap_info": {
+ "location": "mtl5",
+ "topic_url": "http://dmaap-mr-hostname:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves_3gpp_heartbeat": {
+ "type": "message_router",
+ "dmaap_info": {
+ "location": "mtl5",
+ "topic_url": "http://dmaap-mr-hostname:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves_3gpp_performance_assurance": {
+ "type": "message_router",
+ "dmaap_info": {
+ "location": "mtl5",
+ "topic_url": "http://dmaap-mr-hostname:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
"ves_syslog_secondary": {
"type": "message_router",
"dmaap_info": {
@@ -138,5 +166,33 @@
"location": "mtl5",
"topic_url": "http://dmaap-mr-hostname:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
}
+ },
+ "ves_3gpp_fault_supervision_secondary": {
+ "type": "message_router",
+ "dmaap_info": {
+ "location": "mtl5",
+ "topic_url": "http://dmaap-mr-hostname:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves_3gpp_provisioning_secondary": {
+ "type": "message_router",
+ "dmaap_info": {
+ "location": "mtl5",
+ "topic_url": "http://dmaap-mr-hostname:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves_3gpp_heartbeat_secondary": {
+ "type": "message_router",
+ "dmaap_info": {
+ "location": "mtl5",
+ "topic_url": "http://dmaap-mr-hostname:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves_3gpp_performance_assurance_secondary": {
+ "type": "message_router",
+ "dmaap_info": {
+ "location": "mtl5",
+ "topic_url": "http://dmaap-mr-hostname:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
}
}
diff --git a/dpo/spec/vescollector-componentspec.json b/dpo/spec/vescollector-componentspec.json
index 3a21d2db..65972c65 100644
--- a/dpo/spec/vescollector-componentspec.json
+++ b/dpo/spec/vescollector-componentspec.json
@@ -85,6 +85,30 @@
"version": "7.30.2",
"type": "message router",
"config_key": "ves-perf3gpp"
+ },
+ {
+ "format": "VES_specification",
+ "version": "7.30.2",
+ "type": "message router",
+ "config_key": "ves-3gpp-fault-supervision"
+ },
+ {
+ "format": "VES_specification",
+ "version": "7.30.2",
+ "type": "message router",
+ "config_key": "ves-3gpp-provisioning"
+ },
+ {
+ "format": "VES_specification",
+ "version": "7.30.2",
+ "type": "message router",
+ "config_key": "ves-3gpp-heartbeat"
+ },
+ {
+ "format": "VES_specification",
+ "version": "7.30.2",
+ "type": "message router",
+ "config_key": "ves-3gpp-performance-assurance"
}
]
},
diff --git a/src/main/java/org/onap/dcae/restapi/ApiException.java b/src/main/java/org/onap/dcae/restapi/ApiException.java
index 255999a6..9ea02076 100644
--- a/src/main/java/org/onap/dcae/restapi/ApiException.java
+++ b/src/main/java/org/onap/dcae/restapi/ApiException.java
@@ -22,6 +22,9 @@ package org.onap.dcae.restapi;
import com.google.common.base.CaseFormat;
import org.json.JSONObject;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author Pawel Szalapski (pawel.szalapski@nokia.com)
*/
@@ -32,19 +35,25 @@ public enum ApiException {
INVALID_CONTENT_TYPE(ExceptionType.SERVICE_EXCEPTION, "SVC0002", "Bad Parameter (Incorrect request Content-Type)", 400),
UNAUTHORIZED_USER(ExceptionType.POLICY_EXCEPTION, "POL2000", "Unauthorized user", 401),
INVALID_CUSTOM_HEADER(ExceptionType.SERVICE_EXCEPTION, "SVC0002", "Bad Parameter (Incorrect request api version)", 400),
- MISSING_NAMESPACE_PARAMETER(ExceptionType.SERVICE_EXCEPTION, "SVC2006", "Mandatory input attribute event.commonEventHeader.stndDefinedNamespace is missing from request", 400),
- EMPTY_NAMESPACE_PARAMETER(ExceptionType.SERVICE_EXCEPTION, "SVC2006", "Mandatory input attribute event.commonEventHeader.stndDefinedNamespace is empty in request", 400),
+ MISSING_NAMESPACE_PARAMETER(ExceptionType.SERVICE_EXCEPTION, "SVC2006", "Mandatory input %1 %2 is missing from request", List.of("attribute", "event.commonEventHeader.stndDefinedNamespace"), 400),
+ EMPTY_NAMESPACE_PARAMETER(ExceptionType.SERVICE_EXCEPTION, "SVC2006", "Mandatory input %1 %2 is empty in request", List.of("attribute", "event.commonEventHeader.stndDefinedNamespace"), 400),
NO_SERVER_RESOURCES(ExceptionType.SERVICE_EXCEPTION, "SVC1000", "No server resources (internal processing queue full)", 503);
public final int httpStatusCode;
private final ExceptionType type;
private final String code;
private final String details;
+ private final List<String> variables;
ApiException(ExceptionType type, String code, String details, int httpStatusCode) {
+ this(type, code, details, new ArrayList<>(), httpStatusCode);
+ }
+
+ ApiException(ExceptionType type, String code, String details, List<String> variables, int httpStatusCode) {
this.type = type;
this.code = code;
this.details = details;
+ this.variables = variables;
this.httpStatusCode = httpStatusCode;
}
@@ -52,6 +61,9 @@ public enum ApiException {
JSONObject exceptionTypeNode = new JSONObject();
exceptionTypeNode.put("messageId", code);
exceptionTypeNode.put("text", details);
+ if(!variables.isEmpty()) {
+ exceptionTypeNode.put("variables", variables);
+ }
JSONObject requestErrorNode = new JSONObject();
requestErrorNode.put(type.toString(), exceptionTypeNode);
diff --git a/src/test/java/org/onap/dcae/restapi/VesRestControllerTest.java b/src/test/java/org/onap/dcae/restapi/VesRestControllerTest.java
index e5e7239c..10423053 100644
--- a/src/test/java/org/onap/dcae/restapi/VesRestControllerTest.java
+++ b/src/test/java/org/onap/dcae/restapi/VesRestControllerTest.java
@@ -191,7 +191,8 @@ public class VesRestControllerTest {
verifyErrorResponse(
response,
"SVC2006",
- "Mandatory input attribute event.commonEventHeader.stndDefinedNamespace is missing from request"
+ "Mandatory input %1 %2 is missing from request",
+ List.of("attribute", "event.commonEventHeader.stndDefinedNamespace")
);
verifyThatEventWasNotSend();
}
@@ -215,7 +216,8 @@ public class VesRestControllerTest {
verifyErrorResponse(
response,
"SVC2006",
- "Mandatory input attribute event.commonEventHeader.stndDefinedNamespace is empty in request"
+ "Mandatory input %1 %2 is empty in request",
+ List.of("attribute", "event.commonEventHeader.stndDefinedNamespace")
);
verifyThatEventWasNotSend();
}
@@ -251,13 +253,14 @@ public class VesRestControllerTest {
when(applicationSettings.jsonSchema(eq(VERSION_V7))).thenReturn(loadedJsonSchemas.get(VERSION_V7).get());
}
- private void verifyErrorResponse(ResponseEntity<String> response, String messageId, String messageText) throws com.fasterxml.jackson.core.JsonProcessingException {
- final Map<String, String> errorDetails = fetchErrorDetails(response);
- assertThat(errorDetails).containsEntry("messageId", messageId);
- assertThat(errorDetails).containsEntry("text", messageText);
+ private void verifyErrorResponse(ResponseEntity<String> response, String messageId, String messageText, List<String> variables) throws com.fasterxml.jackson.core.JsonProcessingException {
+ final Map<String, ?> errorDetails = fetchErrorDetails(response);
+ assertThat((Map<String, String>)errorDetails).containsEntry("messageId", messageId);
+ assertThat((Map<String, String>)errorDetails).containsEntry("text", messageText);
+ assertThat((Map<String, List<String>>)errorDetails).containsEntry("variables", variables);
}
- private Map<String, String> fetchErrorDetails(ResponseEntity<String> response) throws com.fasterxml.jackson.core.JsonProcessingException {
+ private Map<String, ?> fetchErrorDetails(ResponseEntity<String> response) throws com.fasterxml.jackson.core.JsonProcessingException {
final String body = response.getBody();
ObjectMapper mapper = new ObjectMapper();
Map<String, Map<String, Map<String,String>>> map = mapper.readValue(body, Map.class);