diff options
Diffstat (limited to 'controlloop/common/policy-yaml/src/test')
14 files changed, 33 insertions, 305 deletions
diff --git a/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java b/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java index f8ad499f0..90d498a8d 100644 --- a/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java +++ b/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyBuilderTest.java @@ -61,30 +61,30 @@ public class ControlLoopPolicyBuilderTest { // // Test add services // - Service vSCP = new Service("vSCP"); - Service vUSP = new Service("vUSP"); - Service vTrinity = new Service("Trinity"); - builder = builder.addService(vSCP, vUSP, vTrinity); + Service Ser1 = new Service("Ser1"); + Service Ser2 = new Service("Ser2"); + Service Ser3 = new Service("Ser3"); + builder = builder.addService(Ser1, Ser2, Ser3); assertTrue(builder.getControlLoop().services.size() == 3); // // Test remove services // - builder = builder.removeService(vSCP); + builder = builder.removeService(Ser1); assertTrue(builder.getControlLoop().services.size() == 2); builder = builder.removeAllServices(); assertTrue(builder.getControlLoop().services.size() == 0); // // Test add resources // - Resource vCTS = new Resource("vCTS", ResourceType.VF); - Resource vCOM = new Resource("vCTS", ResourceType.VF); - Resource vRAR = new Resource("vCTS", ResourceType.VF); - builder = builder.addResource(vCTS, vCOM, vRAR); + Resource Resrc1 = new Resource("Resrc1", ResourceType.VF); + Resource Resrc2 = new Resource("Resrc1", ResourceType.VF); + Resource Resrc3 = new Resource("Resrc1", ResourceType.VF); + builder = builder.addResource(Resrc1, Resrc2, Resrc3); assertTrue(builder.getControlLoop().resources.size() == 3); // // Test remove resources // - builder = builder.removeResource(vCTS); + builder = builder.removeResource(Resrc1); assertTrue(builder.getControlLoop().resources.size() == 2); builder = builder.removeAllResources(); assertTrue(builder.getControlLoop().resources.size() == 0); @@ -308,7 +308,7 @@ public class ControlLoopPolicyBuilderTest { Policy triggerPolicy = builder.setTriggerPolicy( "Restart the eNodeB", "Upon getting the trigger event, restart the eNodeB", - "SDNR", + "RANController", new Target(TargetType.PNF), "Restart", null, diff --git a/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyTest.java b/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyTest.java index 9e91dc4d3..555b69282 100644 --- a/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyTest.java +++ b/controlloop/common/policy-yaml/src/test/java/org/onap/policy/controlloop/policy/ControlLoopPolicyTest.java @@ -36,54 +36,25 @@ import org.yaml.snakeyaml.constructor.Constructor; public class ControlLoopPolicyTest { - @Test - public void testSDNO() { - this.test("src/test/resources/v1.0.0/policy_SDNO_1702.yaml"); - } @Test public void test() { this.test("src/test/resources/v1.0.0/policy_Test.yaml"); } - - @Test - public void testMultipleService() { - this.test("src/test/resources/v1.0.0/policy_Test_MultipleService.yaml"); - } - - @Test - public void testF5() { - this.test("src/test/resources/v1.0.0/policy_vSCP_F5_1610.yaml"); - } @Test - public void testUSP() { - this.test("src/test/resources/v1.0.0/policy_vUSP_1610.yaml"); + public void testvService1() { + this.test("src/test/resources/v1.0.0/policy_vService.yaml"); } @Test public void testOpenLoop() { - this.test("src/test/resources/v1.0.0/policy_OpenLoop_1610.yaml"); - } - - @Test - public void testvProbes() { - this.test("src/test/resources/v1.0.0/policy_vProbes_1610.yaml"); - } - - @Test - public void test1707() { - this.test("src/test/resources/v2.0.0/policy_vUSP_1707.yaml"); - } - - @Test - public void testeNodeBALU() { - this.test("src/test/resources/v2.0.0/policy_eNodeB_ALU_1707.yaml"); + this.test("src/test/resources/v1.0.0/policy_OpenLoop.yaml"); } @Test - public void testeNodeBEricsson() { - this.test("src/test/resources/v2.0.0/policy_eNodeB_Ericsson_1707.yaml"); + public void testvService2() { + this.test("src/test/resources/v2.0.0/policy_vService.yaml"); } public void test(String testFile) { diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_OpenLoop_1610.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_OpenLoop.yaml index 7fd27fa97..7fd27fa97 100644 --- a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_OpenLoop_1610.yaml +++ b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_OpenLoop.yaml diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_SDNO_1702.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_SDNO_1702.yaml deleted file mode 100644 index 339950f6f..000000000 --- a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_SDNO_1702.yaml +++ /dev/null @@ -1,26 +0,0 @@ -controlLoop: - version: 1.0.0 - controlLoopName: PoloControlLoop-vPE-248b154b-ff3f-458f-885c-ec290c615714 - services: - - serviceName: vPE - trigger_policy: unique-policy-id-1-healthdianostic - timeout: 600 - -policies: - - id: unique-policy-id-1-healthdiagnostic - name: Do SDNO Health Diagnostic - description: - actor: SDNO - recipe: health-diagnostic - payload: - health-diagnostic-code: HC99 - health-diagnostic-code-parameters: "{\"Junk\":\"--version\",\"Junk2\":\"--help\"}" - target: VM - retry: 0 - timeout: 600 - success: final_success - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception -
\ No newline at end of file diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_Test_MultipleService.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_Test_MultipleService.yaml deleted file mode 100644 index 8ce707729..000000000 --- a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_Test_MultipleService.yaml +++ /dev/null @@ -1,26 +0,0 @@ -controlLoop: - version: 1.0.0 - controlLoopName: ClosedLoop-FRWL-SIG-d925ed73-8231-4d02-9545-db4e101f88f8 - services: - - serviceName: vSCP - - serviceName: vSBG - resources: - - resourceName: F5FW - resourceType: VF - trigger_policy: unique-policy-id-1-restart - timeout: 1200 - -policies: - - id: unique-policy-id-1-restart - name: Restart Policy - description: - actor: APPC - recipe: Restart - target: VM - retry: 2 - timeout: 300 - success: final_success - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_vProbes_1610.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_vProbes_1610.yaml deleted file mode 100644 index 2a5f513ab..000000000 --- a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_vProbes_1610.yaml +++ /dev/null @@ -1,24 +0,0 @@ -controlLoop: - version: 1.0.0 - controlLoopName: ControlLoop-vProbes-41aba939-9a93-4535-b193-973c68fc8763 - services: - resources: - - resourceName: vProbes - resourceType: VF - trigger_policy: unique-policy-id-1-restart - timeout: 600 - -policies: - - id: unique-policy-id-1-restart - name: Restart Policy - description: - actor: APPC - recipe: Restart - target: VM - retry: 2 - timeout: 300 - success: final_success - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_vSCP_F5_1610.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_vSCP_F5_1610.yaml deleted file mode 100644 index 7feaecf7e..000000000 --- a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_vSCP_F5_1610.yaml +++ /dev/null @@ -1,26 +0,0 @@ -controlLoop: - version: 1.0.0 - controlLoopName: ClosedLoop-FRWL-SIG-d925ed73-8231-4d02-9545-db4e101f88f8 - services: - - serviceName: vSCP - - serviceName: trinity - resources: - - resourceName: F5FW - resourceType: VF - trigger_policy: unique-policy-id-1-restart - timeout: 1200 - -policies: - - id: unique-policy-id-1-restart - name: Restart Policy - description: - actor: APPC - recipe: Restart - target: VM - retry: 2 - timeout: 300 - success: final_success - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_vUSP_1610.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_vService.yaml index aebde931e..aebde931e 100644 --- a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_vUSP_1610.yaml +++ b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/policy_vService.yaml diff --git a/controlloop/common/policy-yaml/src/test/resources/v2.0.0-guard/policy_guard_blacklist.yaml b/controlloop/common/policy-yaml/src/test/resources/v2.0.0-guard/policy_guard_blacklist.yaml new file mode 100644 index 000000000..d413313e7 --- /dev/null +++ b/controlloop/common/policy-yaml/src/test/resources/v2.0.0-guard/policy_guard_blacklist.yaml @@ -0,0 +1,17 @@ +guard: + version: 2.0.0 + +guards: + - id: unique_guard_vService_blacklist + name: APPC Restart Blacklist + description: | + We deny restart of the blacklisted targets (avoid midnight to 5am) + actor: APPC + recipe: Restart + limit_constraints: + - blacklist: + - TargetName1 + - TargetName2 + time_in_range: + arg2: 00:00:00-05:00 + arg3: 23:59:59-05:00
\ No newline at end of file diff --git a/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_OpenECOMP_demo_vDNS.yaml b/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vDNS.yaml index 5deb8f7ff..5deb8f7ff 100644 --- a/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_OpenECOMP_demo_vDNS.yaml +++ b/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vDNS.yaml diff --git a/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_OpenECOMP_demo_vFirewall.yaml b/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml index 51597714c..51597714c 100644 --- a/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_OpenECOMP_demo_vFirewall.yaml +++ b/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_ONAP_demo_vFirewall.yaml diff --git a/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_eNodeB_ALU_1707.yaml b/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_eNodeB_ALU_1707.yaml deleted file mode 100644 index 9f41f46d9..000000000 --- a/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_eNodeB_ALU_1707.yaml +++ /dev/null @@ -1,72 +0,0 @@ -controlLoop: - version: 2.0.0 - controlLoopName: ControlLoop-eNodeB-ALU-3ee91181-6f05-4cd3-8437-cad5f58653ca - services: - resources: - pnf: - PNFName: eNodeB.ALU - trigger_policy: unique-policy-id-1-check-aots - timeout: 2400 - -policies: - - id: unique-policy-id-1-check-aots - name: Check AOTS CTS - description: Discard sleeping cell based on the new signature if it appears in recent CTS tickets - actor: AOTS - recipe: checkENodeBTicketHours - payload: - timeWindow: 5 - retry: 2 - timeout: 300 - success: unique-policy-id-2-check-aots-cts - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception - failure_guard: final_failure_guard - - - id: unique-policy-id-2-check-aots-cts - name: Check AOTS CTS Equipment - description: Discard sleeping cell based on the new signature if it is not active in CTS equipment data - actor: AOTS - recipe: checkEquipmentStatus - retry: 2 - timeout: 300 - success: unique-policy-id-3-check-aots-eim - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception - failure_guard: final_failure_guard - - - id: unique-policy-id-3-check-aots-eim - name: Check AOTS EIM_RT - description: Discard sleeping cell based on the new signature if it appears in EIM_RT data - actor: AOTS - recipe: checkEimStatus - retry: 2 - timeout: 300 - success: unique-policy-id-4-sdnr-reset - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception - failure_guard: final_failure_guard - - - id: unique-policy-id-4-sdnr-reset - name: Have SDNR Reset - description: SDNR should now reset this sleeper - actor: SDNR - recipe: Reset - operationsAccumulateParams: - period: 15m - limit: 5 - retry: 2 - timeout: 300 - success: final_success - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception - failure_guard: final_failure_guard - diff --git a/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_eNodeB_Ericsson_1707.yaml b/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_eNodeB_Ericsson_1707.yaml deleted file mode 100644 index 9eff3439d..000000000 --- a/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_eNodeB_Ericsson_1707.yaml +++ /dev/null @@ -1,86 +0,0 @@ -controlLoop: - version: 2.0.0 - controlLoopName: ControlLoop-eNodeB-Ericsson-0732e76a-4228-42d1-8185-972510be388c - services: - resources: - pnf: - PNFName: eNodeB.Ericsson - trigger_policy: unique-policy-id-1-check-aots-ticket - timeout: 2400 - -policies: - - id: unique-policy-id-1-check-aots-ticket - name: Check AOTS CTS - description: Discard sleeping cell based on the new signature if it appears in recent CTS tickets - actor: AOTS - recipe: checkENodeBTicketHours - payload: - timeWindow: 5 - retry: 2 - timeout: 300 - success: unique-policy-id-2-check-aots-cts - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception - failure_guard: final_failure_guard - - - id: unique-policy-id-2-check-aots-cts - name: Check AOTS CTS Equipment - description: Discard sleeping cell based on the new signature if it is not active in CTS equipment data - actor: AOTS - recipe: checkEquipmentStatus - payload: - retry: 2 - timeout: 300 - success: unique-policy-id-3-check-aots-eim - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception - failure_guard: final_failure_guard - - - id: unique-policy-id-3-check-aots-eim - name: Check AOTS EIM_RT - description: Discard sleeping cell based on the new signature if it appears in EIM_RT data - actor: AOTS - recipe: checkEimStatus - retry: 2 - timeout: 300 - success: unique-policy-id-3-check-aots-maintenance - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception - failure_guard: final_failure_guard - - - id: unique-policy-id-4-check-aots-maintenance - name: Check AOTS MAINTENANCE - description: Discard sleeping cell based on the new signature if it appears in Maintenance - actor: AOTS - recipe: checkMaintenanceWindow - retry: 2 - timeout: 300 - success: unique-policy-id-5-sdnr-reset - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception - failure_guard: final_failure_guard - - - id: unique-policy-id-5-sdnr-reset - name: Have SDNR Reset - description: SDNR should now reset this sleeper - actor: SDNR - recipe: Reset - operationsAccumulateParams: - period: 15m - limit: 5 - retry: 2 - timeout: 300 - success: final_success - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception - failure_guard: final_failure_guard diff --git a/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_vUSP_1707.yaml b/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_vService.yaml index b1b03f4ee..b1b03f4ee 100644 --- a/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_vUSP_1707.yaml +++ b/controlloop/common/policy-yaml/src/test/resources/v2.0.0/policy_vService.yaml |