Update optimization policy type 66/91266/10
authorPamela Dragosh <pdragosh@research.att.com>
Thu, 11 Jul 2019 13:58:27 +0000 (09:58 -0400)
committerPamela Dragosh <pdragosh@research.att.com>
Fri, 30 Aug 2019 11:16:46 +0000 (07:16 -0400)
Per work with Optimization team, identifying common attributes for matchable
optimization policies.

Fixed TOSCA syntax errors - use map instead of list.

Removed identity from PciPolicy, QueryPolicy and OptimizationPolicy.

Added example of how vCPE policies now look.

Updated the example for HPA Policy based on Ruoyo input. Fixed syntax
errors due to JSON conversion. Trailing spaces.

Added back in list for applicableResources and required scope attribute
for example policies.

Issue-ID: POLICY-1899
Change-Id: Ic8ae6db0575fb21fca6103ab2ed015c8524def80
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
main/src/test/resources/policies/vCPE.policies.optimization.input.tosca.yaml [new file with mode: 0644]
main/src/test/resources/policytypes/onap.policies.Optimization.yaml [new file with mode: 0644]
main/src/test/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml
main/src/test/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml
main/src/test/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml
main/src/test/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml
main/src/test/resources/policytypes/onap.policies.optimization.PciPolicy.yaml
main/src/test/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml
main/src/test/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml
main/src/test/resources/policytypes/onap.policies.optimization.Vim_fit.yaml
main/src/test/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml

