-->
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.3">
<hashTree>
- <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="APEX PDP STABILITY TEST PLAN" enabled="true">
- <boolProp name="TestPlan.functional_mode">false</boolProp>
- <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
+ <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="APEX PDP STABILITY TEST PLAN">
<boolProp name="TestPlan.serialize_threadgroups">true</boolProp>
- <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
+ <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
+ <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables">
<collectionProp name="Arguments.arguments"/>
</elementProp>
</TestPlan>
</elementProp>
<elementProp name="KAFKA_PORT" elementType="Argument">
<stringProp name="Argument.name">KAFKA_PORT</stringProp>
- <stringProp name="Argument.value">${__P(KAFKA_PORT,29092)}</stringProp>
+ <stringProp name="Argument.value">${__P(KAFKA_PORT,9092)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="CDS_PORT" elementType="Argument">
</elementProp>
<elementProp name="" elementType="Authorization">
<stringProp name="Authorization.url">http://${HOSTNAME}:${APEX_PORT}/policy/apex-pdp/v1/healthcheck</stringProp>
- <stringProp name="Authorization.username">healthcheck</stringProp>
+ <stringProp name="Authorization.username">policyadmin</stringProp>
<stringProp name="Authorization.password">zb!XztG34</stringProp>
<stringProp name="Authorization.domain"></stringProp>
<stringProp name="Authorization.realm"></stringProp>
</elementProp>
<elementProp name="" elementType="Authorization">
<stringProp name="Authorization.url">http://${HOSTNAME}:${APEX_PORT}/metrics</stringProp>
- <stringProp name="Authorization.username">healthcheck</stringProp>
+ <stringProp name="Authorization.username">policyadmin</stringProp>
<stringProp name="Authorization.password">zb!XztG34</stringProp>
<stringProp name="Authorization.domain"></stringProp>
<stringProp name="Authorization.realm"></stringProp>
<boolProp name="AuthManager.controlledByThreadGroup">false</boolProp>
</AuthManager>
<hashTree/>
- <SetupThreadGroup guiclass="SetupThreadGroupGui" testclass="SetupThreadGroup" testname="setUp Thread Group">
+ <SetupThreadGroup guiclass="SetupThreadGroupGui" testclass="SetupThreadGroup" testname="setUp Thread Group" 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>
"parameterClassName": "org.onap.policy.apex.plugins.event.carrier.kafka.KafkaCarrierTechnologyParameters",
"parameters": {
"bootstrapServers": "kafka:9092",
- "groupId": "apex-grp2",
+ "groupId": "apex-group",
"enableAutoCommit": true,
- "autoCommitTime": 1000,
- "sessionTimeout": 30000,
- "consumerPollTime": 100,
- "consumerTopicList": [
- "unauthenticated.dcae_cl_output"
- ],
- "keyDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
- "valueDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
- "kafkaProperties": [
-
- ]
+ "autoCommitTime": 1000,
+ "sessionTimeout": 30000,
+ "consumerPollTime": 100,
+ "consumerTopicList": ["unauthenticated.dcae_policy_example_output"],
+ "keyDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
+ "valueDeserializer": "org.apache.kafka.common.serialization.StringDeserializer"
}
},
"eventProtocolParameters": {
"eventProtocol": "JSON"
},
"eventName": "ApexExample_VesEvent"
- },
- "ApexExample_AAIResponseConsumer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "RESTREQUESTOR",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters",
- "parameters": {
- "url": "https://aai:8443/aai/v14/network/generic-vnfs/generic-vnf?vnf-name={vnf-name}",
- "httpMethod": "GET",
- "httpCodeFilter": "[245][0-9][0-9]",
- "httpHeaders": [
- [
- "Accept",
- "application/json"
- ],
- [
- "Content-Type",
- "application/json"
- ],
- [
- "X-FromAppId",
- "dcae-curl"
- ],
- [
- "x-transactionId",
- "9998"
- ],
- [
- "Authorization",
- "Basic QUFJOkFBSQ=="
- ]
- ]
- }
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventName": "ApexExample_AAISuccessResponseEvent|ApexExample_AAIFailureResponseEvent",
- "requestorMode": true,
- "requestorPeer": "ApexExample_AAIProducer",
- "requestorTimeout": 2000
- },
- "ApexExample_CDSConfigModifyResponseConsumer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "GRPC",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters"
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventName": "ApexExample_CDSConfigModifySuccessResponseEvent|ApexExample_CDSConfigModifyFailureResponseEvent",
- "requestorMode": true,
- "requestorPeer": "ApexExample_CDSConfigModifyRequestProducer",
- "requestorTimeout": 500
- },
- "ApexExample_CDSRestartResponseConsumer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "GRPC",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters"
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventName": "ApexExample_CDSRestartSuccessResponseEvent|ApexExample_CDSRestartFailureResponseEvent",
- "requestorMode": true,
- "requestorPeer": "ApexExample_CDSRestartRequestProducer",
- "requestorTimeout": 500
}
},
"eventOutputParameters": {
"batchSize": 16384,
"lingerTime": 1,
"bufferMemory": 33554432,
- "producerTopic": "apex-cl-mgt2",
+ "producerTopic": "apex-cl-mgt",
"keySerializer": "org.apache.kafka.common.serialization.StringSerializer",
- "valueSerializer": "org.apache.kafka.common.serialization.StringSerializer",
- "kafkaProperties": [
-
- ]
+ "valueSerializer": "org.apache.kafka.common.serialization.StringSerializer"
}
},
"eventProtocolParameters": {
"eventProtocol": "JSON"
- },
- "eventNameFilter": "ApexExample_AAIRequestEvent",
- "requestorMode": true,
- "requestorPeer": "ApexExample_AAIResponseConsumer",
- "requestorTimeout": 2000
- },
- "ApexExample_CDSConfigModifyRequestProducer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "GRPC",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters",
- "parameters": {
- "host": "${KAFKA_HOST}",
- "port": ${CDS_PORT},
- "username": "ccsdkapps",
- "password": "ccsdkapps",
- "timeout": 10
- }
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventNameFilter": "ApexExample_CDSConfigModifyRequestEvent",
- "requestorMode": true,
- "requestorPeer": "ApexExample_CDSConfigModifyResponseConsumer",
- "requestorTimeout": 500
- },
- "ApexExample_CDSRestartRequestProducer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "GRPC",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters",
- "parameters": {
- "host": "${KAFKA_HOST}",
- "port": ${CDS_PORT},
- "username": "ccsdkapps",
- "password": "ccsdkapps",
- "timeout": 10
- }
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventNameFilter": "ApexExample_CDSRestartRequestEvent",
- "requestorMode": true,
- "requestorPeer": "ApexExample_CDSRestartResponseConsumer",
- "requestorTimeout": 500
+ }
}
}
}
</ResponseAssertion>
<hashTree/>
</hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="CreatePolicy-SimpleCL" enabled="true">
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="CreatePolicy-SimpleCL">
<intProp name="HTTPSampler.concurrentPool">6</intProp>
<stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
<stringProp name="HTTPSampler.port">${API_PORT}</stringProp>
"eventInputParameters": {
"SimpleCL_DCAEConsumer": {
"carrierTechnologyParameters": {
- "carrierTechnology": "RESTCLIENT",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
+ "carrierTechnology": "KAFKA",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.kafka.KafkaCarrierTechnologyParameters",
"parameters": {
- "url": "http://${KAFKA_HOST}:${KAFKA_PORT}/events/unauthenticated.DCAE_CL_OUTPUT/cl/apex?timeout=30000"
+ "bootstrapServers": "kafka:9092",
+ "groupId": "apex-group",
+ "enableAutoCommit": true,
+ "autoCommitTime": 1000,
+ "sessionTimeout": 30000,
+ "consumerPollTime": 100,
+ "consumerTopicList": ["unauthenticated.dcae_cl_output"],
+ "keyDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
+ "valueDeserializer": "org.apache.kafka.common.serialization.StringDeserializer"
}
},
"eventProtocolParameters": {
"eventProtocol": "JSON"
},
"eventName": "SimpleCL_VesEvent"
- },
- "SimpleCL_AAIResponseConsumer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "RESTREQUESTOR",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters",
- "parameters": {
- "url": "https://aai:8443/aai/v14/network/pnfs/pnf/{pnfName}",
- "httpMethod": "GET",
- "httpCodeFilter": "[2-5][0-1][0-9]",
- "httpHeaders": [
- [
- "Accept",
- "application/json"
- ],
- [
- "Content-Type",
- "application/json"
- ],
- [
- "X-FromAppId",
- "dcae-curl"
- ],
- [
- "x-transactionId",
- "9998"
- ],
- [
- "Authorization",
- "Basic QUFJOkFBSQ=="
- ]
- ]
- }
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventName": "SimpleCL_AAISuccessResponseEvent|SimpleCL_AAIFailureResponseEvent",
- "requestorMode": true,
- "requestorPeer": "SimpleCL_AAIProducer",
- "requestorTimeout": 2000
- },
- "SimpleCL_CDSConfigModifyResponseConsumer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "GRPC",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters"
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventName": "SimpleCL_CDSConfigModifySuccessResponseEvent|SimpleCL_CDSConfigModifyFailureResponseEvent",
- "requestorMode": true,
- "requestorPeer": "SimpleCL_CDSConfigModifyRequestProducer",
- "requestorTimeout": 500
}
},
"eventOutputParameters": {
- "SimpleCL_AAIProducer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "RESTREQUESTOR",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters"
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventNameFilter": "SimpleCL_AAIRequestEvent",
- "requestorMode": true,
- "requestorPeer": "SimpleCL_AAIResponseConsumer",
- "requestorTimeout": 2000
- },
- "SimpleCL_CDSConfigModifyRequestProducer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "GRPC",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters",
- "parameters": {
- "host": "${KAFKA_HOST}",
- "port": ${CDS_PORT},
- "username": "ccsdkapps",
- "password": "ccsdkapps",
- "timeout": 60
- }
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventNameFilter": "SimpleCL_CDSConfigModifyRequestEvent",
- "requestorMode": true,
- "requestorPeer": "SimpleCL_CDSConfigModifyResponseConsumer",
- "requestorTimeout": 500
- },
"SimpleCL_LogEventProducer": {
"carrierTechnologyParameters": {
- "carrierTechnology": "RESTCLIENT",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
+ "carrierTechnology": "KAFKA",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.kafka.KafkaCarrierTechnologyParameters",
"parameters": {
- "url": "http://${KAFKA_HOST}:${KAFKA_PORT}/events/APEX-CL-MGT"
+ "bootstrapServers": "kafka:9092",
+ "acks": "all",
+ "retries": 0,
+ "batchSize": 16384,
+ "lingerTime": 1,
+ "bufferMemory": 33554432,
+ "producerTopic": "apex-cl-mgt",
+ "keySerializer": "org.apache.kafka.common.serialization.StringSerializer",
+ "valueSerializer": "org.apache.kafka.common.serialization.StringSerializer"
}
},
"eventProtocolParameters": {
"eventProtocol": "JSON"
- },
- "eventNameFilter": "SimpleCL_LogEvent"
+ }
}
}
}
</ConstantTimer>
<hashTree/>
</hashTree>
- <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group">
<stringProp name="ThreadGroup.num_threads">${threads}</stringProp>
<intProp name="ThreadGroup.ramp_time">1</intProp>
<longProp name="ThreadGroup.duration">259200</longProp>
</elementProp>
</HTTPSamplerProxy>
<hashTree>
- <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false">
- <stringProp name="cacheKey">true</stringProp>
- <stringProp name="filename"></stringProp>
- <stringProp name="parameters"></stringProp>
- <stringProp name="script">import groovy.json.JsonSlurper;
-
-def res = [];
-if (prev.getResponseCode() == '200') {
- def jsonSlurper = new JsonSlurper();
- res = jsonSlurper.parseText(prev.getResponseDataAsString());
-
- assert res instanceof Map;
- assert res.healthy == true;
- assert res.message == 'alive';
-}
-</stringProp>
- <stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223Assertion>
- <hashTree/>
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
<collectionProp name="Asserion.test_strings">
<stringProp name="49586">200</stringProp>
</ResponseAssertion>
<hashTree/>
</hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Prometheus Metrics" enabled="true">
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Prometheus Metrics">
<intProp name="HTTPSampler.concurrentPool">6</intProp>
<stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
<stringProp name="HTTPSampler.port">${APEX_PORT}</stringProp>
<stringProp name="TestPlan.comments">Assert response coming back from apex-pdp</stringProp>
</ResponseAssertion>
<hashTree/>
- <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false">
+ </hashTree>
+ <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test simple-cl policy - success"/>
+ <hashTree>
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Send Trigger Event - simple-cl success">
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename"></stringProp>
<stringProp name="parameters"></stringProp>
- <stringProp name="script">import groovy.json.JsonSlurper;
+ <stringProp name="script">import org.apache.kafka.clients.producer.Callback
+import org.apache.kafka.clients.producer.RecordMetadata
+import org.apache.kafka.clients.producer.KafkaProducer
+import org.apache.kafka.clients.producer.ProducerRecord
+import org.apache.kafka.clients.producer.ProducerConfig
+import org.apache.kafka.common.serialization.StringSerializer
-def res = [];
-if (prev.getResponseCode() == '200') {
- def jsonSlurper = new JsonSlurper();
- res = jsonSlurper.parseText(prev.getResponseDataAsString());
+def props = new Properties()
+props.put("bootstrap.servers", "kafka:9092")
+props.put("group.id", "new-group")
+props.put("acks", "all")
+props.put("retries", 0)
+props.put("batch.size", 16384)
+props.put("linger.ms", 1)
+props.put("buffer.memory", 33554432)
+props.put("key.serializer", StringSerializer.class.getName())
+props.put("value.serializer", StringSerializer.class.getName())
- assert res instanceof Map;
- assert res.healthy == true;
- assert res.message == 'alive';
-}
+def producer = new KafkaProducer<>(props)
+
+def jsonString = '''{
+ "event": {
+ "commonEventHeader": {
+ "startEpochMicrosec": 1597953057126,
+ "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}",
+ "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}",
+ "lastEpochMicrosec": 1597952499468,
+ "eventName": "Report hostname & IP",
+ "sourceName": "PNF101",
+ "reportingEntityName": "DCAE",
+ "vesEventListenerVersion": "7.1",
+ "internalHeaderFields": {},
+ "version": "4.0.1",
+ "priority": "Normal",
+ "sequence": 1,
+ "domain": "other"
+ },
+ "otherFields": {
+ "hashMap": {
+ "hostname": "UNDEFINED",
+ "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
+ "pnfName": "PNF101",
+ "ip": "10.101.200.10"
+ },
+ "otherFieldsVersion": "3.0"
+ }
+ }
+}'''
+
+def record = new ProducerRecord<>("unauthenticated.dcae_cl_output", jsonString)
+
+producer.send(record, new Callback() {
+ @Override
+ void onCompletion(RecordMetadata metadata, Exception exception) {
+ if (exception != null) {
+ exception.printStackTrace()
+ } else {
+ println("Sent message to topic ${metadata.topic()} partition ${metadata.partition()} with offset ${metadata.offset()}")
+ }
+ }
+})
+
+producer.close()
</stringProp>
<stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223Assertion>
+ </JSR223Sampler>
<hashTree/>
- </hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Clean up DMaaP notification topic" enabled="true"/>
- <hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Clean up DMaaP notification topic" enabled="true">
- <stringProp name="TestPlan.comments">Clean up DMaaP notification topic</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/APEX-CL-MGT/cg${__threadNum}/c1?limit=100&timeout=500</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
- </hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test simple-cl policy - success" enabled="true"/>
- <hashTree>
- <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="Synchronizing Timer" enabled="true">
- <stringProp name="groupSize">${threads}</stringProp>
- <stringProp name="timeoutInMs">${threadsTimeOutInMs}</stringProp>
- </SyncTimer>
- <hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Trigger Event - simplecl success" enabled="true">
- <stringProp name="TestPlan.comments">Send Trigger Event - simplecl success</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/unauthenticated.DCAE_CL_OUTPUT</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">POST</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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">{
- "event": {
- "commonEventHeader": {
- "startEpochMicrosec": 1597953057126,
- "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}",
- "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}",
- "lastEpochMicrosec": 1597952499468,
- "eventName": "Report hostname & IP",
- "sourceName": "PNF101",
- "reportingEntityName": "DCAE",
- "vesEventListenerVersion": "7.1",
- "internalHeaderFields": {},
- "version": "4.0.1",
- "priority": "Normal",
- "sequence": 1,
- "domain": "other"
- },
- "otherFields": {
- "hashMap": {
- "hostname": "UNDEFINED",
- "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
- "pnfName": "PNF101",
- "ip": "10.101.200.10"
- },
- "otherFieldsVersion": "3.0"
- }
- }
-}</stringProp>
- <stringProp name="Argument.metadata">=</stringProp>
- </elementProp>
- </collectionProp>
- </elementProp>
- </HTTPSamplerProxy>
- <hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="true">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
- <hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Read notification events - simplecl success" enabled="true">
- <stringProp name="TestPlan.comments">Read notification events - simplecl success</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/APEX-CL-MGT/cg${__threadNum}/c1?limit=50&timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false">
- <stringProp name="cacheKey">true</stringProp>
- <stringProp name="filename"></stringProp>
- <stringProp name="parameters"></stringProp>
- <stringProp name="script">import groovy.json.JsonSlurper;
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Read notification events - simplecl 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.ConsumerConfig
+import org.apache.kafka.clients.consumer.KafkaConsumer
+import org.apache.kafka.clients.consumer.ConsumerRecords
+import org.apache.kafka.clients.consumer.ConsumerRecord
+import org.apache.kafka.common.serialization.StringDeserializer
+import groovy.json.JsonSlurper
+
+// Consumer properties
+def props = new Properties()
+props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka:9092") // Adjust to your Kafka bootstrap server
+props.put(ConsumerConfig.GROUP_ID_CONFIG, "apex-group")
+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 the Kafka consumer
+def consumer = new KafkaConsumer<>(props)
+
+// Subscribe to the topic
+consumer.subscribe(["apex-cl-mgt"])
-def res = [];
-if (prev.getResponseCode() == '200') {
- def jsonSlurper = new JsonSlurper();
- def responseString = prev.getResponseDataAsString();
- res = jsonSlurper.parseText(responseString);
- def expectedNumberOfNotifications = ${threads} * 3;
- assert res instanceof List;
- assert res.size() == expectedNumberOfNotifications;
- assert responseString.contains("ACTIVE")
- assert responseString.contains("SUCCESS")
- assert responseString.contains("FINAL_SUCCESS")
- assert !responseString.contains("FAILURE")
+// Poll for messages and assert the value
+def found = false
+def timeout = 10000 // timeout in milliseconds
+def startTime = System.currentTimeMillis()
+
+while (!found && (System.currentTimeMillis() - startTime) < timeout) {
+ println("Inside while loop")
+ ConsumerRecords<String, String> records = consumer.poll(1000)
+ for (ConsumerRecord<String, String> record : records) {
+ println("Received message: Key=${record.key()}, Value=${record.value()}, Partition=${record.partition()}, Offset=${record.offset()}")
+
+ // Parse the JSON value
+ def jsonSlurper = new JsonSlurper()
+ def message = jsonSlurper.parseText(record.value())
+
+ // Perform assertion on specific fields in the JSON
+ if ((message?.source == "APEX") || (message?.component?.status == "ACTIVE")) {
+ found = true
+ println("Assertion passed: source is 'APEX' or status is 'ACTIVE'")
+ break
+ }
+ }
}
+
+// Close the consumer
+consumer.close()
</stringProp>
- <stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223Assertion>
- <hashTree/>
- </hashTree>
- </hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Clean up DMaaP notification topic" enabled="true"/>
- <hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Clean up DMaaP notification topic" enabled="true">
- <stringProp name="TestPlan.comments">Clean up DMaaP notification topic</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/APEX-CL-MGT/cg${__threadNum}/c1?limit=100&timeout=500</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
+ </JSR223Sampler>
+ <hashTree/>
</hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test simple-cl policy - failure" enabled="true"/>
+ <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test example policy - success"/>
<hashTree>
- <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="Synchronizing Timer" enabled="true">
- <stringProp name="groupSize">${threads}</stringProp>
- <stringProp name="timeoutInMs">${threadsTimeOutInMs}</stringProp>
- </SyncTimer>
- <hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Trigger Event - simplecl failure" enabled="true">
- <stringProp name="TestPlan.comments">Send Trigger Event - simplecl failure</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/unauthenticated.DCAE_CL_OUTPUT</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">POST</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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">{
- "event": {
- "commonEventHeader": {
- "startEpochMicrosec": 1597953057126,
- "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}",
- "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}",
- "lastEpochMicrosec": 1597952499468,
- "eventName": "Report hostname & IP",
- "sourceName": "PNF101",
- "reportingEntityName": "DCAE",
- "vesEventListenerVersion": "7.1",
- "internalHeaderFields": {},
- "version": "4.0.1",
- "priority": "Normal",
- "sequence": 1,
- "domain": "other"
- },
- "otherFields": {
- "hashMap": {
- "hostname": "UNDEFINED",
- "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
- "pnfName": "PNF_INVALID",
- "ip": "10.101.200.10"
- },
- "otherFieldsVersion": "3.0"
- }
- }
-}</stringProp>
- <stringProp name="Argument.metadata">=</stringProp>
- </elementProp>
- </collectionProp>
- </elementProp>
- </HTTPSamplerProxy>
- <hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="true">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
- <hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Read notification events - simplecl failure" enabled="true">
- <stringProp name="TestPlan.comments">Read notification events - simplecl failure</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/APEX-CL-MGT/cg${__threadNum}/c1?limit=50&timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false">
- <stringProp name="cacheKey">true</stringProp>
- <stringProp name="filename"></stringProp>
- <stringProp name="parameters"></stringProp>
- <stringProp name="script">import groovy.json.JsonSlurper;
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="JSR223 Sampler">
+ <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.Callback
+import org.apache.kafka.clients.producer.RecordMetadata
+import org.apache.kafka.clients.producer.KafkaProducer
+import org.apache.kafka.clients.producer.ProducerRecord
+import org.apache.kafka.clients.producer.ProducerConfig
+import org.apache.kafka.common.serialization.StringSerializer
-def res = [];
-if (prev.getResponseCode() == '200') {
- def jsonSlurper = new JsonSlurper();
- def responseString = prev.getResponseDataAsString();
- res = jsonSlurper.parseText(responseString);
- def expectedNumberOfNotifications = ${threads} * 2;
- assert res instanceof List;
- assert res.size() == expectedNumberOfNotifications;
- assert responseString.contains("ACTIVE")
- assert responseString.contains("FINAL_FAILURE")
- assert !responseString.contains("FINAL_SUCCESS")
-}
+def props = new Properties()
+props.put("bootstrap.servers", "kafka:9092")
+props.put("group.id", "new-group")
+props.put("acks", "all")
+props.put("retries", 0)
+props.put("batch.size", 16384)
+props.put("linger.ms", 1)
+props.put("buffer.memory", 33554432)
+props.put("key.serializer", StringSerializer.class.getName())
+props.put("value.serializer", StringSerializer.class.getName())
+
+def producer = new KafkaProducer<>(props)
+
+def jsonString = '''{
+ "event": {
+ "commonEventHeader": {
+ "domain": "fault",
+ "eventId": "fault0000245",
+ "eventName": "Fault_Vscf:PilotNumberPoolExhaustion",
+ "lastEpochMicrosec": 1413378172000000,
+ "priority": "High",
+ "reportingEntityName": "ibcx0001vm002oam001",
+ "sequence": 1,
+ "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014${__threadNum}",
+ "sourceName": "vfw-cnf-cds-test-1-vnf",
+ "startEpochMicrosec": 1413378172000000,
+ "timeZoneOffset": "UTC-05:30",
+ "version": "4.0.1",
+ "vesEventListenerVersion": "7.0.1"
+ },
+ "faultFields": {
+ "alarmAdditionalInformation": {
+ "PilotNumberPoolSize": "1000"
+ },
+ "alarmCondition": "PilotNumberPoolExhaustion",
+ "eventSeverity": "CRITICAL",
+ "eventSourceType": "other",
+ "faultFieldsVersion": 4,
+ "specificProblem": "Calls cannot complete - pilot numbers are unavailable",
+ "vfStatus": "Active"
+ }
+ }
+}'''
+
+def record = new ProducerRecord<>("unauthenticated.dcae_policy_example_output", jsonString)
+
+producer.send(record, new Callback() {
+ @Override
+ void onCompletion(RecordMetadata metadata, Exception exception) {
+ if (exception != null) {
+ exception.printStackTrace()
+ } else {
+ println("Sent message to topic ${metadata.topic()} partition ${metadata.partition()} with offset ${metadata.offset()}")
+ }
+ }
+})
+
+producer.close()
</stringProp>
- <stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223Assertion>
- <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">import groovy.json.JsonSlurper;
+ </JSR223Sampler>
+ <hashTree/>
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Read notification events - simplecl 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.ConsumerConfig
+import org.apache.kafka.clients.consumer.KafkaConsumer
+import org.apache.kafka.clients.consumer.ConsumerRecords
+import org.apache.kafka.clients.consumer.ConsumerRecord
+import org.apache.kafka.common.serialization.StringDeserializer
+import groovy.json.JsonSlurper
+
+// Consumer properties
+def props = new Properties()
+props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka:9092") // Adjust to your Kafka bootstrap server
+props.put(ConsumerConfig.GROUP_ID_CONFIG, "apex-group")
+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 the Kafka consumer
+def consumer = new KafkaConsumer<>(props)
+
+// Subscribe to the topic
+consumer.subscribe(["apex-cl-mgt"])
-def res = [];
-if (prev.getResponseCode() == '200') {
- def jsonSlurper = new JsonSlurper();
- def responseString = prev.getResponseDataAsString();
- res = jsonSlurper.parseText(responseString);
- def expectedNumberOfNotifications = ${threads} * 2;
- assert res instanceof List;
- assert res.size() == expectedNumberOfNotifications;
- assert responseString.contains("ACTIVE")
- assert responseString.contains("FINAL_FAILURE")
- assert !responseString.contains("FINAL_SUCCESS")
+// Poll for messages and assert the value
+def found = false
+def timeout = 10000 // timeout in milliseconds
+def startTime = System.currentTimeMillis()
+
+while (!found && (System.currentTimeMillis() - startTime) < timeout) {
+ println("Inside while loop")
+ ConsumerRecords<String, String> records = consumer.poll(1000)
+ for (ConsumerRecord<String, String> record : records) {
+ println("Received message: Key=${record.key()}, Value=${record.value()}, Partition=${record.partition()}, Offset=${record.offset()}")
+
+ // Parse the JSON value
+ def jsonSlurper = new JsonSlurper()
+ def message = jsonSlurper.parseText(record.value())
+
+ // Perform assertion on specific fields in the JSON
+ if ((message?.source == "APEX") || (message?.component?.status == "ACTIVE")) {
+ found = true
+ println("Assertion passed: source is 'APEX' or status is 'ACTIVE'")
+ break
+ }
+ }
}
+
+// Close the consumer
+consumer.close()
</stringProp>
- </JSR223Assertion>
- <hashTree/>
- </hashTree>
- </hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Clean up DMaaP notification topic" enabled="true"/>
- <hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Clean up DMaaP notification topic" enabled="true">
- <stringProp name="TestPlan.comments">Clean up DMaaP notification topic</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/APEX-CL-MGT/cg${__threadNum}/c1?limit=100&timeout=500</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
+ </JSR223Sampler>
+ <hashTree/>
</hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test example policy - success" enabled="true"/>
+ <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test simple-cl policy - failure"/>
<hashTree>
- <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="Synchronizing Timer" enabled="true">
- <stringProp name="groupSize">${threads}</stringProp>
- <stringProp name="timeoutInMs">${threadsTimeOutInMs}</stringProp>
- </SyncTimer>
- <hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Trigger Event - example success" enabled="true">
- <stringProp name="TestPlan.comments">Send Trigger Event - example success</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/unauthenticated.DCAE_POLICY_EXAMPLE_OUTPUT</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">POST</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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">{
- "event": {
- "commonEventHeader": {
- "domain": "fault",
- "eventId": "fault0000245",
- "eventName": "Fault_Vscf:PilotNumberPoolExhaustion",
- "lastEpochMicrosec": 1413378172000000,
- "priority": "High",
- "reportingEntityName": "ibcx0001vm002oam001",
- "sequence": 1,
- "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014${__threadNum}",
- "sourceName": "vfw-cnf-cds-test-1-vnf",
- "startEpochMicrosec": 1413378172000000,
- "timeZoneOffset": "UTC-05:30",
- "version": "4.0.1",
- "vesEventListenerVersion": "7.0.1"
- },
- "faultFields": {
- "alarmAdditionalInformation": {
- "PilotNumberPoolSize": "1000"
- },
- "alarmCondition": "PilotNumberPoolExhaustion",
- "eventSeverity": "CRITICAL",
- "eventSourceType": "other",
- "faultFieldsVersion": 4,
- "specificProblem": "Calls cannot complete - pilot numbers are unavailable",
- "vfStatus": "Active"
- }
- }
-}</stringProp>
- <stringProp name="Argument.metadata">=</stringProp>
- </elementProp>
- </collectionProp>
- </elementProp>
- </HTTPSamplerProxy>
- <hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="true">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Send Trigger Event - simple-cl failure">
+ <stringProp name="cacheKey">true</stringProp>
+ <stringProp name="filename"></stringProp>
+ <stringProp name="parameters"></stringProp>
+ <stringProp name="script">import org.apache.kafka.clients.producer.Callback
+import org.apache.kafka.clients.producer.RecordMetadata
+import org.apache.kafka.clients.producer.KafkaProducer
+import org.apache.kafka.clients.producer.ProducerRecord
+import org.apache.kafka.clients.producer.ProducerConfig
+import org.apache.kafka.common.serialization.StringSerializer
+
+def props = new Properties()
+props.put("bootstrap.servers", "kafka:9092")
+props.put("group.id", "new-group")
+props.put("acks", "all")
+props.put("retries", 0)
+props.put("batch.size", 16384)
+props.put("linger.ms", 1)
+props.put("buffer.memory", 33554432)
+props.put("key.serializer", StringSerializer.class.getName())
+props.put("value.serializer", StringSerializer.class.getName())
+
+def producer = new KafkaProducer<>(props)
+
+def jsonString = '''{
+ "event": {
+ "commonEventHeader": {
+ "startEpochMicrosec": 1597953057126,
+ "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}",
+ "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}",
+ "lastEpochMicrosec": 1597952499468,
+ "eventName": "Report hostname & IP",
+ "sourceName": "PNF101",
+ "reportingEntityName": "DCAE",
+ "vesEventListenerVersion": "7.1",
+ "internalHeaderFields": {},
+ "version": "4.0.1",
+ "priority": "Normal",
+ "sequence": 1,
+ "domain": "other"
+ },
+ "otherFields": {
+ "hashMap": {
+ "hostname": "UNDEFINED",
+ "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
+ "pnfName": "PNF_INVALID",
+ "ip": "10.101.200.10"
+ },
+ "otherFieldsVersion": "3.0"
+ }
+ }
+}'''
+
+def record = new ProducerRecord<>("unauthenticated.dcae_cl_output", jsonString)
+
+producer.send(record, new Callback() {
+ @Override
+ void onCompletion(RecordMetadata metadata, Exception exception) {
+ if (exception != null) {
+ exception.printStackTrace()
+ } else {
+ println("Sent message to topic ${metadata.topic()} partition ${metadata.partition()} with offset ${metadata.offset()}")
+ }
+ }
+})
+
+producer.close()
+</stringProp>
+ <stringProp name="scriptLanguage">groovy</stringProp>
+ </JSR223Sampler>
<hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Read notification events - example success" enabled="true">
- <stringProp name="TestPlan.comments">Read notification events - example success</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/APEX-CL-MGT/cg${__threadNum}/c1?limit=50&timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false">
- <stringProp name="cacheKey">true</stringProp>
- <stringProp name="filename"></stringProp>
- <stringProp name="parameters"></stringProp>
- <stringProp name="script">import groovy.json.JsonSlurper;
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Read notification events - simplecl 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.ConsumerConfig
+import org.apache.kafka.clients.consumer.KafkaConsumer
+import org.apache.kafka.clients.consumer.ConsumerRecords
+import org.apache.kafka.clients.consumer.ConsumerRecord
+import org.apache.kafka.common.serialization.StringDeserializer
+import groovy.json.JsonSlurper
-def res = [];
-if (prev.getResponseCode() == '200') {
- def jsonSlurper = new JsonSlurper();
- def responseString = prev.getResponseDataAsString();
- res = jsonSlurper.parseText(responseString);
- def expectedNumberOfNotifications = ${threads} * 4;
- assert res instanceof List;
- assert res.size() == expectedNumberOfNotifications;
- assert responseString.contains("ACTIVE")
- assert responseString.contains("SUCCESS")
- assert responseString.contains("FINAL_SUCCESS")
- assert !responseString.contains("FAILURE")
+// Consumer properties
+def props = new Properties()
+props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka:9092") // Adjust to your Kafka bootstrap server
+props.put(ConsumerConfig.GROUP_ID_CONFIG, "apex-group")
+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 the Kafka consumer
+def consumer = new KafkaConsumer<>(props)
+
+// Subscribe to the topic
+consumer.subscribe(["apex-cl-mgt"])
+
+// Poll for messages and assert the value
+def found = false
+def timeout = 10000 // timeout in milliseconds
+def startTime = System.currentTimeMillis()
+
+while (!found && (System.currentTimeMillis() - startTime) < timeout) {
+ println("Inside while loop")
+ ConsumerRecords<String, String> records = consumer.poll(1000)
+ for (ConsumerRecord<String, String> record : records) {
+ println("Received message: Key=${record.key()}, Value=${record.value()}, Partition=${record.partition()}, Offset=${record.offset()}")
+
+ // Parse the JSON value
+ def jsonSlurper = new JsonSlurper()
+ def message = jsonSlurper.parseText(record.value())
+
+ // Perform assertion on specific fields in the JSON
+ if (!(message?.name != "SUCCESS")) {
+ found = true
+ println("Assertion passed")
+ break
+ }
+ }
}
+
+// Close the consumer
+consumer.close()
</stringProp>
- <stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223Assertion>
- <hashTree/>
- </hashTree>
- </hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Clean up DMaaP notification topic" enabled="true"/>
- <hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Clean up DMaaP notification topic" enabled="true">
- <stringProp name="TestPlan.comments">Clean up DMaaP notification topic</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/APEX-CL-MGT/cg${__threadNum}/c1?limit=100&timeout=500</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
+ </JSR223Sampler>
+ <hashTree/>
</hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test example policy - failure" enabled="true"/>
+ <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test example policy - failure"/>
<hashTree>
- <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="Synchronizing Timer" enabled="true">
- <stringProp name="groupSize">${threads}</stringProp>
- <stringProp name="timeoutInMs">${threadsTimeOutInMs}</stringProp>
- </SyncTimer>
- <hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Trigger Event - example failure" enabled="true">
- <stringProp name="TestPlan.comments">Send Trigger Event - example failure</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/unauthenticated.DCAE_POLICY_EXAMPLE_OUTPUT</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">POST</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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">{
- "event": {
- "commonEventHeader": {
- "domain": "fault",
- "eventId": "fault0000245",
- "eventName": "Fault_Vscf:PilotNumberPoolExhaustion",
- "lastEpochMicrosec": 1413378172000000,
- "priority": "High",
- "reportingEntityName": "ibcx0001vm002oam001",
- "sequence": 1,
- "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014${__threadNum}",
- "sourceName": "vfw-cnf-cds-test-2-vnf",
- "startEpochMicrosec": 1413378172000000,
- "timeZoneOffset": "UTC-05:30",
- "version": "4.0.1",
- "vesEventListenerVersion": "7.0.1"
- },
- "faultFields": {
- "alarmAdditionalInformation": {
- "PilotNumberPoolSize": "1000"
- },
- "alarmCondition": "PilotNumberPoolExhaustion",
- "eventSeverity": "CRITICAL",
- "eventSourceType": "other",
- "faultFieldsVersion": 4,
- "specificProblem": "Calls cannot complete - pilot numbers are unavailable",
- "vfStatus": "InActive"
- }
- }
-}</stringProp>
- <stringProp name="Argument.metadata">=</stringProp>
- </elementProp>
- </collectionProp>
- </elementProp>
- </HTTPSamplerProxy>
- <hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="true">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Send Trigger Event - example failure">
+ <stringProp name="cacheKey">true</stringProp>
+ <stringProp name="filename"></stringProp>
+ <stringProp name="parameters"></stringProp>
+ <stringProp name="script">import org.apache.kafka.clients.producer.Callback
+import org.apache.kafka.clients.producer.RecordMetadata
+import org.apache.kafka.clients.producer.KafkaProducer
+import org.apache.kafka.clients.producer.ProducerRecord
+import org.apache.kafka.clients.producer.ProducerConfig
+import org.apache.kafka.common.serialization.StringSerializer
+
+def props = new Properties()
+props.put("bootstrap.servers", "kafka:9092")
+props.put("group.id", "new-group")
+props.put("acks", "all")
+props.put("retries", 0)
+props.put("batch.size", 16384)
+props.put("linger.ms", 1)
+props.put("buffer.memory", 33554432)
+props.put("key.serializer", StringSerializer.class.getName())
+props.put("value.serializer", StringSerializer.class.getName())
+
+def producer = new KafkaProducer<>(props)
+
+def jsonString = '''{
+ "event": {
+ "commonEventHeader": {
+ "startEpochMicrosec": 1597953057126,
+ "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}",
+ "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}",
+ "lastEpochMicrosec": 1597952499468,
+ "eventName": "Report hostname & IP",
+ "sourceName": "PNF101",
+ "reportingEntityName": "DCAE",
+ "vesEventListenerVersion": "7.1",
+ "internalHeaderFields": {},
+ "version": "4.0.1",
+ "priority": "Normal",
+ "sequence": 1,
+ "domain": "other"
+ },
+ "otherFields": {
+ "hashMap": {
+ "hostname": "UNDEFINED",
+ "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
+ "pnfName": "PNF101",
+ "ip": "10.101.200.10"
+ },
+ "otherFieldsVersion": "3.0"
+ }
+ }
+}'''
+
+def record = new ProducerRecord<>("unauthenticated.dcae_policy_example_output", jsonString)
+
+producer.send(record, new Callback() {
+ @Override
+ void onCompletion(RecordMetadata metadata, Exception exception) {
+ if (exception != null) {
+ exception.printStackTrace()
+ } else {
+ println("Sent message to topic ${metadata.topic()} partition ${metadata.partition()} with offset ${metadata.offset()}")
+ }
+ }
+})
+
+producer.close()
+</stringProp>
+ <stringProp name="scriptLanguage">groovy</stringProp>
+ </JSR223Sampler>
<hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Read notification events - example failure" enabled="true">
- <stringProp name="TestPlan.comments">Read notification events - example failure</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/APEX-CL-MGT/cg${__threadNum}/c1?limit=50&timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false">
- <stringProp name="cacheKey">true</stringProp>
- <stringProp name="filename"></stringProp>
- <stringProp name="parameters"></stringProp>
- <stringProp name="script">import groovy.json.JsonSlurper;
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Read notification events - simplecl 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.ConsumerConfig
+import org.apache.kafka.clients.consumer.KafkaConsumer
+import org.apache.kafka.clients.consumer.ConsumerRecords
+import org.apache.kafka.clients.consumer.ConsumerRecord
+import org.apache.kafka.common.serialization.StringDeserializer
+import groovy.json.JsonSlurper
+
+// Consumer properties
+def props = new Properties()
+props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka:9092") // Adjust to your Kafka bootstrap server
+props.put(ConsumerConfig.GROUP_ID_CONFIG, "apex-group")
+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")
-def res = [];
-if (prev.getResponseCode() == '200') {
- def jsonSlurper = new JsonSlurper();
- def responseString = prev.getResponseDataAsString();
- res = jsonSlurper.parseText(responseString);
- def expectedNumberOfNotifications = ${threads} * 2;
- assert res instanceof List;
- assert res.size() == expectedNumberOfNotifications;
- assert responseString.contains("ACTIVE")
- assert responseString.contains("FINAL_FAILURE")
- assert !responseString.contains("FINAL_SUCCESS")
+// Create the Kafka consumer
+def consumer = new KafkaConsumer<>(props)
+
+// Subscribe to the topic
+consumer.subscribe(["apex-cl-mgt"])
+
+// Poll for messages and assert the value
+def found = false
+def timeout = 10000 // timeout in milliseconds
+def startTime = System.currentTimeMillis()
+
+while (!found && (System.currentTimeMillis() - startTime) < timeout) {
+ println("Inside while loop")
+ ConsumerRecords<String, String> records = consumer.poll(1000)
+ for (ConsumerRecord<String, String> record : records) {
+ println("Received message: Key=${record.key()}, Value=${record.value()}, Partition=${record.partition()}, Offset=${record.offset()}")
+
+ // Parse the JSON value
+ def jsonSlurper = new JsonSlurper()
+ def message = jsonSlurper.parseText(record.value())
+
+ // Perform assertion on specific fields in the JSON
+ if (!(message?.name == "SUCCESS")) {
+ found = true
+ println("Assertion passed: source is 'APEX' or status is 'ACTIVE'")
+ break
+ }
+ }
}
+
+// Close the consumer
+consumer.close()
</stringProp>
- <stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223Assertion>
- <hashTree/>
- </hashTree>
+ </JSR223Sampler>
+ <hashTree/>
</hashTree>
</hashTree>
- <PostThreadGroup guiclass="PostThreadGroupGui" testclass="PostThreadGroup" testname="tearDown Thread Group" enabled="false">
+ <PostThreadGroup guiclass="PostThreadGroupGui" testclass="PostThreadGroup" testname="tearDown Thread Group">
<intProp name="ThreadGroup.num_threads">1</intProp>
<intProp name="ThreadGroup.ramp_time">1</intProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</elementProp>
</PostThreadGroup>
<hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Un deploy policy" enabled="false">
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Un deploy policy" enabled="true">
<intProp name="HTTPSampler.concurrentPool">6</intProp>
<stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
<stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp>
</elementProp>
</HTTPSamplerProxy>
<hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="false">
<collectionProp name="Asserion.test_strings">
<stringProp name="49588">202</stringProp>
</collectionProp>
</ResponseAssertion>
<hashTree/>
</hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Delete Policy" enabled="false">
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Delete Policy" enabled="true">
<intProp name="HTTPSampler.concurrentPool">6</intProp>
<stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
<stringProp name="HTTPSampler.port">${API_PORT}</stringProp>
</elementProp>
</HTTPSamplerProxy>
<hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="false">
<collectionProp name="Asserion.test_strings">
<stringProp name="49586">200</stringProp>
</collectionProp>
</ResponseAssertion>
<hashTree/>
</hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Delete Policy" enabled="false">
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Delete Policy">
<intProp name="HTTPSampler.concurrentPool">6</intProp>
<stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
<stringProp name="HTTPSampler.port">${API_PORT}</stringProp>
</elementProp>
</HTTPSamplerProxy>
<hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="false">
<collectionProp name="Asserion.test_strings">
<stringProp name="49586">200</stringProp>
</collectionProp>
<hashTree/>
</hashTree>
</hashTree>
- <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Clear DMaaP" enabled="false">
- <stringProp name="ThreadGroup.num_threads">${threads}</stringProp>
- <intProp name="ThreadGroup.ramp_time">1</intProp>
- <longProp name="ThreadGroup.duration">259200</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>
- </ThreadGroup>
- <hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Health Check" enabled="false">
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
- <stringProp name="HTTPSampler.port">${APEX_PORT}</stringProp>
- <stringProp name="HTTPSampler.protocol">https</stringProp>
- <stringProp name="HTTPSampler.path">/policy/apex-pdp/v1/healthcheck</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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>
- <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true">
- <stringProp name="cacheKey">true</stringProp>
- <stringProp name="filename"></stringProp>
- <stringProp name="parameters"></stringProp>
- <stringProp name="script">import groovy.json.JsonSlurper;
-
-def res = [];
-if (prev.getResponseCode() == '200') {
- def jsonSlurper = new JsonSlurper();
- res = jsonSlurper.parseText(prev.getResponseDataAsString());
-
- assert res instanceof Map;
- assert res.healthy == true;
- assert res.message == 'alive';
-}
-</stringProp>
- <stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223Assertion>
- <hashTree/>
- </hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test Controller" enabled="false"/>
- <hashTree>
- <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="Synchronizing Timer" enabled="false">
- <stringProp name="groupSize">${threads}</stringProp>
- <stringProp name="timeoutInMs">${threadsTimeOutInMs}</stringProp>
- </SyncTimer>
- <hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Input Event" enabled="false">
- <stringProp name="TestPlan.comments">Send input event to apex-pdp</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/unauthenticated.DCAE_CL_OUTPUT</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">POST</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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">{
- "event": {
- "commonEventHeader": {
- "startEpochMicrosec": 1597953057126,
- "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}",
- "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}",
- "lastEpochMicrosec": 1597952499468,
- "eventName": "Report hostname & IP",
- "sourceName": "PNF101",
- "reportingEntityName": "DCAE",
- "vesEventListenerVersion": "7.1",
- "internalHeaderFields": {},
- "version": "4.0.1",
- "priority": "Normal",
- "sequence": 1,
- "domain": "other"
- },
- "otherFields": {
- "hashMap": {
- "hostname": "UNDEFINED",
- "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
- "pnfName": "PNF101",
- "ip": "10.101.200.10"
- },
- "otherFieldsVersion": "3.0"
- }
- }
-}</stringProp>
- <stringProp name="Argument.metadata">=</stringProp>
- </elementProp>
- </collectionProp>
- </elementProp>
- </HTTPSamplerProxy>
- <hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">1000</stringProp>
- </ConstantTimer>
- <hashTree/>
- </hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get the ouput event response" enabled="false">
- <stringProp name="TestPlan.comments">Check output event </stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/APEX-CL-MGT/cg${__threadNum}/c1?timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">1000</stringProp>
- </ConstantTimer>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Message" enabled="true">
- <collectionProp name="Asserion.test_strings">
- <stringProp name="1925346054">ACTIVE</stringProp>
- <stringProp name="-310150889">VES event has been received. Going to fetch details from AAI.</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">2</intProp>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response message coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
- <hashTree/>
- </hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get the ouput event response" enabled="false">
- <stringProp name="TestPlan.comments">Check output event </stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/APEX-CL-MGT/cg${__threadNum}/c1?limit=1&timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">1000</stringProp>
- </ConstantTimer>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Message" enabled="true">
- <collectionProp name="Asserion.test_strings">
- <stringProp name="-1149187101">SUCCESS</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">2</intProp>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response message coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
- <hashTree/>
- </hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get the ouput event response" enabled="false">
- <stringProp name="TestPlan.comments">Check output event </stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/APEX-CL-MGT/cg${__threadNum}/c1?limit=1&timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">1000</stringProp>
- </ConstantTimer>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Message" enabled="true">
- <collectionProp name="Asserion.test_strings">
- <stringProp name="439453178">FINAL_SUCCESS</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">2</intProp>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response message coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
- <hashTree/>
- </hashTree>
- <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="While Controller" enabled="false">
- <stringProp name="WhileController.condition">${__javaScript(("${response}".indexOf("VES event has been received. Going to fetch details from AAI") == -1 && ${counter} < 5),)}</stringProp>
- </WhileController>
- <hashTree>
- <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true">
- <stringProp name="CounterConfig.start">0</stringProp>
- <stringProp name="CounterConfig.end">1</stringProp>
- <stringProp name="CounterConfig.incr">1</stringProp>
- <stringProp name="CounterConfig.name"></stringProp>
- <stringProp name="CounterConfig.format"></stringProp>
- <boolProp name="CounterConfig.per_user">false</boolProp>
- </CounterConfig>
- <hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get the ouput event response" enabled="true">
- <stringProp name="TestPlan.comments">Check output event </stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/APEX-CL-MGT/cg${__threadNum}/c1?timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">1000</stringProp>
- </ConstantTimer>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Message" enabled="false">
- <collectionProp name="Asserion.test_strings">
- <stringProp name="1925346054">ACTIVE</stringProp>
- <stringProp name="-310150889">VES event has been received. Going to fetch details from AAI.</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">2</intProp>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response message coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
- <hashTree/>
- <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="JSR223 PostProcessor" enabled="true">
- <stringProp name="cacheKey">true</stringProp>
- <stringProp name="filename"></stringProp>
- <stringProp name="parameters"></stringProp>
- <stringProp name="script">vars.put("response", prev.getResponseDataAsString());</stringProp>
- <stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223PostProcessor>
- <hashTree/>
- </hashTree>
- </hashTree>
- </hashTree>
- </hashTree>
<ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<connectTime>true</connectTime>
</value>
</objProp>
- <stringProp name="filename">/home/dhanrahan/jmeter_results/apex_stability/summary.log</stringProp>
+ <stringProp name="filename">/home/wayne/dev/s3ps/apex-pdp/testsuites/apex-pdp-stability/src/main/resources/s3pTestResults.jtl</stringProp>
</ResultCollector>
<hashTree/>
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
<connectTime>true</connectTime>
</value>
</objProp>
- <stringProp name="filename">/home/dhanrahan/jmeter_results/apex_stability/resultTree.log</stringProp>
+ <stringProp name="filename">/home/wayne/dev/s3ps/apex-pdp/testsuites/apex-pdp-stability/src/main/resources/s3pTestResults.jtl</stringProp>
</ResultCollector>
<hashTree/>
- <ResultCollector guiclass="TableVisualizer" testclass="ResultCollector" testname="View Results in Table" enabled="true">
+ <ResultCollector guiclass="TableVisualizer" testclass="ResultCollector" testname="View Results in Table">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<connectTime>true</connectTime>
</value>
</objProp>
- <stringProp name="filename">/home/dhanrahan/jmeter_results/apex_stability/resultTable.log</stringProp>
+ <stringProp name="filename">/home/wayne/dev/s3ps/apex-pdp/testsuites/apex-pdp-stability/src/main/resources/s3pTestResults.jtl</stringProp>
</ResultCollector>
<hashTree/>
</hashTree>
-->
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.6.3">
<hashTree>
- <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="APEX PDP PERFORMANCE TEST PLAN" enabled="true">
- <stringProp name="TestPlan.comments"></stringProp>
- <boolProp name="TestPlan.functional_mode">false</boolProp>
- <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
+ <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="APEX PDP PERFORMANCE TEST PLAN">
<boolProp name="TestPlan.serialize_threadgroups">true</boolProp>
- <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
+ <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
+ <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables">
<collectionProp name="Arguments.arguments"/>
</elementProp>
- <stringProp name="TestPlan.user_define_classpath"></stringProp>
+ <boolProp name="TestPlan.functional_mode">false</boolProp>
</TestPlan>
<hashTree>
<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager">
</collectionProp>
</HeaderManager>
<hashTree/>
- <ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="false">
+ <ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="true">
<stringProp name="HTTPSampler.port">23324</stringProp>
<stringProp name="HTTPSampler.protocol">http</stringProp>
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables">
<stringProp name="HTTPSampler.implementation"></stringProp>
</ConfigTestElement>
<hashTree/>
- <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
+ <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables">
<collectionProp name="Arguments.arguments">
<elementProp name="threads" elementType="Argument">
<stringProp name="Argument.name">threads</stringProp>
</elementProp>
<elementProp name="KAFKA_PORT" elementType="Argument">
<stringProp name="Argument.name">KAFKA_PORT</stringProp>
- <stringProp name="Argument.value">${__P(KAFKA_PORT,29092)}</stringProp>
+ <stringProp name="Argument.value">${__P(KAFKA_PORT,9092)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="CDS_PORT" elementType="Argument">
</elementProp>
<elementProp name="LOG_PATH" elementType="Argument">
<stringProp name="Argument.name">LOG_PATH</stringProp>
- <stringProp name="Argument.value">${__P(LOG_PATH,/jmeter_results/apex_perf)}</stringProp>
+ <stringProp name="Argument.value">${__P(LOG_PATH,/jmeter_results/apex_stability)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="KAFKA_HOST" elementType="Argument">
</collectionProp>
</Arguments>
<hashTree/>
- <AuthManager guiclass="AuthPanel" testclass="AuthManager" testname="HTTP Authorization Manager" enabled="true">
+ <AuthManager guiclass="AuthPanel" testclass="AuthManager" testname="HTTP Authorization Manager">
<collectionProp name="AuthManager.auth_list">
<elementProp name="" elementType="Authorization">
<stringProp name="Authorization.url">http://${HOSTNAME}:${API_PORT}</stringProp>
<boolProp name="AuthManager.controlledByThreadGroup">false</boolProp>
</AuthManager>
<hashTree/>
- <SetupThreadGroup guiclass="SetupThreadGroupGui" testclass="SetupThreadGroup" testname="setUp Thread Group" enabled="true">
+ <SetupThreadGroup guiclass="SetupThreadGroupGui" testclass="SetupThreadGroup" testname="setUp Thread Group">
<intProp name="ThreadGroup.num_threads">1</intProp>
<intProp name="ThreadGroup.ramp_time">1</intProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</elementProp>
</SetupThreadGroup>
<hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="CreatePolicy-ApexExample">
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="CreatePolicy-ApexExample" enabled="true">
<intProp name="HTTPSampler.concurrentPool">6</intProp>
<stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
<stringProp name="HTTPSampler.port">${API_PORT}</stringProp>
"parameterClassName": "org.onap.policy.apex.plugins.event.carrier.kafka.KafkaCarrierTechnologyParameters",
"parameters": {
"bootstrapServers": "kafka:9092",
- "groupId": "apex-grp2",
+ "groupId": "apex-group",
"enableAutoCommit": true,
- "autoCommitTime": 1000,
- "sessionTimeout": 30000,
- "consumerPollTime": 100,
- "consumerTopicList": [
- "unauthenticated.dcae_cl_output"
- ],
- "keyDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
- "valueDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
- "kafkaProperties": [
-
- ]
+ "autoCommitTime": 1000,
+ "sessionTimeout": 30000,
+ "consumerPollTime": 100,
+ "consumerTopicList": ["unauthenticated.dcae_policy_example_output"],
+ "keyDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
+ "valueDeserializer": "org.apache.kafka.common.serialization.StringDeserializer"
}
},
"eventProtocolParameters": {
"eventProtocol": "JSON"
},
"eventName": "ApexExample_VesEvent"
- },
- "ApexExample_AAIResponseConsumer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "RESTREQUESTOR",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters",
- "parameters": {
- "url": "https://aai:8443/aai/v14/network/generic-vnfs/generic-vnf?vnf-name={vnf-name}",
- "httpMethod": "GET",
- "httpCodeFilter": "[245][0-9][0-9]",
- "httpHeaders": [
- [
- "Accept",
- "application/json"
- ],
- [
- "Content-Type",
- "application/json"
- ],
- [
- "X-FromAppId",
- "dcae-curl"
- ],
- [
- "x-transactionId",
- "9998"
- ],
- [
- "Authorization",
- "Basic QUFJOkFBSQ=="
- ]
- ]
- }
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventName": "ApexExample_AAISuccessResponseEvent|ApexExample_AAIFailureResponseEvent",
- "requestorMode": true,
- "requestorPeer": "ApexExample_AAIProducer",
- "requestorTimeout": 2000
- },
- "ApexExample_CDSConfigModifyResponseConsumer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "GRPC",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters"
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventName": "ApexExample_CDSConfigModifySuccessResponseEvent|ApexExample_CDSConfigModifyFailureResponseEvent",
- "requestorMode": true,
- "requestorPeer": "ApexExample_CDSConfigModifyRequestProducer",
- "requestorTimeout": 500
- },
- "ApexExample_CDSRestartResponseConsumer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "GRPC",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters"
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventName": "ApexExample_CDSRestartSuccessResponseEvent|ApexExample_CDSRestartFailureResponseEvent",
- "requestorMode": true,
- "requestorPeer": "ApexExample_CDSRestartRequestProducer",
- "requestorTimeout": 500
}
},
"eventOutputParameters": {
"ApexExample_AAIProducer": {
"carrierTechnologyParameters": {
- "carrierTechnology": "RESTREQUESTOR",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters"
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventNameFilter": "ApexExample_AAIRequestEvent",
- "requestorMode": true,
- "requestorPeer": "ApexExample_AAIResponseConsumer",
- "requestorTimeout": 2000
- },
- "ApexExample_CDSConfigModifyRequestProducer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "GRPC",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters",
- "parameters": {
- "host": "${KAFKA_HOST}",
- "port": ${CDS_PORT},
- "username": "ccsdkapps",
- "password": "ccsdkapps",
- "timeout": 10
- }
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventNameFilter": "ApexExample_CDSConfigModifyRequestEvent",
- "requestorMode": true,
- "requestorPeer": "ApexExample_CDSConfigModifyResponseConsumer",
- "requestorTimeout": 500
- },
- "ApexExample_CDSRestartRequestProducer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "GRPC",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters",
+ "carrierTechnology": "KAFKA",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.kafka.KafkaCarrierTechnologyParameters",
"parameters": {
- "host": "${KAFKA_HOST}",
- "port": ${CDS_PORT},
- "username": "ccsdkapps",
- "password": "ccsdkapps",
- "timeout": 10
+ "bootstrapServers": "kafka:9092",
+ "acks": "all",
+ "retries": 0,
+ "batchSize": 16384,
+ "lingerTime": 1,
+ "bufferMemory": 33554432,
+ "producerTopic": "apex-cl-mgt",
+ "keySerializer": "org.apache.kafka.common.serialization.StringSerializer",
+ "valueSerializer": "org.apache.kafka.common.serialization.StringSerializer"
}
},
"eventProtocolParameters": {
"eventProtocol": "JSON"
- },
- "eventNameFilter": "ApexExample_CDSRestartRequestEvent",
- "requestorMode": true,
- "requestorPeer": "ApexExample_CDSRestartResponseConsumer",
- "requestorTimeout": 500
+ }
}
}
}
</ResponseAssertion>
<hashTree/>
</hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="CreatePolicy-SimpleCL">
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="CreatePolicy-SimpleCL" enabled="true">
<intProp name="HTTPSampler.concurrentPool">6</intProp>
<stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
<stringProp name="HTTPSampler.port">${API_PORT}</stringProp>
"parameterClassName": "org.onap.policy.apex.plugins.event.carrier.kafka.KafkaCarrierTechnologyParameters",
"parameters": {
"bootstrapServers": "kafka:9092",
- "groupId": "apex-grp2",
+ "groupId": "apex-group",
"enableAutoCommit": true,
- "autoCommitTime": 1000,
- "sessionTimeout": 30000,
- "consumerPollTime": 100,
- "consumerTopicList": [
- "unauthenticated.dcae_cl_output"
- ],
- "keyDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
- "valueDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
- "kafkaProperties": [
-
- ]
+ "autoCommitTime": 1000,
+ "sessionTimeout": 30000,
+ "consumerPollTime": 100,
+ "consumerTopicList": ["unauthenticated.dcae_cl_output"],
+ "keyDeserializer": "org.apache.kafka.common.serialization.StringDeserializer",
+ "valueDeserializer": "org.apache.kafka.common.serialization.StringDeserializer"
}
},
"eventProtocolParameters": {
"eventProtocol": "JSON"
},
"eventName": "SimpleCL_VesEvent"
- },
- "SimpleCL_AAIResponseConsumer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "RESTREQUESTOR",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters",
- "parameters": {
- "url": "https://aai:8443/aai/v14/network/pnfs/pnf/{pnfName}",
- "httpMethod": "GET",
- "httpCodeFilter": "[2-5][0-1][0-9]",
- "httpHeaders": [
- [
- "Accept",
- "application/json"
- ],
- [
- "Content-Type",
- "application/json"
- ],
- [
- "X-FromAppId",
- "dcae-curl"
- ],
- [
- "x-transactionId",
- "9998"
- ],
- [
- "Authorization",
- "Basic QUFJOkFBSQ=="
- ]
- ]
- }
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventName": "SimpleCL_AAISuccessResponseEvent|SimpleCL_AAIFailureResponseEvent",
- "requestorMode": true,
- "requestorPeer": "SimpleCL_AAIProducer",
- "requestorTimeout": 2000
- },
- "SimpleCL_CDSConfigModifyResponseConsumer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "GRPC",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters"
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventName": "SimpleCL_CDSConfigModifySuccessResponseEvent|SimpleCL_CDSConfigModifyFailureResponseEvent",
- "requestorMode": true,
- "requestorPeer": "SimpleCL_CDSConfigModifyRequestProducer",
- "requestorTimeout": 500
}
},
"eventOutputParameters": {
- "SimpleCL_AAIProducer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "RESTREQUESTOR",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters"
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventNameFilter": "SimpleCL_AAIRequestEvent",
- "requestorMode": true,
- "requestorPeer": "SimpleCL_AAIResponseConsumer",
- "requestorTimeout": 2000
- },
- "SimpleCL_CDSConfigModifyRequestProducer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "GRPC",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.grpc.GrpcCarrierTechnologyParameters",
- "parameters": {
- "host": "${KAFKA_HOST}",
- "port": ${CDS_PORT},
- "username": "ccsdkapps",
- "password": "ccsdkapps",
- "timeout": 60
- }
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventNameFilter": "SimpleCL_CDSConfigModifyRequestEvent",
- "requestorMode": true,
- "requestorPeer": "SimpleCL_CDSConfigModifyResponseConsumer",
- "requestorTimeout": 500
- },
"SimpleCL_LogEventProducer": {
"carrierTechnologyParameters": {
"carrierTechnology": "KAFKA",
"batchSize": 16384,
"lingerTime": 1,
"bufferMemory": 33554432,
- "producerTopic": "apex-cl-mgt2",
+ "producerTopic": "apex-cl-mgt",
"keySerializer": "org.apache.kafka.common.serialization.StringSerializer",
- "valueSerializer": "org.apache.kafka.common.serialization.StringSerializer",
- "kafkaProperties": [
-
- ]
+ "valueSerializer": "org.apache.kafka.common.serialization.StringSerializer"
}
},
"eventProtocolParameters": {
"eventProtocol": "JSON"
- },
- "eventNameFilter": "SimpleCL_LogEvent"
+ }
}
}
}
</ConstantTimer>
<hashTree/>
</hashTree>
- <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
+ <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group">
<stringProp name="ThreadGroup.num_threads">${threads}</stringProp>
<intProp name="ThreadGroup.ramp_time">1</intProp>
<longProp name="ThreadGroup.duration">7200</longProp>
</elementProp>
</ThreadGroup>
<hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Health Check" enabled="true">
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Health Check">
<intProp name="HTTPSampler.concurrentPool">6</intProp>
<stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
<stringProp name="HTTPSampler.port">${APEX_PORT}</stringProp>
</elementProp>
</HTTPSamplerProxy>
<hashTree>
- <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false">
- <stringProp name="cacheKey">true</stringProp>
- <stringProp name="filename"></stringProp>
- <stringProp name="parameters"></stringProp>
- <stringProp name="script">import groovy.json.JsonSlurper;
-
-def res = [];
-if (prev.getResponseCode() == '200') {
- def jsonSlurper = new JsonSlurper();
- res = jsonSlurper.parseText(prev.getResponseDataAsString());
-
- assert res instanceof Map;
- assert res.healthy == true;
- assert res.message == 'alive';
-}
-</stringProp>
- <stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223Assertion>
- <hashTree/>
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
<collectionProp name="Asserion.test_strings">
<stringProp name="49586">200</stringProp>
</ResponseAssertion>
<hashTree/>
</hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Prometheus Metrics" enabled="true">
+ <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Prometheus Metrics">
<intProp name="HTTPSampler.concurrentPool">6</intProp>
<stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
<stringProp name="HTTPSampler.port">${APEX_PORT}</stringProp>
<stringProp name="TestPlan.comments">Assert response coming back from apex-pdp</stringProp>
</ResponseAssertion>
<hashTree/>
- <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false">
+ </hashTree>
+ <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test simple-cl policy - success" enabled="true"/>
+ <hashTree>
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Send Trigger Event - simple-cl success" enabled="true">
<stringProp name="cacheKey">true</stringProp>
<stringProp name="filename"></stringProp>
<stringProp name="parameters"></stringProp>
- <stringProp name="script">import groovy.json.JsonSlurper;
+ <stringProp name="script">import org.apache.kafka.clients.producer.Callback
+import org.apache.kafka.clients.producer.RecordMetadata
+import org.apache.kafka.clients.producer.KafkaProducer
+import org.apache.kafka.clients.producer.ProducerRecord
+import org.apache.kafka.clients.producer.ProducerConfig
+import org.apache.kafka.common.serialization.StringSerializer
-def res = [];
-if (prev.getResponseCode() == '200') {
- def jsonSlurper = new JsonSlurper();
- res = jsonSlurper.parseText(prev.getResponseDataAsString());
+def props = new Properties()
+props.put("bootstrap.servers", "kafka:9092")
+props.put("group.id", "new-group")
+props.put("acks", "all")
+props.put("retries", 0)
+props.put("batch.size", 16384)
+props.put("linger.ms", 1)
+props.put("buffer.memory", 33554432)
+props.put("key.serializer", StringSerializer.class.getName())
+props.put("value.serializer", StringSerializer.class.getName())
- assert res instanceof Map;
- assert res.healthy == true;
- assert res.message == 'alive';
-}
+def producer = new KafkaProducer<>(props)
+
+def jsonString = '''{
+ "event": {
+ "commonEventHeader": {
+ "startEpochMicrosec": 1597953057126,
+ "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}",
+ "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}",
+ "lastEpochMicrosec": 1597952499468,
+ "eventName": "Report hostname & IP",
+ "sourceName": "PNF101",
+ "reportingEntityName": "DCAE",
+ "vesEventListenerVersion": "7.1",
+ "internalHeaderFields": {},
+ "version": "4.0.1",
+ "priority": "Normal",
+ "sequence": 1,
+ "domain": "other"
+ },
+ "otherFields": {
+ "hashMap": {
+ "hostname": "UNDEFINED",
+ "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
+ "pnfName": "PNF101",
+ "ip": "10.101.200.10"
+ },
+ "otherFieldsVersion": "3.0"
+ }
+ }
+}'''
+
+def record = new ProducerRecord<>("unauthenticated.dcae_cl_output", jsonString)
+
+producer.send(record, new Callback() {
+ @Override
+ void onCompletion(RecordMetadata metadata, Exception exception) {
+ if (exception != null) {
+ exception.printStackTrace()
+ } else {
+ println("Sent message to topic ${metadata.topic()} partition ${metadata.partition()} with offset ${metadata.offset()}")
+ }
+ }
+})
+
+producer.close()
</stringProp>
<stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223Assertion>
+ </JSR223Sampler>
<hashTree/>
- </hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Clean up DMaaP notification topic" enabled="true"/>
- <hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Clean up DMaaP notification topic" enabled="true">
- <stringProp name="TestPlan.comments">Clean up DMaaP notification topic</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/apex-cl-mgt/cg${__threadNum}/c1?limit=300&timeout=500</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
- </hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test simple-cl policy - success" enabled="true"/>
- <hashTree>
- <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="Synchronizing Timer" enabled="true">
- <stringProp name="groupSize">${threads}</stringProp>
- <stringProp name="timeoutInMs">${threadsTimeOutInMs}</stringProp>
- </SyncTimer>
- <hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Trigger Event - simplecl success" enabled="true">
- <stringProp name="TestPlan.comments">Send Trigger Event - simplecl success</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/unauthenticated.dcae_cl_output</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">POST</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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">{
- "event": {
- "commonEventHeader": {
- "startEpochMicrosec": 1597953057126,
- "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}",
- "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}",
- "lastEpochMicrosec": 1597952499468,
- "eventName": "Report hostname & IP",
- "sourceName": "PNF101",
- "reportingEntityName": "DCAE",
- "vesEventListenerVersion": "7.1",
- "internalHeaderFields": {},
- "version": "4.0.1",
- "priority": "Normal",
- "sequence": 1,
- "domain": "other"
- },
- "otherFields": {
- "hashMap": {
- "hostname": "UNDEFINED",
- "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
- "pnfName": "PNF101",
- "ip": "10.101.200.10"
- },
- "otherFieldsVersion": "3.0"
- }
- }
-}</stringProp>
- <stringProp name="Argument.metadata">=</stringProp>
- </elementProp>
- </collectionProp>
- </elementProp>
- </HTTPSamplerProxy>
- <hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="true">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
- <hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Read notification events - simplecl success" enabled="true">
- <stringProp name="TestPlan.comments">Read notification events - simplecl success</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/apex-cl-mgt/cg${__threadNum}/c1?limit=100&timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false">
- <stringProp name="cacheKey">true</stringProp>
- <stringProp name="filename"></stringProp>
- <stringProp name="parameters"></stringProp>
- <stringProp name="script">import groovy.json.JsonSlurper;
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Read notification events - simplecl 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.ConsumerConfig
+import org.apache.kafka.clients.consumer.KafkaConsumer
+import org.apache.kafka.clients.consumer.ConsumerRecords
+import org.apache.kafka.clients.consumer.ConsumerRecord
+import org.apache.kafka.common.serialization.StringDeserializer
+import groovy.json.JsonSlurper
+
+// Consumer properties
+def props = new Properties()
+props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka:9092") // Adjust to your Kafka bootstrap server
+props.put(ConsumerConfig.GROUP_ID_CONFIG, "apex-group")
+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 the Kafka consumer
+def consumer = new KafkaConsumer<>(props)
+
+// Subscribe to the topic
+consumer.subscribe(["apex-cl-mgt"])
-def res = [];
-if (prev.getResponseCode() == '200') {
- def jsonSlurper = new JsonSlurper();
- def responseString = prev.getResponseDataAsString();
- res = jsonSlurper.parseText(responseString);
- def expectedNumberOfNotifications = ${threads} * 3;
- assert res instanceof List;
- assert res.size() == expectedNumberOfNotifications;
- assert responseString.contains("ACTIVE")
- assert responseString.contains("SUCCESS")
- assert responseString.contains("FINAL_SUCCESS")
- assert !responseString.contains("FAILURE")
+// Poll for messages and assert the value
+def found = false
+def timeout = 10000 // timeout in milliseconds
+def startTime = System.currentTimeMillis()
+
+while (!found && (System.currentTimeMillis() - startTime) < timeout) {
+ println("Inside while loop")
+ ConsumerRecords<String, String> records = consumer.poll(1000)
+ for (ConsumerRecord<String, String> record : records) {
+ println("Received message: Key=${record.key()}, Value=${record.value()}, Partition=${record.partition()}, Offset=${record.offset()}")
+
+ // Parse the JSON value
+ def jsonSlurper = new JsonSlurper()
+ def message = jsonSlurper.parseText(record.value())
+
+ // Perform assertion on specific fields in the JSON
+ if ((message?.source == "APEX") || (message?.component?.status == "ACTIVE")) {
+ found = true
+ println("Assertion passed: source is 'APEX' or status is 'ACTIVE'")
+ break
+ }
+ }
}
+
+// Close the consumer
+consumer.close()
</stringProp>
- <stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223Assertion>
- <hashTree/>
- </hashTree>
- </hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Clean up DMaaP notification topic" enabled="true"/>
- <hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Clean up DMaaP notification topic" enabled="true">
- <stringProp name="TestPlan.comments">Clean up DMaaP notification topic</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/apex-cl-mgt/cg${__threadNum}/c1?limit=300&timeout=500</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
+ </JSR223Sampler>
+ <hashTree/>
</hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test simple-cl policy - failure" enabled="true"/>
+ <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test example policy - success" enabled="true"/>
<hashTree>
- <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="Synchronizing Timer" enabled="true">
- <stringProp name="groupSize">${threads}</stringProp>
- <stringProp name="timeoutInMs">${threadsTimeOutInMs}</stringProp>
- </SyncTimer>
- <hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Trigger Event - simplecl failure" enabled="true">
- <stringProp name="TestPlan.comments">Send Trigger Event - simplecl failure</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/unauthenticated.dcae_cl_output</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">POST</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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">{
- "event": {
- "commonEventHeader": {
- "startEpochMicrosec": 1597953057126,
- "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}",
- "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}",
- "lastEpochMicrosec": 1597952499468,
- "eventName": "Report hostname & IP",
- "sourceName": "PNF101",
- "reportingEntityName": "DCAE",
- "vesEventListenerVersion": "7.1",
- "internalHeaderFields": {},
- "version": "4.0.1",
- "priority": "Normal",
- "sequence": 1,
- "domain": "other"
- },
- "otherFields": {
- "hashMap": {
- "hostname": "UNDEFINED",
- "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
- "pnfName": "PNF_INVALID",
- "ip": "10.101.200.10"
- },
- "otherFieldsVersion": "3.0"
- }
- }
-}</stringProp>
- <stringProp name="Argument.metadata">=</stringProp>
- </elementProp>
- </collectionProp>
- </elementProp>
- </HTTPSamplerProxy>
- <hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="true">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="JSR223 Sampler" 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.producer.Callback
+import org.apache.kafka.clients.producer.RecordMetadata
+import org.apache.kafka.clients.producer.KafkaProducer
+import org.apache.kafka.clients.producer.ProducerRecord
+import org.apache.kafka.clients.producer.ProducerConfig
+import org.apache.kafka.common.serialization.StringSerializer
+
+def props = new Properties()
+props.put("bootstrap.servers", "kafka:9092")
+props.put("group.id", "new-group")
+props.put("acks", "all")
+props.put("retries", 0)
+props.put("batch.size", 16384)
+props.put("linger.ms", 1)
+props.put("buffer.memory", 33554432)
+props.put("key.serializer", StringSerializer.class.getName())
+props.put("value.serializer", StringSerializer.class.getName())
+
+def producer = new KafkaProducer<>(props)
+
+def jsonString = '''{
+ "event": {
+ "commonEventHeader": {
+ "domain": "fault",
+ "eventId": "fault0000245",
+ "eventName": "Fault_Vscf:PilotNumberPoolExhaustion",
+ "lastEpochMicrosec": 1413378172000000,
+ "priority": "High",
+ "reportingEntityName": "ibcx0001vm002oam001",
+ "sequence": 1,
+ "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014${__threadNum}",
+ "sourceName": "vfw-cnf-cds-test-1-vnf",
+ "startEpochMicrosec": 1413378172000000,
+ "timeZoneOffset": "UTC-05:30",
+ "version": "4.0.1",
+ "vesEventListenerVersion": "7.0.1"
+ },
+ "faultFields": {
+ "alarmAdditionalInformation": {
+ "PilotNumberPoolSize": "1000"
+ },
+ "alarmCondition": "PilotNumberPoolExhaustion",
+ "eventSeverity": "CRITICAL",
+ "eventSourceType": "other",
+ "faultFieldsVersion": 4,
+ "specificProblem": "Calls cannot complete - pilot numbers are unavailable",
+ "vfStatus": "Active"
+ }
+ }
+}'''
+
+def record = new ProducerRecord<>("unauthenticated.dcae_policy_example_output", jsonString)
+
+producer.send(record, new Callback() {
+ @Override
+ void onCompletion(RecordMetadata metadata, Exception exception) {
+ if (exception != null) {
+ exception.printStackTrace()
+ } else {
+ println("Sent message to topic ${metadata.topic()} partition ${metadata.partition()} with offset ${metadata.offset()}")
+ }
+ }
+})
+
+producer.close()
+</stringProp>
+ </JSR223Sampler>
<hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Read notification events - simplecl failure" enabled="true">
- <stringProp name="TestPlan.comments">Read notification events - simplecl failure</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/apex-cl-mgt/cg${__threadNum}/c1?limit=100&timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false">
- <stringProp name="cacheKey">true</stringProp>
- <stringProp name="filename"></stringProp>
- <stringProp name="parameters"></stringProp>
- <stringProp name="script">import groovy.json.JsonSlurper;
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Read notification events - simplecl 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.ConsumerConfig
+import org.apache.kafka.clients.consumer.KafkaConsumer
+import org.apache.kafka.clients.consumer.ConsumerRecords
+import org.apache.kafka.clients.consumer.ConsumerRecord
+import org.apache.kafka.common.serialization.StringDeserializer
+import groovy.json.JsonSlurper
+
+// Consumer properties
+def props = new Properties()
+props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka:9092") // Adjust to your Kafka bootstrap server
+props.put(ConsumerConfig.GROUP_ID_CONFIG, "apex-group")
+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 the Kafka consumer
+def consumer = new KafkaConsumer<>(props)
-def res = [];
-if (prev.getResponseCode() == '200') {
- def jsonSlurper = new JsonSlurper();
- def responseString = prev.getResponseDataAsString();
- res = jsonSlurper.parseText(responseString);
- def expectedNumberOfNotifications = ${threads} * 2;
- assert res instanceof List;
- assert res.size() == expectedNumberOfNotifications;
- assert responseString.contains("ACTIVE")
- assert responseString.contains("FINAL_FAILURE")
- assert !responseString.contains("FINAL_SUCCESS")
+// Subscribe to the topic
+consumer.subscribe(["apex-cl-mgt"])
+
+// Poll for messages and assert the value
+def found = false
+def timeout = 10000 // timeout in milliseconds
+def startTime = System.currentTimeMillis()
+
+while (!found && (System.currentTimeMillis() - startTime) < timeout) {
+ println("Inside while loop")
+ ConsumerRecords<String, String> records = consumer.poll(1000)
+ for (ConsumerRecord<String, String> record : records) {
+ println("Received message: Key=${record.key()}, Value=${record.value()}, Partition=${record.partition()}, Offset=${record.offset()}")
+
+ // Parse the JSON value
+ def jsonSlurper = new JsonSlurper()
+ def message = jsonSlurper.parseText(record.value())
+
+ // Perform assertion on specific fields in the JSON
+ if ((message?.source == "APEX") || (message?.component?.status == "ACTIVE")) {
+ found = true
+ println("Assertion passed: source is 'APEX' or status is 'ACTIVE'")
+ break
+ }
+ }
}
+
+// Close the consumer
+consumer.close()
</stringProp>
- <stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223Assertion>
- <hashTree/>
- </hashTree>
- </hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Clean up DMaaP notification topic" enabled="true"/>
- <hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Clean up DMaaP notification topic" enabled="true">
- <stringProp name="TestPlan.comments">Clean up DMaaP notification topic</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/apex-cl-mgt/cg${__threadNum}/c1?limit=300&timeout=500</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
+ </JSR223Sampler>
+ <hashTree/>
</hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test example policy - success" enabled="true"/>
+ <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test simple-cl policy - failure" enabled="true"/>
<hashTree>
- <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="Synchronizing Timer" enabled="true">
- <stringProp name="groupSize">${threads}</stringProp>
- <stringProp name="timeoutInMs">${threadsTimeOutInMs}</stringProp>
- </SyncTimer>
- <hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Trigger Event - example success" enabled="true">
- <stringProp name="TestPlan.comments">Send Trigger Event - example success</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/unauthenticated.dcae_policy_example_output</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">POST</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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">{
- "event": {
- "commonEventHeader": {
- "domain": "fault",
- "eventId": "fault0000245",
- "eventName": "Fault_Vscf:PilotNumberPoolExhaustion",
- "lastEpochMicrosec": 1413378172000000,
- "priority": "High",
- "reportingEntityName": "ibcx0001vm002oam001",
- "sequence": 1,
- "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014${__threadNum}",
- "sourceName": "vfw-cnf-cds-test-1-vnf",
- "startEpochMicrosec": 1413378172000000,
- "timeZoneOffset": "UTC-05:30",
- "version": "4.0.1",
- "vesEventListenerVersion": "7.0.1"
- },
- "faultFields": {
- "alarmAdditionalInformation": {
- "PilotNumberPoolSize": "1000"
- },
- "alarmCondition": "PilotNumberPoolExhaustion",
- "eventSeverity": "CRITICAL",
- "eventSourceType": "other",
- "faultFieldsVersion": 4,
- "specificProblem": "Calls cannot complete - pilot numbers are unavailable",
- "vfStatus": "Active"
- }
- }
-}</stringProp>
- <stringProp name="Argument.metadata">=</stringProp>
- </elementProp>
- </collectionProp>
- </elementProp>
- </HTTPSamplerProxy>
- <hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="true">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Send Trigger Event - simple-cl failure" enabled="true">
+ <stringProp name="cacheKey">true</stringProp>
+ <stringProp name="filename"></stringProp>
+ <stringProp name="parameters"></stringProp>
+ <stringProp name="script">import org.apache.kafka.clients.producer.Callback
+import org.apache.kafka.clients.producer.RecordMetadata
+import org.apache.kafka.clients.producer.KafkaProducer
+import org.apache.kafka.clients.producer.ProducerRecord
+import org.apache.kafka.clients.producer.ProducerConfig
+import org.apache.kafka.common.serialization.StringSerializer
+
+def props = new Properties()
+props.put("bootstrap.servers", "kafka:9092")
+props.put("group.id", "new-group")
+props.put("acks", "all")
+props.put("retries", 0)
+props.put("batch.size", 16384)
+props.put("linger.ms", 1)
+props.put("buffer.memory", 33554432)
+props.put("key.serializer", StringSerializer.class.getName())
+props.put("value.serializer", StringSerializer.class.getName())
+
+def producer = new KafkaProducer<>(props)
+
+def jsonString = '''{
+ "event": {
+ "commonEventHeader": {
+ "startEpochMicrosec": 1597953057126,
+ "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}",
+ "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}",
+ "lastEpochMicrosec": 1597952499468,
+ "eventName": "Report hostname & IP",
+ "sourceName": "PNF101",
+ "reportingEntityName": "DCAE",
+ "vesEventListenerVersion": "7.1",
+ "internalHeaderFields": {},
+ "version": "4.0.1",
+ "priority": "Normal",
+ "sequence": 1,
+ "domain": "other"
+ },
+ "otherFields": {
+ "hashMap": {
+ "hostname": "UNDEFINED",
+ "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
+ "pnfName": "PNF_INVALID",
+ "ip": "10.101.200.10"
+ },
+ "otherFieldsVersion": "3.0"
+ }
+ }
+}'''
+
+def record = new ProducerRecord<>("unauthenticated.dcae_cl_output", jsonString)
+
+producer.send(record, new Callback() {
+ @Override
+ void onCompletion(RecordMetadata metadata, Exception exception) {
+ if (exception != null) {
+ exception.printStackTrace()
+ } else {
+ println("Sent message to topic ${metadata.topic()} partition ${metadata.partition()} with offset ${metadata.offset()}")
+ }
+ }
+})
+
+producer.close()
+</stringProp>
+ <stringProp name="scriptLanguage">groovy</stringProp>
+ </JSR223Sampler>
<hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Read notification events - example success" enabled="true">
- <stringProp name="TestPlan.comments">Read notification events - example success</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/apex-cl-mgt/cg${__threadNum}/c1?limit=100&timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false">
- <stringProp name="cacheKey">true</stringProp>
- <stringProp name="filename"></stringProp>
- <stringProp name="parameters"></stringProp>
- <stringProp name="script">import groovy.json.JsonSlurper;
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Read notification events - simplecl 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.ConsumerConfig
+import org.apache.kafka.clients.consumer.KafkaConsumer
+import org.apache.kafka.clients.consumer.ConsumerRecords
+import org.apache.kafka.clients.consumer.ConsumerRecord
+import org.apache.kafka.common.serialization.StringDeserializer
+import groovy.json.JsonSlurper
+
+// Consumer properties
+def props = new Properties()
+props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka:9092") // Adjust to your Kafka bootstrap server
+props.put(ConsumerConfig.GROUP_ID_CONFIG, "apex-group")
+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 the Kafka consumer
+def consumer = new KafkaConsumer<>(props)
-def res = [];
-if (prev.getResponseCode() == '200') {
- def jsonSlurper = new JsonSlurper();
- def responseString = prev.getResponseDataAsString();
- res = jsonSlurper.parseText(responseString);
- def expectedNumberOfNotifications = ${threads} * 4;
- assert res instanceof List;
- assert res.size() == expectedNumberOfNotifications;
- assert responseString.contains("ACTIVE")
- assert responseString.contains("SUCCESS")
- assert responseString.contains("FINAL_SUCCESS")
- assert !responseString.contains("FAILURE")
+// Subscribe to the topic
+consumer.subscribe(["apex-cl-mgt"])
+
+// Poll for messages and assert the value
+def found = false
+def timeout = 10000 // timeout in milliseconds
+def startTime = System.currentTimeMillis()
+
+while (!found && (System.currentTimeMillis() - startTime) < timeout) {
+ println("Inside while loop")
+ ConsumerRecords<String, String> records = consumer.poll(1000)
+ for (ConsumerRecord<String, String> record : records) {
+ println("Received message: Key=${record.key()}, Value=${record.value()}, Partition=${record.partition()}, Offset=${record.offset()}")
+
+ // Parse the JSON value
+ def jsonSlurper = new JsonSlurper()
+ def message = jsonSlurper.parseText(record.value())
+
+ // Perform assertion on specific fields in the JSON
+ if (!(message?.name != "SUCCESS")) {
+ found = true
+ println("Assertion passed")
+ break
+ }
+ }
}
+
+// Close the consumer
+consumer.close()
</stringProp>
- <stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223Assertion>
- <hashTree/>
- </hashTree>
- </hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Clean up DMaaP notification topic" enabled="true"/>
- <hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Clean up DMaaP notification topic" enabled="true">
- <stringProp name="TestPlan.comments">Clean up DMaaP notification topic</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/apex-cl-mgt/cg${__threadNum}/c1?limit=300&timeout=500</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
+ </JSR223Sampler>
+ <hashTree/>
</hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test example policy - failure" enabled="true"/>
+ <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test example policy - failure"/>
<hashTree>
- <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="Synchronizing Timer" enabled="true">
- <stringProp name="groupSize">${threads}</stringProp>
- <stringProp name="timeoutInMs">${threadsTimeOutInMs}</stringProp>
- </SyncTimer>
- <hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Trigger Event - example failure" enabled="true">
- <stringProp name="TestPlan.comments">Send Trigger Event - example failure</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/unauthenticated.dcae_policy_example_output</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">POST</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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">{
- "event": {
- "commonEventHeader": {
- "domain": "fault",
- "eventId": "fault0000245",
- "eventName": "Fault_Vscf:PilotNumberPoolExhaustion",
- "lastEpochMicrosec": 1413378172000000,
- "priority": "High",
- "reportingEntityName": "ibcx0001vm002oam001",
- "sequence": 1,
- "sourceId": "de305d54-75b4-431b-adb2-eb6b9e546014${__threadNum}",
- "sourceName": "vfw-cnf-cds-test-2-vnf",
- "startEpochMicrosec": 1413378172000000,
- "timeZoneOffset": "UTC-05:30",
- "version": "4.0.1",
- "vesEventListenerVersion": "7.0.1"
- },
- "faultFields": {
- "alarmAdditionalInformation": {
- "PilotNumberPoolSize": "1000"
- },
- "alarmCondition": "PilotNumberPoolExhaustion",
- "eventSeverity": "CRITICAL",
- "eventSourceType": "other",
- "faultFieldsVersion": 4,
- "specificProblem": "Calls cannot complete - pilot numbers are unavailable",
- "vfStatus": "InActive"
- }
- }
-}</stringProp>
- <stringProp name="Argument.metadata">=</stringProp>
- </elementProp>
- </collectionProp>
- </elementProp>
- </HTTPSamplerProxy>
- <hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- </hashTree>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="true">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Send Trigger Event - example failure" enabled="true">
+ <stringProp name="cacheKey">true</stringProp>
+ <stringProp name="filename"></stringProp>
+ <stringProp name="parameters"></stringProp>
+ <stringProp name="script">import org.apache.kafka.clients.producer.Callback
+import org.apache.kafka.clients.producer.RecordMetadata
+import org.apache.kafka.clients.producer.KafkaProducer
+import org.apache.kafka.clients.producer.ProducerRecord
+import org.apache.kafka.clients.producer.ProducerConfig
+import org.apache.kafka.common.serialization.StringSerializer
+
+def props = new Properties()
+props.put("bootstrap.servers", "kafka:9092")
+props.put("group.id", "new-group")
+props.put("acks", "all")
+props.put("retries", 0)
+props.put("batch.size", 16384)
+props.put("linger.ms", 1)
+props.put("buffer.memory", 33554432)
+props.put("key.serializer", StringSerializer.class.getName())
+props.put("value.serializer", StringSerializer.class.getName())
+
+def producer = new KafkaProducer<>(props)
+
+def jsonString = '''{
+ "event": {
+ "commonEventHeader": {
+ "startEpochMicrosec": 1597953057126,
+ "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}",
+ "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}",
+ "lastEpochMicrosec": 1597952499468,
+ "eventName": "Report hostname & IP",
+ "sourceName": "PNF101",
+ "reportingEntityName": "DCAE",
+ "vesEventListenerVersion": "7.1",
+ "internalHeaderFields": {},
+ "version": "4.0.1",
+ "priority": "Normal",
+ "sequence": 1,
+ "domain": "other"
+ },
+ "otherFields": {
+ "hashMap": {
+ "hostname": "UNDEFINED",
+ "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
+ "pnfName": "PNF101",
+ "ip": "10.101.200.10"
+ },
+ "otherFieldsVersion": "3.0"
+ }
+ }
+}'''
+
+def record = new ProducerRecord<>("unauthenticated.dcae_policy_example_output", jsonString)
+
+producer.send(record, new Callback() {
+ @Override
+ void onCompletion(RecordMetadata metadata, Exception exception) {
+ if (exception != null) {
+ exception.printStackTrace()
+ } else {
+ println("Sent message to topic ${metadata.topic()} partition ${metadata.partition()} with offset ${metadata.offset()}")
+ }
+ }
+})
+
+producer.close()
+</stringProp>
+ <stringProp name="scriptLanguage">groovy</stringProp>
+ </JSR223Sampler>
<hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Read notification events - example failure" enabled="true">
- <stringProp name="TestPlan.comments">Read notification events - example failure</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/apex-cl-mgt/cg${__threadNum}/c1?limit=100&timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="false">
- <stringProp name="cacheKey">true</stringProp>
- <stringProp name="filename"></stringProp>
- <stringProp name="parameters"></stringProp>
- <stringProp name="script">import groovy.json.JsonSlurper;
+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Read notification events - simplecl 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.ConsumerConfig
+import org.apache.kafka.clients.consumer.KafkaConsumer
+import org.apache.kafka.clients.consumer.ConsumerRecords
+import org.apache.kafka.clients.consumer.ConsumerRecord
+import org.apache.kafka.common.serialization.StringDeserializer
+import groovy.json.JsonSlurper
+
+// Consumer properties
+def props = new Properties()
+props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka:9092") // Adjust to your Kafka bootstrap server
+props.put(ConsumerConfig.GROUP_ID_CONFIG, "apex-group")
+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 the Kafka consumer
+def consumer = new KafkaConsumer<>(props)
+
+// Subscribe to the topic
+consumer.subscribe(["apex-cl-mgt"])
-def res = [];
-if (prev.getResponseCode() == '200') {
- def jsonSlurper = new JsonSlurper();
- def responseString = prev.getResponseDataAsString();
- res = jsonSlurper.parseText(responseString);
- def expectedNumberOfNotifications = ${threads} * 2;
- assert res instanceof List;
- assert res.size() == expectedNumberOfNotifications;
- assert responseString.contains("ACTIVE")
- assert responseString.contains("FINAL_FAILURE")
- assert !responseString.contains("FINAL_SUCCESS")
+// Poll for messages and assert the value
+def found = false
+def timeout = 10000 // timeout in milliseconds
+def startTime = System.currentTimeMillis()
+
+while (!found && (System.currentTimeMillis() - startTime) < timeout) {
+ println("Inside while loop")
+ ConsumerRecords<String, String> records = consumer.poll(1000)
+ for (ConsumerRecord<String, String> record : records) {
+ println("Received message: Key=${record.key()}, Value=${record.value()}, Partition=${record.partition()}, Offset=${record.offset()}")
+
+ // Parse the JSON value
+ def jsonSlurper = new JsonSlurper()
+ def message = jsonSlurper.parseText(record.value())
+
+ // Perform assertion on specific fields in the JSON
+ if (!(message?.name == "SUCCESS")) {
+ found = true
+ println("Assertion passed: source is 'APEX' or status is 'ACTIVE'")
+ break
+ }
+ }
}
+
+// Close the consumer
+consumer.close()
</stringProp>
- <stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223Assertion>
- <hashTree/>
- </hashTree>
+ </JSR223Sampler>
+ <hashTree/>
</hashTree>
</hashTree>
- <PostThreadGroup guiclass="PostThreadGroupGui" testclass="PostThreadGroup" testname="tearDown Thread Group" enabled="true">
+ <PostThreadGroup guiclass="PostThreadGroupGui" testclass="PostThreadGroup" testname="tearDown Thread Group">
<intProp name="ThreadGroup.num_threads">1</intProp>
<intProp name="ThreadGroup.ramp_time">1</intProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
<intProp name="HTTPSampler.concurrentPool">6</intProp>
<stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
<stringProp name="HTTPSampler.port">${PAP_PORT}</stringProp>
- <stringProp name="HTTPSampler.protocol">https</stringProp>
+ <stringProp name="HTTPSampler.protocol">http</stringProp>
<stringProp name="HTTPSampler.path">/policy/pap/v1/pdps/deployments/batch</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<stringProp name="HTTPSampler.method">POST</stringProp>
</elementProp>
</HTTPSamplerProxy>
<hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="false">
<collectionProp name="Asserion.test_strings">
<stringProp name="49588">202</stringProp>
</collectionProp>
<intProp name="HTTPSampler.concurrentPool">6</intProp>
<stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
<stringProp name="HTTPSampler.port">${API_PORT}</stringProp>
- <stringProp name="HTTPSampler.protocol">https</stringProp>
+ <stringProp name="HTTPSampler.protocol">http</stringProp>
<stringProp name="HTTPSampler.path">/policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies/onap.policies.apex.Simplecontrolloop/versions/1.0.0</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<stringProp name="HTTPSampler.method">DELETE</stringProp>
</elementProp>
</HTTPSamplerProxy>
<hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="false">
<collectionProp name="Asserion.test_strings">
<stringProp name="49586">200</stringProp>
</collectionProp>
<intProp name="HTTPSampler.concurrentPool">6</intProp>
<stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
<stringProp name="HTTPSampler.port">${API_PORT}</stringProp>
- <stringProp name="HTTPSampler.protocol">https</stringProp>
+ <stringProp name="HTTPSampler.protocol">http</stringProp>
<stringProp name="HTTPSampler.path">/policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies/onap.policies.apex.Example/versions/1.0.0</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<stringProp name="HTTPSampler.method">DELETE</stringProp>
</elementProp>
</HTTPSamplerProxy>
<hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
+ <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="false">
<collectionProp name="Asserion.test_strings">
<stringProp name="49586">200</stringProp>
</collectionProp>
<hashTree/>
</hashTree>
</hashTree>
- <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Clear DMaaP" enabled="false">
- <stringProp name="ThreadGroup.num_threads">${threads}</stringProp>
- <intProp name="ThreadGroup.ramp_time">1</intProp>
- <longProp name="ThreadGroup.duration">259200</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>
- </ThreadGroup>
- <hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Health Check" enabled="false">
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <stringProp name="HTTPSampler.domain">${HOSTNAME}</stringProp>
- <stringProp name="HTTPSampler.port">${APEX_PORT}</stringProp>
- <stringProp name="HTTPSampler.protocol">https</stringProp>
- <stringProp name="HTTPSampler.path">/policy/apex-pdp/v1/healthcheck</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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>
- <JSR223Assertion guiclass="TestBeanGUI" testclass="JSR223Assertion" testname="JSR223 Assertion" enabled="true">
- <stringProp name="cacheKey">true</stringProp>
- <stringProp name="filename"></stringProp>
- <stringProp name="parameters"></stringProp>
- <stringProp name="script">import groovy.json.JsonSlurper;
-
-def res = [];
-if (prev.getResponseCode() == '200') {
- def jsonSlurper = new JsonSlurper();
- res = jsonSlurper.parseText(prev.getResponseDataAsString());
-
- assert res instanceof Map;
- assert res.healthy == true;
- assert res.message == 'alive';
-}
-</stringProp>
- <stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223Assertion>
- <hashTree/>
- </hashTree>
- <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Test Controller" enabled="true"/>
- <hashTree>
- <SyncTimer guiclass="TestBeanGUI" testclass="SyncTimer" testname="Synchronizing Timer" enabled="false">
- <stringProp name="groupSize">${threads}</stringProp>
- <stringProp name="timeoutInMs">${threadsTimeOutInMs}</stringProp>
- </SyncTimer>
- <hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Send Input Event" enabled="false">
- <stringProp name="TestPlan.comments">Send input event to apex-pdp</stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/unauthenticated.dcae_cl_output</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">POST</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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">{
- "event": {
- "commonEventHeader": {
- "startEpochMicrosec": 1597953057126,
- "sourceId": "927b2580-36d9-4f13-8421-3c9d43b7a57${__threadNum}",
- "eventId": "8c7935a4-79d8-4ec0-b661-dcca3cd6800${__threadNum}",
- "lastEpochMicrosec": 1597952499468,
- "eventName": "Report hostname & IP",
- "sourceName": "PNF101",
- "reportingEntityName": "DCAE",
- "vesEventListenerVersion": "7.1",
- "internalHeaderFields": {},
- "version": "4.0.1",
- "priority": "Normal",
- "sequence": 1,
- "domain": "other"
- },
- "otherFields": {
- "hashMap": {
- "hostname": "UNDEFINED",
- "pnfId": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
- "pnfName": "PNF101",
- "ip": "10.101.200.10"
- },
- "otherFieldsVersion": "3.0"
- }
- }
-}</stringProp>
- <stringProp name="Argument.metadata">=</stringProp>
- </elementProp>
- </collectionProp>
- </elementProp>
- </HTTPSamplerProxy>
- <hashTree>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">1000</stringProp>
- </ConstantTimer>
- <hashTree/>
- </hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get the ouput event response" enabled="true">
- <stringProp name="TestPlan.comments">Check output event </stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/apex-cl-mgt/cg${__threadNum}/c1?timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">1000</stringProp>
- </ConstantTimer>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Message" enabled="true">
- <collectionProp name="Asserion.test_strings">
- <stringProp name="1925346054">ACTIVE</stringProp>
- <stringProp name="-310150889">VES event has been received. Going to fetch details from AAI.</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">2</intProp>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response message coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
- <hashTree/>
- </hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get the ouput event response" enabled="false">
- <stringProp name="TestPlan.comments">Check output event </stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/apex-cl-mgt/cg${__threadNum}/c1?limit=1&timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">1000</stringProp>
- </ConstantTimer>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Message" enabled="true">
- <collectionProp name="Asserion.test_strings">
- <stringProp name="-1149187101">SUCCESS</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">2</intProp>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response message coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
- <hashTree/>
- </hashTree>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get the ouput event response" enabled="false">
- <stringProp name="TestPlan.comments">Check output event </stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/apex-cl-mgt/cg${__threadNum}/c1?limit=1&timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">1000</stringProp>
- </ConstantTimer>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Message" enabled="true">
- <collectionProp name="Asserion.test_strings">
- <stringProp name="439453178">FINAL_SUCCESS</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">2</intProp>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response message coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
- <hashTree/>
- </hashTree>
- <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="While Controller" enabled="false">
- <stringProp name="WhileController.condition">${__javaScript(("${response}".indexOf("VES event has been received. Going to fetch details from AAI") == -1 && ${counter} < 5),)}</stringProp>
- </WhileController>
- <hashTree>
- <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="Counter" enabled="true">
- <stringProp name="CounterConfig.start">0</stringProp>
- <stringProp name="CounterConfig.end">1</stringProp>
- <stringProp name="CounterConfig.incr">1</stringProp>
- <stringProp name="CounterConfig.name"></stringProp>
- <stringProp name="CounterConfig.format"></stringProp>
- <boolProp name="CounterConfig.per_user">false</boolProp>
- </CounterConfig>
- <hashTree/>
- <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Get the ouput event response" enabled="true">
- <stringProp name="TestPlan.comments">Check output event </stringProp>
- <intProp name="HTTPSampler.concurrentPool">6</intProp>
- <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/apex-cl-mgt/cg${__threadNum}/c1?timeout=30000</stringProp>
- <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
- <stringProp name="HTTPSampler.method">GET</stringProp>
- <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
- <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>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">1000</stringProp>
- </ConstantTimer>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Code" 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>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response code coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert Response Message" enabled="false">
- <collectionProp name="Asserion.test_strings">
- <stringProp name="1925346054">ACTIVE</stringProp>
- <stringProp name="-310150889">VES event has been received. Going to fetch details from AAI.</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">2</intProp>
- <stringProp name="Scope.variable">Response code</stringProp>
- <stringProp name="TestPlan.comments">Assert response message coming back from apex-pdp</stringProp>
- </ResponseAssertion>
- <hashTree/>
- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="WAIT" enabled="false">
- <stringProp name="ConstantTimer.delay">${wait}</stringProp>
- </ConstantTimer>
- <hashTree/>
- <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="JSR223 PostProcessor" enabled="true">
- <stringProp name="cacheKey">true</stringProp>
- <stringProp name="filename"></stringProp>
- <stringProp name="parameters"></stringProp>
- <stringProp name="script">vars.put("response", prev.getResponseDataAsString());</stringProp>
- <stringProp name="scriptLanguage">groovy</stringProp>
- </JSR223PostProcessor>
- <hashTree/>
- </hashTree>
- </hashTree>
- </hashTree>
- </hashTree>
<ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<connectTime>true</connectTime>
</value>
</objProp>
- <stringProp name="filename">/home/dhanrahan/jmeter_results/apex_perf/summary.log</stringProp>
+ <stringProp name="filename">/home/wayne/dev/s3ps/apex-pdp/testsuites/apex-pdp-stability/src/main/resources/s3pTestResults.jtl</stringProp>
</ResultCollector>
<hashTree/>
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
<connectTime>true</connectTime>
</value>
</objProp>
- <stringProp name="filename">/home/dhanrahan/jmeter_results/apex_perf/resultTree.log</stringProp>
+ <stringProp name="filename">/home/wayne/dev/s3ps/apex-pdp/testsuites/apex-pdp-stability/src/main/resources/s3pTestResults.jtl</stringProp>
</ResultCollector>
<hashTree/>
<ResultCollector guiclass="TableVisualizer" testclass="ResultCollector" testname="View Results in Table" enabled="true">
<connectTime>true</connectTime>
</value>
</objProp>
- <stringProp name="filename">/home/dhanrahan/jmeter_results/apex_perf/resultTable.log</stringProp>
+ <stringProp name="filename">/home/wayne/dev/s3ps/apex-pdp/testsuites/apex-pdp-stability/src/main/resources/s3pTestResults.jtl</stringProp>
</ResultCollector>
<hashTree/>
</hashTree>