From f53879588a464c727ece62f87c7625b47e6de7f1 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Tue, 7 May 2019 12:42:26 +0000 Subject: Set default and check existance of Policy Type The TOSCA specification has a "bug" in that it does not have a field to specify the version of a policy type to use. We already had introduced the "type_version" field for this. This review introduces setting of the default version of a policy type to be be used by a policy as the latest version of the policy type in the database. As a side effect of this, we now have to check for existence of the policy type of a policy in the database. This means that creation/update of a policy with a non-existant policy type specified will now fail. Issue-ID: POLICY-1738 Change-Id: I27080cf6cd358948810dab6897c72dfe4d41fe91 Signed-off-by: liamfallon --- .../vFirewall.policy.monitoring.input.tosca.json | 2 +- .../vFirewall.policy.monitoring.input.tosca.yaml | 2 +- .../onap.policies.controlloop.Operational.yaml | 6 + .../onap.policies.controlloop.guard.Blacklist.yaml | 40 +++++ ...olicies.controlloop.guard.FrequencyLimiter.yaml | 50 +++++++ .../onap.policies.controlloop.guard.MinMax.yaml | 44 ++++++ ...nap.policies.monitoring.cdap.tca.hi.lo.app.yaml | 163 +++++++++++++++++++++ .../onap.policy.monitoring.cdap.tca.hi.lo.app.yaml | 163 --------------------- 8 files changed, 305 insertions(+), 165 deletions(-) create mode 100644 models-examples/src/main/resources/policytypes/onap.policies.controlloop.Operational.yaml create mode 100644 models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.Blacklist.yaml create mode 100644 models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml create mode 100644 models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.MinMax.yaml create mode 100644 models-examples/src/main/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml delete mode 100644 models-examples/src/main/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml (limited to 'models-examples') diff --git a/models-examples/src/main/resources/policies/vFirewall.policy.monitoring.input.tosca.json b/models-examples/src/main/resources/policies/vFirewall.policy.monitoring.input.tosca.json index aef04c99c..cdc40eb5b 100644 --- a/models-examples/src/main/resources/policies/vFirewall.policy.monitoring.input.tosca.json +++ b/models-examples/src/main/resources/policies/vFirewall.policy.monitoring.input.tosca.json @@ -7,7 +7,7 @@ { "onap.vfirewall.tca": { - "type": "onap.policy.monitoring.cdap.tca.hi.lo.app", + "type": "onap.policies.monitoring.cdap.tca.hi.lo.app", "version": "1.0.0", "metadata": { diff --git a/models-examples/src/main/resources/policies/vFirewall.policy.monitoring.input.tosca.yaml b/models-examples/src/main/resources/policies/vFirewall.policy.monitoring.input.tosca.yaml index bce8b366f..6ac547058 100644 --- a/models-examples/src/main/resources/policies/vFirewall.policy.monitoring.input.tosca.yaml +++ b/models-examples/src/main/resources/policies/vFirewall.policy.monitoring.input.tosca.yaml @@ -3,7 +3,7 @@ topology_template: policies: - onap.vfirewall.tca: - type: onap.policy.monitoring.cdap.tca.hi.lo.app + type: onap.policies.monitoring.cdap.tca.hi.lo.app version: 1.0.0 metadata: policy-id: onap.vfirewall.tca 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 new file mode 100644 index 000000000..e18c16a6d --- /dev/null +++ b/models-examples/src/main/resources/policytypes/onap.policies.controlloop.Operational.yaml @@ -0,0 +1,6 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +policy_types: + - 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 new file mode 100644 index 000000000..e09861428 --- /dev/null +++ b/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.Blacklist.yaml @@ -0,0 +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 +data_types: + - 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 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 new file mode 100644 index 000000000..2a7b6247f --- /dev/null +++ b/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml @@ -0,0 +1,50 @@ +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.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 +data_types: + - 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 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 new file mode 100644 index 000000000..0a1aa9b72 --- /dev/null +++ b/models-examples/src/main/resources/policytypes/onap.policies.controlloop.guard.MinMax.yaml @@ -0,0 +1,44 @@ +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: + 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 \ 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 new file mode 100644 index 000000000..2985603af --- /dev/null +++ b/models-examples/src/main/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml @@ -0,0 +1,163 @@ +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 +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 diff --git a/models-examples/src/main/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml b/models-examples/src/main/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml deleted file mode 100644 index f8e9b7521..000000000 --- a/models-examples/src/main/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml +++ /dev/null @@ -1,163 +0,0 @@ -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 - - - 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 -- cgit 1.2.3-korg