aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models-decisions/src/main/java/org/onap/policy/models/decisions/concepts/DecisionRequest.java29
-rw-r--r--models-examples/src/main/resources/policytypes/onap.policies.Naming.yaml4
-rw-r--r--models-examples/src/main/resources/policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml56
3 files changed, 60 insertions, 29 deletions
diff --git a/models-decisions/src/main/java/org/onap/policy/models/decisions/concepts/DecisionRequest.java b/models-decisions/src/main/java/org/onap/policy/models/decisions/concepts/DecisionRequest.java
index 1ba7f4362..ca1e9e207 100644
--- a/models-decisions/src/main/java/org/onap/policy/models/decisions/concepts/DecisionRequest.java
+++ b/models-decisions/src/main/java/org/onap/policy/models/decisions/concepts/DecisionRequest.java
@@ -21,10 +21,10 @@
package org.onap.policy.models.decisions.concepts;
import com.google.gson.annotations.SerializedName;
-
+import java.util.HashMap;
import java.util.Map;
-
import lombok.Data;
+import lombok.NoArgsConstructor;
/**
* This class is for a Decision Request to a Decision PDP Engine.
@@ -33,6 +33,7 @@ import lombok.Data;
*
*/
@Data
+@NoArgsConstructor
public class DecisionRequest {
@SerializedName("ONAPName")
private String onapName;
@@ -46,9 +47,33 @@ public class DecisionRequest {
@SerializedName("requestId")
private String requestId;
+ @SerializedName("context")
+ private Map<String, Object> context;
+
@SerializedName("action")
private String action;
@SerializedName("resource")
private Map<String, Object> resource;
+
+ /**
+ * Copy constructor.
+ *
+ * @param request Incoming DecisionRequest
+ */
+ public DecisionRequest(DecisionRequest request) {
+ this.setOnapName(request.getOnapName());
+ this.setOnapComponent(request.getOnapComponent());
+ this.setOnapInstance(request.getOnapInstance());
+ this.setRequestId(request.getRequestId());
+ if (request.getContext() != null) {
+ this.setContext(new HashMap<>());
+ this.getContext().putAll(request.getContext());
+ }
+ this.setAction(request.getAction());
+ if (request.getResource() != null) {
+ this.setResource(new HashMap<>());
+ this.getResource().putAll(request.getResource());
+ }
+ }
}
diff --git a/models-examples/src/main/resources/policytypes/onap.policies.Naming.yaml b/models-examples/src/main/resources/policytypes/onap.policies.Naming.yaml
index f1b9c43d2..8636b7980 100644
--- a/models-examples/src/main/resources/policytypes/onap.policies.Naming.yaml
+++ b/models-examples/src/main/resources/policytypes/onap.policies.Naming.yaml
@@ -13,7 +13,7 @@ policy_types:
type: policy.data.naming-model-entity
data_types:
policy.data.naming-model-entity:
- derived_from: tosca.nodes.Root
+ derived_from: tosca.datatypes.Root
properties:
nfRole:
type: string
@@ -37,7 +37,7 @@ data_types:
entry_schema:
type: policy.data.naming-property
policy.data.naming-property:
- derived_from: tosca.nodes.Root
+ derived_from: tosca.datatypes.Root
properties:
property-name:
type: string
diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml
index b6327c87b..f45ee8162 100644
--- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml
+++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml
@@ -1,28 +1,34 @@
tosca_definitions_version: tosca_simple_yaml_1_0_0
policy_types:
- onap.policies.optimization.service.SubscriberPolicy:
- derived_from: onap.policies.optimization.Service
- version: 1.0.0
- properties:
- subscriberProperties:
- type: policy.data.subscriberProperties_properties
- required: true
+ onap.policies.optimization.service.SubscriberPolicy:
+ derived_from: onap.policies.optimization.Service
+ version: 1.0.0
+ properties:
+ subscriberProperties:
+ type: policy.data.subscriberProperties_properties
+ required: true
data_types:
- policy.data.subscriberProperties_properties:
- derived_from: tosca.nodes.Root
- properties:
- subscriberName:
- type: list
- required: true
- entry_schema:
- type: string
- subscriberRole:
- type: list
- required: true
- entry_schema:
- type: string
- provStatus:
- type: list
- required: true
- entry_schema:
- type: string \ No newline at end of file
+ policy.data.subscriberProperties_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ subscriberName:
+ type: list
+ required: true
+ metadata:
+ contextProvider: true
+ entry_schema:
+ type: string
+ subscriberRole:
+ type: list
+ required: true
+ metadata:
+ contextMatchable: scope
+ entry_schema:
+ type: string
+ provStatus:
+ type: list
+ required: true
+ metadata:
+ contextAttribute: true
+ entry_schema:
+ type: string \ No newline at end of file