summaryrefslogtreecommitdiffstats
path: root/robot
diff options
context:
space:
mode:
authormarekpl <marek.pondel@nokia.com>2019-05-07 17:03:56 +0200
committerMarek Pondel <marek.pondel@nokia.com>2019-05-10 17:16:40 +0000
commitba33e13ce034bb85801312e43f311b9cde493120 (patch)
treec491d86253b255c416efadc99269076f761aa328 /robot
parenta7800b7b4425937dbf11b090e2f2153e168af2ae (diff)
hvves testsuite update dut to kafka sasl feature
hvves testsuite update dut to kafka sasl feature Change-Id: I1bb65e8770488ae773265bd9d251810e7a508055 Signed-off-by: marekpl <marek.pondel@nokia.com> Issue-ID: DCAEGEN2-1448
Diffstat (limited to 'robot')
-rw-r--r--robot/resources/global_properties.robot4
-rw-r--r--robot/resources/test_templates/hvves_template.robot37
-rw-r--r--robot/testsuites/hvves.robot16
3 files changed, 24 insertions, 33 deletions
diff --git a/robot/resources/global_properties.robot b/robot/resources/global_properties.robot
index 609e9b21..d1232b5a 100644
--- a/robot/resources/global_properties.robot
+++ b/robot/resources/global_properties.robot
@@ -35,9 +35,5 @@ ${GLOBAL_AAI_ZONE_ID} nova1
${GLOBAL_AAI_ZONE_NAME} nova
${GLOBAL_AAI_DESIGN_TYPE} integration
${GLOBAL_AAI_ZONE_CONTEXT} labs
-${GLOBAL_DNS_HV_VES_NAME} dcae-hv-ves-collector
-${GLOBAL_HV_VES_SERVER_PORT} 6061
${GLOBAL_DNS_VES_NAME} dcae-ves-collector
${GLOBAL_VES_SERVER_PORT} 8080
-${GLOBAL_DNS_MESSAGE_ROUTER_KAFKA_NAME} message-router-kafka
-${GLOBAL_MESSAGE_ROUTER_KAFKA_PORT} 9092
diff --git a/robot/resources/test_templates/hvves_template.robot b/robot/resources/test_templates/hvves_template.robot
index 9924b821..50c71d19 100644
--- a/robot/resources/test_templates/hvves_template.robot
+++ b/robot/resources/test_templates/hvves_template.robot
@@ -5,28 +5,30 @@ Library Rammbock
Library KafkaLibrary
Library BuiltIn
Library Collections
+Library HttpLibrary.HTTP
*** Variables ***
${hvves_message} 0x0a94020a0e73616d706c652d76657273696f6e12087065726633677070180120012a0a70657266334750503232321173616d706c652d6576656e742d6e616d653a1173616d706c652d6576656e742d7479706540f19afddd0548f19afddd05521573616d706c652d6e662d6e616d696e672d636f64655a1673616d706c652d6e66632d6e616d696e672d636f6465621573616d706c652d6e662d76656e646f722d6e616d656a1a73616d706c652d7265706f7274696e672d656e746974792d6964721c73616d706c652d7265706f7274696e672d656e746974792d6e616d657a1073616d706c652d736f757263652d696482010f73616d706c652d786e662d6e616d658a01095554432b30323a3030920105372e302e32120e7465737420746573742074657374
${hvves_kafka_topic} HV_VES_PERF3GPP
+${security_protocol} SASL_PLAINTEXT
+${sasl_mechanisms} PLAIN
*** Keywords ***
-Check Number Of Messages On Topic
- [Documentation] Checks number of messages published on kafka topic.
- [Arguments] ${kafka_server} ${kafka_port} ${kafka_topic}
- [Teardown] Close
- Connect Consumer bootstrap_servers=${kafka_server}:${kafka_port}
- ${status} ${msg_number}= Run Keyword And Ignore Error Get Number Of Messages In Topics ${kafka_topic}
- Run Keyword If '${status}' == 'FAIL' Return From Keyword 0
- Run Keyword If '${status}' == 'PASS' Return From Keyword ${msg_number}
+Check Message Via Message Router Api
+ [Documentation] Checks message via message router API.
+ [Arguments] ${message_router} ${message_router_port} ${topic} ${state}
+ ${response}= GET http://${message_router}:${message_router_port}/events/${topic}/1/1
+ ${body}= Get Response Body
+ Run Keyword If '${state}'=='before' Should Be Equal ${body} []
+ Run Keyword If '${state}'=='after' Should Not Be Equal ${body} []
Check If Topic Exists
[Documentation] Checks if specific topic exists on kafka.
- [Arguments] ${kafka_server} ${kafka_port} ${kafka_topic}
- [Teardown] Close
- Connect Consumer bootstrap_servers=${kafka_server}:${kafka_port}
- ${topics}= Get Kafka Topics
- List Should Contain Value ${topics} ${kafka_topic}
+ [Arguments] ${message_router} ${message_router_port} ${topic}
+ ${response}= GET http://${message_router}:${message_router_port}/topics
+ ${body}= Get Response Body
+ ${value}= Get Json Value ${body} /topics
+ Should Contain ${value} ${topic}
Define WTP Protocol
[Documentation] Defines Wire Transfer Protocol.
@@ -48,14 +50,9 @@ Start HV-VES TCP Client And Send Message
New Message HvVesMessage protocol=WireTransferProtocol
Client Sends Message
-Download VesEvent Proto File
- [Documentation] Download proto file.
- [Arguments] ${path}
- Run wget "https://gerrit.onap.org/r/gitweb?p=dcaegen2/collectors/hv-ves.git;a=blob_plain;f=hv-collector-domain/src/main/proto/event/VesEvent.proto;hb=HEAD" -O ${path}/VesEvent.proto
-
Decode Last Message From Topic
[Documentation] Decode last message from Kafka topic.
- [Arguments] ${kafka_server} ${kafka_port} ${kafka_topic} ${proto_file_dir}
- ${msg}= Run kafkacat -C -b ${kafka_server}:${kafka_port} -t ${kafka_topic} -D "" -o -1 -c 1 | protoc --decode_raw --proto_path=${proto_file_dir}
+ [Arguments] ${kafka_server} ${kafka_port} ${kafka_topic} ${sec_protocol} ${mechanisms} ${username} ${password}
+ ${msg}= Run kafkacat -C -b ${kafka_server}:${kafka_port} -t ${kafka_topic} -X security.protocol=${sec_protocol} -X sasl.mechanisms=${mechanisms} -X sasl.username=${username} -X sasl.password=${password} -D "" -o -1 -c 1 | protoc --decode_raw
[Return] ${msg}
diff --git a/robot/testsuites/hvves.robot b/robot/testsuites/hvves.robot
index a67b0c3c..8e0544a4 100644
--- a/robot/testsuites/hvves.robot
+++ b/robot/testsuites/hvves.robot
@@ -1,7 +1,7 @@
*** Settings ***
Documentation HV-VES 'Sunny Scenario' Robot Framwork test - message is sent to the collector and Kafka topic is checked if the message has been published.
-Default Tags HVVES ete
-Test Timeout 10s
+Default Tags hvves ete
+Test Timeout 3m
Resource ${EXECDIR}/robot/resources/global_properties.robot
Resource ${EXECDIR}/robot/resources/test_templates/hvves_template.robot
Suite Teardown Reset Rammbock
@@ -10,13 +10,11 @@ Suite Teardown Reset Rammbock
*** Test Cases ***
HV-VES test case
- ${msg_number_initial}= Check Number Of Messages On Topic ${GLOBAL_DNS_MESSAGE_ROUTER_KAFKA_NAME} ${GLOBAL_MESSAGE_ROUTER_KAFKA_PORT} ${hvves_kafka_topic}
+ Check Message Via Message Router Api ${GLOBAL_DMAAP_MESSAGE_ROUTER_SERVER_NAME} ${GLOBAL_DMAAP_MESSAGE_ROUTER_SERVER_PORT} ${hvves_kafka_topic} before
Define WTP Protocol
- Start HV-VES TCP Client And Send Message ${GLOBAL_DNS_HV_VES_NAME} ${GLOBAL_HV_VES_SERVER_PORT}
- Wait Until Keyword Succeeds 5s 1s Check If Topic Exists ${GLOBAL_DNS_MESSAGE_ROUTER_KAFKA_NAME} ${GLOBAL_MESSAGE_ROUTER_KAFKA_PORT} ${hvves_kafka_topic}
- ${msg_number_after}= Check Number Of Messages On Topic ${GLOBAL_DNS_MESSAGE_ROUTER_KAFKA_NAME} ${GLOBAL_MESSAGE_ROUTER_KAFKA_PORT} ${hvves_kafka_topic}
- Should Not Be Equal As Integers ${msg_number_initial} ${msg_number_after}
- Download VesEvent Proto File ${EXECDIR}
- ${msg_decoded}= Decode Last Message From Topic ${GLOBAL_DNS_MESSAGE_ROUTER_KAFKA_NAME} ${GLOBAL_MESSAGE_ROUTER_KAFKA_PORT} ${hvves_kafka_topic} ${EXECDIR}
+ Start HV-VES TCP Client And Send Message ${GLOBAL_DCAE_HVVES_SERVER_NAME} ${GLOBAL_DCAE_HVVES_SERVER_PORT}
+ Wait Until Keyword Succeeds 30s 5s Check If Topic Exists ${GLOBAL_DMAAP_MESSAGE_ROUTER_SERVER_NAME} ${GLOBAL_DMAAP_MESSAGE_ROUTER_SERVER_PORT} ${hvves_kafka_topic}
+ Check Message Via Message Router Api ${GLOBAL_DMAAP_MESSAGE_ROUTER_SERVER_NAME} ${GLOBAL_DMAAP_MESSAGE_ROUTER_SERVER_PORT} ${hvves_kafka_topic} after
+ ${msg_decoded}= Decode Last Message From Topic ${GLOBAL_DMAAP_KAFKA_SERVER_NAME} ${GLOBAL_DMAAP_KAFKA_SERVER_PORT} ${hvves_kafka_topic} ${security_protocol} ${sasl_mechanisms} ${GLOBAL_DMAAP_KAFKA_JAAS_USERNAME} ${GLOBAL_DMAAP_KAFKA_JAAS_PASSWORD}
${msg_decoded_template}= Get File ${EXECDIR}/robot/assets/templates/hvves/hvves_decoded_msg.template
Should Be Equal As Strings ${msg_decoded} ${msg_decoded_template}