diff --git a/main/src/test/resources/policies/vCPE.policies.optimization.input.tosca.yaml b/main/src/test/resources/policies/vCPE.policies.optimization.input.tosca.yaml
new file mode 100644 (file)
index 0000000..17f20df
--- /dev/null
@@ -0,0 +1,173 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+topology_template:
+  policies:
+    -
+        OSDF_CASABLANCA.Affinity_vCPE_1:
+            type: onap.policies.optimization.AffinityPolicy
+            version: 1.0.0
+            metadata:
+                policy-id: OSDF_CASABLANCA.Affinity_vCPE_1
+                policy-version: 1
+            properties:
+                scope: []
+                services: [vCPE]
+                resources: [vGMuxInfra, vG]
+                geography: [US, INTERNATIONAL]
+                identity: affinity_vCPE
+                applicableResources: any
+                affinityProperties:
+                    qualifier: same
+                    category: complex
+    -
+        OSDF_CASABLANCA.Capacity_vG_1:
+            type: onap.policies.optimization.Vim_fit
+            version: 1.0.0
+            metadata:
+                policy-id: OSDF_CASABLANCA.Capacity_vG_1
+                policy-version: 1
+            properties:
+                scope: []
+                services: [vCPE]
+                resources: [vG]
+                geography: [US, INTERNATIONAL]
+                identity: capacity_vG
+                applicableResources: any
+                capacityProperty:
+                   controller: multicloud
+                   request: "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\"}, \"unit\": \"GB\"}}"
+    -
+        OSDF_CASABLANCA.Distance_vG_1:
+            type: onap.policies.optimization.DistancePolicy
+            version: 1.0.0
+            metadata:
+                policy-id: OSDF_CASABLANCA.Distance_vG_1
+                policy-version: 1
+            properties:
+                scope: []
+                services: [vCPE]
+                resources: [vG]
+                geography: [US, INTERNATIONAL]
+                identity: distance-vG
+                applicableResources: any
+                distanceProperties:
+                    locationInfo: customer_loc
+                    distance:
+                        value: 1500
+                        operator: "<"
+                        unit: km
+    -
+        OSDF_CASABLANCA.hpa_policy_vG_1:
+            type: onap.policies.optimization.HpaPolicy
+            version: 1.0.0
+            metadata:
+                policy-id: OSDF_CASABLANCA.hpa_policy_vG_1
+                policy-version: 1
+            properties:
+                scope: []
+                services: [vCPE]
+                resources: [vG]
+                geography: [US, INTERNATIONAL]
+                identity: hpa-vG
+                flavorFeatures:
+                    -
+                         id: vg_1
+                         type: vnfc
+                         directives:
+                             -    type: flavor_directives
+                                  attributes:
+                                      -    attribute_name: flavor_label_vm_01
+                                           attribute_value: ""
+                         flavorProperties:
+                             -
+                                  hpa-feature: basicCapabilities
+                                  mandatory: True
+                                  architecture: generic
+                                  directives: []
+                                  hpa-feature-attributes:
+                                      -    hpa-attribute-key: numVirtualCpu
+                                           hpa-attribute-value: 6
+                                           operator: ['>=']
+                                           unit: ""
+                                      -    hpa-attribute-key: virtualMemSize
+                                           hpa-attribute-value: 4
+                                           operator: ['<=']
+                                           unit: ""
+                             -
+                                  hpa-feature: ovsDpdk
+                                  mandatory: False
+                                  architecture: generic
+                                  directives: []
+                                  hpa-feature-attributes:
+                                      -    hpa-attribute-key: dataProcessingAccelerationLibrary
+                                           hpa-attribute-value: ovsDpdk_version
+                                           operator: [=]
+                                           unit: ""
+    -
+        OSDF_CASABLANCA.queryPolicy_vCPE:
+            type: onap.policies.optimization.QueryPolicy
+            version: 1.0.0
+            metadata:
+                policy-id: OSDF_CASABLANCA.queryPolicy_vCPE
+                policy-version: 1
+            properties:
+                scope: []
+                services: [vCPE]
+                resources: [vGMuxInfra, vG]
+                geography: [US, INTERNATIONAL]
+                identity: vCPE_Query_Policy
+                queryProperties:
+                    -
+                        attribute: locationId
+                        attribute_location: customerLocation
+                        value: ""
+                    -
+                        attribute: id
+                        attribute_location: "vpnInfo.vpnId"
+                        value: ""
+                    -
+                        attribute: upstreamBW
+                        attribute_location: "vpnInfo.upstreamBW"
+                        value: ""
+                    -
+                        attribute: customerLatitude
+                        attribute_location: customerLatitude
+                        value: 1.1
+                    - 
+                        attribute: customerLongitude
+                        attribute_location: customerLongitude
+                        value: 2.2
+    -
+        OSDF_CASABLANCA.SubscriberPolicy_v1:
+            type: onap.policies.optimization.SubscriberPolicy
+            version: 1.0.0
+            metadata:
+                policy-id: OSDF_CASABLANCA.SubscriberPolicy_v1
+                policy-version: 1
+            properties:
+                scope: []
+                services: [vCPE]
+                identity: subscriber_vCPE
+                properties:
+                    subscriberName: [subscriber_x, subscriber_y]
+                    subscriberRole: ["PVT Homing"]
+                    provStatus: [CAPPED]
+    -
+        OSDF_CASABLANCA.vnfPolicy_vG:
+            type: onap.policies.optimization.VnfPolicy
+            version: 1.0.0
+            metadata:
+                policy-id: OSDF_CASABLANCA.vnfPolicy_vG
+                policy-version: 1
+            properties:
+                scope: []
+                services: [vCPE]
+                resources: [vG]
+                geography: [US, INTERNATIONAL]
+                identity: vnf_vG
+                applicableResources: any
+                vnfProperties:
+                    -
+                        inventoryProvider: aai
+                        serviceType: ""
+                        inventoryType: cloudRegionId
+                        customerId: ""
diff --git a/main/src/test/resources/policytypes/onap.policies.Optimization.yaml b/main/src/test/resources/policytypes/onap.policies.Optimization.yaml
new file mode 100644 (file)
index 0000000..62f2c6f
--- /dev/null
@@ -0,0 +1,39 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+policy_types:
+    onap.policies.Optimization:
+        derived_from: tosca.policies.Root
+        version: 1.0.0
+        description: The base policy type for all policies that govern optimization
+        properties:
+            scope:
+                description: Scope for the policy - could be for a specific release.
+                type: string
+                matchable: true
+                required: true
+            services:
+                description: One or more services that the policy applies to.
+                type: list
+                matchable: true
+                required: true
+                entry_schema:
+                    type: string
+            resources:
+                description: One or more VNF resources that the policy applies to.
+                type: list
+                matchable: true
+                required: true
+                entry_schema:
+                    type: string
+            geography:
+                description: One or more geographic regions
+                type: list
+                matchable: true
+                required: true
+                entry_schema:
+                    type: string
+                    constraints:
+                        - valid_values: ["US", "International"]
+            identity:
+                description: Used internally for identification
+                type: string
+                required: true
index 415e05e..f0d47ed 100644 (file)
@@ -1,32 +1,8 @@
 tosca_definitions_version: tosca_simple_yaml_1_0_0
 policy_types:
