aboutsummaryrefslogtreecommitdiffstats
path: root/a1-policy-management/src
diff options
context:
space:
mode:
authorKAPIL SINGAL <ks220y@att.com>2020-10-28 13:18:45 +0000
committerGerrit Code Review <gerrit@onap.org>2020-10-28 13:18:45 +0000
commit90f39a1c0df14b817a4d50443695b145a5acbe5e (patch)
tree0d1eff36e63714c25fdff13af9547c214eaba10c /a1-policy-management/src
parent988f2af648a069ae86a4d9fc9499b80716ca8443 (diff)
parentd8e7dc1541d7467faf1b49df6a3539ab3d6c142f (diff)
Merge "Improved validation of parameters for putPolicy in the NBI"
Diffstat (limited to 'a1-policy-management/src')
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java5
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java2
2 files changed, 5 insertions, 2 deletions
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java
index c18ec81b..13568dbc 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java
@@ -190,6 +190,9 @@ public class PolicyController {
})
public Mono<ResponseEntity<Object>> putPolicy(@RequestBody PolicyInfo policyInfo) {
+ if (!policyInfo.validate()) {
+ return ErrorResponse.createMono("Missing required parameter in body", HttpStatus.BAD_REQUEST);
+ }
String jsonString = gson.toJson(policyInfo.policyData);
Ric ric = rics.get(policyInfo.ricId);
PolicyType type = policyTypes.get(policyInfo.policyTypeId);
@@ -286,7 +289,7 @@ public class PolicyController {
@ApiResponse(code = 200, message = "Policies", response = PolicyInfoList.class),
@ApiResponse(code = 404, message = "Near-RT RIC, policy type or service not found",
response = ErrorResponse.ErrorInfo.class)})
- public ResponseEntity<Object> getPolicies( //
+ public ResponseEntity<Object> getPolicyInstances( //
@ApiParam(name = Consts.POLICY_TYPE_ID_PARAM, required = false,
value = "The identity of the policy type to get policies for.") //
@RequestParam(name = Consts.POLICY_TYPE_ID_PARAM, required = false) String type, //
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java
index 0ec2165c..594cf786 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java
@@ -65,7 +65,7 @@ public class PolicyInfo {
@ApiModelProperty(value = "Callback URI for policy status updates", required = false)
@JsonProperty(value = "status_notification_uri", required = false)
@SerializedName("status_notification_uri")
- public String statusNotificationUri;
+ public String statusNotificationUri = "";
PolicyInfo() {}