From: Jim Hahn Date: Wed, 24 Jul 2019 16:37:07 +0000 (+0000) Subject: Merge "Add more junit coverage to xacml-pdp (round #2)" X-Git-Tag: 2.1.1~5 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=1bef77fdf96f66b5ff0bbf41e23fe7edeab4437d;hp=0ae998fcb08390a0d4a2dd2b98116be280c299d5;p=policy%2Fxacml-pdp.git Merge "Add more junit coverage to xacml-pdp (round #2)" --- diff --git a/main/src/main/java/org/onap/policy/pdpx/main/comm/XacmlPdpHearbeatPublisher.java b/main/src/main/java/org/onap/policy/pdpx/main/comm/XacmlPdpHearbeatPublisher.java index c160c1da..3177c096 100644 --- a/main/src/main/java/org/onap/policy/pdpx/main/comm/XacmlPdpHearbeatPublisher.java +++ b/main/src/main/java/org/onap/policy/pdpx/main/comm/XacmlPdpHearbeatPublisher.java @@ -20,8 +20,10 @@ package org.onap.policy.pdpx.main.comm; -import java.util.Timer; -import java.util.TimerTask; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; import lombok.Getter; import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient; import org.onap.policy.models.pdp.concepts.PdpStatus; @@ -29,7 +31,7 @@ import org.onap.policy.pdpx.main.XacmlState; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class XacmlPdpHearbeatPublisher extends TimerTask { +public class XacmlPdpHearbeatPublisher implements Runnable { public static final int DEFAULT_INTERVAL_MS = 60000; private static final Logger LOGGER = LoggerFactory.getLogger(XacmlPdpHearbeatPublisher.class); @@ -47,7 +49,9 @@ public class XacmlPdpHearbeatPublisher extends TimerTask { @Getter private long intervalMs = DEFAULT_INTERVAL_MS; - private Timer timer = null; + private ScheduledExecutorService timerThread; + + private ScheduledFuture timer; /** @@ -73,9 +77,9 @@ public class XacmlPdpHearbeatPublisher extends TimerTask { * Method to terminate the heart beat. */ public synchronized void terminate() { - if (timer != null) { - timer.cancel(); - timer.purge(); + if (timerThread != null) { + timerThread.shutdownNow(); + timerThread = null; timer = null; } } @@ -90,9 +94,9 @@ public class XacmlPdpHearbeatPublisher extends TimerTask { if (intervalMs != null && intervalMs > 0 && intervalMs != this.intervalMs) { this.intervalMs = intervalMs; - if (timer != null) { - terminate(); - start(); + if (timerThread != null) { + timer.cancel(false); + timer = timerThread.scheduleWithFixedDelay(this, 0, this.intervalMs, TimeUnit.MILLISECONDS); } } } @@ -101,15 +105,15 @@ public class XacmlPdpHearbeatPublisher extends TimerTask { * Starts the timer. */ public synchronized void start() { - if (timer == null) { - timer = makeTimer(); - timer.scheduleAtFixedRate(this, 0, this.intervalMs); + if (timerThread == null) { + timerThread = makeTimerThread(); + timer = timerThread.scheduleWithFixedDelay(this, 0, this.intervalMs, TimeUnit.MILLISECONDS); } } // these may be overridden by junit tests - protected Timer makeTimer() { - return new Timer(true); + protected ScheduledExecutorService makeTimerThread() { + return Executors.newScheduledThreadPool(1); } } diff --git a/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpHearbeatPublisherTest.java b/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpHearbeatPublisherTest.java index 34bb0fa3..a1f50771 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpHearbeatPublisherTest.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/comm/XacmlPdpHearbeatPublisherTest.java @@ -23,6 +23,8 @@ package org.onap.policy.pdpx.main.comm; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyBoolean; +import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyLong; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; @@ -32,7 +34,9 @@ import static org.mockito.Mockito.when; import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; -import java.util.Timer; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -54,15 +58,18 @@ public class XacmlPdpHearbeatPublisherTest { private XacmlState state; @Mock - private Timer timer1; + private ScheduledExecutorService executor; @Mock - private Timer timer2; + private ScheduledFuture timer1; + + @Mock + private ScheduledFuture timer2; @Mock private PdpStatus status; - private Queue timers; + private Queue> timers; private XacmlPdpHearbeatPublisher publisher; @@ -78,6 +85,8 @@ public class XacmlPdpHearbeatPublisherTest { timers = new LinkedList<>(Arrays.asList(timer1, timer2)); + when(executor.scheduleWithFixedDelay(any(), anyLong(), anyLong(), any())).thenAnswer(args -> timers.remove()); + publisher = new MyPublisher(client, state); } @@ -94,16 +103,11 @@ public class XacmlPdpHearbeatPublisherTest { // not yet started publisher.terminate(); - verify(timer1, never()).cancel(); - verify(timer2, never()).cancel(); - // now start it and then try again publisher.start(); publisher.terminate(); - verify(timer1).cancel(); - // timer2 should still be in the queue assertSame(timer2, timers.peek()); @@ -111,8 +115,6 @@ public class XacmlPdpHearbeatPublisherTest { // repeat - nothing more should happen publisher.terminate(); - verify(timer1, times(1)).cancel(); - // timer2 should still be in the queue assertSame(timer2, timers.peek()); } @@ -127,47 +129,49 @@ public class XacmlPdpHearbeatPublisherTest { // now start it publisher.start(); - verify(timer1).scheduleAtFixedRate(publisher, 0, INTERVAL1); + verify(executor).scheduleWithFixedDelay(publisher, 0, INTERVAL1, TimeUnit.MILLISECONDS); // null interval - no changes publisher.restart(null); - verify(timer1, times(1)).scheduleAtFixedRate(any(), anyLong(), anyLong()); + verify(executor, times(1)).scheduleWithFixedDelay(any(), anyInt(), anyLong(), any()); assertSame(timer2, timers.peek()); // same interval - no changes publisher.restart(INTERVAL1); - verify(timer1, times(1)).scheduleAtFixedRate(any(), anyLong(), anyLong()); + verify(executor, times(1)).scheduleWithFixedDelay(any(), anyInt(), anyLong(), any()); assertSame(timer2, timers.peek()); // invalid interval - no changes publisher.restart(INTERVAL_INVALID); - verify(timer1, times(1)).scheduleAtFixedRate(any(), anyLong(), anyLong()); + verify(executor, times(1)).scheduleWithFixedDelay(any(), anyInt(), anyLong(), any()); assertSame(timer2, timers.peek()); // new interval - old timer should be cancelled and new started publisher.restart(INTERVAL2); - verify(timer1).cancel(); - verify(timer2).scheduleAtFixedRate(publisher, 0, INTERVAL2); + verify(timer1).cancel(anyBoolean()); + verify(executor).scheduleWithFixedDelay(publisher, 0, INTERVAL2, TimeUnit.MILLISECONDS); } @Test public void testStart() { publisher.start(); - verify(timer1).scheduleAtFixedRate(publisher, 0, XacmlPdpHearbeatPublisher.DEFAULT_INTERVAL_MS); + verify(executor).scheduleWithFixedDelay(publisher, 0, XacmlPdpHearbeatPublisher.DEFAULT_INTERVAL_MS, + TimeUnit.MILLISECONDS); // repeat - nothing more should happen publisher.start(); - verify(timer1, times(1)).scheduleAtFixedRate(any(), anyLong(), anyLong()); - verify(timer1, never()).cancel(); + verify(executor, times(1)).scheduleWithFixedDelay(any(), anyInt(), anyLong(), any()); + verify(timer1, never()).cancel(anyBoolean()); } @Test - public void testMakeTimer() { + public void testMakeTimerThread() { // create a plain listener to test the "real" makeTimer() method publisher = new XacmlPdpHearbeatPublisher(client, state); publisher.start(); + publisher.restart(100L); publisher.terminate(); } @@ -178,8 +182,8 @@ public class XacmlPdpHearbeatPublisherTest { } @Override - protected Timer makeTimer() { - return timers.remove(); + protected ScheduledExecutorService makeTimerThread() { + return executor; } } } diff --git a/testsuites/performance/src/main/resources/testplans/perf.jmx b/testsuites/performance/src/main/resources/testplans/perf.jmx index 02eecec4..a53a9f43 100644 --- a/testsuites/performance/src/main/resources/testplans/perf.jmx +++ b/testsuites/performance/src/main/resources/testplans/perf.jmx @@ -1,31 +1,41 @@ - + Policy XACML PDP Performance Tests false true - true + false - - POLICY_XACML_PDP_HOST - ${__P(host,10.12.6.164)} + + POLICY_PDPX_HOST + ${__P(host,10.12.6.106)} = DURATION - ${__P(duration, 5)} + ${__P(duration, 3000)} = USERS - ${__P(users, 1)} + ${__P(users, 10)} = - - PORT - ${__P(port, 6969)} + + PDP_PORT + ${__P(port, 30420)} + = + + + PAP_PORT + ${__P(port, 30089)} + = + + + API_PORT + ${__P(port, 32187)} = @@ -33,6 +43,384 @@ + + + + Content-Type + application/json + + + Accept + application/json + + + + + + continue + + false + 1 + + 1 + 1 + false + + + + + + true + + + + false + { + "tosca_definitions_version": "tosca_simple_yaml_1_0_0", + "topology_template": { + "policies": [ + { + "onap.scaleout.tca": { + "type": "onap.policies.monitoring.cdap.tca.hi.lo.app", + "version": "1.0.0", + "metadata": { + "policy-id": "onap.scaleout.tca" + }, + "properties": { + "tca_policy": { + "domain": "measurementsForVfScaling", + "metricsPerEventName": [ + { + "eventName": "vLoadBalancer", + "controlLoopSchemaType": "VNF", + "policyScope": "type=configuration", + "policyName": "onap.scaleout.tca", + "policyVersion": "v0.0.1", + "thresholds": [ + { + "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", + "closedLoopEventStatus": "ONSET", + "version": "1.0.2", + "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", + "thresholdValue": 500, + "direction": "LESS_OR_EQUAL", + "severity": "MAJOR" + }, + { + "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", + "closedLoopEventStatus": "ONSET", + "version": "1.0.2", + "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", + "thresholdValue": 5000, + "direction": "GREATER_OR_EQUAL", + "severity": "CRITICAL" + } + ] + } + ] + } + } + } + } + ] + } +} + = + + + + ${POLICY_PDPX_HOST} + ${API_PORT} + https + + policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies + POST + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${API_PORT}/policy/api/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + true + + + + false + { + "policy-id" : "guard.minmax.scaleout", + "content" : { + "actor": "SO", + "recipe": "scaleOut", + "targets": ".*", + "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", + "min": "1", + "max": "5", + "guardActiveStart": "00:00:01-05:00", + "guardActiveEnd": "23:59:59-05:00" + } +} + = + + + + ${POLICY_PDPX_HOST} + ${API_PORT} + https + + policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies + POST + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${API_PORT}/policy/api/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + true + + + + false + { + "policy-id" : "guard.frequency.scaleout", + "content" : { + "actor": "SO", + "recipe": "scaleOut", + "targets": ".*", + "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", + "limit": "1", + "timeWindow": "10", + "timeUnits": "minute", + "guardActiveStart": "00:00:01-05:00", + "guardActiveEnd": "23:59:59-05:00" + } +} + = + + + + ${POLICY_PDPX_HOST} + ${API_PORT} + https + + policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies + POST + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${API_PORT}/policy/api/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + true + + + + false + {"policies":[{"policy-id":"onap.scaleout.tca"}]} + = + + + + ${POLICY_PDPX_HOST} + ${PAP_PORT} + https + + policy/pap/v1/pdps/policies + POST + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${PAP_PORT}/policy/pap/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + true + + + + false + {"policies":[{"policy-id":"guard.minmax.scaleout"}]} + = + + + + ${POLICY_PDPX_HOST} + ${PAP_PORT} + https + + policy/pap/v1/pdps/policies + POST + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${PAP_PORT}/policy/pap/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + true + + + + false + {"policies":[{"policy-id":"guard.frequency.scaleout"}]} + = + + + + ${POLICY_PDPX_HOST} + ${PAP_PORT} + https + + policy/pap/v1/pdps/policies + POST + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${PAP_PORT}/policy/pap/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + /tmp/pdpx_perf_setup.log + + + continue @@ -40,7 +428,7 @@ -1 ${USERS} - 1 + 10 true ${DURATION} 1 @@ -50,8 +438,8 @@ - ${POLICY_XACML_PDP_HOST} - 6969 + ${POLICY_PDPX_HOST} + ${PDP_PORT} https policy/pdpx/v1/healthcheck @@ -74,6 +462,7 @@ Assertion.response_code false 1 + all @@ -95,23 +484,10 @@ if (prev.getResponseCode() == '200') { - - - - Accept - application/json - - - Content-Type - application/json - - - - - https://${POLICY_XACML_PDP_HOST}:6969/policy/pdpx/v1/healthcheck + https://${POLICY_PDPX_HOST}:${PDP_PORT}/policy/pdpx/v1 healthcheck zb!XztG34 @@ -156,6 +532,7 @@ if (prev.getResponseCode() == '200') { /tmp/pdpx_perf_health.log + @@ -166,7 +543,7 @@ if (prev.getResponseCode() == '200') { -1 ${USERS} - 1 + 10 true ${DURATION} 1 @@ -176,8 +553,8 @@ if (prev.getResponseCode() == '200') { - ${POLICY_XACML_PDP_HOST} - 6969 + ${POLICY_PDPX_HOST} + ${PDP_PORT} https policy/pdpx/v1/statistics @@ -222,23 +599,228 @@ if (prev.getResponseCode() == '200') { - - - - Accept - application/json - - - Content-Type - application/json + + + + https://${POLICY_PDPX_HOST}:${PDP_PORT}/policy/pdpx/v1 + healthcheck + zb!XztG34 + + - + true + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + /tmp/pdpx_perf_stats.log + + + + continue + + false + -1 + + ${USERS} + 10 + true + ${DURATION} + 1 + + + + true + + + + false + { + "ONAPName": "DCAE", + "ONAPComponent": "PolicyHandler", + "ONAPInstance": "622431a4-9dea-4eae-b443-3b2164639c64", + "action": "configure", + "resource": { + "policy-id": "onap.scaleout.tca" + } +} + = + + + + ${POLICY_PDPX_HOST} + ${PDP_PORT} + https + + policy/pdpx/v1/decision + POST + true + false + true + false + + + + Get Configuration Data for Monitoring Policy + + + + + 200 + + + Assertion.response_code + false + 1 + + + + + true + + + + false + { + "ONAPName": "Policy", + "ONAPComponent": "drools-pdp", + "ONAPInstance": "usecase-template", + "requestId": "unique-request-id-1", + "action": "guard", + "resource": { + "guard": { + "actor": "SO", + "recipe": "scaleOut", + "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", + "target": "vLoadBalancer-00" + } + } +} + + + + = + + + + ${POLICY_PDPX_HOST} + ${PDP_PORT} + https + + policy/pdpx/v1/decision + POST + true + false + true + false + + + + Get Configuration Data for Monitoring Policy + + + + + 200 + + + Assertion.response_code + false + 1 + + + + + true + + + + false + { + "ONAPName": "Policy", + "ONAPComponent": "drools-pdp", + "ONAPInstance": "usecase-template", + "requestId": "unique-request-id-1", + "action": "guard", + "resource": { + "guard": { + "actor": "SO", + "recipe": "scaleOut", + "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", + "target": "vLoadBalancer-00", + "vfCount": "1" + } + } +} + = + + + + ${POLICY_PDPX_HOST} + ${PDP_PORT} + https + + policy/pdpx/v1/decision + POST + true + false + true + false + + + + Get Configuration Data for Monitoring Policy + + + + + 200 + + + Assertion.response_code + false + 1 + + + - https://${POLICY_XACML_PDP_HOST}:6969/policy/pdpx/v1/statistics + https://${POLICY_PDPX_HOST}:${PDP_PORT}/policy/pdpx/v1 healthcheck zb!XztG34 @@ -282,10 +864,371 @@ if (prev.getResponseCode() == '200') { true - /tmp/pdpx_perf_stats.log + /tmp/pdpx_perf_decisions.log + + + + + continue + + false + 1 + + 1 + 1 + false + + + + + + + + + ${POLICY_PDPX_HOST} + ${PAP_PORT} + https + + policy/pap/v1/pdps/policies/onap.scaleout.tca + DELETE + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${PAP_PORT}/policy/pap/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + + + + ${POLICY_PDPX_HOST} + ${PAP_PORT} + https + + policy/pap/v1/pdps/policies/guard.minmax.scaleout + DELETE + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${PAP_PORT}/policy/pap/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + + + + ${POLICY_PDPX_HOST} + ${PAP_PORT} + https + + policy/pap/v1/pdps/policies/guard.frequency.scaleout + DELETE + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${PAP_PORT}/policy/pap/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + + + + ${POLICY_PDPX_HOST} + ${API_PORT} + https + + policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.scaleout.tca/versions/1.0.0 + DELETE + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${API_PORT}/policy/api/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + + + + ${POLICY_PDPX_HOST} + ${API_PORT} + https + + policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0/policies/guard.minmax.scaleout/versions/1.0.0 + DELETE + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${API_PORT}/policy/api/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + + + + ${POLICY_PDPX_HOST} + ${API_PORT} + https + + policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0/policies/guard.frequency.scaleout/versions/1.0.0 + DELETE + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${API_PORT}/policy/api/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + /tmp/pdpx_perf_teardown.log + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + /tmp/pdpx_perf_summaryReport.log + true + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + /tmp/pdpx_perf_resultsTree.log + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + /tmp/pdpx_perf_resultsTable.log + + diff --git a/testsuites/stability/src/main/resources/testplans/stability.jmx b/testsuites/stability/src/main/resources/testplans/stability.jmx index 8e4d5301..c4be29be 100644 --- a/testsuites/stability/src/main/resources/testplans/stability.jmx +++ b/testsuites/stability/src/main/resources/testplans/stability.jmx @@ -1,5 +1,5 @@ - + Policy XACML PDP Stability Tests @@ -8,9 +8,9 @@ false - - POLICY_XACML_PDP_HOST - ${__P(host,10.12.6.164)} + + POLICY_PDPX_HOST + ${__P(host,10.12.6.106)} = @@ -23,9 +23,19 @@ ${__P(users, 1)} = - - PORT - ${__P(port, 6969)} + + PDP_PORT + ${__P(port, 30420)} + = + + + PAP_PORT + ${__P(port, 30089)} + = + + + API_PORT + ${__P(port, 32187)} = @@ -33,15 +43,393 @@ - + + + + Content-Type + application/json + + + Accept + application/json + + + + + + continue + + false + 1 + + 1 + 1 + false + + + + + + true + + + + false + { + "tosca_definitions_version": "tosca_simple_yaml_1_0_0", + "topology_template": { + "policies": [ + { + "onap.scaleout.tca": { + "type": "onap.policies.monitoring.cdap.tca.hi.lo.app", + "version": "1.0.0", + "metadata": { + "policy-id": "onap.scaleout.tca" + }, + "properties": { + "tca_policy": { + "domain": "measurementsForVfScaling", + "metricsPerEventName": [ + { + "eventName": "vLoadBalancer", + "controlLoopSchemaType": "VNF", + "policyScope": "type=configuration", + "policyName": "onap.scaleout.tca", + "policyVersion": "v0.0.1", + "thresholds": [ + { + "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", + "closedLoopEventStatus": "ONSET", + "version": "1.0.2", + "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", + "thresholdValue": 500, + "direction": "LESS_OR_EQUAL", + "severity": "MAJOR" + }, + { + "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", + "closedLoopEventStatus": "ONSET", + "version": "1.0.2", + "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", + "thresholdValue": 5000, + "direction": "GREATER_OR_EQUAL", + "severity": "CRITICAL" + } + ] + } + ] + } + } + } + } + ] + } +} + = + + + + ${POLICY_PDPX_HOST} + ${API_PORT} + https + + policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies + POST + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${API_PORT}/policy/api/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + true + + + + false + { + "policy-id" : "guard.minmax.scaleout", + "content" : { + "actor": "SO", + "recipe": "scaleOut", + "targets": ".*", + "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", + "min": "1", + "max": "5", + "guardActiveStart": "00:00:01-05:00", + "guardActiveEnd": "23:59:59-05:00" + } +} + = + + + + ${POLICY_PDPX_HOST} + ${API_PORT} + https + + policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies + POST + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${API_PORT}/policy/api/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + true + + + + false + { + "policy-id" : "guard.frequency.scaleout", + "content" : { + "actor": "SO", + "recipe": "scaleOut", + "targets": ".*", + "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", + "limit": "1", + "timeWindow": "10", + "timeUnits": "minute", + "guardActiveStart": "00:00:01-05:00", + "guardActiveEnd": "23:59:59-05:00" + } +} + = + + + + ${POLICY_PDPX_HOST} + ${API_PORT} + https + + policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies + POST + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${API_PORT}/policy/api/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + true + + + + false + {"policies":[{"policy-id":"onap.scaleout.tca"}]} + = + + + + ${POLICY_PDPX_HOST} + ${PAP_PORT} + https + + policy/pap/v1/pdps/policies + POST + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${PAP_PORT}/policy/pap/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + true + + + + false + {"policies":[{"policy-id":"guard.minmax.scaleout"}]} + = + + + + ${POLICY_PDPX_HOST} + ${PAP_PORT} + https + + policy/pap/v1/pdps/policies + POST + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${PAP_PORT}/policy/pap/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + true + + + + false + {"policies":[{"policy-id":"guard.frequency.scaleout"}]} + = + + + + ${POLICY_PDPX_HOST} + ${PAP_PORT} + https + + policy/pap/v1/pdps/policies + POST + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${PAP_PORT}/policy/pap/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + /tmp/pdpx_stability_setup.log + + + + continue false -1 ${USERS} - 1 - true + 10 + false ${DURATION} 1 @@ -50,8 +438,8 @@ - ${POLICY_XACML_PDP_HOST} - 6969 + ${POLICY_PDPX_HOST} + ${PDP_PORT} https policy/pdpx/v1/healthcheck @@ -74,6 +462,7 @@ Assertion.response_code false 1 + all @@ -90,31 +479,15 @@ if (prev.getResponseCode() == '200') { assert res instanceof Map; assert res.code == 200; - assert res.name == "Policy Xacml PDP"; - assert res.healthy==true; - assert res.message=="alive"; } - - - - Accept - application/json - - - Content-Type - application/json - - - - - https://${POLICY_XACML_PDP_HOST}:6969/policy/pdpx/v1/healthcheck + https://${POLICY_PDPX_HOST}:${PDP_PORT}/policy/pdpx/v1 healthcheck zb!XztG34 @@ -158,19 +531,20 @@ if (prev.getResponseCode() == '200') { true - + /tmp/pdpx_stability_health.log + - + continue false -1 ${USERS} - 1 - true + 10 + false ${DURATION} 1 @@ -179,8 +553,8 @@ if (prev.getResponseCode() == '200') { - ${POLICY_XACML_PDP_HOST} - 6969 + ${POLICY_PDPX_HOST} + ${PDP_PORT} https policy/pdpx/v1/statistics @@ -219,35 +593,234 @@ if (prev.getResponseCode() == '200') { assert res instanceof Map; assert res.code == 200; - assert res.totalPoliciesCount == 0; - assert res.permitDecisionsCount == 0; - assert res.denyDecisionsCount == 0; - assert res.indeterminantDecisionsCount == 0; - assert res.notApplicableDecisionsCount == 0; - } - - - - Accept - application/json - - - Content-Type - application/json + + + + https://${POLICY_PDPX_HOST}:${PDP_PORT}/policy/pdpx/v1 + healthcheck + zb!XztG34 + + - + true + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + /tmp/pdpx_stability_stats.log + + + + continue + + false + -1 + + ${USERS} + 10 + false + ${DURATION} + 1 + + + + true + + + + false + { + "ONAPName": "DCAE", + "ONAPComponent": "PolicyHandler", + "ONAPInstance": "622431a4-9dea-4eae-b443-3b2164639c64", + "action": "configure", + "resource": { + "policy-id": "onap.scaleout.tca" + } +} + = + + + + ${POLICY_PDPX_HOST} + ${PDP_PORT} + https + + policy/pdpx/v1/decision + POST + true + false + true + false + + + + Get Configuration Data for Monitoring Policy + + + + + 200 + + + Assertion.response_code + false + 1 + + + + + true + + + + false + { + "ONAPName": "Policy", + "ONAPComponent": "drools-pdp", + "ONAPInstance": "usecase-template", + "requestId": "unique-request-id-1", + "action": "guard", + "resource": { + "guard": { + "actor": "SO", + "recipe": "scaleOut", + "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", + "target": "vLoadBalancer-00" + } + } +} + + + + = + + + + ${POLICY_PDPX_HOST} + ${PDP_PORT} + https + + policy/pdpx/v1/decision + POST + true + false + true + false + + + + Get Configuration Data for Monitoring Policy + + + + + 200 + + + Assertion.response_code + false + 1 + + + + + true + + + + false + { + "ONAPName": "Policy", + "ONAPComponent": "drools-pdp", + "ONAPInstance": "usecase-template", + "requestId": "unique-request-id-1", + "action": "guard", + "resource": { + "guard": { + "actor": "SO", + "recipe": "scaleOut", + "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", + "target": "vLoadBalancer-00", + "vfCount": "1" + } + } +} + = + + + + ${POLICY_PDPX_HOST} + ${PDP_PORT} + https + + policy/pdpx/v1/decision + POST + true + false + true + false + + + + Get Configuration Data for Monitoring Policy + + + + + 200 + + + Assertion.response_code + false + 1 + + + - https://${POLICY_XACML_PDP_HOST}:6969/policy/pdpx/v1/statistics + https://${POLICY_PDPX_HOST}:${PDP_PORT}/policy/pdpx/v1 healthcheck zb!XztG34 @@ -291,10 +864,371 @@ if (prev.getResponseCode() == '200') { true - + /tmp/pdpx_stability_decisions.log + + + + + continue + + false + 1 + + 1 + 1 + false + + + + + + + + + ${POLICY_PDPX_HOST} + ${PAP_PORT} + https + + policy/pap/v1/pdps/policies/onap.scaleout.tca + DELETE + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${PAP_PORT}/policy/pap/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + + + + ${POLICY_PDPX_HOST} + ${PAP_PORT} + https + + policy/pap/v1/pdps/policies/guard.minmax.scaleout + DELETE + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${PAP_PORT}/policy/pap/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + + + + ${POLICY_PDPX_HOST} + ${PAP_PORT} + https + + policy/pap/v1/pdps/policies/guard.frequency.scaleout + DELETE + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${PAP_PORT}/policy/pap/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + + + + ${POLICY_PDPX_HOST} + ${API_PORT} + https + + policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.scaleout.tca/versions/1.0.0 + DELETE + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${API_PORT}/policy/api/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + + + + ${POLICY_PDPX_HOST} + ${API_PORT} + https + + policy/api/v1/policytypes/onap.policies.controlloop.guard.MinMax/versions/1.0.0/policies/guard.minmax.scaleout/versions/1.0.0 + DELETE + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${API_PORT}/policy/api/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + + + + ${POLICY_PDPX_HOST} + ${API_PORT} + https + + policy/api/v1/policytypes/onap.policies.controlloop.guard.FrequencyLimiter/versions/1.0.0/policies/guard.frequency.scaleout/versions/1.0.0 + DELETE + true + false + true + false + + + + + + + + + https://${POLICY_PDPX_HOST}:${API_PORT}/policy/api/v1 + healthcheck + zb!XztG34 + + + + + true + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + /tmp/pdpx_stability_teardown.log + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + /tmp/pdpx_stability_summaryReport.log + true + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + /tmp/pdpx_stabilty_resultsTree.log + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + /tmp/pdpx_stability_resultsTable.log + +