-    - onap.policies.Optimization:
-        derived_from: tosca.policies.Root
-        version: 1.0.0
-        description: a base policy type for all policies that govern optimization
-    - onap.policies.optimization.AffinityPolicy:
+    onap.policies.optimization.AffinityPolicy:
         derived_from: onap.policies.Optimization
         properties:
-            policyScope:
-                type: list
-                description: scope where the policy is applicable
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-            policyType:
-                type: list
-                description: type of a policy
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-                    constraints:
-                    -   valid_values:
-                        - zone
-            identity:
-                type: string
-                required: true
             applicableResources:
                 type: list
                 required: true
@@ -39,25 +15,16 @@ policy_types:
             affinityProperties:
                 type: policy.data.affinityProperties_properties
                 required: true
-            resources:
-                type: list
-                required: true
-                entry_schema:
-                    type: string
 data_types:
-  -
     policy.data.affinityProperties_properties:
         derived_from: tosca.nodes.Root
         properties:
             qualifier:
-                type: list
-                required: true
-                entry_schema:
-                    type: string
-                    constraints:
-                    -   valid_values:
-                        - same
-                        - different
+                type: string
+                constraints:
+                -   valid_values:
+                    - same
+                    - different
             category:
                 type: string
                 required: true
index a0571bc..9bcdd7a 100644 (file)
@@ -1,37 +1,8 @@
 tosca_definitions_version: tosca_simple_yaml_1_0_0
 policy_types:
-    - onap.policies.Optimization:
-        derived_from: tosca.policies.Root
-        version: 1.0.0
-        description: a base policy type for all policies that govern optimization
-    - onap.policies.optimization.DistancePolicy:
+    onap.policies.optimization.DistancePolicy:
         derived_from: onap.policies.Optimization
         properties:
-            policyScope:
-                type: list
-                description: scope where the policy is applicable
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-            policyType:
-                type: list
-                description: type of a policy
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-                    constraints:
-                    -   valid_values:
-                        - distance_to_location
-            identity:
-                type: string
-                required: true
-            resources:
-                type: list
-                required: true
-                entry_schema:
-                    type: string
             applicableResources:
                 type: list
                 required: true
@@ -45,7 +16,6 @@ policy_types:
                 type: policy.data.distanceProperties_properties
                 required: true
 data_types:
-  -
     policy.data.distanceProperties_properties:
         derived_from: tosca.nodes.Root
         properties:
@@ -55,6 +25,8 @@ data_types:
             distance:
                 type: policy.data.distance_properties
                 required: true
+                entry_schema:
+                    type: policy.data.distance_properties
     policy.data.distance_properties:
         derived_from: tosca.nodes.Root
         properties:
@@ -70,9 +42,9 @@ data_types:
                     -   valid_values:
                         - <
                         - <=
-                        - '>'
-                        - '>='
-                        - '='
+                        - >
+                        - >=
+                        - =
             unit:
                 type: list
                 required: true
index e9e5436..21a2e72 100644 (file)
@@ -1,44 +1,14 @@
 tosca_definitions_version: tosca_simple_yaml_1_0_0
 policy_types:
-    - onap.policies.Optimization:
-        derived_from: tosca.policies.Root
-        version: 1.0.0
-        description: a base policy type for all policies that govern optimization
-    - onap.policies.optimization.HpaPolicy:
+    onap.policies.optimization.HpaPolicy:
         derived_from: onap.policies.Optimization
         properties:
