diff options
-rwxr-xr-x | testsuites/run-s3p-test.sh | 58 | ||||
-rw-r--r-- | testsuites/stability/src/main/resources/s3p.jmx | 2978 |
2 files changed, 1400 insertions, 1636 deletions
diff --git a/testsuites/run-s3p-test.sh b/testsuites/run-s3p-test.sh index 8af1c9291..0523876e6 100755 --- a/testsuites/run-s3p-test.sh +++ b/testsuites/run-s3p-test.sh @@ -1,6 +1,6 @@ #!/bin/bash # ============LICENSE_START======================================================= -# Copyright (C) 2023 Nordix Foundation. All rights reserved. +# Copyright (C) 2023-2025 Nordix Foundation. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,28 +22,44 @@ if [ -z "${WORKSPACE}" ]; then export WORKSPACE=$(git rev-parse --show-toplevel) fi +export PROJECT="drools-pdp" export TESTDIR=${WORKSPACE}/testsuites export DROOLS_PERF_TEST_FILE=$TESTDIR/performance/src/main/resources/amsterdam/policyMTPerformanceTestPlan.jmx export DROOLS_STAB_TEST_FILE=$TESTDIR/stability/src/main/resources/s3p.jmx -if [ $1 == "run" ] -then - - mkdir automate-performance;cd automate-performance; - git clone "https://gerrit.onap.org/r/policy/docker" - cd docker/csit - - if [ $2 == "performance" ] - then - bash start-s3p-tests.sh run $DROOLS_PERF_TEST_FILE drools-applications; - elif [ $2 == "stability" ] - then - bash start-s3p-tests.sh run $DROOLS_STAB_TEST_FILE drools-applications; - else - echo "echo Invalid arguments provided. Usage: $0 [option..] {performance | stability}" - fi - -else - echo "Invalid arguments provided. Usage: $0 [option..] {run | uninstall}" -fi +function run_tests() { + local test_file=$1 + + mkdir -p automate-s3p-test + cd automate-s3p-test || exit 1 + git clone "https://gerrit.onap.org/r/policy/docker" + cd docker/csit || exit 1 + + bash run-s3p-tests.sh test "$test_file" $PROJECT +} + +function clean() { + cd $TESTDIR/automate-s3p-test/docker/csit + bash run-s3p-tests.sh clean +} + +echo "===========================" +echo "Running tests for: $PROJECT" +echo "===========================" + +case $1 in + performance) + run_tests "$DROOLS_PERF_TEST_FILE" + ;; + stability) + run_tests "$DROOLS_STAB_TEST_FILE" + ;; + clean) + clean + ;; + *) + echo "Invalid arguments provided. Usage: $0 {performance | stability | clean}" + exit 1 + ;; +esac diff --git a/testsuites/stability/src/main/resources/s3p.jmx b/testsuites/stability/src/main/resources/s3p.jmx index c4ebb7ae9..cde152771 100644 --- a/testsuites/stability/src/main/resources/s3p.jmx +++ b/testsuites/stability/src/main/resources/s3p.jmx @@ -1,11 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.2"> +<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.3"> <hashTree> - <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="PDP-D Stability" enabled="true"> - <boolProp name="TestPlan.functional_mode">false</boolProp> + <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="PDP-D Stability"> <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp> - <boolProp name="TestPlan.serialize_threadgroups">false</boolProp> - <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> + <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> <collectionProp name="Arguments.arguments"> <elementProp name="API_HOST" elementType="Argument"> <stringProp name="Argument.name">API_HOST</stringProp> @@ -34,7 +32,7 @@ </elementProp> <elementProp name="KAFKA_PORT" elementType="Argument"> <stringProp name="Argument.name">KAFKA_PORT</stringProp> - <stringProp name="Argument.value">9092</stringProp> + <stringProp name="Argument.value">29092</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> <elementProp name="DROOLS_HOST" elementType="Argument"> @@ -54,14 +52,14 @@ </elementProp> <elementProp name="HTTP" elementType="Argument"> <stringProp name="Argument.name">HTTP</stringProp> - <stringProp name="Argument.value">https</stringProp> + <stringProp name="Argument.value">http</stringProp> <stringProp name="Argument.metadata">=</stringProp> </elementProp> </collectionProp> </elementProp> </TestPlan> <hashTree> - <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> + <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager"> <collectionProp name="HeaderManager.headers"> <elementProp name="" elementType="Header"> <stringProp name="Header.name">Accept</stringProp> @@ -102,52 +100,41 @@ </AuthManager> <hashTree/> <ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="true"> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> <stringProp name="HTTPSampler.port">9696</stringProp> <stringProp name="HTTPSampler.protocol">http</stringProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> + <collectionProp name="Arguments.arguments"/> + </elementProp> + <stringProp name="HTTPSampler.implementation"></stringProp> </ConfigTestElement> <hashTree/> - <SetupThreadGroup guiclass="SetupThreadGroupGui" testclass="SetupThreadGroup" testname="Set up" enabled="true"> + <SetupThreadGroup guiclass="SetupThreadGroupGui" testclass="SetupThreadGroup" testname="Set up"> + <intProp name="ThreadGroup.num_threads">1</intProp> + <intProp name="ThreadGroup.ramp_time">1</intProp> + <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp> <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> - <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> + <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller"> <stringProp name="LoopController.loops">1</stringProp> <boolProp name="LoopController.continue_forever">false</boolProp> </elementProp> - <stringProp name="ThreadGroup.num_threads">1</stringProp> - <stringProp name="ThreadGroup.ramp_time">1</stringProp> - <boolProp name="ThreadGroup.scheduler">false</boolProp> - <stringProp name="ThreadGroup.duration"></stringProp> - <stringProp name="ThreadGroup.delay"></stringProp> - <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp> </SetupThreadGroup> <hashTree> <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="API" enabled="true"/> <hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="API Healthcheck" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="API Healthcheck"> + <intProp name="HTTPSampler.concurrentPool">6</intProp> <stringProp name="HTTPSampler.domain">${API_HOST}</stringProp> <stringProp name="HTTPSampler.port">${API_PORT}</stringProp> <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> <stringProp name="HTTPSampler.path">/policy/api/v1/healthcheck</stringProp> <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> + <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> + <collectionProp name="Arguments.arguments"/> + </elementProp> </HTTPSamplerProxy> <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion"> <collectionProp name="Asserion.test_strings"> <stringProp name="49586">200</stringProp> </collectionProp> @@ -157,7 +144,7 @@ <intProp name="Assertion.test_type">8</intProp> </ResponseAssertion> <hashTree/> - <JSONPathAssertion guiclass="JSONPathAssertionGui" testclass="JSONPathAssertion" testname="JSON Assertion" enabled="true"> + <JSONPathAssertion guiclass="JSONPathAssertionGui" testclass="JSONPathAssertion" testname="JSON Assertion"> <stringProp name="JSON_PATH">$.healthy</stringProp> <stringProp name="EXPECTED_VALUE">true</stringProp> <boolProp name="JSONVALIDATION">true</boolProp> @@ -167,7 +154,13 @@ </JSONPathAssertion> <hashTree/> </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Create vCPE Policy" enabled="true"> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Create vCPE Policy"> + <intProp name="HTTPSampler.concurrentPool">6</intProp> + <stringProp name="HTTPSampler.domain">${API_HOST}</stringProp> + <stringProp name="HTTPSampler.port">${API_PORT}</stringProp> + <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> + <stringProp name="HTTPSampler.path">policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> <collectionProp name="Arguments.arguments"> @@ -222,26 +215,11 @@ </elementProp> </collectionProp> </elementProp> - <stringProp name="HTTPSampler.domain">${API_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${API_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies</stringProp> - <stringProp name="HTTPSampler.method">POST</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> </HTTPSamplerProxy> <hashTree> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> + <stringProp name="49587">201</stringProp> </collectionProp> <stringProp name="Assertion.custom_message"></stringProp> <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> @@ -251,6 +229,12 @@ <hashTree/> </hashTree> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Create 5G SON O1 Policy" enabled="true"> + <intProp name="HTTPSampler.concurrentPool">6</intProp> + <stringProp name="HTTPSampler.domain">${API_HOST}</stringProp> + <stringProp name="HTTPSampler.port">${API_PORT}</stringProp> + <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> + <stringProp name="HTTPSampler.path">policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> <collectionProp name="Arguments.arguments"> @@ -305,26 +289,11 @@ </elementProp> </collectionProp> </elementProp> - <stringProp name="HTTPSampler.domain">${API_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${API_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies</stringProp> - <stringProp name="HTTPSampler.method">POST</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> </HTTPSamplerProxy> <hashTree> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> + <stringProp name="49587">201</stringProp> </collectionProp> <stringProp name="Assertion.custom_message"></stringProp> <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> @@ -334,6 +303,12 @@ <hashTree/> </hashTree> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Create 5G SON A1 Policy" enabled="true"> + <intProp name="HTTPSampler.concurrentPool">6</intProp> + <stringProp name="HTTPSampler.domain">${API_HOST}</stringProp> + <stringProp name="HTTPSampler.port">${API_PORT}</stringProp> + <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> + <stringProp name="HTTPSampler.path">policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> <collectionProp name="Arguments.arguments"> @@ -388,26 +363,11 @@ </elementProp> </collectionProp> </elementProp> - <stringProp name="HTTPSampler.domain">${API_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${API_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies</stringProp> - <stringProp name="HTTPSampler.method">POST</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> </HTTPSamplerProxy> <hashTree> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> + <stringProp name="49587">201</stringProp> </collectionProp> <stringProp name="Assertion.custom_message"></stringProp> <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> @@ -417,31 +377,22 @@ <hashTree/> </hashTree> </hashTree> - <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="PAP" enabled="true"/> + <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="PAP"/> <hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="PAP Healthcheck" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="PAP Healthcheck"> + <intProp name="HTTPSampler.concurrentPool">6</intProp> <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp> <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp> <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> <stringProp name="HTTPSampler.path">/policy/pap/v1/healthcheck</stringProp> <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> + <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> + <collectionProp name="Arguments.arguments"/> + </elementProp> </HTTPSamplerProxy> <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion"> <collectionProp name="Asserion.test_strings"> <stringProp name="49586">200</stringProp> </collectionProp> @@ -451,7 +402,7 @@ <intProp name="Assertion.test_type">8</intProp> </ResponseAssertion> <hashTree/> - <JSONPathAssertion guiclass="JSONPathAssertionGui" testclass="JSONPathAssertion" testname="JSON Assertion" enabled="true"> + <JSONPathAssertion guiclass="JSONPathAssertionGui" testclass="JSONPathAssertion" testname="JSON Assertion"> <stringProp name="JSON_PATH">$.healthy</stringProp> <stringProp name="EXPECTED_VALUE">true</stringProp> <boolProp name="JSONVALIDATION">true</boolProp> @@ -461,7 +412,13 @@ </JSONPathAssertion> <hashTree/> </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Deploy vCPE Policy" enabled="true"> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Deploy vCPE Policy"> + <intProp name="HTTPSampler.concurrentPool">6</intProp> + <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp> + <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp> + <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> + <stringProp name="HTTPSampler.path">policy/pap/v1/pdps/policies</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> <collectionProp name="Arguments.arguments"> @@ -472,24 +429,9 @@ </elementProp> </collectionProp> </elementProp> - <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">policy/pap/v1/pdps/policies</stringProp> - <stringProp name="HTTPSampler.method">POST</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> </HTTPSamplerProxy> <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> + <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion"> <collectionProp name="Asserion.test_strings"> <stringProp name="49588">202</stringProp> </collectionProp> @@ -500,7 +442,13 @@ </ResponseAssertion> <hashTree/> </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Deploy 5G SON O1" enabled="true"> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Deploy 5G SON O1"> + <intProp name="HTTPSampler.concurrentPool">6</intProp> + <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp> + <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp> + <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> + <stringProp name="HTTPSampler.path">policy/pap/v1/pdps/policies</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> <collectionProp name="Arguments.arguments"> @@ -511,21 +459,6 @@ </elementProp> </collectionProp> </elementProp> - <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">policy/pap/v1/pdps/policies</stringProp> - <stringProp name="HTTPSampler.method">POST</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> </HTTPSamplerProxy> <hashTree> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> @@ -539,7 +472,13 @@ </ResponseAssertion> <hashTree/> </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Deploy 5G SON A1" enabled="true"> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Deploy 5G SON A1"> + <intProp name="HTTPSampler.concurrentPool">6</intProp> + <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp> + <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp> + <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> + <stringProp name="HTTPSampler.path">policy/pap/v1/pdps/policies</stringProp> + <stringProp name="HTTPSampler.method">POST</stringProp> <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> <collectionProp name="Arguments.arguments"> @@ -550,21 +489,6 @@ </elementProp> </collectionProp> </elementProp> - <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">policy/pap/v1/pdps/policies</stringProp> - <stringProp name="HTTPSampler.method">POST</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> </HTTPSamplerProxy> <hashTree> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> @@ -579,425 +503,19 @@ <hashTree/> </hashTree> </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POLICY-PDP-PAP " enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/policy-pdp-pap/${__time()}/1?timeout=2000</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Drain vCPE success appc-lcm-read" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/appc-lcm-read/vcpesuccess/1?timeout=5000</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Drain vCPE success policy-cl-mgt" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/policy-cl-mgt/vcpesuccess/1?timeout=5000</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Drain SON 01 SDNR-CL" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/SDNR-CL/sonO1/1?timeout=5000</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Drain SON 01 SDNR-CL-RSP" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/SDNR-CL-RSP/sonO1/1?timeout=5000</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Drain SON 01 DCAE_CL_RSP" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/DCAE_CL_RSP/son01/1?timeout=5000</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Drain SON A1 SDNR-CL" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/SDNR-CL/sonA1/1?timeout=5000</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Drain SON A1 SDNR-CL-RSP" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/SDNR-CL-RSP/sonA1/1?timeout=5000</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Drain SON A1 DCAE_CL_RSP" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/DCAE_CL_RSP/sonA1/1?timeout=5000</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Drain SON A1 policy-cl-mgt" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/policy-cl-mgt/sonA1/1?timeout=5000</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Drain SON A1 policy-cl-mgt" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/policy-cl-mgt/sonA1/1?timeout=5000</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - </ResponseAssertion> - <hashTree/> - </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="PDP-D" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> - <stringProp name="HTTPSampler.domain">${DROOLS_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${DROOLS_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">policy/pdp/engine/controllers/usecases/drools/facts</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="49586">200</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_code</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">8</intProp> - </ResponseAssertion> - <hashTree/> - <JSONPathAssertion guiclass="JSONPathAssertionGui" testclass="JSONPathAssertion" testname="JSON Assertion" enabled="true"> - <stringProp name="JSON_PATH">$.usecases</stringProp> - <stringProp name="EXPECTED_VALUE">7</stringProp> - <boolProp name="JSONVALIDATION">true</boolProp> - <boolProp name="EXPECT_NULL">false</boolProp> - <boolProp name="INVERT">false</boolProp> - <boolProp name="ISREGEX">false</boolProp> - </JSONPathAssertion> - <hashTree/> - </hashTree> </hashTree> - <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="vCPE Success" enabled="true"> - <stringProp name="ThreadGroup.on_sample_error">startnextloop</stringProp> - <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="vCPE SUCCESS"> + <intProp name="ThreadGroup.num_threads">1</intProp> + <intProp name="ThreadGroup.ramp_time">1</intProp> + <stringProp name="ThreadGroup.duration">${duration}</stringProp> + <longProp name="ThreadGroup.delay">11</longProp> + <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp> + <boolProp name="ThreadGroup.scheduler">true</boolProp> + <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> + <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller"> <intProp name="LoopController.loops">-1</intProp> <boolProp name="LoopController.continue_forever">false</boolProp> </elementProp> - <stringProp name="ThreadGroup.num_threads">1</stringProp> - <stringProp name="ThreadGroup.ramp_time">1</stringProp> - <boolProp name="ThreadGroup.scheduler">true</boolProp> - <stringProp name="ThreadGroup.duration">${duration}</stringProp> - <stringProp name="ThreadGroup.delay">11</stringProp> - <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp> - <boolProp name="ThreadGroup.delayedStart">false</boolProp> </ThreadGroup> <hashTree> <UserParameters guiclass="UserParametersGui" testclass="UserParameters" testname="Set consumer group per scenario" enabled="true"> @@ -1013,7 +531,7 @@ <stringProp name="TestPlan.comments">Global to the thread group</stringProp> </UserParameters> <hashTree/> - <UserParameters guiclass="UserParametersGui" testclass="UserParameters" testname="Set request id per cycle" enabled="true"> + <UserParameters guiclass="UserParametersGui" testclass="UserParameters" testname="Set request id per cycle"> <collectionProp name="UserParameters.names"> <stringProp name="693933066">requestId</stringProp> </collectionProp> @@ -1026,60 +544,65 @@ <stringProp name="TestPlan.comments">Update on a per iteration basis</stringProp> </UserParameters> <hashTree/> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="DCAE[DCAE_TOPIC]: ONSET" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> - <collectionProp name="Arguments.arguments"> - <elementProp name="" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">false</boolProp> - <stringProp name="Argument.value">{
 - "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",
 - "closedLoopAlarmStart": 1463679805324,
 - "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca",
 - "closedLoopEventStatus": "ONSET",
 - "requestID": "${requestId}",
 - "target_type": "VNF",
 - "target": "generic-vnf.vnf-id",
 - "AAI": {
 - "vserver.is-closed-loop-disabled": "false",
 - "vserver.prov-status": "ACTIVE",
 - "generic-vnf.vnf-id": "vCPE_Infrastructure_vGMUX_demo_app"
 - },
 - "from": "DCAE",
 - "version": "1.0.2"
 -}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> - </collectionProp> - </elementProp> - <stringProp name="HTTPSampler.domain">${DROOLS_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${DROOLS_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">policy/pdp/engine/topics/sources/dmaap/dcae_topic/events</stringProp> - <stringProp name="HTTPSampler.method">PUT</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> - <collectionProp name="HeaderManager.headers"> - <elementProp name="" elementType="Header"> - <stringProp name="Header.name">Content-Type</stringProp> - <stringProp name="Header.value">text/plain</stringProp> - </elementProp> - </collectionProp> - </HeaderManager> - <hashTree/> - </hashTree> - <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Init DMaaP Counter" enabled="true"> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="DCAE[dcae-topic]: ONSET"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import org.apache.kafka.clients.producer.KafkaProducer +import org.apache.kafka.clients.producer.ProducerConfig +import org.apache.kafka.clients.producer.ProducerRecord +import org.apache.kafka.common.serialization.StringSerializer + +// Kafka producer configuration +def props = new Properties() +props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, vars.get("KAFKA_HOST") + ":" + vars.get("KAFKA_PORT")) +props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()) +props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()) +props.put(ProducerConfig.CLIENT_ID_CONFIG, "dcae-topic-producer") + +// Create Kafka producer +def producer = new KafkaProducer<>(props) + +// Prepare the message +def message = """ +{ + "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", + "closedLoopAlarmStart": 1463679805324, + "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca", + "closedLoopEventStatus": "ONSET", + "requestID": "${requestId}", + "target_type": "VNF", + "target": "generic-vnf.vnf-id", + "AAI": { + "vserver.is-closed-loop-disabled": "false", + "vserver.prov-status": "ACTIVE", + "generic-vnf.vnf-id": "vCPE_Infrastructure_vGMUX_demo_app" + }, + "from": "DCAE", + "version": "1.0.2" +} +""".toString() + +// Create a producer record +def record = new ProducerRecord<>("unauthenticated.dcae_cl_output", vars.get("requestId").toString(), message) + +// Send the message +def future = producer.send(record) + +// Wait for the send to complete and log the result +def metadata = future.get() +log.info("Message sent to topic: ${metadata.topic()}, partition: ${metadata.partition()}, offset: ${metadata.offset()}") + +// Close the producer +producer.close() + +// Set a variable to indicate successful sending +vars.put("messageSent", "true") +</stringProp> + </JSR223Sampler> + <hashTree/> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Init Kafka Counter"> <stringProp name="scriptLanguage">groovy</stringProp> <stringProp name="parameters"></stringProp> <stringProp name="filename"></stringProp> @@ -1087,318 +610,403 @@ <stringProp name="script">vars.put("counter", "0");</stringProp> </JSR223Sampler> <hashTree/> - <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="APPCL Restart Loop Controller" enabled="true"> - <stringProp name="WhileController.condition">${__javaScript(${counter} < 10)}</stringProp> - </WhileController> + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="APPCL Restart Loop Controller"> + <stringProp name="LoopController.loops">10</stringProp> + </LoopController> <hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POLICY[appc-lcm-read]: Restart" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"> - <elementProp name="filter" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">true</boolProp> - <stringProp name="Argument.value">{"class":"And", "filters": [ { "class":"Equals", "field":"request-id", "value":"${requestId}" }, { "class":"Equals", "field":"rpc-name", "value":"restart" }]}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - <boolProp name="HTTPArgument.use_equals">true</boolProp> - <stringProp name="Argument.name">filter</stringProp> - </elementProp> - </collectionProp> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/appc-lcm-read/${consumerGroup}/1?timeout=15000&limit=1</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Read kafka topic"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import org.apache.kafka.clients.consumer.KafkaConsumer +import org.apache.kafka.clients.consumer.ConsumerConfig +import org.apache.kafka.common.serialization.StringDeserializer +import java.time.Duration + +// Kafka consumer configuration +def props = new Properties() +props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, vars.get("KAFKA_HOST") + ":" + vars.get("KAFKA_PORT")) +props.put(ConsumerConfig.GROUP_ID_CONFIG, vars.get("consumerGroup")) +props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest") + +// Create Kafka consumer +def consumer = new KafkaConsumer<>(props) + +try { + // Subscribe to the topic + consumer.subscribe(Arrays.asList("appc-lcm-read")) + + // Poll for records + def records = consumer.poll(Duration.ofMillis(15000)) + + if (records.isEmpty()) { + log.warn("No records found within the timeout period") + vars.put("messageConsumed", "false") + } else { + // Process the first record + def record = records.first() + def requestId = record.key() + def value = record.value() + + // Store the entire message + vars.put("kafkaMessage", value) + + // Parse the value + def jsonSlurper = new groovy.json.JsonSlurper() + def parsedValue = jsonSlurper.parseText(value) + + // Extract required fields + vars.put("requestIdOnset", parsedValue["request-id"]) + vars.put("correlationId", parsedValue["correlation-id"]) + vars.put("subRequestId", parsedValue["sub-request-id"]) + + // Log the extracted information + log.info("RequestId: " + requestId) + log.info("Parsed Value: " + parsedValue) + + vars.put("messageConsumed", "true") + } +} catch (Exception e) { + log.error("Error processing Kafka message: " + e.getMessage()) + vars.put("messageConsumed", "false") +} finally { + // Close the consumer + consumer.close() +} +</stringProp> + </JSR223Sampler> <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="No []" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="2914">[]</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">12</intProp> - </ResponseAssertion> - <hashTree/> - <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="request-id extractor" enabled="true"> - <stringProp name="RegexExtractor.useHeaders">false</stringProp> - <stringProp name="RegexExtractor.refname">requestIdOnset</stringProp> - <stringProp name="RegexExtractor.regex">\\"request-id\\": \\"(.+?)\\"</stringProp> - <stringProp name="RegexExtractor.template">$1$</stringProp> - <stringProp name="RegexExtractor.default">none</stringProp> - <boolProp name="RegexExtractor.default_empty_value">false</boolProp> - </RegexExtractor> - <hashTree/> - <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="correlation-id extractor" enabled="true"> - <stringProp name="RegexExtractor.useHeaders">false</stringProp> - <stringProp name="RegexExtractor.refname">correlationId</stringProp> - <stringProp name="RegexExtractor.regex">correlation-id\\": \\"(.+?)\\"</stringProp> - <stringProp name="RegexExtractor.template">$1$</stringProp> - <stringProp name="RegexExtractor.default">none</stringProp> - <boolProp name="RegexExtractor.default_empty_value">false</boolProp> - </RegexExtractor> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="requestId extractor"> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="script">import groovy.json.JsonSlurper + +def message = vars.get("kafkaMessage") +def jsonSlurper = new JsonSlurper() +def parsedMessage = jsonSlurper.parseText(message) + +vars.put("requestIdOnset", parsedMessage.requestId ?: "none") +</stringProp> + <stringProp name="scriptLanguage">groovy</stringProp> + </JSR223PostProcessor> <hashTree/> - <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="sub-request-id extractor" enabled="true"> - <stringProp name="RegexExtractor.useHeaders">false</stringProp> - <stringProp name="RegexExtractor.refname">subRequestId</stringProp> - <stringProp name="RegexExtractor.regex">sub-request-id\\": \\"(.+?)\\"</stringProp> - <stringProp name="RegexExtractor.template">$1$</stringProp> - <stringProp name="RegexExtractor.default">none</stringProp> - <boolProp name="RegexExtractor.default_empty_value">false</boolProp> - </RegexExtractor> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="notification extractor"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import groovy.json.JsonSlurper + +def message = vars.get("kafkaMessage") +def jsonSlurper = new JsonSlurper() +def parsedMessage = jsonSlurper.parseText(message) + +vars.put("notification", parsedMessage.notification ?: "none") +</stringProp> + </JSR223PostProcessor> <hashTree/> - <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true"> + <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion"> <stringProp name="scriptLanguage">groovy</stringProp> <stringProp name="parameters"></stringProp> <stringProp name="filename"></stringProp> <stringProp name="cacheKey">true</stringProp> - <stringProp name="script">String requestIdOnset = vars.get("requestIdOnset"); -String requestId = vars.get("requestId"); -String correlationId = vars.get("correlationId"); -String subRequestId = vars.get("subRequestId"); -String counter = vars.get("counter"); - -String transaction = "none"; - -log.info ("The requestId id is " + requestId); -log.info ("The requestIdOnset id is " + requestIdOnset); -log.info ("The correlation id is " + correlationId); -log.info ("The subrequest id is " + subRequestId); -log.info ("The counter is " + counter); - -if ( requestId == requestIdOnset ) { - if ( correlationId == "none" || subRequestId == "none" ) { - transaction = "FINAL"; - log.info ("Final Failure Transaction"); - AssertionResult.setFailureMessage("Missing correlationId or subRequestId"); - AssertionResult.setFailure(true); - } else { - transaction = "FINAL"; - vars.put("transaction", "FINAL"); - log.info ("Final Success Transaction"); - } + <stringProp name="script">import org.apache.kafka.clients.consumer.ConsumerRecord + +// Assuming the Kafka message is stored in a variable named 'kafkaMessage' +ConsumerRecord<String, String> record = vars.getObject("kafkaMessage") + +String requestIdOnset = record.key() +String requestId = vars.get("requestId") +String correlationId = "none" +String subRequestId = "none" +String counter = vars.get("counter") + +String transaction = "none" + +// Parse the Kafka message value (assuming it's JSON) +def jsonSlurper = new groovy.json.JsonSlurper() +def messageContent = jsonSlurper.parseText(record.value()) + +if (messageContent.containsKey("correlation-id")) { + correlationId = messageContent["correlation-id"] +} +if (messageContent.containsKey("sub-request-id")) { + subRequestId = messageContent["sub-request-id"] } -int counterTemp = Integer.parseInt(counter) +1; +log.info("The requestId is " + requestId) +log.info("The requestIdOnset is " + requestIdOnset) +log.info("The correlation id is " + correlationId) +log.info("The subrequest id is " + subRequestId) +log.info("The counter is " + counter) + +if (requestId == requestIdOnset) { + if (correlationId == "none" || subRequestId == "none") { + transaction = "FINAL" + log.info("Final Failure Transaction") + AssertionResult.setFailureMessage("Missing correlationId or subRequestId") + AssertionResult.setFailure(true) + } else { + transaction = "FINAL" + vars.put("transaction", "FINAL") + log.info("Final Success Transaction") + } +} + +int counterTemp = Integer.parseInt(counter) + 1 if (transaction == "FINAL") { - counterTemp = 99; + counterTemp = 99 } else if (counterTemp >= 10) { - AssertionResult.setFailureMessage("vCPE Success APPCL Failure, reached maximum number of 10 attempts "); - AssertionResult.setFailure(true); + AssertionResult.setFailureMessage("vCPE Success APPCL Failure, reached maximum number of 10 attempts") + AssertionResult.setFailure(true) } -vars.put("counter", Integer.toString(counterTemp)); - +vars.put("counter", Integer.toString(counterTemp)) </stringProp> </JSR223Assertion> <hashTree/> </hashTree> </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="APPC[appc-lcm-read]: SUCCESS" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> - <collectionProp name="Arguments.arguments"> - <elementProp name="" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">false</boolProp> - <stringProp name="Argument.value">{
 - "body": {
 - "output": {
 - "common-header": {
 - "timestamp": "2020-05-05T15:56:34.845Z",
 - "api-ver": "2.00",
 - "originator-id": "${requestId}",
 - "request-id": "${requestId}",
 - "sub-request-id": "${subRequestId}",
 - "flags": {}
 - },
 - "status": {
 - "code": 400,
 - "message": "Restart Successful"
 - }
 - }
 - },
 - "version": "2.0",
 - "rpc-name": "restart",
 - "correlation-id": "${correlationId}",
 - "type": "response"
 -}
 -</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> - </collectionProp> - </elementProp> - <stringProp name="HTTPSampler.domain">${DROOLS_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${DROOLS_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">policy/pdp/engine/topics/sources/dmaap/appc-lcm-write/events</stringProp> - <stringProp name="HTTPSampler.method">PUT</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> - <collectionProp name="HeaderManager.headers"> - <elementProp name="" elementType="Header"> - <stringProp name="Header.name">Content-Type</stringProp> - <stringProp name="Header.value">text/plain</stringProp> - </elementProp> - </collectionProp> - </HeaderManager> - <hashTree/> - </hashTree> - <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Init DMaaP Counter" enabled="true"> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="APPC [appc-lcm-read]: SUCCESS"> <stringProp name="scriptLanguage">groovy</stringProp> <stringProp name="parameters"></stringProp> <stringProp name="filename"></stringProp> <stringProp name="cacheKey">true</stringProp> - <stringProp name="script">vars.put("counter", "0");</stringProp> + <stringProp name="script">import org.apache.kafka.clients.producer.KafkaProducer +import org.apache.kafka.clients.producer.ProducerConfig +import org.apache.kafka.clients.producer.ProducerRecord +import org.apache.kafka.common.serialization.StringSerializer + +// Kafka producer configuration +def props = new Properties() +props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, vars.get("KAFKA_HOST") + ":" + vars.get("KAFKA_PORT")) +props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()) +props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()) +props.put(ProducerConfig.CLIENT_ID_CONFIG, "appc-lcm-write-producer") + +// Create Kafka producer +def producer = new KafkaProducer<>(props) + +// Prepare the message +def message = """ +{ + "body": { + "output": { + "common-header": { + "timestamp": "${new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", TimeZone.getTimeZone("UTC"))}", + "api-ver": "2.00", + "originator-id": "${vars.get("requestId")}", + "request-id": "${vars.get("requestId")}", + "sub-request-id": "${vars.get("subRequestId")}", + "flags": {} + }, + "status": { + "code": 400, + "message": "Restart Successful" + } + } + }, + "version": "2.0", + "rpc-name": "restart", + "correlation-id": "${vars.get("correlationId")}", + "type": "response" +} +""".toString() + +// Create a producer record +def record = new ProducerRecord<>("appc-lcm-write", vars.get("requestId").toString(), message) + +// Send the message +def future = producer.send(record) + +// Wait for the send to complete and log the result +def metadata = future.get() +log.info("Message sent to topic: ${metadata.topic()}, partition: ${metadata.partition()}, offset: ${metadata.offset()}") + +// Close the producer +producer.close() + +// Set a variable to indicate successful sending +vars.put("messageSent", "true") +</stringProp> </JSR223Sampler> <hashTree/> - <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="Final Success Controller" enabled="true"> + <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="Final Success Controller"> <stringProp name="WhileController.condition">${__javaScript(${counter} < 60)}</stringProp> </WhileController> <hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POLICY[policy-cl-mgt]: FINAL_SUCCESS" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"> - <elementProp name="filter" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">true</boolProp> - <stringProp name="Argument.value">{"class":"And", "filters": [ { "class":"Equals", "field":"requestId", "value":"${requestId}" }, { "class":"Equals", "field":"notification", "value":"FINAL: SUCCESS" }]}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - <boolProp name="HTTPArgument.use_equals">true</boolProp> - <stringProp name="Argument.name">filter</stringProp> - </elementProp> - </collectionProp> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/policy-cl-mgt/${consumerGroup}/1?timeout=15000&limit=1</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="POLICY [policy-cl-mgt]: FINAL_SUCCESS"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import org.apache.kafka.clients.consumer.KafkaConsumer +import org.apache.kafka.clients.consumer.ConsumerConfig +import org.apache.kafka.common.serialization.StringDeserializer +import java.time.Duration + +// Kafka consumer configuration +def props = new Properties() +props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, vars.get("KAFKA_HOST") + ":" + vars.get("KAFKA_PORT")) +props.put(ConsumerConfig.GROUP_ID_CONFIG, vars.get("consumerGroup")) +props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest") + +// Create Kafka consumer +def consumer = new KafkaConsumer<>(props) + +// Subscribe to the topic +consumer.subscribe(Arrays.asList("policy-cl-mgt")) + +// Initialize variables +def maxAttempts = 60 +def attempts = 0 +def success = false + +// Poll for records +while (attempts < maxAttempts && !success) { + def records = consumer.poll(Duration.ofMillis(15000)) + + for (record in records) { + def value = record.value() + log.info("Received message: " + value) + + // Parse the value + def jsonSlurper = new groovy.json.JsonSlurper() + def parsedValue = jsonSlurper.parseText(value) + + // Extract required fields + def requestId = parsedValue.requestId + def notification = parsedValue.notification + + // Check if this is the message we're looking for + if (requestId == vars.get("requestId") && notification == "FINAL: SUCCESS") { + success = true + log.info("Final Success: RequestId=" + requestId + ", Notification=" + notification) + break + } + } + + attempts++ + if (!success) { + log.info("Attempt " + attempts + " of " + maxAttempts + " failed to find matching message") + } +} + +// Close the consumer +consumer.close() + +// Set variables based on the result +if (success) { + vars.put("finalStatus", "SUCCESS") +} else { + vars.put("finalStatus", "FAILURE") + AssertionResult.setFailureMessage("Failed to receive FINAL: SUCCESS notification after " + maxAttempts + " attempts") + AssertionResult.setFailure(true) +} +</stringProp> + </JSR223Sampler> <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="No []" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="2914">[]</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">12</intProp> - </ResponseAssertion> - <hashTree/> - <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="requestId extractor" enabled="true"> - <stringProp name="RegexExtractor.useHeaders">false</stringProp> - <stringProp name="RegexExtractor.refname">requestIdOnset</stringProp> - <stringProp name="RegexExtractor.regex">requestId\\": \\"(.+?)\\"</stringProp> - <stringProp name="RegexExtractor.template">$1$</stringProp> - <stringProp name="RegexExtractor.default">none</stringProp> - <boolProp name="RegexExtractor.default_empty_value">false</boolProp> - </RegexExtractor> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="requestId extractor" enabled="true"> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="script">import groovy.json.JsonSlurper + +def message = vars.get("kafkaMessage") +def jsonSlurper = new JsonSlurper() +def parsedMessage = jsonSlurper.parseText(message) + +vars.put("requestIdOnset", parsedMessage.requestId ?: "none") +</stringProp> + <stringProp name="scriptLanguage">groovy</stringProp> + </JSR223PostProcessor> <hashTree/> - <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="notification extractor" enabled="true"> - <stringProp name="RegexExtractor.useHeaders">false</stringProp> - <stringProp name="RegexExtractor.refname">notification</stringProp> - <stringProp name="RegexExtractor.regex">notification\\": \\"FINAL: (.+?)\\"</stringProp> - <stringProp name="RegexExtractor.template">$1$</stringProp> - <stringProp name="RegexExtractor.default">none</stringProp> - <boolProp name="RegexExtractor.default_empty_value">false</boolProp> - </RegexExtractor> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="notification extractor"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import groovy.json.JsonSlurper + +def message = vars.get("kafkaMessage") +def jsonSlurper = new JsonSlurper() +def parsedMessage = jsonSlurper.parseText(message) + +vars.put("notification", parsedMessage.notification ?: "none") +</stringProp> + </JSR223PostProcessor> <hashTree/> <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true"> <stringProp name="scriptLanguage">groovy</stringProp> <stringProp name="parameters"></stringProp> <stringProp name="filename"></stringProp> <stringProp name="cacheKey">true</stringProp> - <stringProp name="script">String requestIdOnset = vars.get("requestIdOnset"); -String requestId = vars.get("requestId"); -String notification = vars.get("notification"); -String counter = vars.get("counter"); - -String transaction = "none"; - -log.info ("The requestId id is " + requestId); -log.info ("The requestIdOnset id is " + requestIdOnset); -log.info ("The notification is " + notification); -log.info ("The transaction is " + transaction); -log.info ("The counter is " + counter); - -if ( requestId == requestIdOnset ) { - if ( notification == "SUCCESS" ) { - transaction = "FINAL"; - log.info ("Final Success Transaction"); - log.info ("The notification is SUCCESS"); - } else if ( notification == "FAILURE" ) { - transaction = "FINAL"; - log.info ("Final Failure Transaction"); - AssertionResult.setFailureMessage("Bad final notification"); - AssertionResult.setFailure(true); - } + <stringProp name="script">import groovy.json.JsonSlurper + +// Parse Kafka message content +def message = vars.get("kafkaMessage") +def jsonSlurper = new JsonSlurper() +def parsedMessage = jsonSlurper.parseText(message) + +// Extract relevant fields +String requestIdOnset = parsedMessage.requestId +String notification = parsedMessage.notification +String requestId = vars.get("requestId") +String counter = vars.get("counter") +String transaction = "none" + +// Log extracted information +log.info("The requestId is " + requestId) +log.info("The requestIdOnset is " + requestIdOnset) +log.info("The notification is " + notification) +log.info("The counter is " + counter) + +// Perform assertions +if (requestId == requestIdOnset) { + if (notification == "SUCCESS") { + transaction = "FINAL" + log.info("Final Success Transaction") + } else if (notification == "FAILURE") { + transaction = "FINAL" + log.info("Final Failure Transaction") + AssertionResult.setFailureMessage("Bad final notification") + AssertionResult.setFailure(true) + } } -int counterTemp = Integer.parseInt(counter) +1; +// Update counter +int counterTemp = Integer.parseInt(counter) + 1 if (transaction == "FINAL") { - counterTemp = 99; + counterTemp = 99 } else if (counterTemp >= 60) { - AssertionResult.setFailureMessage("vCPE Success POLICYCL Failure, reached maximum number of attempts "); - AssertionResult.setFailure(true); + AssertionResult.setFailureMessage("vCPE Success POLICYCL Failure, reached maximum number of attempts") + AssertionResult.setFailure(true) } - -vars.put("counter", Integer.toString(counterTemp));</stringProp> +vars.put("counter", Integer.toString(counterTemp)) +</stringProp> </JSR223Assertion> <hashTree/> </hashTree> </hashTree> - <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Flow Control Action" enabled="true"> - <intProp name="ActionProcessor.action">1</intProp> - <intProp name="ActionProcessor.target">0</intProp> - <stringProp name="ActionProcessor.duration">200</stringProp> - </TestAction> - <hashTree/> </hashTree> - <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="SON O1 Success" enabled="true"> - <stringProp name="ThreadGroup.on_sample_error">startnextloop</stringProp> - <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="SON 01 Success"> + <intProp name="ThreadGroup.num_threads">1</intProp> + <intProp name="ThreadGroup.ramp_time">1</intProp> + <stringProp name="ThreadGroup.duration">${duration}</stringProp> + <longProp name="ThreadGroup.delay">11</longProp> + <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp> + <boolProp name="ThreadGroup.scheduler">true</boolProp> + <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> + <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller"> <intProp name="LoopController.loops">-1</intProp> <boolProp name="LoopController.continue_forever">false</boolProp> </elementProp> - <stringProp name="ThreadGroup.num_threads">1</stringProp> - <stringProp name="ThreadGroup.ramp_time">1</stringProp> - <boolProp name="ThreadGroup.scheduler">true</boolProp> - <stringProp name="ThreadGroup.duration">${duration}</stringProp> - <stringProp name="ThreadGroup.delay">11</stringProp> - <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp> - <boolProp name="ThreadGroup.delayedStart">false</boolProp> </ThreadGroup> <hashTree> <UserParameters guiclass="UserParametersGui" testclass="UserParameters" testname="Set consumer group per scenario" enabled="true"> @@ -1427,385 +1035,482 @@ vars.put("counter", Integer.toString(counterTemp));</stringProp> <stringProp name="TestPlan.comments">Update on a per iteration basis</stringProp> </UserParameters> <hashTree/> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="DCAE[DCAE_TOPIC]: ONSET" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> - <collectionProp name="Arguments.arguments"> - <elementProp name="" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">false</boolProp> - <stringProp name="Argument.value">{
 - "closedLoopControlName": "ControlLoop-SONO1-fb41f388-a5f2-11e8-98d0-529269fb1459",
 - "closedLoopAlarmStart": 1606806580487,
 - "closedLoopEventClient": "microservice.PCI",
 - "closedLoopEventStatus": "ONSET",
 - "requestID": "${requestId}",
 - "target_type": "PNF",
 - "target": "pnf.pnf-name",
 - "AAI": {
 - "generic-vnf.prov-status": "ACTIVE",
 - "generic-vnf.is-closed-loop-disabled": "false",
 - "pnf.pnf-name": "ncserver1"
 - }, 
 - "from": "PCIMS",
 - "version": "1.0.2",
 - "policyName": "SONO1",
 - "policyVersion": "1.0.2",
 - "Action": "ModifyO1Config",
 - "payload": "{\"Configurations\":[{\"data\":{\"FAPService\":{\"alias\":\"Chn0330\",\"X0005b9Lte\":{\"phyCellIdInUse\":6,\"pnfName\":\"ncserver23\"},\"CellConfig\":{\"LTE\":{\"RAN\":{\"Common\":{\"CellIdentity\":\"Chn0330\"}}}}}}},{\"data\":{\"FAPService\":{\"alias\":\"Chn0331\",\"X0005b9Lte\":{\"phyCellIdInUse\":7,\"pnfName\":\"ncserver23\"},\"CellConfig\":{\"LTE\":{\"RAN\":{\"Common\":{\"CellIdentity\":\"Chn0331\"}}}}}}}]}"
 -}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> - </collectionProp> - </elementProp> - <stringProp name="HTTPSampler.domain">${DROOLS_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${DROOLS_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">policy/pdp/engine/topics/sources/dmaap/dcae_topic/events</stringProp> - <stringProp name="HTTPSampler.method">PUT</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> - <collectionProp name="HeaderManager.headers"> - <elementProp name="" elementType="Header"> - <stringProp name="Header.name">Content-Type</stringProp> - <stringProp name="Header.value">text/plain</stringProp> - </elementProp> - </collectionProp> - </HeaderManager> - <hashTree/> - </hashTree> - <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Init DMaaP Counter" enabled="true"> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="DCAE[dcae-topic]: ONSET"> <stringProp name="scriptLanguage">groovy</stringProp> <stringProp name="parameters"></stringProp> <stringProp name="filename"></stringProp> <stringProp name="cacheKey">true</stringProp> - <stringProp name="script">vars.put("counterO1", "0");</stringProp> + <stringProp name="script">import org.apache.kafka.clients.producer.KafkaProducer +import org.apache.kafka.clients.producer.ProducerConfig +import org.apache.kafka.clients.producer.ProducerRecord +import org.apache.kafka.common.serialization.StringSerializer + +// Kafka producer configuration +def props = new Properties() +props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, vars.get("KAFKA_HOST") + ":" + vars.get("KAFKA_PORT")) +props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()) +props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()) +props.put(ProducerConfig.CLIENT_ID_CONFIG, "dcae-topic-producer") + +// Create Kafka producer +def producer = new KafkaProducer<>(props) + +// Prepare the message +def message = """ +{ + "closedLoopControlName": "ControlLoop-SONO1-fb41f388-a5f2-11e8-98d0-529269fb1459", + "closedLoopAlarmStart": 1606806580487, + "closedLoopEventClient": "microservice.PCI", + "closedLoopEventStatus": "ONSET", + "requestID": "${requestId}", + "target_type": "PNF", + "target": "pnf.pnf-name", + "AAI": { + "generic-vnf.prov-status": "ACTIVE", + "generic-vnf.is-closed-loop-disabled": "false", + "pnf.pnf-name": "ncserver1" + }, + "from": "PCIMS", + "version": "1.0.2", + "policyName": "SONO1", + "policyVersion": "1.0.2", + "Action": "ModifyO1Config", + "payload": "{\"Configurations\":[{\"data\":{\"FAPService\":{\"alias\":\"Chn0330\",\"X0005b9Lte\":{\"phyCellIdInUse\":6,\"pnfName\":\"ncserver23\"},\"CellConfig\":{\"LTE\":{\"RAN\":{\"Common\":{\"CellIdentity\":\"Chn0330\"}}}}}}},{\"data\":{\"FAPService\":{\"alias\":\"Chn0331\",\"X0005b9Lte\":{\"phyCellIdInUse\":7,\"pnfName\":\"ncserver23\"},\"CellConfig\":{\"LTE\":{\"RAN\":{\"Common\":{\"CellIdentity\":\"Chn0331\"}}}}}}}]}" +} +""".toString() + +// Create a producer record +def record = new ProducerRecord<>("unauthenticated.dcae_cl_output", vars.get("requestId").toString(), message) + +// Send the message +def future = producer.send(record) + +// Wait for the send to complete and log the result +def metadata = future.get() +log.info("Message sent to topic: ${metadata.topic()}, partition: ${metadata.partition()}, offset: ${metadata.offset()}") + +// Close the producer +producer.close() + +// Set a variable to indicate successful sending +vars.put("messageSent", "true") +</stringProp> </JSR223Sampler> <hashTree/> - <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="SDNR-CL Modify01Config" enabled="true"> - <stringProp name="WhileController.condition">${__javaScript(${counterO1} < 10)}</stringProp> - </WhileController> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Init Kafka Counter"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">vars.put("counter01", "0");</stringProp> + </JSR223Sampler> + <hashTree/> + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="SDNR-CL Modify Config"> + <stringProp name="LoopController.loops">10</stringProp> + </LoopController> <hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POLICY[SDNR-CL]: Modify01Config" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"> - <elementProp name="filter" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">true</boolProp> - <stringProp name="Argument.value">{"class":"And", "filters": [ { "class":"Equals", "field":"request-id", "value":"${requestId}" }, { "class":"Equals", "field":"rpc-name", "value":"modifyo1config" }]}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - <boolProp name="HTTPArgument.use_equals">true</boolProp> - <stringProp name="Argument.name">filter</stringProp> - </elementProp> - </collectionProp> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/SDNR-CL/${consumerGroup}/1?timeout=15000&limit=1</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Read kafka topic"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import org.apache.kafka.clients.consumer.KafkaConsumer +import org.apache.kafka.clients.consumer.ConsumerConfig +import org.apache.kafka.common.serialization.StringDeserializer +import java.time.Duration + +// Kafka consumer configuration +def props = new Properties() +props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, vars.get("KAFKA_HOST") + ":" + vars.get("KAFKA_PORT")) +props.put(ConsumerConfig.GROUP_ID_CONFIG, vars.get("consumerGroup")) +props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest") + +// Create Kafka consumer +def consumer = new KafkaConsumer<>(props) + +try { + // Subscribe to the topic + consumer.subscribe(Arrays.asList("SDNR-CL")) + + // Poll for records + def records = consumer.poll(Duration.ofMillis(15000)) + + if (records.isEmpty()) { + log.warn("No records found within the timeout period") + vars.put("messageConsumed", "false") + } else { + // Process the first record + def record = records.first() + def requestId = record.key() + def value = record.value() + + // Store the entire message + vars.put("kafkaMessage", value) + + // Parse the value + def jsonSlurper = new groovy.json.JsonSlurper() + def parsedValue = jsonSlurper.parseText(value) + + // Extract required fields + vars.put("requestIdOnset", parsedValue["request-id"]) + vars.put("correlationId", parsedValue["correlation-id"]) + vars.put("subRequestId", parsedValue["sub-request-id"]) + + // Log the extracted information + log.info("RequestId: " + requestId) + log.info("Parsed Value: " + parsedValue) + + vars.put("messageConsumed", "true") + } +} catch (Exception e) { + log.error("Error processing Kafka message: " + e.getMessage()) + vars.put("messageConsumed", "false") +} finally { + // Close the consumer + consumer.close() +} +</stringProp> + </JSR223Sampler> <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="No []" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="2914">[]</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">12</intProp> - </ResponseAssertion> - <hashTree/> - <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="request-id extractor" enabled="true"> - <stringProp name="RegexExtractor.useHeaders">false</stringProp> - <stringProp name="RegexExtractor.refname">requestIdOnset</stringProp> - <stringProp name="RegexExtractor.regex">\\"RequestID\\": \\"(.+?)\\"</stringProp> - <stringProp name="RegexExtractor.template">$1$</stringProp> - <stringProp name="RegexExtractor.default">none</stringProp> - <boolProp name="RegexExtractor.default_empty_value">false</boolProp> - </RegexExtractor> - <hashTree/> - <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="correlation-id extractor" enabled="true"> - <stringProp name="RegexExtractor.useHeaders">false</stringProp> - <stringProp name="RegexExtractor.refname">correlationId</stringProp> - <stringProp name="RegexExtractor.regex">correlation-id\\": \\"(.+?)\\"</stringProp> - <stringProp name="RegexExtractor.template">$1$</stringProp> - <stringProp name="RegexExtractor.default">none</stringProp> - <boolProp name="RegexExtractor.default_empty_value">false</boolProp> - </RegexExtractor> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="requestId extractor" enabled="true"> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="script">import groovy.json.JsonSlurper + +def message = vars.get("kafkaMessage") +def jsonSlurper = new JsonSlurper() +def parsedMessage = jsonSlurper.parseText(message) + +vars.put("requestIdOnset", parsedMessage.requestId ?: "none") +</stringProp> + <stringProp name="scriptLanguage">groovy</stringProp> + </JSR223PostProcessor> <hashTree/> - <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="sub-request-id extractor" enabled="true"> - <stringProp name="RegexExtractor.useHeaders">false</stringProp> - <stringProp name="RegexExtractor.refname">subRequestId</stringProp> - <stringProp name="RegexExtractor.regex">SubRequestID\\": \\"(.+?)\\"</stringProp> - <stringProp name="RegexExtractor.template">$1$</stringProp> - <stringProp name="RegexExtractor.default">none</stringProp> - <boolProp name="RegexExtractor.default_empty_value">false</boolProp> - </RegexExtractor> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="notification extractor" enabled="true"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import groovy.json.JsonSlurper + +def message = vars.get("kafkaMessage") +def jsonSlurper = new JsonSlurper() +def parsedMessage = jsonSlurper.parseText(message) + +vars.put("notification", parsedMessage.notification ?: "none") +</stringProp> + </JSR223PostProcessor> <hashTree/> - <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true"> + <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion"> <stringProp name="scriptLanguage">groovy</stringProp> <stringProp name="parameters"></stringProp> <stringProp name="filename"></stringProp> <stringProp name="cacheKey">true</stringProp> - <stringProp name="script">String requestIdOnset = vars.get("requestIdOnset"); -String requestId = vars.get("requestId"); -String correlationId = vars.get("correlationId"); -String subRequestId = vars.get("subRequestId"); -String counter = vars.get("counterO1"); - -String transaction = "none"; - -log.info ("The requestId id is " + requestId); -log.info ("The requestIdOnset id is " + requestIdOnset); -log.info ("The correlation id is " + correlationId); -log.info ("The subrequest id is " + subRequestId); -log.info ("The counter is " + counter); - -if ( requestId == requestIdOnset ) { - if ( correlationId == "none" || subRequestId == "none" ) { - transaction = "FINAL"; - log.info ("Final Failure Transaction"); - AssertionResult.setFailureMessage("Missing correlationId or subRequestId"); - AssertionResult.setFailure(true); - } else { - transaction = "FINAL"; - vars.put("transaction", "FINAL"); - log.info ("Final Success Transaction"); - } + <stringProp name="script">import org.apache.kafka.clients.consumer.ConsumerRecord + +// Assuming the Kafka message is stored in a variable named 'kafkaMessage' +ConsumerRecord<String, String> record = vars.getObject("kafkaMessage") + +String requestIdOnset = record.key() +String requestId = vars.get("requestId") +String correlationId = "none" +String subRequestId = "none" +String counter = vars.get("counter") + +String transaction = "none" + +// Parse the Kafka message value (assuming it's JSON) +def jsonSlurper = new groovy.json.JsonSlurper() +def messageContent = jsonSlurper.parseText(record.value()) + +if (messageContent.containsKey("correlation-id")) { + correlationId = messageContent["correlation-id"] +} +if (messageContent.containsKey("sub-request-id")) { + subRequestId = messageContent["sub-request-id"] } -int counterTemp = Integer.parseInt(counter) +1; +log.info("The requestId is " + requestId) +log.info("The requestIdOnset is " + requestIdOnset) +log.info("The correlation id is " + correlationId) +log.info("The subrequest id is " + subRequestId) +log.info("The counter is " + counter) + +if (requestId == requestIdOnset) { + if (correlationId == "none" || subRequestId == "none") { + transaction = "FINAL" + log.info("Final Failure Transaction") + AssertionResult.setFailureMessage("Missing correlationId or subRequestId") + AssertionResult.setFailure(true) + } else { + transaction = "FINAL" + vars.put("transaction", "FINAL") + log.info("Final Success Transaction") + } +} + +int counterTemp = Integer.parseInt(counter) + 1 if (transaction == "FINAL") { - counterTemp = 99; + counterTemp = 99 } else if (counterTemp >= 10) { - AssertionResult.setFailureMessage("SON 01 Failure, reached maximum number of 10 attempts "); - AssertionResult.setFailure(true); + AssertionResult.setFailureMessage("SON 01 Failure, reached maximum number of 10 attempts") + AssertionResult.setFailure(true) } -vars.put("counterO1", Integer.toString(counterTemp)); - +vars.put("counter01", Integer.toString(counterTemp)) </stringProp> </JSR223Assertion> <hashTree/> </hashTree> </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SDNR[SDNR-CL-RSP]: SUCCESS" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> - <collectionProp name="Arguments.arguments"> - <elementProp name="" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">false</boolProp> - <stringProp name="Argument.value">{
 - "body": {
 - "output": {
 - "CommonHeader": {
 - "TimeStamp": "2022-08-10T07:10:05.614Z",
 - "APIver": "1.0",
 - "RequestID": "${requestId}",
 - "SubRequestID": "${subRequestId}",
 - "RequestTrack": [],
 - "Flags": []
 - },
 - "Status": {
 - "Code": 200,
 - "Value": "SUCCESS"
 - },
 - "Payload": "{ \"Configurations\":[ { \"Status\": { \"Code\": 200, \"Value\": \"SUCCESS\" }, \"data\":{\"FAPService\":{\"alias\":\"Chn0330\",\"X0005b9Lte\":{\"phyCellIdInUse\":6,\"pnfName\":\"ncserver23\"},\"CellConfig\":{\"LTE\":{\"RAN\":{\"Common\":{\"CellIdentity\":\"Chn0330\"}}}}}} } ] }"
 - }
 - },
 - "version": "1.0",
 - "rpc-name": "ModifyO1Config",
 - "correlation-id": "${correlationId}",
 - "type": "response"
 -}
 -
 + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="SDNR[SDNR-CL-RSP]: SUCCESS"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import org.apache.kafka.clients.producer.KafkaProducer +import org.apache.kafka.clients.producer.ProducerConfig +import org.apache.kafka.clients.producer.ProducerRecord +import org.apache.kafka.common.serialization.StringSerializer + +// Kafka producer configuration +def props = new Properties() +props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, vars.get("KAFKA_HOST") + ":" + vars.get("KAFKA_PORT")) +props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()) +props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()) +props.put(ProducerConfig.CLIENT_ID_CONFIG, "sdnr-cl-rsp-producer") + +// Create Kafka producer +def producer = new KafkaProducer<>(props) + +// Prepare the message +def message = """ +{ + "body": { + "output": { + "CommonHeader": { + "TimeStamp": "2022-08-10T07:10:05.614Z", + "APIver": "1.0", + "RequestID": "${requestId}", + "SubRequestID": "${subRequestId}", + "RequestTrack": [], + "Flags": [] + }, + "Status": { + "Code": 200, + "Value": "SUCCESS" + }, + "Payload": "{ \"Configurations\":[ { \"Status\": { \"Code\": 200, \"Value\": \"SUCCESS\" }, \"data\":{\"FAPService\":{\"alias\":\"Chn0330\",\"X0005b9Lte\":{\"phyCellIdInUse\":6,\"pnfName\":\"ncserver23\"},\"CellConfig\":{\"LTE\":{\"RAN\":{\"Common\":{\"CellIdentity\":\"Chn0330\"}}}}}} } ] }" + } + }, + "version": "1.0", + "rpc-name": "ModifyO1Config", + "correlation-id": "${correlationId}", + "type": "response" +} +""".toString() + +// Create a producer record +def record = new ProducerRecord<>("sdnr-cl-rsp", vars.get("requestId").toString(), message) + +// Send the message +def future = producer.send(record) + +// Wait for the send to complete and log the result +def metadata = future.get() +log.info("Message sent to topic: ${metadata.topic()}, partition: ${metadata.partition()}, offset: ${metadata.offset()}") + +// Close the producer +producer.close() + +// Set a variable to indicate successful sending +vars.put("messageSent", "true") </stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> - </collectionProp> - </elementProp> - <stringProp name="HTTPSampler.domain">${DROOLS_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${DROOLS_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">policy/pdp/engine/topics/sources/dmaap/sdnr-cl-rsp/events</stringProp> - <stringProp name="HTTPSampler.method">PUT</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> - <collectionProp name="HeaderManager.headers"> - <elementProp name="" elementType="Header"> - <stringProp name="Header.name">Content-Type</stringProp> - <stringProp name="Header.value">text/plain</stringProp> - </elementProp> - </collectionProp> - </HeaderManager> - <hashTree/> - </hashTree> - <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Init DMaaP Counter" enabled="true"> + </JSR223Sampler> + <hashTree/> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Init Kafka Counter"> <stringProp name="scriptLanguage">groovy</stringProp> <stringProp name="parameters"></stringProp> <stringProp name="filename"></stringProp> <stringProp name="cacheKey">true</stringProp> - <stringProp name="script">vars.put("counterO1", "0");</stringProp> + <stringProp name="script">vars.put("counter01", "0");</stringProp> </JSR223Sampler> <hashTree/> - <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="Final Success Controller" enabled="true"> - <stringProp name="WhileController.condition">${__javaScript(${counterO1} < 60)}</stringProp> + <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="Final Success Controller"> + <stringProp name="WhileController.condition">${__javaScript(${counter} < 60)}</stringProp> </WhileController> <hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POLICY[policy-cl-mgt]: FINAL_SUCCESS" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"> - <elementProp name="filter" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">true</boolProp> - <stringProp name="Argument.value">{"class":"And", "filters": [ { "class":"Equals", "field":"requestId", "value":"${requestId}" }, { "class":"Equals", "field":"notification", "value":"FINAL: SUCCESS" }]}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - <boolProp name="HTTPArgument.use_equals">true</boolProp> - <stringProp name="Argument.name">filter</stringProp> - </elementProp> - </collectionProp> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/policy-cl-mgt/${consumerGroup}/1?timeout=15000&limit=1</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="POLICY [policy-cl-mgt]: FINAL_SUCCESS"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import org.apache.kafka.clients.consumer.KafkaConsumer +import org.apache.kafka.clients.consumer.ConsumerConfig +import org.apache.kafka.common.serialization.StringDeserializer +import java.time.Duration + +// Kafka consumer configuration +def props = new Properties() +props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, vars.get("KAFKA_HOST") + ":" + vars.get("KAFKA_PORT")) +props.put(ConsumerConfig.GROUP_ID_CONFIG, vars.get("consumerGroup")) +props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest") + +// Create Kafka consumer +def consumer = new KafkaConsumer<>(props) + +// Subscribe to the topic +consumer.subscribe(Arrays.asList("policy-cl-mgt")) + +// Initialize variables +def maxAttempts = 60 +def attempts = 0 +def success = false + +// Poll for records +while (attempts < maxAttempts && !success) { + def records = consumer.poll(Duration.ofMillis(15000)) + + for (record in records) { + def value = record.value() + log.info("Received message: " + value) + + // Parse the value + def jsonSlurper = new groovy.json.JsonSlurper() + def parsedValue = jsonSlurper.parseText(value) + + // Extract required fields + def requestId = parsedValue.requestId + def notification = parsedValue.notification + + // Check if this is the message we're looking for + if (requestId == vars.get("requestId") && notification == "FINAL: SUCCESS") { + success = true + log.info("Final Success: RequestId=" + requestId + ", Notification=" + notification) + break + } + } + + attempts++ + if (!success) { + log.info("Attempt " + attempts + " of " + maxAttempts + " failed to find matching message") + } +} + +// Close the consumer +consumer.close() + +// Set variables based on the result +if (success) { + vars.put("finalStatus", "SUCCESS") +} else { + vars.put("finalStatus", "FAILURE") + AssertionResult.setFailureMessage("Failed to receive FINAL: SUCCESS notification after " + maxAttempts + " attempts") + AssertionResult.setFailure(true) +} +</stringProp> + </JSR223Sampler> <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="No []" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="2914">[]</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">12</intProp> - </ResponseAssertion> - <hashTree/> - <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="requestId extractor" enabled="true"> - <stringProp name="RegexExtractor.useHeaders">false</stringProp> - <stringProp name="RegexExtractor.refname">requestIdOnset</stringProp> - <stringProp name="RegexExtractor.regex">requestId\\": \\"(.+?)\\"</stringProp> - <stringProp name="RegexExtractor.template">$1$</stringProp> - <stringProp name="RegexExtractor.default">none</stringProp> - <boolProp name="RegexExtractor.default_empty_value">false</boolProp> - </RegexExtractor> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="requestId extractor" enabled="true"> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="script">import groovy.json.JsonSlurper + +def message = vars.get("kafkaMessage") +def jsonSlurper = new JsonSlurper() +def parsedMessage = jsonSlurper.parseText(message) + +vars.put("requestIdOnset", parsedMessage.requestId ?: "none") +</stringProp> + <stringProp name="scriptLanguage">groovy</stringProp> + </JSR223PostProcessor> <hashTree/> - <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="notification extractor" enabled="true"> - <stringProp name="RegexExtractor.useHeaders">false</stringProp> - <stringProp name="RegexExtractor.refname">notification</stringProp> - <stringProp name="RegexExtractor.regex">notification\\": \\"FINAL: (.+?)\\"</stringProp> - <stringProp name="RegexExtractor.template">$1$</stringProp> - <stringProp name="RegexExtractor.default">none</stringProp> - <boolProp name="RegexExtractor.default_empty_value">false</boolProp> - </RegexExtractor> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="notification extractor" enabled="true"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import groovy.json.JsonSlurper + +def message = vars.get("kafkaMessage") +def jsonSlurper = new JsonSlurper() +def parsedMessage = jsonSlurper.parseText(message) + +vars.put("notification", parsedMessage.notification ?: "none") +</stringProp> + </JSR223PostProcessor> <hashTree/> - <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true"> + <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion"> <stringProp name="scriptLanguage">groovy</stringProp> <stringProp name="parameters"></stringProp> <stringProp name="filename"></stringProp> <stringProp name="cacheKey">true</stringProp> - <stringProp name="script">String requestIdOnset = vars.get("requestIdOnset"); -String requestId = vars.get("requestId"); -String notification = vars.get("notification"); -String counter = vars.get("counterO1"); - -String transaction = "none"; - -log.info ("The requestId id is " + requestId); -log.info ("The requestIdOnset id is " + requestIdOnset); -log.info ("The notification is " + notification); -log.info ("The transaction is " + transaction); -log.info ("The counter is " + counter); - -if ( requestId == requestIdOnset ) { - if ( notification == "SUCCESS" ) { - transaction = "FINAL"; - log.info ("Final Success Transaction"); - log.info ("The notification is SUCCESS"); - } else if ( notification == "FAILURE" ) { - transaction = "FINAL"; - log.info ("Final Failure Transaction"); - AssertionResult.setFailureMessage("Bad final notification"); - AssertionResult.setFailure(true); - } + <stringProp name="script">import groovy.json.JsonSlurper + +// Parse Kafka message content +def message = vars.get("kafkaMessage") +def jsonSlurper = new JsonSlurper() +def parsedMessage = jsonSlurper.parseText(message) + +// Extract relevant fields +String requestIdOnset = parsedMessage.requestId +String notification = parsedMessage.notification +String requestId = vars.get("requestId") +String counter = vars.get("counter") +String transaction = "none" + +// Log extracted information +log.info("The requestId is " + requestId) +log.info("The requestIdOnset is " + requestIdOnset) +log.info("The notification is " + notification) +log.info("The counter is " + counter) + +// Perform assertions +if (requestId == requestIdOnset) { + if (notification == "SUCCESS") { + transaction = "FINAL" + log.info("Final Success Transaction") + } else if (notification == "FAILURE") { + transaction = "FINAL" + log.info("Final Failure Transaction") + AssertionResult.setFailureMessage("Bad final notification") + AssertionResult.setFailure(true) + } } -int counterTemp = Integer.parseInt(counter) +1; +// Update counter +int counterTemp = Integer.parseInt(counter) + 1 if (transaction == "FINAL") { - counterTemp = 99; + counterTemp = 99 } else if (counterTemp >= 60) { - AssertionResult.setFailureMessage("vCPE Success POLICYCL Failure, reached maximum number of attempts "); - AssertionResult.setFailure(true); + AssertionResult.setFailureMessage("vCPE Success POLICYCL Failure, reached maximum number of attempts") + AssertionResult.setFailure(true) } - -vars.put("counterO1", Integer.toString(counterTemp));</stringProp> +vars.put("counter01", Integer.toString(counterTemp)) +</stringProp> </JSR223Assertion> <hashTree/> </hashTree> </hashTree> - <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Flow Control Action" enabled="true"> - <intProp name="ActionProcessor.action">1</intProp> - <intProp name="ActionProcessor.target">0</intProp> - <stringProp name="ActionProcessor.duration">250</stringProp> - </TestAction> - <hashTree/> </hashTree> - <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="SON A1 Success" enabled="true"> - <stringProp name="ThreadGroup.on_sample_error">startnextloop</stringProp> - <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> + <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="SON A1 Success"> + <intProp name="ThreadGroup.num_threads">1</intProp> + <intProp name="ThreadGroup.ramp_time">1</intProp> + <stringProp name="ThreadGroup.duration">${duration}</stringProp> + <longProp name="ThreadGroup.delay">11</longProp> + <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp> + <boolProp name="ThreadGroup.scheduler">true</boolProp> + <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> + <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller"> <intProp name="LoopController.loops">-1</intProp> <boolProp name="LoopController.continue_forever">false</boolProp> </elementProp> - <stringProp name="ThreadGroup.num_threads">1</stringProp> - <stringProp name="ThreadGroup.ramp_time">1</stringProp> - <boolProp name="ThreadGroup.scheduler">true</boolProp> - <stringProp name="ThreadGroup.duration">${duration}</stringProp> - <stringProp name="ThreadGroup.delay">11</stringProp> - <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp> - <boolProp name="ThreadGroup.delayedStart">false</boolProp> </ThreadGroup> <hashTree> <UserParameters guiclass="UserParametersGui" testclass="UserParameters" testname="Set consumer group per scenario" enabled="true"> @@ -1813,8 +1518,8 @@ vars.put("counterO1", Integer.toString(counterTemp));</stringProp> <stringProp name="-308835287">consumerGroup</stringProp> </collectionProp> <collectionProp name="UserParameters.thread_values"> - <collectionProp name="1059562701"> - <stringProp name="109619490">sonA1</stringProp> + <collectionProp name="1059733039"> + <stringProp name="109619924">sonO1</stringProp> </collectionProp> </collectionProp> <boolProp name="UserParameters.per_iteration">false</boolProp> @@ -1834,406 +1539,494 @@ vars.put("counterO1", Integer.toString(counterTemp));</stringProp> <stringProp name="TestPlan.comments">Update on a per iteration basis</stringProp> </UserParameters> <hashTree/> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="DCAE[DCAE_TOPIC]: ONSET" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> - <collectionProp name="Arguments.arguments"> - <elementProp name="" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">false</boolProp> - <stringProp name="Argument.value">{
 - "closedLoopControlName": "ControlLoop-SONA1-7d4baf04-8875-4d1f-946d-06b874048b61",
 - "closedLoopAlarmStart": 1606805921693,
 - "closedLoopEventClient": "microservice.SONH",
 - "closedLoopEventStatus": "ONSET",
 - "requestID": "${requestId}",
 - "target_type": "PNF",
 - "target": "pnf.pnf-name",
 - "AAI": {
 - "generic-vnf.prov-status": "ACTIVE",
 - "generic-vnf.is-closed-loop-disabled": "false",
 - "pnf.pnf-name": "ncserver2"
 - },
 - "from": "SONHMS",
 - "version": "1.0.2",
 - "policyName": "SONA1",
 - "policyVersion": "1.0.2",
 - "Action": "ModifyA1Policy",
 - "payload": "{ \"Configurations\":[ { \"data\":{ \"FAPService\":{ \"alias\":\"Cell1\", \"CellConfig\":{ \"LTE\":{ \"RAN\":{ \"Common\":{ \"CellIdentity\":\"1\" }, \"NeighborListInUse\" : { \"LTECellNumberOfEntries\" : \"1\" , \"LTECell\" : [{ \"PLMNID\" :\"plmnid1\", \"CID\":\"Chn0001\", \"PhyCellID\":\"3\", \"PNFName\":\"ncserver01\", \"Blacklisted\":\"false\"}] } } } } } } } ] }"
 -}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> - </collectionProp> - </elementProp> - <stringProp name="HTTPSampler.domain">${DROOLS_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${DROOLS_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">policy/pdp/engine/topics/sources/dmaap/dcae_topic/events</stringProp> - <stringProp name="HTTPSampler.method">PUT</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> - <collectionProp name="HeaderManager.headers"> - <elementProp name="" elementType="Header"> - <stringProp name="Header.name">Content-Type</stringProp> - <stringProp name="Header.value">text/plain</stringProp> - </elementProp> - </collectionProp> - </HeaderManager> - <hashTree/> - </hashTree> - <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Init DMaaP Counter" enabled="true"> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="DCAE[dcae-topic]: ONSET"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import org.apache.kafka.clients.producer.KafkaProducer +import org.apache.kafka.clients.producer.ProducerConfig +import org.apache.kafka.clients.producer.ProducerRecord +import org.apache.kafka.common.serialization.StringSerializer + +// Kafka producer configuration +def props = new Properties() +props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, vars.get("KAFKA_HOST") + ":" + vars.get("KAFKA_PORT")) +props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()) +props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()) +props.put(ProducerConfig.CLIENT_ID_CONFIG, "dcae-topic-producer") + +// Create Kafka producer +def producer = new KafkaProducer<>(props) + +// Prepare the message +def message = """ +{ + "closedLoopControlName": "ControlLoop-SONA1-7d4baf04-8875-4d1f-946d-06b874048b61", + "closedLoopAlarmStart": 1606805921693, + "closedLoopEventClient": "microservice.SONH", + "closedLoopEventStatus": "ONSET", + "requestID": "${requestId}", + "target_type": "PNF", + "target": "pnf.pnf-name", + "AAI": { + "generic-vnf.prov-status": "ACTIVE", + "generic-vnf.is-closed-loop-disabled": "false", + "pnf.pnf-name": "ncserver2" + }, + "from": "SONHMS", + "version": "1.0.2", + "policyName": "SONA1", + "policyVersion": "1.0.2", + "Action": "ModifyA1Policy", + "payload": "{ \"Configurations\":[ { \"data\":{ \"FAPService\":{ \"alias\":\"Cell1\", \"CellConfig\":{ \"LTE\":{ \"RAN\":{ \"Common\":{ \"CellIdentity\":\"1\" }, \"NeighborListInUse\" : { \"LTECellNumberOfEntries\" : \"1\" , \"LTECell\" : [{ \"PLMNID\" :\"plmnid1\", \"CID\":\"Chn0001\", \"PhyCellID\":\"3\", \"PNFName\":\"ncserver01\", \"Blacklisted\":\"false\"}] } } } } } } } ] }" +} +""".toString() + +// Create a producer record +def record = new ProducerRecord<>("unauthenticated.dcae_cl_output", vars.get("requestId").toString(), message) + +// Send the message +def future = producer.send(record) + +// Wait for the send to complete and log the result +def metadata = future.get() +log.info("Message sent to topic: ${metadata.topic()}, partition: ${metadata.partition()}, offset: ${metadata.offset()}") + +// Close the producer +producer.close() + +// Set a variable to indicate successful sending +vars.put("messageSent", "true") +</stringProp> + </JSR223Sampler> + <hashTree/> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Init Kafka Counter" enabled="true"> <stringProp name="scriptLanguage">groovy</stringProp> <stringProp name="parameters"></stringProp> <stringProp name="filename"></stringProp> <stringProp name="cacheKey">true</stringProp> - <stringProp name="script">vars.put("counterA1", "0");</stringProp> + <stringProp name="script">vars.put("counter01", "0");</stringProp> </JSR223Sampler> <hashTree/> - <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="SDNR-CL ModifyA1Config" enabled="true"> - <stringProp name="WhileController.condition">${__javaScript(${counterA1} < 10)}</stringProp> - </WhileController> + <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="SDNR-CL Modify A1 Config"> + <stringProp name="LoopController.loops">10</stringProp> + </LoopController> <hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POLICY[SDNR-CL]: ModifyA1Config" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"> - <elementProp name="filter" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">true</boolProp> - <stringProp name="Argument.value">{"class":"And", "filters": [ { "class":"Equals", "field":"request-id", "value":"${requestId}" }, { "class":"Equals", "field":"rpc-name", "value":"modifya1config" }]}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - <boolProp name="HTTPArgument.use_equals">true</boolProp> - <stringProp name="Argument.name">filter</stringProp> - </elementProp> - </collectionProp> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/SDNR-CL/${consumerGroup}/1?timeout=15000&limit=1</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Read kafka topic" enabled="true"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import org.apache.kafka.clients.consumer.KafkaConsumer +import org.apache.kafka.clients.consumer.ConsumerConfig +import org.apache.kafka.common.serialization.StringDeserializer +import java.time.Duration + +// Kafka consumer configuration +def props = new Properties() +props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, vars.get("KAFKA_HOST") + ":" + vars.get("KAFKA_PORT")) +props.put(ConsumerConfig.GROUP_ID_CONFIG, vars.get("consumerGroup")) +props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest") + +// Create Kafka consumer +def consumer = new KafkaConsumer<>(props) + +try { + // Subscribe to the topic + consumer.subscribe(Arrays.asList("SDNR-CL")) + + // Poll for records + def records = consumer.poll(Duration.ofMillis(15000)) + + if (records.isEmpty()) { + log.warn("No records found within the timeout period") + vars.put("messageConsumed", "false") + } else { + // Process the first record + def record = records.first() + def requestId = record.key() + def value = record.value() + + // Store the entire message + vars.put("kafkaMessage", value) + + // Parse the value + def jsonSlurper = new groovy.json.JsonSlurper() + def parsedValue = jsonSlurper.parseText(value) + + // Extract required fields + vars.put("requestIdOnset", parsedValue["request-id"]) + vars.put("correlationId", parsedValue["correlation-id"]) + vars.put("subRequestId", parsedValue["sub-request-id"]) + + // Log the extracted information + log.info("RequestId: " + requestId) + log.info("Parsed Value: " + parsedValue) + + vars.put("messageConsumed", "true") + } +} catch (Exception e) { + log.error("Error processing Kafka message: " + e.getMessage()) + vars.put("messageConsumed", "false") +} finally { + // Close the consumer + consumer.close() +} +</stringProp> + </JSR223Sampler> <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="No []" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="2914">[]</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">12</intProp> - </ResponseAssertion> - <hashTree/> - <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="request-id extractor" enabled="true"> - <stringProp name="RegexExtractor.useHeaders">false</stringProp> - <stringProp name="RegexExtractor.refname">requestIdOnset</stringProp> - <stringProp name="RegexExtractor.regex">\\"RequestID\\": \\"(.+?)\\"</stringProp> - <stringProp name="RegexExtractor.template">$1$</stringProp> - <stringProp name="RegexExtractor.default">none</stringProp> - <boolProp name="RegexExtractor.default_empty_value">false</boolProp> - </RegexExtractor> - <hashTree/> - <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="correlation-id extractor" enabled="true"> - <stringProp name="RegexExtractor.useHeaders">false</stringProp> - <stringProp name="RegexExtractor.refname">correlationId</stringProp> - <stringProp name="RegexExtractor.regex">correlation-id\\": \\"(.+?)\\"</stringProp> - <stringProp name="RegexExtractor.template">$1$</stringProp> - <stringProp name="RegexExtractor.default">none</stringProp> - <boolProp name="RegexExtractor.default_empty_value">false</boolProp> - </RegexExtractor> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="requestId extractor" enabled="true"> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="script">import groovy.json.JsonSlurper + +def message = vars.get("kafkaMessage") +def jsonSlurper = new JsonSlurper() +def parsedMessage = jsonSlurper.parseText(message) + +vars.put("requestIdOnset", parsedMessage.requestId ?: "none") +</stringProp> + <stringProp name="scriptLanguage">groovy</stringProp> + </JSR223PostProcessor> <hashTree/> - <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="sub-request-id extractor" enabled="true"> - <stringProp name="RegexExtractor.useHeaders">false</stringProp> - <stringProp name="RegexExtractor.refname">subRequestId</stringProp> - <stringProp name="RegexExtractor.regex">SubRequestID\\": \\"(.+?)\\"</stringProp> - <stringProp name="RegexExtractor.template">$1$</stringProp> - <stringProp name="RegexExtractor.default">none</stringProp> - <boolProp name="RegexExtractor.default_empty_value">false</boolProp> - </RegexExtractor> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="notification extractor" enabled="true"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import groovy.json.JsonSlurper + +def message = vars.get("kafkaMessage") +def jsonSlurper = new JsonSlurper() +def parsedMessage = jsonSlurper.parseText(message) + +vars.put("notification", parsedMessage.notification ?: "none") +</stringProp> + </JSR223PostProcessor> <hashTree/> - <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true"> + <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion"> <stringProp name="scriptLanguage">groovy</stringProp> <stringProp name="parameters"></stringProp> <stringProp name="filename"></stringProp> <stringProp name="cacheKey">true</stringProp> - <stringProp name="script">String requestIdOnset = vars.get("requestIdOnset"); -String requestId = vars.get("requestId"); -String correlationId = vars.get("correlationId"); -String subRequestId = vars.get("subRequestId"); -String counter = vars.get("counterA1"); - -String transaction = "none"; - -log.info ("The requestId id is " + requestId); -log.info ("The requestIdOnset id is " + requestIdOnset); -log.info ("The correlation id is " + correlationId); -log.info ("The subrequest id is " + subRequestId); -log.info ("The counter is " + counter); - -if ( requestId == requestIdOnset ) { - if ( correlationId == "none" || subRequestId == "none" ) { - transaction = "FINAL"; - log.info ("Final Failure Transaction"); - AssertionResult.setFailureMessage("Missing correlationId or subRequestId"); - AssertionResult.setFailure(true); - } else { - transaction = "FINAL"; - vars.put("transaction", "FINAL"); - log.info ("Final Success Transaction"); - } + <stringProp name="script">import org.apache.kafka.clients.consumer.ConsumerRecord + +// Assuming the Kafka message is stored in a variable named 'kafkaMessage' +ConsumerRecord<String, String> record = vars.getObject("kafkaMessage") + +String requestIdOnset = record.key() +String requestId = vars.get("requestId") +String correlationId = "none" +String subRequestId = "none" +String counter = vars.get("counter") + +String transaction = "none" + +// Parse the Kafka message value (assuming it's JSON) +def jsonSlurper = new groovy.json.JsonSlurper() +def messageContent = jsonSlurper.parseText(record.value()) + +if (messageContent.containsKey("correlation-id")) { + correlationId = messageContent["correlation-id"] +} +if (messageContent.containsKey("sub-request-id")) { + subRequestId = messageContent["sub-request-id"] +} + +log.info("The requestId is " + requestId) +log.info("The requestIdOnset is " + requestIdOnset) +log.info("The correlation id is " + correlationId) +log.info("The subrequest id is " + subRequestId) +log.info("The counter is " + counter) + +if (requestId == requestIdOnset) { + if (correlationId == "none" || subRequestId == "none") { + transaction = "FINAL" + log.info("Final Failure Transaction") + AssertionResult.setFailureMessage("Missing correlationId or subRequestId") + AssertionResult.setFailure(true) + } else { + transaction = "FINAL" + vars.put("transaction", "FINAL") + log.info("Final Success Transaction") + } } -int counterTemp = Integer.parseInt(counter) +1; +int counterTemp = Integer.parseInt(counter) + 1 if (transaction == "FINAL") { - counterTemp = 99; + counterTemp = 99 } else if (counterTemp >= 10) { - AssertionResult.setFailureMessage("SON A1 Success SDNR-CL Failure, reached maximum number of 10 attempts "); - AssertionResult.setFailure(true); + AssertionResult.setFailureMessage("SON A1 Failure, reached maximum number of 10 attempts") + AssertionResult.setFailure(true) } -vars.put("counterA1", Integer.toString(counterTemp)); - +vars.put("counter01", Integer.toString(counterTemp)) </stringProp> </JSR223Assertion> <hashTree/> </hashTree> </hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="SDNR[SDNR-CL-RSP]: SUCCESS" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">true</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments"> - <collectionProp name="Arguments.arguments"> - <elementProp name="" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">false</boolProp> - <stringProp name="Argument.value">{
 - "body": {
 - "output": {
 - "CommonHeader": {
 - "TimeStamp": "2022-09-10T07:10:05.614Z",
 - "APIver": "1.0",
 - "RequestID": "${requestId}",
 - "SubRequestID": "${subRequestId}",
 - "RequestTrack": [],
 - "Flags": []
 - },
 - "Status": {
 - "Code": 200,
 - "Value": "SUCCESS"
 - },
 - "Payload": "{ \"Configurations\":[ { \"Status\": { \"Code\": 200, \"Value\": \"SUCCESS\" }, \"data\":{ \"FAPService\":{ \"alias\":\"Cell1\", \"CellConfig\":{ \"LTE\":{ \"RAN\":{ \"Common\":{ \"CellIdentity\":\"1\" }, \"NeighborListInUse\" : { \"LTECellNumberOfEntries\" : \"1\" , \"LTECell\" : [{ \"PLMNID\" :\"plmnid1\", \"CID\":\"Chn0001\", \"PhyCellID\":\"3\", \"PNFName\":\"ncserver01\", \"Blacklisted\":\"false\"}] } } } } } } } ] }"
 - }
 - },
 - "version": "1.0",
 - "rpc-name": "ModifyA1Policy",
 - "correlation-id": "${correlationId}",
 - "type": "response"
 -}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - </elementProp> - </collectionProp> - </elementProp> - <stringProp name="HTTPSampler.domain">${DROOLS_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${DROOLS_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">policy/pdp/engine/topics/sources/dmaap/sdnr-cl-rsp/events</stringProp> - <stringProp name="HTTPSampler.method">PUT</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> - <hashTree> - <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true"> - <collectionProp name="HeaderManager.headers"> - <elementProp name="" elementType="Header"> - <stringProp name="Header.name">Content-Type</stringProp> - <stringProp name="Header.value">text/plain</stringProp> - </elementProp> - </collectionProp> - </HeaderManager> - <hashTree/> - </hashTree> - <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Init DMaaP Counter" enabled="true"> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="SDNR[SDNR-CL-RSP]: SUCCESS"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import org.apache.kafka.clients.producer.KafkaProducer +import org.apache.kafka.clients.producer.ProducerConfig +import org.apache.kafka.clients.producer.ProducerRecord +import org.apache.kafka.common.serialization.StringSerializer + +// Kafka producer configuration +def props = new Properties() +props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, vars.get("KAFKA_HOST") + ":" + vars.get("KAFKA_PORT")) +props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()) +props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()) +props.put(ProducerConfig.CLIENT_ID_CONFIG, "sdnr-cl-rsp-producer") + +// Create Kafka producer +def producer = new KafkaProducer<>(props) + +// Prepare the message +def message = """ +{ + "body": { + "output": { + "CommonHeader": { + "TimeStamp": "2022-08-10T07:10:05.614Z", + "APIver": "1.0", + "RequestID": "${requestId}", + "SubRequestID": "${subRequestId}", + "RequestTrack": [], + "Flags": [] + }, + "Status": { + "Code": 200, + "Value": "SUCCESS" + }, + "Payload": "{ \"Configurations\":[ { \"Status\": { \"Code\": 200, \"Value\": \"SUCCESS\" }, \"data\":{\"FAPService\":{\"alias\":\"Chn0330\",\"X0005b9Lte\":{\"phyCellIdInUse\":6,\"pnfName\":\"ncserver23\"},\"CellConfig\":{\"LTE\":{\"RAN\":{\"Common\":{\"CellIdentity\":\"Chn0330\"}}}}}} } ] }" + } + }, + "version": "1.0", + "rpc-name": "ModifyO1Config", + "correlation-id": "${correlationId}", + "type": "response" +} +""".toString() + +// Create a producer record +def record = new ProducerRecord<>("sdnr-cl-rsp", vars.get("requestId").toString(), message) + +// Send the message +def future = producer.send(record) + +// Wait for the send to complete and log the result +def metadata = future.get() +log.info("Message sent to topic: ${metadata.topic()}, partition: ${metadata.partition()}, offset: ${metadata.offset()}") + +// Close the producer +producer.close() + +// Set a variable to indicate successful sending +vars.put("messageSent", "true") +</stringProp> + </JSR223Sampler> + <hashTree/> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Init Kafka Counter"> <stringProp name="scriptLanguage">groovy</stringProp> <stringProp name="parameters"></stringProp> <stringProp name="filename"></stringProp> <stringProp name="cacheKey">true</stringProp> - <stringProp name="script">vars.put("counterA1", "0");</stringProp> + <stringProp name="script">vars.put("counter01", "0");</stringProp> </JSR223Sampler> <hashTree/> <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="Final Success Controller" enabled="true"> - <stringProp name="WhileController.condition">${__javaScript(${counterA1} < 60)}</stringProp> + <stringProp name="WhileController.condition">${__javaScript(${counter} < 60)}</stringProp> </WhileController> <hashTree> - <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="POLICY[policy-cl-mgt]: FINAL_SUCCESS" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"> - <elementProp name="filter" elementType="HTTPArgument"> - <boolProp name="HTTPArgument.always_encode">true</boolProp> - <stringProp name="Argument.value">{"class":"And", "filters": [ { "class":"Equals", "field":"requestId", "value":"${requestId}" }, { "class":"Equals", "field":"notification", "value":"FINAL: SUCCESS" }]}</stringProp> - <stringProp name="Argument.metadata">=</stringProp> - <boolProp name="HTTPArgument.use_equals">true</boolProp> - <stringProp name="Argument.name">filter</stringProp> - </elementProp> - </collectionProp> - </elementProp> - <stringProp name="HTTPSampler.domain">${KAFKA_HOST}</stringProp> - <stringProp name="HTTPSampler.port">${KAFKA_PORT}</stringProp> - <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> - <stringProp name="HTTPSampler.path">events/policy-cl-mgt/${consumerGroup}/1?timeout=15000&limit=1</stringProp> - <stringProp name="HTTPSampler.method">GET</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> - </HTTPSamplerProxy> + <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="POLICY [policy-cl-mgt]: FINAL_SUCCESS" enabled="true"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import org.apache.kafka.clients.consumer.KafkaConsumer +import org.apache.kafka.clients.consumer.ConsumerConfig +import org.apache.kafka.common.serialization.StringDeserializer +import java.time.Duration + +// Kafka consumer configuration +def props = new Properties() +props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, vars.get("KAFKA_HOST") + ":" + vars.get("KAFKA_PORT")) +props.put(ConsumerConfig.GROUP_ID_CONFIG, vars.get("consumerGroup")) +props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()) +props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest") + +// Create Kafka consumer +def consumer = new KafkaConsumer<>(props) + +// Subscribe to the topic +consumer.subscribe(Arrays.asList("policy-cl-mgt")) + +// Initialize variables +def maxAttempts = 60 +def attempts = 0 +def success = false + +// Poll for records +while (attempts < maxAttempts && !success) { + def records = consumer.poll(Duration.ofMillis(15000)) + + for (record in records) { + def value = record.value() + log.info("Received message: " + value) + + // Parse the value + def jsonSlurper = new groovy.json.JsonSlurper() + def parsedValue = jsonSlurper.parseText(value) + + // Extract required fields + def requestId = parsedValue.requestId + def notification = parsedValue.notification + + // Check if this is the message we're looking for + if (requestId == vars.get("requestId") && notification == "FINAL: SUCCESS") { + success = true + log.info("Final Success: RequestId=" + requestId + ", Notification=" + notification) + break + } + } + + attempts++ + if (!success) { + log.info("Attempt " + attempts + " of " + maxAttempts + " failed to find matching message") + } +} + +// Close the consumer +consumer.close() + +// Set variables based on the result +if (success) { + vars.put("finalStatus", "SUCCESS") +} else { + vars.put("finalStatus", "FAILURE") + AssertionResult.setFailureMessage("Failed to receive FINAL: SUCCESS notification after " + maxAttempts + " attempts") + AssertionResult.setFailure(true) +} +</stringProp> + </JSR223Sampler> <hashTree> - <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="No []" enabled="true"> - <collectionProp name="Asserion.test_strings"> - <stringProp name="2914">[]</stringProp> - </collectionProp> - <stringProp name="Assertion.custom_message"></stringProp> - <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> - <boolProp name="Assertion.assume_success">false</boolProp> - <intProp name="Assertion.test_type">12</intProp> - </ResponseAssertion> - <hashTree/> - <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="requestId extractor" enabled="true"> - <stringProp name="RegexExtractor.useHeaders">false</stringProp> - <stringProp name="RegexExtractor.refname">requestIdOnset</stringProp> - <stringProp name="RegexExtractor.regex">requestId\\": \\"(.+?)\\"</stringProp> - <stringProp name="RegexExtractor.template">$1$</stringProp> - <stringProp name="RegexExtractor.default">none</stringProp> - <boolProp name="RegexExtractor.default_empty_value">false</boolProp> - </RegexExtractor> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="requestId extractor" enabled="true"> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="script">import groovy.json.JsonSlurper + +def message = vars.get("kafkaMessage") +def jsonSlurper = new JsonSlurper() +def parsedMessage = jsonSlurper.parseText(message) + +vars.put("requestIdOnset", parsedMessage.requestId ?: "none") +</stringProp> + <stringProp name="scriptLanguage">groovy</stringProp> + </JSR223PostProcessor> <hashTree/> - <RegexExtractor guiclass="RegexExtractorGui" testclass="RegexExtractor" testname="notification extractor" enabled="true"> - <stringProp name="RegexExtractor.useHeaders">false</stringProp> - <stringProp name="RegexExtractor.refname">notification</stringProp> - <stringProp name="RegexExtractor.regex">notification\\": \\"FINAL: (.+?)\\"</stringProp> - <stringProp name="RegexExtractor.template">$1$</stringProp> - <stringProp name="RegexExtractor.default">none</stringProp> - <boolProp name="RegexExtractor.default_empty_value">false</boolProp> - </RegexExtractor> + <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="notification extractor" enabled="true"> + <stringProp name="scriptLanguage">groovy</stringProp> + <stringProp name="parameters"></stringProp> + <stringProp name="filename"></stringProp> + <stringProp name="cacheKey">true</stringProp> + <stringProp name="script">import groovy.json.JsonSlurper + +def message = vars.get("kafkaMessage") +def jsonSlurper = new JsonSlurper() +def parsedMessage = jsonSlurper.parseText(message) + +vars.put("notification", parsedMessage.notification ?: "none") +</stringProp> + </JSR223PostProcessor> <hashTree/> <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true"> <stringProp name="scriptLanguage">groovy</stringProp> <stringProp name="parameters"></stringProp> <stringProp name="filename"></stringProp> <stringProp name="cacheKey">true</stringProp> - <stringProp name="script">String requestIdOnset = vars.get("requestIdOnset"); -String requestId = vars.get("requestId"); -String notification = vars.get("notification"); -String counter = vars.get("counterA1"); - -String transaction = "none"; - -log.info ("The requestId id is " + requestId); -log.info ("The requestIdOnset id is " + requestIdOnset); -log.info ("The notification is " + notification); -log.info ("The transaction is " + transaction); -log.info ("The counter is " + counter); - -if ( requestId == requestIdOnset ) { - if ( notification == "SUCCESS" ) { - transaction = "FINAL"; - log.info ("Final Success Transaction"); - log.info ("The notification is SUCCESS"); - } else if ( notification == "FAILURE" ) { - transaction = "FINAL"; - log.info ("Final Failure Transaction"); - AssertionResult.setFailureMessage("Bad final notification"); - AssertionResult.setFailure(true); - } + <stringProp name="script">import groovy.json.JsonSlurper + +// Parse Kafka message content +def message = vars.get("kafkaMessage") +def jsonSlurper = new JsonSlurper() +def parsedMessage = jsonSlurper.parseText(message) + +// Extract relevant fields +String requestIdOnset = parsedMessage.requestId +String notification = parsedMessage.notification +String requestId = vars.get("requestId") +String counter = vars.get("counter") +String transaction = "none" + +// Log extracted information +log.info("The requestId is " + requestId) +log.info("The requestIdOnset is " + requestIdOnset) +log.info("The notification is " + notification) +log.info("The counter is " + counter) + +// Perform assertions +if (requestId == requestIdOnset) { + if (notification == "SUCCESS") { + transaction = "FINAL" + log.info("Final Success Transaction") + } else if (notification == "FAILURE") { + transaction = "FINAL" + log.info("Final Failure Transaction") + AssertionResult.setFailureMessage("Bad final notification") + AssertionResult.setFailure(true) + } } -int counterTemp = Integer.parseInt(counter) +1; +// Update counter +int counterTemp = Integer.parseInt(counter) + 1 if (transaction == "FINAL") { - counterTemp = 99; + counterTemp = 99 } else if (counterTemp >= 60) { - AssertionResult.setFailureMessage("vCPE Success POLICYCL Failure, reached maximum number of attempts "); - AssertionResult.setFailure(true); + AssertionResult.setFailureMessage("vCPE Success POLICYCL Failure, reached maximum number of attempts") + AssertionResult.setFailure(true) } - -vars.put("counterA1", Integer.toString(counterTemp));</stringProp> +vars.put("counter01", Integer.toString(counterTemp)) +</stringProp> </JSR223Assertion> <hashTree/> </hashTree> </hashTree> - <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Flow Control Action" enabled="true"> - <intProp name="ActionProcessor.action">1</intProp> - <intProp name="ActionProcessor.target">0</intProp> - <stringProp name="ActionProcessor.duration">250</stringProp> - </TestAction> - <hashTree/> </hashTree> <PostThreadGroup guiclass="PostThreadGroupGui" testclass="PostThreadGroup" testname="Tear down" enabled="true"> + <intProp name="ThreadGroup.num_threads">1</intProp> + <intProp name="ThreadGroup.ramp_time">1</intProp> + <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp> <stringProp name="ThreadGroup.on_sample_error">continue</stringProp> - <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true"> + <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller"> <stringProp name="LoopController.loops">1</stringProp> <boolProp name="LoopController.continue_forever">false</boolProp> </elementProp> - <stringProp name="ThreadGroup.num_threads">1</stringProp> - <stringProp name="ThreadGroup.ramp_time">1</stringProp> - <boolProp name="ThreadGroup.scheduler">false</boolProp> - <stringProp name="ThreadGroup.duration"></stringProp> - <stringProp name="ThreadGroup.delay"></stringProp> - <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp> </PostThreadGroup> <hashTree> <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="PAP" enabled="true"/> <hashTree> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Undeploy vCPE Policy" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> + <intProp name="HTTPSampler.concurrentPool">6</intProp> <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp> <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp> <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> <stringProp name="HTTPSampler.path">policy/pap/v1/pdps/policies/operational.restart/versions/1.0.0</stringProp> <stringProp name="HTTPSampler.method">DELETE</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> + <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> + <collectionProp name="Arguments.arguments"/> + </elementProp> </HTTPSamplerProxy> <hashTree> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> @@ -2248,25 +2041,16 @@ vars.put("counterA1", Integer.toString(counterTemp));</stringProp> <hashTree/> </hashTree> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Undeploy 5G SON A1" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> + <intProp name="HTTPSampler.concurrentPool">6</intProp> <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp> <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp> <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> <stringProp name="HTTPSampler.path">policy/pap/v1/pdps/policies/op.5g.son.a1/versions/1.0.0</stringProp> <stringProp name="HTTPSampler.method">DELETE</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> + <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> + <collectionProp name="Arguments.arguments"/> + </elementProp> </HTTPSamplerProxy> <hashTree> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> @@ -2281,25 +2065,16 @@ vars.put("counterA1", Integer.toString(counterTemp));</stringProp> <hashTree/> </hashTree> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Undeploy 5G SON O1" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> + <intProp name="HTTPSampler.concurrentPool">6</intProp> <stringProp name="HTTPSampler.domain">${PAP_HOST}</stringProp> <stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp> <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> <stringProp name="HTTPSampler.path">policy/pap/v1/pdps/policies/op.5g.son.o1/versions/1.0.0</stringProp> <stringProp name="HTTPSampler.method">DELETE</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> + <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> + <collectionProp name="Arguments.arguments"/> + </elementProp> </HTTPSamplerProxy> <hashTree> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> @@ -2317,25 +2092,16 @@ vars.put("counterA1", Integer.toString(counterTemp));</stringProp> <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="API" enabled="true"/> <hashTree> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Delete vCPE Policy" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> + <intProp name="HTTPSampler.concurrentPool">6</intProp> <stringProp name="HTTPSampler.domain">${API_HOST}</stringProp> <stringProp name="HTTPSampler.port">${API_PORT}</stringProp> <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> <stringProp name="HTTPSampler.path">policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies/operational.restart/versions/1.0.0</stringProp> <stringProp name="HTTPSampler.method">DELETE</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> + <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> + <collectionProp name="Arguments.arguments"/> + </elementProp> </HTTPSamplerProxy> <hashTree> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> @@ -2350,25 +2116,16 @@ vars.put("counterA1", Integer.toString(counterTemp));</stringProp> <hashTree/> </hashTree> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Delete 5G SON A1" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> + <intProp name="HTTPSampler.concurrentPool">6</intProp> <stringProp name="HTTPSampler.domain">${API_HOST}</stringProp> <stringProp name="HTTPSampler.port">${API_PORT}</stringProp> <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> <stringProp name="HTTPSampler.path">policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies/op.5g.son.a1/versions/1.0.0</stringProp> <stringProp name="HTTPSampler.method">DELETE</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> + <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> + <collectionProp name="Arguments.arguments"/> + </elementProp> </HTTPSamplerProxy> <hashTree> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> @@ -2383,25 +2140,16 @@ vars.put("counterA1", Integer.toString(counterTemp));</stringProp> <hashTree/> </hashTree> <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Delete 5G SON O1" enabled="true"> - <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> - <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> - <collectionProp name="Arguments.arguments"/> - </elementProp> + <intProp name="HTTPSampler.concurrentPool">6</intProp> <stringProp name="HTTPSampler.domain">${API_HOST}</stringProp> <stringProp name="HTTPSampler.port">${API_PORT}</stringProp> <stringProp name="HTTPSampler.protocol">${HTTP}</stringProp> <stringProp name="HTTPSampler.path">policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/policies/op.5g.son.o1/versions/1.0.0</stringProp> <stringProp name="HTTPSampler.method">DELETE</stringProp> - <boolProp name="HTTPSampler.follow_redirects">false</boolProp> - <boolProp name="HTTPSampler.auto_redirects">false</boolProp> - <boolProp name="HTTPSampler.use_keepalive">false</boolProp> - <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> - <boolProp name="HTTPSampler.BROWSER_COMPATIBLE_MULTIPART">false</boolProp> - <boolProp name="HTTPSampler.image_parser">false</boolProp> - <boolProp name="HTTPSampler.concurrentDwn">false</boolProp> - <stringProp name="HTTPSampler.concurrentPool">6</stringProp> - <boolProp name="HTTPSampler.md5">false</boolProp> - <intProp name="HTTPSampler.ipSourceType">0</intProp> + <boolProp name="HTTPSampler.postBodyRaw">false</boolProp> + <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"> + <collectionProp name="Arguments.arguments"/> + </elementProp> </HTTPSamplerProxy> <hashTree> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> |