diff options
author | liamfallon <liam.fallon@est.tech> | 2019-09-05 21:10:46 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-09-05 21:10:46 +0000 |
commit | b0e460abe43d40528da4856f2f3d5ee162ac1830 (patch) | |
tree | 6cbacdbe977abab77e2b65d9e62d650d1433c21e | |
parent | ff4c8525a70ef5b514d803b5093b91e45564f973 (diff) |
Repair policy types in TOSCA service template
Changed policy types from a list of maps to a map.
Changed data types from a list of maps to a map.
Made all knock on changes to adapters and tests.
Updated Issue ID.
Added
onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml
policy type that is required to be preloaded in policy-api.
Issue-ID: POLICY-2047
Change-Id: Ic8e809eab248fd7242f0e565fa2e3da75bcfbdeb
Signed-off-by: liamfallon <liam.fallon@est.tech>
26 files changed, 1095 insertions, 1200 deletions
diff --git a/models-examples/src/main/resources/policies/onap.policies.controlloop.guard.MinMax.yaml b/models-examples/src/main/resources/policies/onap.policies.controlloop.guard.MinMax.yaml new file mode 100644 index 000000000..0fc677d9c --- /dev/null +++ b/models-examples/src/main/resources/policies/onap.policies.controlloop.guard.MinMax.yaml @@ -0,0 +1,43 @@ +policy_types: + onap.policies.controlloop.Guard: + derived_from: tosca.policies.Root + version: 1.0.0 + description: Guard Policies for Control Loop Operational Policies + onap.policies.controlloop.guard.MinMax: + derived_from: onap.policies.controlloop.Guard + version: 1.0.0 + description: Supports Min/Max number of VF Modules + properties: + minmax_policy: + type: map + description: null + entry_schema: + type: onap.datatypes.guard.MinMax +data_types: + onap.datatypes.guard.MinMax: + derived_from: tosca.datatypes.Root + properties: + actor: + type: string + description: Specifies the Actor + required: true + recipe: + type: string + description: Specified the Recipe + required: true + time_range: + type: tosca.datatypes.TimeInterval + description: An optional range of time during the day the Min/Max limit is valid for. + required: false + controlLoopName: + type: string + description: An optional specific control loop to apply this guard to. + required: false + min_vf_module_instances: + type: integer + required: true + description: The minimum instances of this VF-Module + max_vf_module_instances: + type: integer + required: false + description: The maximum instances of this VF-Module diff --git a/models-examples/src/main/resources/policytypes/onap.policies.Optimization.yaml b/models-examples/src/main/resources/policytypes/onap.policies.Optimization.yaml new file mode 100644 index 000000000..49470ba3b --- /dev/null +++ b/models-examples/src/main/resources/policytypes/onap.policies.Optimization.yaml @@ -0,0 +1,41 @@ +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: list + 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
\ No newline at end of file diff --git a/models-examples/src/main/resources/policytypes/onap.policies.controlloop.Operational.yaml b/models-examples/src/main/resources/policytypes/onap.policies.controlloop.Operational.yaml index e18c16a6d..f21fd5afb 100644 --- a/models-examples/src/main/resources/policytypes/onap.policies.controlloop.Operational.yaml +++ b/models-examples/src/main/resources/policytypes/onap.policies.controlloop.Operational.yaml @@ -1,6 +1,6 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 policy_types: - - onap.policies.controlloop.Operational: + onap.policies.controlloop.Operational: derived_from: tosca.policies.Root version: 1.0.0 description: Operational Policy for Control Loops
\ No newline at end of file diff --git a/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.Blacklist.yaml b/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.Blacklist.yaml index e09861428..91a825212 100644 --- a/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.Blacklist.yaml +++ b/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.Blacklist.yaml @@ -1,40 +1,40 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 policy_types: - - onap.policies.controlloop.Guard: - derived_from: tosca.policies.Root - version: 1.0.0 - description: Guard Policies for Control Loop Operational Policies - - onap.policies.controlloop.guard.Blacklist: - derived_from: onap.policies.controlloop.Guard - version: 1.0.0 - description: Supports blacklist of VNF's from performing control loop actions on. - properties: - blacklist_policy: - type: map - description: - entry_schema: - type: onap.datatypes.guard.Blacklist + onap.policies.controlloop.Guard: + derived_from: tosca.policies.Root + version: 1.0.0 + description: Guard Policies for Control Loop Operational Policies + onap.policies.controlloop.guard.Blacklist: + derived_from: onap.policies.controlloop.Guard + version: 1.0.0 + description: Supports blacklist of VNF's from performing control loop actions on. + properties: + blacklist_policy: + type: map + description: null + entry_schema: + type: onap.datatypes.guard.Blacklist data_types: - - onap.datatypes.guard.Blacklist: + onap.datatypes.guard.Blacklist: derived_from: tosca.datatypes.Root properties: - actor: - type: string - description: Specifies the Actor - required: true - recipe: - type: string - description: Specified the Recipe - required: true - time_range: - type: tosca.datatypes.TimeInterval - description: An optional range of time during the day the blacklist is valid for. - required: false - controlLoopName: - type: string - description: An optional specific control loop to apply this guard to. - required: false - blacklist: - type: list - description: List of VNF's - required: true
\ No newline at end of file + actor: + type: string + description: Specifies the Actor + required: true + recipe: + type: string + description: Specified the Recipe + required: true + time_range: + type: tosca.datatypes.TimeInterval + description: An optional range of time during the day the blacklist is valid for. + required: false + controlLoopName: + type: string + description: An optional specific control loop to apply this guard to. + required: false + blacklist: + type: list + description: List of VNF's + required: true
\ No newline at end of file diff --git a/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml b/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml index 2a7b6247f..45e5471fc 100644 --- a/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml +++ b/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml @@ -1,50 +1,50 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 policy_types: - - onap.policies.controlloop.Guard: + onap.policies.controlloop.Guard: derived_from: tosca.policies.Root version: 1.0.0 description: Guard Policies for Control Loop Operational Policies - - onap.policies.controlloop.guard.FrequencyLimiter: + onap.policies.controlloop.guard.FrequencyLimiter: derived_from: onap.policies.controlloop.Guard version: 1.0.0 description: Supports limiting the frequency of actions being taken by a Actor. properties: - frequency_policy: - type: map - description: - entry_schema: - type: onap.datatypes.guard.FrequencyLimiter + frequency_policy: + type: map + description: null + entry_schema: + type: onap.datatypes.guard.FrequencyLimiter data_types: - - onap.datatypes.guard.FrequencyLimiter: + onap.datatypes.guard.FrequencyLimiter: derived_from: tosca.datatypes.Root properties: - actor: - type: string - description: Specifies the Actor - required: true - recipe: - type: string - description: Specified the Recipe - required: true - time_window: - type: scalar-unit.time - description: The time window to count the actions against. - required: true - limit: - type: integer - description: The limit - required: true - constraints: - - greater_than: 0 - time_range: - type: tosca.datatypes.TimeInterval - description: An optional range of time during the day the frequency is valid for. - required: false - controlLoopName: - type: string - description: An optional specific control loop to apply this guard to. - required: false - target: - type: string - description: An optional specific VNF to apply this guard to. - required: false
\ No newline at end of file + actor: + type: string + description: Specifies the Actor + required: true + recipe: + type: string + description: Specified the Recipe + required: true + time_window: + type: scalar-unit.time + description: The time window to count the actions against. + required: true + limit: + type: integer + description: The limit + required: true + constraints: + - greater_than: 0 + time_range: + type: tosca.datatypes.TimeInterval + description: An optional range of time during the day the frequency is valid for. + required: false + controlLoopName: + type: string + description: An optional specific control loop to apply this guard to. + required: false + target: + type: string + description: An optional specific VNF to apply this guard to. + required: false
\ No newline at end of file diff --git a/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.MinMax.yaml b/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.MinMax.yaml index 0a1aa9b72..54c4204e2 100644 --- a/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.MinMax.yaml +++ b/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.MinMax.yaml @@ -1,44 +1,44 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 policy_types: - - onap.policies.controlloop.Guard: + onap.policies.controlloop.Guard: derived_from: tosca.policies.Root version: 1.0.0 description: Guard Policies for Control Loop Operational Policies - - onap.policies.controlloop.guard.MinMax: + onap.policies.controlloop.guard.MinMax: derived_from: onap.policies.controlloop.Guard version: 1.0.0 description: Supports Min/Max number of VF Modules properties: - minmax_policy: - type: map - description: - entry_schema: - type: onap.datatypes.guard.MinMax + minmax_policy: + type: map + description: null + entry_schema: + type: onap.datatypes.guard.MinMax data_types: - - onap.datatypes.guard.MinMax: + onap.datatypes.guard.MinMax: derived_from: tosca.datatypes.Root properties: - actor: - type: string - description: Specifies the Actor - required: true - recipe: - type: string - description: Specified the Recipe - required: true - time_range: - type: tosca.datatypes.TimeInterval - description: An optional range of time during the day the Min/Max limit is valid for. - required: false - controlLoopName: - type: string - description: An optional specific control loop to apply this guard to. - required: false - min_vf_module_instances: - type: integer - required: true - description: The minimum instances of this VF-Module - - max_vf_module_instances: - type: integer - required: false - description: The maximum instances of this VF-Module
\ No newline at end of file + actor: + type: string + description: Specifies the Actor + required: true + recipe: + type: string + description: Specified the Recipe + required: true + time_range: + type: tosca.datatypes.TimeInterval + description: An optional range of time during the day the Min/Max limit is valid for. + required: false + controlLoopName: + type: string + description: An optional specific control loop to apply this guard to. + required: false + min_vf_module_instances: + type: integer + required: true + description: The minimum instances of this VF-Module + max_vf_module_instances: + type: integer + required: false + description: The maximum instances of this VF-Module
\ No newline at end of file diff --git a/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml b/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml new file mode 100644 index 000000000..35a515611 --- /dev/null +++ b/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml @@ -0,0 +1,23 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +policy_types: + onap.policies.controlloop.Guard: + derived_from: tosca.policies.Root + version: 1.0.0 + description: Guard Policies for Control Loop Operational Policies + onap.policies.controlloop.guard.Coordination: + derived_from: onap.policies.controlloop.Guard + version: 1.0.0 + description: Guard Policies for Control Loop Coordination + onap.policies.controlloop.guard.coordination.FirstBlocksSecond: + derived_from: onap.policies.controlloop.guard.Coordination + version: 1.0.0 + description: Supports one Control Loop blocking another + properties: + controlLoop: + type: list + description: Specific Control Loops to which to apply this guard + required: true + constraint: + length: 2 + entry_schema: + type: string
\ No newline at end of file diff --git a/models-examples/src/main/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml b/models-examples/src/main/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml index 2985603af..2f5abdde3 100644 --- a/models-examples/src/main/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml +++ b/models-examples/src/main/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml @@ -1,163 +1,158 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 policy_types: - - - onap.policies.Monitoring: - derived_from: tosca.policies.Root - description: a base policy type for all policies that governs monitoring provisioning - - - onap.policies.monitoring.cdap.tca.hi.lo.app: - derived_from: onap.policies.Monitoring - version: 1.0.0 - properties: - tca_policy: - type: map - description: TCA Policy JSON - entry_schema: - type: onap.datatypes.monitoring.tca_policy + onap.policies.Monitoring: + derived_from: tosca.policies.Root + description: a base policy type for all policies that governs monitoring provisioning + onap.policies.monitoring.cdap.tca.hi.lo.app: + derived_from: onap.policies.Monitoring + version: 1.0.0 + properties: + tca_policy: + type: map + description: TCA Policy JSON + entry_schema: + type: onap.datatypes.monitoring.tca_policy data_types: - - - onap.datatypes.monitoring.metricsPerEventName: - derived_from: tosca.datatypes.Root - properties: - controlLoopSchemaType: - type: string - required: true - description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM - constraints: - - valid_values: - - VM - - VNF - eventName: - type: string - required: true - description: Event name to which thresholds need to be applied - policyName: - type: string - required: true - description: TCA Policy Scope Name - policyScope: - type: string - required: true - description: TCA Policy Scope - policyVersion: - type: string - required: true - description: TCA Policy Scope Version - thresholds: - type: list - required: true - description: Thresholds associated with eventName - entry_schema: - type: onap.datatypes.monitoring.thresholds - - - onap.datatypes.monitoring.tca_policy: - derived_from: tosca.datatypes.Root - properties: - domain: - type: string - required: true - description: Domain name to which TCA needs to be applied - default: measurementsForVfScaling - constraints: - - equal: measurementsForVfScaling - metricsPerEventName: - type: list - required: true - description: Contains eventName and threshold details that need to be applied to given eventName - entry_schema: - type: onap.datatypes.monitoring.metricsPerEventName - - - onap.datatypes.monitoring.thresholds: - derived_from: tosca.datatypes.Root - properties: - closedLoopControlName: - type: string - required: true - description: Closed Loop Control Name associated with the threshold - closedLoopEventStatus: - type: string - required: true - description: Closed Loop Event Status of the threshold - constraints: - - valid_values: - - ONSET - - ABATED - direction: - type: string - required: true - description: Direction of the threshold - constraints: - - valid_values: - - LESS - - LESS_OR_EQUAL - - GREATER - - GREATER_OR_EQUAL - - EQUAL - fieldPath: - type: string - required: true - description: Json field Path as per CEF message which needs to be analyzed for TCA - constraints: - - valid_values: - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage - - $.event.measurementsForVfScalingFields.meanRequestLatency - - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered - - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached - - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured - - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree - - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed - - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value - severity: - type: string - required: true - description: Threshold Event Severity - constraints: - - valid_values: - - CRITICAL - - MAJOR - - MINOR - - WARNING - - NORMAL - thresholdValue: - type: integer - required: true - description: Threshold value for the field Path inside CEF message - version: - type: string - required: true - description: Version number associated with the threshold
\ No newline at end of file + onap.datatypes.monitoring.metricsPerEventName: + derived_from: tosca.datatypes.Root + properties: + controlLoopSchemaType: + type: string + required: true + description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM + constraints: + - valid_values: + - VM + - VNF + eventName: + type: string + required: true + description: Event name to which thresholds need to be applied + policyName: + type: string + required: true + description: TCA Policy Scope Name + policyScope: + type: string + required: true + description: TCA Policy Scope + policyVersion: + type: string + required: true + description: TCA Policy Scope Version + thresholds: + type: list + required: true + description: Thresholds associated with eventName + entry_schema: + type: onap.datatypes.monitoring.thresholds + onap.datatypes.monitoring.tca_policy: + derived_from: tosca.datatypes.Root + properties: + domain: + type: string + required: true + description: Domain name to which TCA needs to be applied + default: measurementsForVfScaling + constraints: + - equal: measurementsForVfScaling + metricsPerEventName: + type: list + required: true + description: Contains eventName and threshold details that need to be applied to given eventName + entry_schema: + type: onap.datatypes.monitoring.metricsPerEventName + onap.datatypes.monitoring.thresholds: + derived_from: tosca.datatypes.Root + properties: + closedLoopControlName: + type: string + required: true + description: Closed Loop Control Name associated with the threshold + closedLoopEventStatus: + type: string + required: true + description: Closed Loop Event Status of the threshold + constraints: + - valid_values: + - ONSET + - ABATED + direction: + type: string + required: true + description: Direction of the threshold + constraints: + - valid_values: + - LESS + - LESS_OR_EQUAL + - GREATER + - GREATER_OR_EQUAL + - EQUAL + fieldPath: + type: string + required: true + description: Json field Path as per CEF message which needs to be analyzed for TCA + constraints: + - valid_values: + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated + - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait + - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage + - $.event.measurementsForVfScalingFields.meanRequestLatency + - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered + - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached + - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured + - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree + - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed + - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value + severity: + type: string + required: true + description: Threshold Event Severity + constraints: + - valid_values: + - CRITICAL + - MAJOR + - MINOR + - WARNING + - NORMAL + thresholdValue: + type: integer + required: true + description: Threshold value for the field Path inside CEF message + version: + type: string + required: true + description: Version number associated with the threshold
\ No newline at end of file diff --git a/models-examples/src/main/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml b/models-examples/src/main/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml index 63796fa3f..cf70e9bb2 100644 --- a/models-examples/src/main/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml +++ b/models-examples/src/main/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml @@ -1,18 +1,16 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 policy_types: - - - onap.policies.Monitoring: - derived_from: tosca.policies.Root - description: a base policy type for all policies that govern monitoring provision - version: 1.0.0 - - - onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server: - derived_from: policy.nodes.Root - version: 1.0.0 - properties: - buscontroller_feed_publishing_endpoint: - type: string - description: DMAAP Bus Controller feed endpoint - datafile.policy: - type: string - description: datafile Policy JSON as string
\ No newline at end of file + onap.policies.Monitoring: + derived_from: tosca.policies.Root + description: a base policy type for all policies that govern monitoring provision + version: 1.0.0 + onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server: + derived_from: policy.nodes.Root + version: 1.0.0 + properties: + buscontroller_feed_publishing_endpoint: + type: string + description: DMAAP Bus Controller feed endpoint + datafile.policy: + type: string + description: datafile Policy JSON as string
\ No newline at end of file diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml index 1dcc5af86..ce2538c66 100644 --- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml +++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml @@ -1,63 +1,30 @@ 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: - 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 - consraints: - - valid_values: - - zone - identity: - type: string - required: true - applicableResources: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - any - - all - affinityProperties: - type: policy.data.affinityProperties_properties - required: true - resources: - type: list - required: true - entry_schema: - type: string + onap.policies.optimization.AffinityPolicy: + derived_from: onap.policies.Optimization + properties: + applicableResources: + type: list + required: true + entry_schema: + type: string + constraints: + - valid_values: + - any + - all + affinityProperties: + type: policy.data.affinityProperties_properties + required: true 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 - category: - type: string - required: true + policy.data.affinityProperties_properties: + derived_from: tosca.nodes.Root + properties: + qualifier: + type: string + constraints: + - valid_values: + - same + - different + category: + type: string + required: true
\ No newline at end of file diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml index 458d152e0..4137fc7eb 100644 --- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml +++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml @@ -1,83 +1,55 @@ 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: - 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 - consraints: - - valid_values: - - distance_to_location - identity: - type: string - required: true - resources: - type: list - required: true - entry_schema: - type: string - applicableResources: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - any - - all - distanceProperties: - type: policy.data.distanceProperties_properties - required: true + onap.policies.optimization.DistancePolicy: + derived_from: onap.policies.Optimization + properties: + applicableResources: + type: list + required: true + entry_schema: + type: string + constraints: + - valid_values: + - any + - all + distanceProperties: + type: policy.data.distanceProperties_properties + required: true data_types: - - - policy.data.distanceProperties_properties: - derived_from: tosca.nodes.Root - properties: - locationInfo: - type: string - required: true - distance: - type: policy.data.distance_properties - required: true - policy.data.distance_properties: - derived_from: tosca.nodes.Root - properties: - value: - type: string - required: true - operator: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - < - - <= - - '>' - - '>=' - - '=' - unit: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - km + policy.data.distanceProperties_properties: + derived_from: tosca.nodes.Root + properties: + locationInfo: + type: string + required: true + 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: + value: + type: string + required: true + operator: + type: list + required: true + entry_schema: + type: string + constraints: + - valid_values: + - < + - <= + - '>' + - '>=' + - = + unit: + type: list + required: true + entry_schema: + type: string + constraints: + - valid_values: + - km
\ No newline at end of file diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml index be4110517..62bc4afca 100644 --- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml +++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml @@ -1,136 +1,102 @@ 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: - 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 - consraints: - - 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 + onap.policies.optimization.HpaPolicy: + derived_from: onap.policies.Optimization + properties: + flavorFeatures: + type: list + required: true + entry_schema: + type: policy.data.flavorFeatures_properties data_types: - - - policy.data.flavorFeatures_properties: - derived_from: tosca.nodes.Root - properties: - id: - type: string - required: true - type: - type: string - required: true - directives: - type: list - required: true - entry_schema: - type: policy.data.directives_properties - flavorProperties: - type: list - required: true - entry_schema: - type: policy.data.flavorProperties_properties - - - policy.data.directives_properties: - derived_from: tosca.nodes.Root - properties: - type: - type: string - attributes: - type: list - entry_schema: - type: policy.data.directives_attributes_properties - - - policy.data.directives_attributes_properties: - derived_from: tosca.nodes.Root - properties: - attribute_name: - type: string - attribute_value: - type: string - - - policy.data.flavorProperties_properties: - derived_from: tosca.nodes.Root - properties: - hpa-feature: - type: string - required: true - mandatory: - type: string - required: true - score: - type: string - required: false - architecture: - type: string - required: true - hpa-version: - type: string - required: true - directives: - type: list - required: true - entry_schema: - type: policy.data.directives_properties - hpa-feature-attributes: - type: list - required: true - entry_schema: - type: policy.data.hpa-feature-attributes_properties - - - policy.data.hpa-feature-attributes_properties: - derived_from: tosca.nodes.Root - properties: - hpa-attribute-key: - type: string - required: true - hpa-attribute-value: - type: string - required: true - operator: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - < - - <= - - '>' - - '>=' - - '=' - - '!=' - - any - - all - - subset - unit: - type: string - required: false + policy.data.flavorFeatures_properties: + derived_from: tosca.nodes.Root + properties: + id: + type: string + required: true + type: + type: string + required: true + directives: + type: list + required: true + entry_schema: + type: policy.data.directives_properties + flavorProperties: + type: list + required: true + entry_schema: + type: policy.data.flavorProperties_properties + policy.data.directives_properties: + derived_from: tosca.nodes.Root + properties: + type: + type: string + attributes: + type: list + entry_schema: + type: policy.data.directives_attributes_properties + policy.data.directives_attributes_properties: + derived_from: tosca.nodes.Root + properties: + attribute_name: + type: string + attribute_value: + type: string + policy.data.flavorProperties_properties: + derived_from: tosca.nodes.Root + properties: + hpa-feature: + type: string + required: true + mandatory: + type: string + required: true + score: + type: string + required: false + architecture: + type: string + required: true + hpa-version: + type: string + required: true + directives: + type: list + required: true + entry_schema: + type: policy.data.directives_properties + hpa-feature-attributes: + type: list + required: true + entry_schema: + type: policy.data.hpa-feature-attributes_properties + policy.data.hpa-feature-attributes_properties: + derived_from: tosca.nodes.Root + properties: + hpa-attribute-key: + type: string + required: true + hpa-attribute-value: + type: string + required: true + operator: + type: list + required: true + entry_schema: + type: string + constraints: + - valid_values: + - < + - <= + - '>' + - '>=' + - = + - '!=' + - any + - all + - subset + unit: + type: string + required: false
\ No newline at end of file diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml index 267109861..f8652dda5 100644 --- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml +++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml @@ -1,90 +1,65 @@ 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: - 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 - consraints: - - valid_values: - - placement_optimization - identity: - type: string - required: true - objective: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - minimize - - maximize - objectiveParameter: - type: policy.data.objectiveParameter_properties - required: true + onap.policies.optimization.OptimizationPolicy: + derived_from: onap.policies.Optimization + properties: + objective: + type: list + required: true + entry_schema: + type: string + constraints: + - valid_values: + - minimize + - maximize + objectiveParameter: + type: policy.data.objectiveParameter_properties + required: true data_types: - - - policy.data.objectiveParameter_properties: - derived_from: tosca.nodes.Root - properties: - parameterAttributes: - type: list - required: true - entry_schema: - type: policy.data.parameterAttributes_properties - operator: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - '*' - - + - - '-' - - / - - '%' - policy.data.parameterAttributes_properties: - derived_from: tosca.nodes.Root - properties: - resources: - type: string - required: true - customerLocationInfo: - type: string - required: true - parameter: - type: string - required: true - weight: - type: string - required: true - operator: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - '*' - - + - - '-' - - / - - '%' + policy.data.objectiveParameter_properties: + derived_from: tosca.nodes.Root + properties: + parameterAttributes: + type: list + required: true + entry_schema: + type: policy.data.parameterAttributes_properties + operator: + type: list + required: true + entry_schema: + type: string + constraints: + - valid_values: + - '*' + - + + - '-' + - / + - '%' + policy.data.parameterAttributes_properties: + derived_from: tosca.nodes.Root + properties: + resources: + type: string + required: true + customerLocationInfo: + type: string + required: true + parameter: + type: string + required: true + weight: + type: string + required: true + operator: + type: list + required: true + entry_schema: + type: string + constraints: + - valid_values: + - '*' + - + + - '-' + - / + - '%'
\ No newline at end of file diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.PciPolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.PciPolicy.yaml index ba4dbec37..5efb8f218 100644 --- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.PciPolicy.yaml +++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.PciPolicy.yaml @@ -1,59 +1,29 @@ 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: - 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 - consraints: - - 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 + onap.policies.optimization.PciPolicy: + derived_from: onap.policies.Optimization + properties: + pciProperties: + type: list + required: false + entry_schema: + type: policy.data.pciProperties_properties data_types: - - - policy.data.pciProperties_properties: - derived_from: tosca.nodes.Root - properties: - algoCategory: - type: string - required: false - pciOptmizationAlgoName: - type: string - required: false - pciOptimizationNwConstraint: - type: string - required: false - pciOptimizationPriority: - type: string - required: false - pciOptimizationTimeConstraint: - type: string - required: false + policy.data.pciProperties_properties: + derived_from: tosca.nodes.Root + properties: + algoCategory: + type: string + required: false + pciOptmizationAlgoName: + type: string + required: false + pciOptimizationNwConstraint: + type: string + required: false + pciOptimizationPriority: + type: string + required: false + pciOptimizationTimeConstraint: + type: string + required: false
\ No newline at end of file diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml index 82cd60a46..778d24b37 100644 --- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml +++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml @@ -1,48 +1,23 @@ 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: - 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 - consraints: - - valid_values: - - request_param_query - identity: - type: string - required: true - queryProperties: - type: list - required: true - entry_schema: - type: policy.data.queryProperties_properties + onap.policies.optimization.QueryPolicy: + derived_from: onap.policies.Optimization + properties: + queryProperties: + type: list + required: true + entry_schema: + type: policy.data.queryProperties_properties data_types: - - - policy.data.queryProperties_properties: - derived_from: tosca.nodes.Root - properties: - attribute: - type: string - required: true - value: - type: string - required: true - attribute_location: - type: string - required: true + policy.data.queryProperties_properties: + derived_from: tosca.nodes.Root + properties: + attribute: + type: string + required: true + value: + type: string + required: true + attribute_location: + type: string + required: true
\ No newline at end of file diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml index ab006fa57..e821aae83 100644 --- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml +++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml @@ -1,52 +1,27 @@ 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: - 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 - consraints: - - valid_values: - - subscriberPolicy - identity: - type: string - required: true - properties: - type: policy.data.properties_properties - required: true + onap.policies.optimization.SubscriberPolicy: + derived_from: onap.policies.Optimization + properties: + subscriberProperties: + type: policy.data.subscriberProperties_properties + required: true data_types: - - - policy.data.properties_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 + 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 diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.Vim_fit.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.Vim_fit.yaml index 9c12f7d63..d2b4ef6a6 100644 --- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.Vim_fit.yaml +++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.Vim_fit.yaml @@ -1,57 +1,27 @@ 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: - 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 - consraints: - - valid_values: - - vim_fit - identity: - type: string - required: true - applicableResources: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - any - - all - resources: - type: list - required: true - entry_schema: - type: string - capacityProperties: - type: policy.data.capacityProperties_properties - required: true + onap.policies.optimization.Vim_fit: + derived_from: onap.policies.Optimization + properties: + applicableResources: + type: list + required: true + entry_schema: + type: string + constraints: + - valid_values: + - any + - all + capacityProperties: + type: policy.data.capacityProperties_properties + required: true data_types: - - - policy.data.capacityProperties_properties: - derived_from: tosca.nodes.Root - properties: - controller: - type: string - required: true - request: - type: string - required: true + policy.data.capacityProperties_properties: + derived_from: tosca.nodes.Root + properties: + controller: + type: string + required: true + request: + type: string + required: true
\ No newline at end of file diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml index 4bfc24216..f825f449d 100644 --- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml +++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml @@ -1,74 +1,43 @@ 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: - 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 - consraints: - - valid_values: - - vnfPolicy - identity: - type: string - required: true - resources: - type: list - required: true - entry_schema: - type: string - applicableResources: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - any - - all - vnfProperties: - type: list - required: true - entry_schema: - type: policy.data.vnfProperties_properties + onap.policies.optimization.VnfPolicy: + derived_from: onap.policies.Optimization + properties: + applicableResources: + type: list + required: true + entry_schema: + type: string + constraints: + - valid_values: + - any + - all + vnfProperties: + type: list + required: true + entry_schema: + type: policy.data.vnfProperties_properties data_types: - - - policy.data.vnfProperties_properties: - derived_from: tosca.nodes.Root - properties: - inventoryProvider: - type: string - required: true - serviceType: - type: string - required: true - inventoryType: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - serviceInstanceId - - vnfName - - cloudRegionId - - vimId - customerId: - type: string - required: true - + policy.data.vnfProperties_properties: + derived_from: tosca.nodes.Root + properties: + inventoryProvider: + type: string + required: true + serviceType: + type: string + required: true + inventoryType: + type: list + required: true + entry_schema: + type: string + constraints: + - valid_values: + - serviceInstanceId + - vnfName + - cloudRegionId + - vimId + customerId: + type: string + required: true
\ No newline at end of file diff --git a/models-provider/src/main/resources/dummyimpl/DummyToscaPolicyTypeGetResponse.json b/models-provider/src/main/resources/dummyimpl/DummyToscaPolicyTypeGetResponse.json index c28c2d2f2..477d4477a 100644 --- a/models-provider/src/main/resources/dummyimpl/DummyToscaPolicyTypeGetResponse.json +++ b/models-provider/src/main/resources/dummyimpl/DummyToscaPolicyTypeGetResponse.json @@ -1,223 +1,213 @@ { - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.Monitoring": { - "derived_from": "tosca.policies.Root", - "description": "a base policy type for all policies that governs monitoring provisioning" - } - }, - { - "onap.policy.monitoring.cdap.tca.hi.lo.app": { - "derived_from": "onap.policies.Monitoring", - "version": "1.0.0", - "properties": { - "tca_policy": { - "type": "map", - "description": "TCA Policy JSON", - "entry_schema": { - "type": "onap.datatypes.monitoring.tca_policy" - } - } - } - } + "tosca_definitions_version": "tosca_simple_yaml_1_0_0", + "policy_types": { + "onap.policies.Monitoring": { + "derived_from": "tosca.policies.Root", + "description": "a base policy type for all policies that governs monitoring provisioning" + }, + "onap.policy.monitoring.cdap.tca.hi.lo.app": { + "derived_from": "onap.policies.Monitoring", + "version": "1.0.0", + "properties": { + "tca_policy": { + "type": "map", + "description": "TCA Policy JSON", + "entry_schema": { + "type": "onap.datatypes.monitoring.tca_policy" + } + } } - ], - "data_types": [ - { - "onap.datatypes.monitoring.metricsPerEventName": { - "derived_from": "tosca.datatypes.Root", - "properties": { - "controlLoopSchemaType": { - "type": "string", - "required": true, - "description": "Specifies Control Loop Schema Type for the event Name e.g. VNF, VM", - "constraints": [ - { - "valid_values": [ - "VM", - "VNF" - ] - } - ] - }, - "eventName": { - "type": "string", - "required": true, - "description": "Event name to which thresholds need to be applied" - }, - "policyName": { - "type": "string", - "required": true, - "description": "TCA Policy Scope Name" - }, - "policyScope": { - "type": "string", - "required": true, - "description": "TCA Policy Scope" - }, - "policyVersion": { - "type": "string", - "required": true, - "description": "TCA Policy Scope Version" - }, - "thresholds": { - "type": "list", - "required": true, - "description": "Thresholds associated with eventName", - "entry_schema": { - "type": "onap.datatypes.monitoring.thresholds" - } - } + } + }, + "data_types": { + "onap.datatypes.monitoring.metricsPerEventName": { + "derived_from": "tosca.datatypes.Root", + "properties": { + "controlLoopSchemaType": { + "type": "string", + "required": true, + "description": "Specifies Control Loop Schema Type for the event Name e.g. VNF, VM", + "constraints": [ + { + "valid_values": [ + "VM", + "VNF" + ] } - } + ] + }, + "eventName": { + "type": "string", + "required": true, + "description": "Event name to which thresholds need to be applied" + }, + "policyName": { + "type": "string", + "required": true, + "description": "TCA Policy Scope Name" + }, + "policyScope": { + "type": "string", + "required": true, + "description": "TCA Policy Scope" + }, + "policyVersion": { + "type": "string", + "required": true, + "description": "TCA Policy Scope Version" + }, + "thresholds": { + "type": "list", + "required": true, + "description": "Thresholds associated with eventName", + "entry_schema": { + "type": "onap.datatypes.monitoring.thresholds" + } + } + } + } + }, + "onap.datatypes.monitoring.tca_policy": { + "derived_from": "tosca.datatypes.Root", + "properties": { + "domain": { + "type": "string", + "required": true, + "description": "Domain name to which TCA needs to be applied", + "default": "measurementsForVfScaling", + "constraints": [ + { + "equal": "measurementsForVfScaling" + } + ] }, - { - "onap.datatypes.monitoring.tca_policy": { - "derived_from": "tosca.datatypes.Root", - "properties": { - "domain": { - "type": "string", - "required": true, - "description": "Domain name to which TCA needs to be applied", - "default": "measurementsForVfScaling", - "constraints": [ - { - "equal": "measurementsForVfScaling" - } - ] - }, - "metricsPerEventName": { - "type": "list", - "required": true, - "description": "Contains eventName and threshold details that need to be applied to given eventName", - "entry_schema": { - "type": "onap.datatypes.monitoring.metricsPerEventName" - } - } - } - } + "metricsPerEventName": { + "type": "list", + "required": true, + "description": "Contains eventName and threshold details that need to be applied to given eventName", + "entry_schema": { + "type": "onap.datatypes.monitoring.metricsPerEventName" + } + } + } + }, + "onap.datatypes.monitoring.thresholds": { + "derived_from": "tosca.datatypes.Root", + "properties": { + "closedLoopControlName": { + "type": "string", + "required": true, + "description": "Closed Loop Control Name associated with the threshold" }, - { - "onap.datatypes.monitoring.thresholds": { - "derived_from": "tosca.datatypes.Root", - "properties": { - "closedLoopControlName": { - "type": "string", - "required": true, - "description": "Closed Loop Control Name associated with the threshold" - }, - "closedLoopEventStatus": { - "type": "string", - "required": true, - "description": "Closed Loop Event Status of the threshold", - "constraints": [ - { - "valid_values": [ - "ONSET", - "ABATED" - ] - } - ] - }, - "direction": { - "type": "string", - "required": true, - "description": "Direction of the threshold", - "constraints": [ - { - "valid_values": [ - "LESS", - "LESS_OR_EQUAL", - "GREATER", - "GREATER_OR_EQUAL", - "EQUAL" - ] - } - ] - }, - "fieldPath": { - "type": "string", - "required": true, - "description": "Json field Path as per CEF message which needs to be analyzed for TCA", - "constraints": [ - { - "valid_values": [ - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage", - "$.event.measurementsForVfScalingFields.meanRequestLatency", - "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered", - "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached", - "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured", - "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree", - "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed", - "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value" - ] - } - ] - }, - "severity": { - "type": "string", - "required": true, - "description": "Threshold Event Severity", - "constraints": [ - { - "valid_values": [ - "CRITICAL", - "MAJOR", - "MINOR", - "WARNING", - "NORMAL" - ] - } - ] - }, - "thresholdValue": { - "type": "integer", - "required": true, - "description": "Threshold value for the field Path inside CEF message" - }, - "version": { - "type": "string", - "required": true, - "description": "Version number associated with the threshold" - } - } - } + "closedLoopEventStatus": { + "type": "string", + "required": true, + "description": "Closed Loop Event Status of the threshold", + "constraints": [ + { + "valid_values": [ + "ONSET", + "ABATED" + ] + } + ] + }, + "direction": { + "type": "string", + "required": true, + "description": "Direction of the threshold", + "constraints": [ + { + "valid_values": [ + "LESS", + "LESS_OR_EQUAL", + "GREATER", + "GREATER_OR_EQUAL", + "EQUAL" + ] + } + ] + }, + "fieldPath": { + "type": "string", + "required": true, + "description": "Json field Path as per CEF message which needs to be analyzed for TCA", + "constraints": [ + { + "valid_values": [ + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated", + "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait", + "$.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage", + "$.event.measurementsForVfScalingFields.meanRequestLatency", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree", + "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed", + "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value" + ] + } + ] + }, + "severity": { + "type": "string", + "required": true, + "description": "Threshold Event Severity", + "constraints": [ + { + "valid_values": [ + "CRITICAL", + "MAJOR", + "MINOR", + "WARNING", + "NORMAL" + ] + } + ] + }, + "thresholdValue": { + "type": "integer", + "required": true, + "description": "Threshold value for the field Path inside CEF message" + }, + "version": { + "type": "string", + "required": true, + "description": "Version number associated with the threshold" } - ] -}
\ No newline at end of file + } + } +} diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java index 7b7690009..2ccf215c9 100644 --- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java +++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java @@ -22,6 +22,7 @@ package org.onap.policy.models.provider.impl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import com.google.gson.GsonBuilder; @@ -62,16 +63,22 @@ public class PolicyTypePersistenceTest { // @formatter:off private String[] policyTypeResourceNames = { - "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml", - "policytypes/onap.policies.optimization.AffinityPolicy.yaml", + "policytypes/onap.policies.controlloop.Operational.yaml", "policytypes/onap.policies.optimization.DistancePolicy.yaml", - "policytypes/onap.policies.optimization.HpaPolicy.yaml", - "policytypes/onap.policies.optimization.OptimizationPolicy.yaml", + "policytypes/onap.policies.optimization.VnfPolicy.yaml", "policytypes/onap.policies.optimization.PciPolicy.yaml", - "policytypes/onap.policies.optimization.QueryPolicy.yaml", - "policytypes/onap.policies.optimization.SubscriberPolicy.yaml", + "policytypes/onap.policies.optimization.OptimizationPolicy.yaml", + "policytypes/onap.policies.controlloop.guard.Blacklist.yaml", + "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml", + "policytypes/onap.policies.optimization.HpaPolicy.yaml", "policytypes/onap.policies.optimization.Vim_fit.yaml", - "policytypes/onap.policies.optimization.VnfPolicy.yaml", + "policytypes/onap.policies.optimization.SubscriberPolicy.yaml", + "policytypes/onap.policies.optimization.AffinityPolicy.yaml", + "policytypes/onap.policies.optimization.QueryPolicy.yaml", + "policytypes/onap.policies.controlloop.guard.MinMax.yaml", + "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml", + "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml", + "policytypes/onap.policies.Optimization.yaml", "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml" }; // @formatter:on @@ -141,7 +148,7 @@ public class PolicyTypePersistenceTest { ToscaServiceTemplate serviceTemplate = standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); assertNotNull(serviceTemplate); - ToscaPolicyType inPolicyType = serviceTemplate.getPolicyTypes().get(0).values().iterator().next(); + ToscaPolicyType inPolicyType = serviceTemplate.getPolicyTypes().values().iterator().next(); databaseProvider.createPolicyTypes(serviceTemplate); databaseProvider.updatePolicyTypes(serviceTemplate); @@ -162,7 +169,7 @@ public class PolicyTypePersistenceTest { assertEquals(inPolicyType.getName(), policyTypeList.get(0).getName()); policyTypeList = databaseProvider.getFilteredPolicyTypeList(ToscaPolicyTypeFilter.builder().build()); - assertEquals(2, policyTypeList.size()); + assertTrue(policyTypeList.size() <= 3); assertEquals(inPolicyType.getName(), policyTypeList.get(0).getName()); for (ToscaPolicyType policyType: databaseProvider.getPolicyTypeList(null, null)) { diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java index c0f40f159..0a8fa2788 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java @@ -111,4 +111,28 @@ public class ToscaEntity implements PfNameVersion { return entityMap; } + + /** + * Convert a map of TOSCA entities into a regular map. + * + * @param mapOfEntities the incoming list of maps of entities + * @return The entities on a regular map + * @throws PfModelException on duplicate entity entries + */ + public static <T extends ToscaEntity> Map<ToscaEntityKey, T> getEntityMapAsMap(Map<String, T> mapOfEntities) { + // Declare the return map + Map<ToscaEntityKey, T> entityMap = new LinkedHashMap<>(); + + for (T entityEntry : mapOfEntities.values()) { + if (entityMap.containsKey(entityEntry.getKey())) { + throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, + "list of map of entities contains more than one entity with key " + entityEntry.getKey()); + } + + entityMap.put(entityEntry.getKey(), entityEntry); + } + + return entityMap; + } + } diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplate.java index 21b15a8ae..17391964e 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplate.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplate.java @@ -25,7 +25,6 @@ package org.onap.policy.models.tosca.authorative.concepts; import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; -import java.util.List; import java.util.Map; import lombok.Data; import lombok.EqualsAndHashCode; @@ -49,17 +48,17 @@ public class ToscaServiceTemplate extends ToscaEntity { @ApiModelProperty(name = "policy_types") @SerializedName("policy_types") - private List<Map<String, ToscaPolicyType>> policyTypes; + private Map<String, ToscaPolicyType> policyTypes; @ApiModelProperty(name = "data_types") @SerializedName("data_types") - private List<Map<String, ToscaDataType>> dataTypes; + private Map<String, ToscaDataType> dataTypes; public Map<ToscaEntityKey, ToscaPolicyType> getPolicyTypesAsMap() { - return ToscaEntity.getEntityListMapAsMap(policyTypes); + return ToscaEntity.getEntityMapAsMap(policyTypes); } public Map<ToscaEntityKey, ToscaDataType> getDataTypesAsMap() { - return ToscaEntity.getEntityListMapAsMap(dataTypes); + return ToscaEntity.getEntityMapAsMap(dataTypes); } }
\ No newline at end of file diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java index e41281d7f..8c6e492f7 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java @@ -25,6 +25,8 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.TreeMap; + import lombok.NonNull; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfModelException; @@ -83,8 +85,8 @@ public class AuthorativeToscaProvider { LOGGER.debug("->getPolicyTypeList: name={}, version={}", name, version); - List<ToscaPolicyType> policyTypeList = asConceptList( - new SimpleToscaProvider().getPolicyTypes(dao, name, version).toAuthorative().getPolicyTypes()); + List<ToscaPolicyType> policyTypeList = new ArrayList<>( + new SimpleToscaProvider().getPolicyTypes(dao, name, version).toAuthorative().getPolicyTypes().values()); LOGGER.debug("<-getPolicyTypeList: name={}, version={}, policyTypeList={}", name, version, policyTypeList); return policyTypeList; @@ -106,7 +108,7 @@ public class AuthorativeToscaProvider { ToscaServiceTemplate serviceTemplate = new SimpleToscaProvider().getPolicyTypes(dao, null, null).toAuthorative(); - List<ToscaPolicyType> filteredPolicyTypes = asConceptList(serviceTemplate.getPolicyTypes()); + List<ToscaPolicyType> filteredPolicyTypes = new ArrayList<>(serviceTemplate.getPolicyTypes().values()); filteredPolicyTypes = filter.filter(filteredPolicyTypes); serviceTemplate.setPolicyTypes(asConceptMap(filteredPolicyTypes)); @@ -257,7 +259,7 @@ public class AuthorativeToscaProvider { List<ToscaPolicy> filteredPolicies = asConceptList(serviceTemplate.getToscaTopologyTemplate().getPolicies()); filteredPolicies = filter.filter(filteredPolicies); - serviceTemplate.getToscaTopologyTemplate().setPolicies(asConceptMap(filteredPolicies)); + serviceTemplate.getToscaTopologyTemplate().setPolicies(asConceptMapList(filteredPolicies)); LOGGER.debug("<-getFilteredPolicies: filter={}, serviceTemplate={}", filter, serviceTemplate); return serviceTemplate; @@ -368,14 +370,29 @@ public class AuthorativeToscaProvider { * @param conceptList the concept list * @return the list of concept map */ - private <T extends ToscaEntity> List<Map<String, T>> asConceptMap(List<T> conceptList) { + private <T extends ToscaEntity> List<Map<String, T>> asConceptMapList(List<T> conceptList) { List<Map<String, T>> toscaEntityMapList = new ArrayList<>(); for (T concept : conceptList) { - Map<String, T> conceptMap = new LinkedHashMap<>(); + Map<String, T> conceptMap = new TreeMap<>(); conceptMap.put(concept.getName(), concept); toscaEntityMapList.add(conceptMap); } return toscaEntityMapList; } + + /** + * Return the contents of a list of concepts as map of concepts. + * + * @param conceptList the concept list + * @return the list of concept map + */ + private <T extends ToscaEntity> Map<String, T> asConceptMap(List<T> conceptList) { + Map<String, T> conceptMap = new LinkedHashMap<>(); + for (T concept : conceptList) { + conceptMap.put(concept.getName(), concept); + } + + return conceptMap; + } } diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java index 83c9dc0cf..e07894cd8 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java @@ -22,7 +22,12 @@ package org.onap.policy.models.tosca.simple.concepts; import com.google.gson.annotations.SerializedName; + +import java.util.Collections; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; + import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -43,6 +48,8 @@ import org.onap.policy.models.base.PfKey; import org.onap.policy.models.base.PfValidationMessage; import org.onap.policy.models.base.PfValidationResult; import org.onap.policy.models.base.PfValidationResult.ValidationResult; +import org.onap.policy.models.tosca.authorative.concepts.ToscaDataType; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; /** @@ -141,11 +148,19 @@ public class JpaToscaServiceTemplate extends JpaToscaEntityType<ToscaServiceTemp toscaServiceTemplate.setToscaDefinitionsVersion(toscaDefinitionsVersion); if (dataTypes != null) { - toscaServiceTemplate.setDataTypes(dataTypes.toAuthorative()); + toscaServiceTemplate.setDataTypes(new LinkedHashMap<>()); + List<Map<String, ToscaDataType>> dataTypeMapList = dataTypes.toAuthorative(); + for (Map<String, ToscaDataType> dataTypeMap : dataTypeMapList) { + toscaServiceTemplate.getDataTypes().putAll(dataTypeMap); + } } if (policyTypes != null) { - toscaServiceTemplate.setPolicyTypes(policyTypes.toAuthorative()); + toscaServiceTemplate.setPolicyTypes(new LinkedHashMap<>()); + List<Map<String, ToscaPolicyType>> policyTypeMapList = policyTypes.toAuthorative(); + for (Map<String, ToscaPolicyType> policyTypeMap : policyTypeMapList) { + toscaServiceTemplate.getPolicyTypes().putAll(policyTypeMap); + } } if (topologyTemplate != null) { @@ -171,12 +186,12 @@ public class JpaToscaServiceTemplate extends JpaToscaEntityType<ToscaServiceTemp if (toscaServiceTemplate.getDataTypes() != null) { dataTypes = new JpaToscaDataTypes(); - dataTypes.fromAuthorative(toscaServiceTemplate.getDataTypes()); + dataTypes.fromAuthorative(Collections.singletonList(toscaServiceTemplate.getDataTypes())); } if (toscaServiceTemplate.getPolicyTypes() != null) { policyTypes = new JpaToscaPolicyTypes(); - policyTypes.fromAuthorative(toscaServiceTemplate.getPolicyTypes()); + policyTypes.fromAuthorative(Collections.singletonList(toscaServiceTemplate.getPolicyTypes())); } diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilterTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilterTest.java index 5fbad5559..28836a981 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilterTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilterTest.java @@ -58,16 +58,22 @@ public class ToscaPolicyTypeFilterTest { // @formatter:off private static final String[] policyTypeResourceNames = { - "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml", - "policytypes/onap.policies.optimization.AffinityPolicy.yaml", + "policytypes/onap.policies.controlloop.Operational.yaml", "policytypes/onap.policies.optimization.DistancePolicy.yaml", - "policytypes/onap.policies.optimization.HpaPolicy.yaml", - "policytypes/onap.policies.optimization.OptimizationPolicy.yaml", + "policytypes/onap.policies.optimization.VnfPolicy.yaml", "policytypes/onap.policies.optimization.PciPolicy.yaml", - "policytypes/onap.policies.optimization.QueryPolicy.yaml", - "policytypes/onap.policies.optimization.SubscriberPolicy.yaml", + "policytypes/onap.policies.optimization.OptimizationPolicy.yaml", + "policytypes/onap.policies.controlloop.guard.Blacklist.yaml", + "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml", + "policytypes/onap.policies.optimization.HpaPolicy.yaml", "policytypes/onap.policies.optimization.Vim_fit.yaml", - "policytypes/onap.policies.optimization.VnfPolicy.yaml", + "policytypes/onap.policies.optimization.SubscriberPolicy.yaml", + "policytypes/onap.policies.optimization.AffinityPolicy.yaml", + "policytypes/onap.policies.optimization.QueryPolicy.yaml", + "policytypes/onap.policies.controlloop.guard.MinMax.yaml", + "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml", + "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml", + "policytypes/onap.policies.Optimization.yaml", "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml" }; // @formatter:on @@ -90,9 +96,7 @@ public class ToscaPolicyTypeFilterTest { new StandardCoder().decode(yamlAsJsonString, ToscaServiceTemplate.class); assertNotNull(serviceTemplate); - for (Map<String, ToscaPolicyType> foundPolicyTypeMap : serviceTemplate.getPolicyTypes()) { - addPolicyTypes(foundPolicyTypeMap); - } + addPolicyTypes(serviceTemplate.getPolicyTypes()); } for (ToscaPolicyType type : typeList) { @@ -138,21 +142,21 @@ public class ToscaPolicyTypeFilterTest { ToscaPolicyTypeFilter.builder().version(ToscaPolicyTypeFilter.LATEST_VERSION).build(); List<ToscaPolicyType> filteredList = filter.filter(typeList); - assertEquals(13, filteredList.size()); + assertEquals(20, filteredList.size()); assertEquals(VERSION_100, filteredList.get(0).getVersion()); - assertEquals(VERSION_000, filteredList.get(4).getVersion()); + assertEquals(VERSION_000, filteredList.get(11).getVersion()); typeList.get(12).setVersion("2.0.0"); filteredList = filter.filter(typeList); - assertEquals(13, filteredList.size()); - assertEquals("2.0.0", filteredList.get(0).getVersion()); - assertEquals(VERSION_000, filteredList.get(4).getVersion()); + assertEquals(20, filteredList.size()); + assertEquals("2.0.0", filteredList.get(11).getVersion()); + assertEquals(VERSION_000, filteredList.get(18).getVersion()); typeList.get(12).setVersion(VERSION_100); filteredList = filter.filter(typeList); - assertEquals(13, filteredList.size()); + assertEquals(20, filteredList.size()); assertEquals(VERSION_100, filteredList.get(0).getVersion()); - assertEquals(VERSION_000, filteredList.get(4).getVersion()); + assertEquals(VERSION_000, filteredList.get(18).getVersion()); } @Test @@ -174,7 +178,7 @@ public class ToscaPolicyTypeFilterTest { assertEquals(9, filteredList.size()); filter = ToscaPolicyTypeFilter.builder().name("onap.policies.optimization.Vim_fit").version(VERSION_000) - .build(); + .build(); filteredList = filter.filter(typeList); assertEquals(1, filteredList.size()); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java index 8bed1e4a1..d77b52daa 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java @@ -27,7 +27,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import com.google.gson.GsonBuilder; -import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import java.util.Properties; import org.apache.commons.lang3.ObjectUtils; @@ -137,15 +137,15 @@ public class AuthorativeToscaProviderPolicyTypeTest { PfConceptKey policyTypeKey = new PfConceptKey(POLICY_AFFINITY_VERSION0); - ToscaPolicyType beforePolicyType = toscaServiceTemplate.getPolicyTypes().get(1).get(policyTypeKey.getName()); - ToscaPolicyType createdPolicyType = createdServiceTemplate.getPolicyTypes().get(1).get(policyTypeKey.getName()); + ToscaPolicyType beforePolicyType = toscaServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); + ToscaPolicyType createdPolicyType = createdServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); assertEquals(true, beforePolicyType.getName().equals(createdPolicyType.getName())); assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), createdPolicyType.getDescription())); ToscaServiceTemplate gotServiceTemplate = new AuthorativeToscaProvider().getPolicyTypes(pfDao, policyTypeKey.getName(), policyTypeKey.getVersion()); - ToscaPolicyType gotPolicyType = gotServiceTemplate.getPolicyTypes().get(0).get(policyTypeKey.getName()); + ToscaPolicyType gotPolicyType = gotServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), createdPolicyType.getDescription())); @@ -160,11 +160,11 @@ public class AuthorativeToscaProviderPolicyTypeTest { assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); gotPolicyTypeList = new AuthorativeToscaProvider().getPolicyTypeList(pfDao, null, null); - assertEquals(2, gotPolicyTypeList.size()); + assertEquals(1, gotPolicyTypeList.size()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); gotPolicyTypeList = new AuthorativeToscaProvider().getPolicyTypeList(pfDao, null, VERSION_000); - assertEquals(2, gotPolicyTypeList.size()); + assertEquals(1, gotPolicyTypeList.size()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); } @@ -203,29 +203,29 @@ public class AuthorativeToscaProviderPolicyTypeTest { PfConceptKey policyTypeKey = new PfConceptKey(POLICY_AFFINITY_VERSION0); - ToscaPolicyType beforePolicyType = toscaServiceTemplate.getPolicyTypes().get(1).get(policyTypeKey.getName()); - ToscaPolicyType createdPolicyType = createdServiceTemplate.getPolicyTypes().get(1).get(policyTypeKey.getName()); + ToscaPolicyType beforePolicyType = toscaServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); + ToscaPolicyType createdPolicyType = createdServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); assertEquals(true, beforePolicyType.getName().equals(createdPolicyType.getName())); assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), createdPolicyType.getDescription())); ToscaServiceTemplate gotServiceTemplate = new AuthorativeToscaProvider().getFilteredPolicyTypes(pfDao, ToscaPolicyTypeFilter.builder().build()); - ToscaPolicyType gotPolicyType = gotServiceTemplate.getPolicyTypes().get(1).get(policyTypeKey.getName()); + ToscaPolicyType gotPolicyType = gotServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), gotPolicyType.getDescription())); gotServiceTemplate = new AuthorativeToscaProvider().getFilteredPolicyTypes(pfDao, ToscaPolicyTypeFilter.builder().name(policyTypeKey.getName()).build()); - gotPolicyType = gotServiceTemplate.getPolicyTypes().get(0).get(policyTypeKey.getName()); + gotPolicyType = gotServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), gotPolicyType.getDescription())); gotServiceTemplate = new AuthorativeToscaProvider().getFilteredPolicyTypes(pfDao, ToscaPolicyTypeFilter.builder().name(policyTypeKey.getName()).version(VERSION_000).build()); - gotPolicyType = gotServiceTemplate.getPolicyTypes().get(0).get(policyTypeKey.getName()); + gotPolicyType = gotServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), gotPolicyType.getDescription())); @@ -236,7 +236,7 @@ public class AuthorativeToscaProviderPolicyTypeTest { gotPolicyTypeList = new AuthorativeToscaProvider().getFilteredPolicyTypeList(pfDao, ToscaPolicyTypeFilter.builder().build()); - assertEquals(2, gotPolicyTypeList.size()); + assertEquals(1, gotPolicyTypeList.size()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); gotPolicyTypeList = new AuthorativeToscaProvider().getFilteredPolicyTypeList(pfDao, @@ -251,7 +251,7 @@ public class AuthorativeToscaProviderPolicyTypeTest { gotPolicyTypeList = new AuthorativeToscaProvider().getFilteredPolicyTypeList(pfDao, ToscaPolicyTypeFilter.builder().version("1.0.0").build()); - assertEquals(1, gotPolicyTypeList.size()); + assertEquals(0, gotPolicyTypeList.size()); assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName())); } @@ -274,7 +274,7 @@ public class AuthorativeToscaProviderPolicyTypeTest { new AuthorativeToscaProvider().createPolicyTypes(pfDao, testToscaServiceTemplate); }).hasMessage(MISSING_POLICY_TYPES); - testToscaServiceTemplate.setPolicyTypes(new ArrayList<>()); + testToscaServiceTemplate.setPolicyTypes(new LinkedHashMap<>()); assertThatThrownBy(() -> { new AuthorativeToscaProvider().createPolicyTypes(pfDao, testToscaServiceTemplate); }).hasMessage("An incoming list of concepts must have at least one entry"); @@ -287,8 +287,8 @@ public class AuthorativeToscaProviderPolicyTypeTest { PfConceptKey policyTypeKey = new PfConceptKey(POLICY_AFFINITY_VERSION0); - ToscaPolicyType beforePolicyType = toscaServiceTemplate.getPolicyTypes().get(1).get(policyTypeKey.getName()); - ToscaPolicyType createdPolicyType = createdServiceTemplate.getPolicyTypes().get(1).get(policyTypeKey.getName()); + ToscaPolicyType beforePolicyType = toscaServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); + ToscaPolicyType createdPolicyType = createdServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); assertEquals(true, beforePolicyType.getName().equals(createdPolicyType.getName())); assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), createdPolicyType.getDescription())); } @@ -319,15 +319,15 @@ public class AuthorativeToscaProviderPolicyTypeTest { PfConceptKey policyTypeKey = new PfConceptKey(POLICY_AFFINITY_VERSION0); - ToscaPolicyType beforePolicyType = toscaServiceTemplate.getPolicyTypes().get(1).get(policyTypeKey.getName()); - ToscaPolicyType createdPolicyType = createdServiceTemplate.getPolicyTypes().get(1).get(policyTypeKey.getName()); + ToscaPolicyType beforePolicyType = toscaServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); + ToscaPolicyType createdPolicyType = createdServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); assertEquals(true, beforePolicyType.getName().equals(createdPolicyType.getName())); assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), createdPolicyType.getDescription())); ToscaServiceTemplate updatedServiceTemplate = new AuthorativeToscaProvider().updatePolicyTypes(pfDao, toscaServiceTemplate); - ToscaPolicyType updatedPolicy = updatedServiceTemplate.getPolicyTypes().get(1).get(policyTypeKey.getName()); + ToscaPolicyType updatedPolicy = updatedServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); assertEquals(true, beforePolicyType.getName().equals(updatedPolicy.getName())); assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), updatedPolicy.getDescription())); } @@ -370,15 +370,15 @@ public class AuthorativeToscaProviderPolicyTypeTest { PfConceptKey policyTypeKey = new PfConceptKey(POLICY_AFFINITY_VERSION0); - ToscaPolicyType beforePolicyType = toscaServiceTemplate.getPolicyTypes().get(1).get(policyTypeKey.getName()); - ToscaPolicyType createdPolicyType = createdServiceTemplate.getPolicyTypes().get(1).get(policyTypeKey.getName()); + ToscaPolicyType beforePolicyType = toscaServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); + ToscaPolicyType createdPolicyType = createdServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); assertEquals(true, beforePolicyType.getName().equals(createdPolicyType.getName())); assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), createdPolicyType.getDescription())); ToscaServiceTemplate deletedServiceTemplate = new AuthorativeToscaProvider().deletePolicyType(pfDao, policyTypeKey.getName(), policyTypeKey.getVersion()); - ToscaPolicyType deletedPolicy = deletedServiceTemplate.getPolicyTypes().get(0).get(policyTypeKey.getName()); + ToscaPolicyType deletedPolicy = deletedServiceTemplate.getPolicyTypes().get(policyTypeKey.getName()); assertEquals(true, beforePolicyType.getName().equals(deletedPolicy.getName())); assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), deletedPolicy.getDescription())); @@ -405,7 +405,7 @@ public class AuthorativeToscaProviderPolicyTypeTest { new AuthorativeToscaProvider().createPolicyTypes(pfDao, testServiceTemplate); }).hasMessage(MISSING_POLICY_TYPES); - testServiceTemplate.setPolicyTypes(new ArrayList<>()); + testServiceTemplate.setPolicyTypes(new LinkedHashMap<>()); assertThatThrownBy(() -> { new AuthorativeToscaProvider().createPolicyTypes(pfDao, testServiceTemplate); }).hasMessage("An incoming list of concepts must have at least one entry"); |