-            policyScope:
-                type: list
-                description: scope where the policy is applicable
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-            policyType:
-                type: list
-                description: type of a policy
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-                    constraints:
-                    -   valid_values:
-                        - hpa
-            resources:
-                type: list
-                required: true
-                entry_schema:
-                    type: string
-            identity:
-                type: string
-                required: true
             flavorFeatures:
                 type: list
                 required: true
                 entry_schema:
                     type: policy.data.flavorFeatures_properties
 data_types:
-  -
     policy.data.flavorFeatures_properties:
         derived_from: tosca.nodes.Root
         properties:
@@ -58,7 +28,6 @@ data_types:
                 required: true
                 entry_schema:
                     type: policy.data.flavorProperties_properties
-  -
     policy.data.directives_properties:
         derived_from: tosca.nodes.Root
         properties:
@@ -68,7 +37,6 @@ data_types:
                 type: list
                 entry_schema:
                     type: policy.data.directives_attributes_properties
-  -
     policy.data.directives_attributes_properties:
         derived_from: tosca.nodes.Root
         properties:
@@ -76,7 +44,6 @@ data_types:
                 type: string
             attribute_value:
                 type: string
-  -
     policy.data.flavorProperties_properties:
         derived_from: tosca.nodes.Root
         properties:
@@ -105,7 +72,6 @@ data_types:
                 required: true
                 entry_schema:
                     type: policy.data.hpa-feature-attributes_properties
-  -
     policy.data.hpa-feature-attributes_properties:
         derived_from: tosca.nodes.Root
         properties:
@@ -124,10 +90,10 @@ data_types:
                     -   valid_values:
                         - <
                         - <=
-                        - '>'
-                        - '>='
-                        - '='
-                        - '!='
+                        - >
+                        - >=
+                        - =
+                        - !=
                         - any
                         - all
                         - subset
index cccd0b5..76bc550 100644 (file)
@@ -1,32 +1,8 @@
 tosca_definitions_version: tosca_simple_yaml_1_0_0
 policy_types:
-    - onap.policies.Optimization:
-        derived_from: tosca.policies.Root
-        version: 1.0.0
-        description: a base policy type for all policies that govern optimization
-    - onap.policies.optimization.OptimizationPolicy:
+    onap.policies.optimization.OptimizationPolicy:
         derived_from: onap.policies.Optimization
         properties:
-            policyScope:
-                type: list
-                description: scope where the policy is applicable
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-            policyType:
-                type: list
-                description: type of a policy
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-                    constraints:
-                    -   valid_values:
-                        - placement_optimization
-            identity:
-                type: string
-                required: true
             objective:
                 type: list
                 required: true
@@ -40,7 +16,6 @@ policy_types:
                 type: policy.data.objectiveParameter_properties
                 required: true
 data_types:
-  -
     policy.data.objectiveParameter_properties:
         derived_from: tosca.nodes.Root
         properties:
index 2cc6d41..8118796 100644 (file)
@@ -1,44 +1,14 @@
 tosca_definitions_version: tosca_simple_yaml_1_0_0
 policy_types:
-    - onap.policies.Optimization:
-        derived_from: tosca.policies.Root
-        version: 1.0.0
-        description: a base policy type for all policies that govern optimization
-    - onap.policies.optimization.PciPolicy:
+    onap.policies.optimization.PciPolicy:
         derived_from: onap.policies.Optimization
         properties:
-            policyScope:
-                type: list
-                description: scope where the policy is applicable
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-            policyType:
-                type: list
-                description: type of a policy
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-                    constraints:
-                    -   valid_values:
-                        - pciPolicy
-            identity:
-                type: string
-                required: true
-            resources:
-                type: list
-                required: true
-                entry_schema:
-                    type: string
             pciProperties:
                 type: list
                 required: false
                 entry_schema:
                   type: policy.data.pciProperties_properties
 data_types:
-  -
     policy.data.pciProperties_properties:
         derived_from: tosca.nodes.Root
         properties:
index 7c54a8d..7f85c77 100644 (file)
@@ -1,39 +1,14 @@
 tosca_definitions_version: tosca_simple_yaml_1_0_0
 policy_types:
-    - onap.policies.Optimization:
-        derived_from: tosca.policies.Root
-        version: 1.0.0
-        description: a base policy type for all policies that govern optimization
-    - onap.policies.optimization.QueryPolicy:
+    onap.policies.optimization.QueryPolicy:
         derived_from: onap.policies.Optimization
         properties:
