summaryrefslogtreecommitdiffstats
path: root/applications/guard/src/test/resources
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-03-08 10:41:26 -0400
committerPamela Dragosh <pdragosh@research.att.com>2020-03-09 14:12:45 -0400
commita0ad29cdb6d6f541aac59f9e265f79d3ad085560 (patch)
treee86ea9484f21d56bacf7c7c0d8fd6e85ab3121b3 /applications/guard/src/test/resources
parente89d4c2ab8033c9482965f0e2f811e059378d37d (diff)
Updates to support fixed guard policy types
Because the new TOSCA compliant policy types support required fields, we can simplify the guard translator to utilize Match in the target vs the previous complicated Condition usage. Added test coverage to bump above 90% specifically for the guard and coordination code. Added a sonar exclusion for the test module. Issue-ID: POLICY-2244 Change-Id: Ia90d117bd7b86d28a2268fd5ab8315dce7bf0c12 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'applications/guard/src/test/resources')
-rw-r--r--applications/guard/src/test/resources/guard.policy-minmax-missing-fields1.yaml19
-rw-r--r--applications/guard/src/test/resources/requests/guard.vfCount.3.json16
-rw-r--r--applications/guard/src/test/resources/requests/guard.vfCount.6.json16
-rw-r--r--applications/guard/src/test/resources/requests/guard.vfCount.json (renamed from applications/guard/src/test/resources/requests/guard.vfCount.1.json)4
-rw-r--r--applications/guard/src/test/resources/test-bad-policies.yaml35
-rw-r--r--applications/guard/src/test/resources/test-directive.yaml4
-rw-r--r--applications/guard/src/test/resources/test-policies.yaml116
-rw-r--r--applications/guard/src/test/resources/vDNS.policy.guard.blacklist.output.tosca.yaml18
-rw-r--r--applications/guard/src/test/resources/vDNS.policy.guard.frequency.output.tosca.yaml20
-rw-r--r--applications/guard/src/test/resources/vDNS.policy.guard.minmax.output.tosca.yaml19
10 files changed, 157 insertions, 110 deletions
diff --git a/applications/guard/src/test/resources/guard.policy-minmax-missing-fields1.yaml b/applications/guard/src/test/resources/guard.policy-minmax-missing-fields1.yaml
deleted file mode 100644
index 6a441182..00000000
--- a/applications/guard/src/test/resources/guard.policy-minmax-missing-fields1.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_0_0
-topology_template:
- policies:
- -
- guard.minmax.missing1:
- type: onap.policies.controlloop.guard.MinMax
- version: 1.0.0
- metadata:
- policy-id : guard.minmax.scaleout
- policy-version: 1
- properties:
- actor: FOO
- recipe: bar
-# targets: *.
-# clname: ControlLoop-Foo-Bar
- min: 1
- max: 5
-# guardActiveStart: 00:00:01-05:00
-# guardActiveEnd: 23:59:59-05:00
diff --git a/applications/guard/src/test/resources/requests/guard.vfCount.3.json b/applications/guard/src/test/resources/requests/guard.vfCount.3.json
deleted file mode 100644
index 9faa55d6..00000000
--- a/applications/guard/src/test/resources/requests/guard.vfCount.3.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "ONAPName": "Policy",
- "ONAPComponent": "drools-pdp",
- "ONAPInstance": "usecase-template",
- "requestId": "unique-request-id-3",
- "action": "guard",
- "resource": {
- "guard": {
- "actor": "SO",
- "recipe": "VF Module Create",
- "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",
- "target": "vLoadBalancer-00",
- "vfCount": "3"
- }
- }
-}
diff --git a/applications/guard/src/test/resources/requests/guard.vfCount.6.json b/applications/guard/src/test/resources/requests/guard.vfCount.6.json
deleted file mode 100644
index e00d67ae..00000000
--- a/applications/guard/src/test/resources/requests/guard.vfCount.6.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "ONAPName": "Policy",
- "ONAPComponent": "drools-pdp",
- "ONAPInstance": "usecase-template",
- "requestId": "unique-request-id-2",
- "action": "guard",
- "resource": {
- "guard": {
- "actor": "SO",
- "recipe": "VF Module Create",
- "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",
- "target": "vLoadBalancer-00",
- "vfCount" : "6"
- }
- }
-}
diff --git a/applications/guard/src/test/resources/requests/guard.vfCount.1.json b/applications/guard/src/test/resources/requests/guard.vfCount.json
index ef1b5f65..7fc7d230 100644
--- a/applications/guard/src/test/resources/requests/guard.vfCount.1.json
+++ b/applications/guard/src/test/resources/requests/guard.vfCount.json
@@ -9,8 +9,8 @@
"actor": "SO",
"recipe": "VF Module Create",
"clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",
- "target": "vLoadBalancer-00",
- "vfCount": "1"
+ "target": "e6130d03-56f1-4b0a-9a1d-e1b2ebc30e0e",
+ "vfCount": "0"
}
}
}
diff --git a/applications/guard/src/test/resources/test-bad-policies.yaml b/applications/guard/src/test/resources/test-bad-policies.yaml
new file mode 100644
index 00000000..df2431d4
--- /dev/null
+++ b/applications/guard/src/test/resources/test-bad-policies.yaml
@@ -0,0 +1,35 @@
+tosca_definitions_version: tosca_simple_yaml_1_1_0
+topology_template:
+ policies:
+ -
+ frequency-missing-properties:
+ type: onap.policies.controlloop.guard.common.FrequencyLimiter
+ type_version: 1.0.0
+ version: 1.0.0
+ -
+ frequency-timewindow:
+ type: onap.policies.controlloop.guard.common.FrequencyLimiter
+ type_version: 1.0.0
+ version: 1.0.0
+ properties:
+ limit: 5
+ timeWindow: i am a bad value
+ -
+ minmax-notarget:
+ type: onap.policies.controlloop.guard.common.MinMax
+ type_version: 1.0.0
+ version: 1.0.0
+ properties:
+ -
+ minmax-nominmax:
+ type: onap.policies.controlloop.guard.common.MinMax
+ type_version: 1.0.0
+ version: 1.0.0
+ properties:
+ target: foo
+ -
+ blacklist-noblacklist:
+ type: onap.policies.controlloop.guard.common.Blacklist
+ type_version: 1.0.0
+ version: 1.0.0
+ properties:
diff --git a/applications/guard/src/test/resources/test-directive.yaml b/applications/guard/src/test/resources/test-directive.yaml
new file mode 100644
index 00000000..44dfa74b
--- /dev/null
+++ b/applications/guard/src/test/resources/test-directive.yaml
@@ -0,0 +1,4 @@
+controlLoop:
+ - cl1
+ - cl2
+directive: whatisthisvaluesupposedtobe
diff --git a/applications/guard/src/test/resources/test-policies.yaml b/applications/guard/src/test/resources/test-policies.yaml
new file mode 100644
index 00000000..1ac7271c
--- /dev/null
+++ b/applications/guard/src/test/resources/test-policies.yaml
@@ -0,0 +1,116 @@
+tosca_definitions_version: tosca_simple_yaml_1_1_0
+topology_template:
+ policies:
+ -
+ frequency-default:
+ type: onap.policies.controlloop.guard.common.FrequencyLimiter
+ type_version: 1.0.0
+ version: 1.0.0
+ description: |
+ This is the default APPC Restart frequency limiter policy for all control loops.
+ metadata:
+ policy-id: frequency-default
+ policy-version: 1.0.0
+ properties:
+ actor: APPC
+ operation: Restart
+ timeWindow: 10
+ timeUnits: minute
+ limit: 1
+ -
+ frequency-loop-1:
+ type: onap.policies.controlloop.guard.common.FrequencyLimiter
+ type_version: 1.0.0
+ version: 1.0.0
+ description: |
+ This frequency limiter is for APPC Restart on a specific control loop. It allows more restarts.
+ metadata:
+ policy-id: frequency-loop-1
+ policy-version: 1.0.0
+ properties:
+ actor: APPC
+ operation: Restart
+ id: loop-1
+ timeWindow: 10
+ timeUnits: minute
+ limit: 3
+ -
+ frequency-loop-3:
+ type: onap.policies.controlloop.guard.common.FrequencyLimiter
+ type_version: 1.0.0
+ version: 1.0.0
+ description: |
+ This frequency limiter is for APPC Restart on a specific control loop. It allows
+ NO restarts in a time frame.
+ metadata:
+ policy-id: frequency-loop-3
+ policy-version: 1.0.0
+ properties:
+ actor: APPC
+ operation: Restart
+ timeRange:
+ start_time: T00:00:00Z
+ end_time: T08:00:00Z
+ id: loop-3
+ timeWindow: 8
+ timeUnits: hour
+ limit: 0
+ -
+ minmax-default:
+ type: onap.policies.controlloop.guard.common.MinMax
+ type_version: 1.0.0
+ version: 1.0.0
+ metadata:
+ policy-id : minmax-default
+ policy-version: 1.0.0
+ properties:
+ actor: SO
+ operation: VF Module Create
+ target: vf-module-id-1
+ min: 1
+ max: 5
+ -
+ minmax-vfmodule-loop2:
+ type: onap.policies.controlloop.guard.common.MinMax
+ type_version: 1.0.0
+ version: 1.0.0
+ metadata:
+ policy-id : minmax-vfmodule-loop2
+ policy-version: 1.0.0
+ properties:
+ actor: SO
+ operation: VF Module Create
+ id: loop-2
+ target: vf-module-id-2
+ min: 3
+ max: 6
+ -
+ blacklist-1:
+ type: onap.policies.controlloop.guard.common.Blacklist
+ type_version: 1.0.0
+ version: 1.0.0
+ metadata:
+ policy-id : blacklist-1
+ policy-version: 1.0.0
+ properties:
+ actor: APPC
+ operation: Migrate
+ id: loop-5
+ blacklist:
+ - vnf1
+ - vnf2
+ -
+ unknown-1:
+ type: onap.policies.controlloop.guard.common.Unknown
+ type_version: 1.0.0
+ version: 1.0.0
+ metadata:
+ policy-id : unknown-1
+ policy-version: 1.0.0
+ properties:
+ actor: APPC
+ operation: Migrate
+ id: loop-5
+ blacklist:
+ - vnf1
+ - vnf2 \ No newline at end of file
diff --git a/applications/guard/src/test/resources/vDNS.policy.guard.blacklist.output.tosca.yaml b/applications/guard/src/test/resources/vDNS.policy.guard.blacklist.output.tosca.yaml
deleted file mode 100644
index 7d3a54ec..00000000
--- a/applications/guard/src/test/resources/vDNS.policy.guard.blacklist.output.tosca.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_0_0
-topology_template:
- policies:
- -
- guard.frequency.scaleout:
- type: onap.policies.controlloop.guard.Blacklist
- version: 1.0.0
- metadata:
- policy-id: guard.frequency.scaleout
- policy-version: 1
- properties:
- actor: SO
- recipe: VF Module Create
- targets: vLoadBalancer-01
- clname: ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
- limit: 2
- guardActiveStart: 00:00:00Z
- guardActiveEnd: 23:59:59Z
diff --git a/applications/guard/src/test/resources/vDNS.policy.guard.frequency.output.tosca.yaml b/applications/guard/src/test/resources/vDNS.policy.guard.frequency.output.tosca.yaml
deleted file mode 100644
index 506a44ed..00000000
--- a/applications/guard/src/test/resources/vDNS.policy.guard.frequency.output.tosca.yaml
+++ /dev/null
@@ -1,20 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_0_0
-topology_template:
- policies:
- -
- guard.frequency.scaleout:
- type: onap.policies.controlloop.guard.FrequencyLimiter
- version: 1.0.0
- metadata:
- policy-id: guard.frequency.scaleout
- policy-version: 1
- properties:
- actor: SO
- recipe: VF Module Create
- targets: .*
- clname: ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
- limit: 2
- timeWindow: 10
- timeUnits: minute
- guardActiveStart: 00:00:00Z
- guardActiveEnd: 23:59:59Z
diff --git a/applications/guard/src/test/resources/vDNS.policy.guard.minmax.output.tosca.yaml b/applications/guard/src/test/resources/vDNS.policy.guard.minmax.output.tosca.yaml
deleted file mode 100644
index ff2a423d..00000000
--- a/applications/guard/src/test/resources/vDNS.policy.guard.minmax.output.tosca.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-tosca_definitions_version: tosca_simple_yaml_1_0_0
-topology_template:
- policies:
- -
- guard.minmax.scaleout:
- type: onap.policies.controlloop.guard.MinMax
- version: 1.0.0
- metadata:
- policy-id : guard.minmax.scaleout
- policy-version: 1
- properties:
- actor: SO
- recipe: VF Module Create
- targets: .*
- clname: ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
- min: 2
- max: 5
- guardActiveStart: 00:00:00Z
- guardActiveEnd: 23:59:59Z