-            policyScope:
-                type: list
-                description: scope where the policy is applicable
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-            policyType:
-                type: list
-                description: type of a policy
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-                    constraints:
-                    -   valid_values:
-                        - request_param_query
-            identity:
-                type: string
-                required: true
             queryProperties:
                 type: list
                 required: true
                 entry_schema:
                     type: policy.data.queryProperties_properties
 data_types:
-  -
     policy.data.queryProperties_properties:
         derived_from: tosca.nodes.Root
         properties:
index 294dcdf..6b24fbc 100644 (file)
@@ -1,38 +1,13 @@
 tosca_definitions_version: tosca_simple_yaml_1_0_0
 policy_types:
-    - onap.policies.Optimization:
-        derived_from: tosca.policies.Root
-        version: 1.0.0
-        description: a base policy type for all policies that govern optimization
-    - onap.policies.optimization.SubscriberPolicy:
+    onap.policies.optimization.SubscriberPolicy:
         derived_from: onap.policies.Optimization
         properties:
-            policyScope:
-                type: list
-                description: scope where the policy is applicable
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-            policyType:
-                type: list
-                description: type of a policy
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-                    constraints:
-                    -   valid_values:
-                        - subscriberPolicy
-            identity:
-                type: string
-                required: true
-            properties:
-                type: policy.data.properties_properties
+            subscriberProperties:
+                type: policy.data.subscriberProperties_properties
                 required: true
 data_types:
-  -
-    policy.data.properties_properties:
+    policy.data.subscriberProperties_properties:
         derived_from: tosca.nodes.Root
         properties:
             subscriberName:
index e4dc500..2d35741 100644 (file)
@@ -1,32 +1,8 @@
 tosca_definitions_version: tosca_simple_yaml_1_0_0
 policy_types:
-    - onap.policies.Optimization:
-        derived_from: tosca.policies.Root
-        version: 1.0.0
-        description: a base policy type for all policies that govern optimization
-    - onap.policies.optimization.Vim_fit:
+    onap.policies.optimization.Vim_fit:
         derived_from: onap.policies.Optimization
         properties:
-            policyScope:
-                type: list
-                description: scope where the policy is applicable
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-            policyType:
-                type: list
-                description: type of a policy
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-                    constraints:
-                    -   valid_values:
-                        - vim_fit
-            identity:
-                type: string
-                required: true
             applicableResources:
                 type: list
                 required: true
@@ -36,16 +12,10 @@ policy_types:
                     -   valid_values:
                         - any
                         - all
-            resources:
-                type: list
-                required: true
-                entry_schema:
-                    type: string
-            capacityProperties:
+           capacityProperties:
                 type: policy.data.capacityProperties_properties
                 required: true
 data_types:
-  -
     policy.data.capacityProperties_properties:
         derived_from: tosca.nodes.Root
         properties:
index 009df41..3ee6248 100644 (file)
@@ -1,37 +1,8 @@
 tosca_definitions_version: tosca_simple_yaml_1_0_0
 policy_types:
-    - onap.policies.Optimization:
-        derived_from: tosca.policies.Root
-        version: 1.0.0
-        description: a base policy type for all policies that govern optimization
-    - onap.policies.optimization.VnfPolicy:
+    onap.policies.optimization.VnfPolicy:
         derived_from: onap.policies.Optimization
         properties:
-            policyScope:
-                type: list
-                description: scope where the policy is applicable
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-            policyType:
-                type: list
-                description: type of a policy
-                required: true
-                matchable: true
-                entry_schema:
-                    type: string
-                    constraints:
-                    -   valid_values:
-                        - vnfPolicy
-            identity:
-                type: string
-                required: true
-            resources:
-                type: list
-                required: true
-                entry_schema:
-                    type: string
             applicableResources:
                 type: list
                 required: true
@@ -47,7 +18,6 @@ policy_types:
                 entry_schema:
                     type: policy.data.vnfProperties_properties
 data_types:
-  -
     policy.data.vnfProperties_properties:
         derived_from: tosca.nodes.Root
         properties: