aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarekpl <marek.pondel@nokia.com>2018-10-24 14:33:25 +0200
committermarekpl <marek.pondel@nokia.com>2018-10-24 14:37:34 +0200
commit503647c4a628df771413d73a2ab7eef65cffc4f0 (patch)
treefd29ee64d784d93072684b1cbb76fcf88cb8f922
parent021d5eb12ccb2ea6d44fd703cf0e56beb157429c (diff)
HV-VES TA sunny scenario
Robot Framework for HV-VES sunny scenario case Issue-ID: INT-650 Change-Id: I27476a821d9f51e4e4c2a5cf33a3a8a13b8c7f34 Signed-off-by: marekpl <marek.pondel@nokia.com>
-rw-r--r--robot/assets/templates/hvves/hvves_decoded_msg.template21
-rw-r--r--robot/resources/global_properties.robot3
-rw-r--r--robot/resources/test_templates/hvves_template.robot51
-rw-r--r--robot/testsuites/hvves.robot21
-rwxr-xr-xsetup.sh15
5 files changed, 109 insertions, 2 deletions
diff --git a/robot/assets/templates/hvves/hvves_decoded_msg.template b/robot/assets/templates/hvves/hvves_decoded_msg.template
new file mode 100644
index 00000000..88a44282
--- /dev/null
+++ b/robot/assets/templates/hvves/hvves_decoded_msg.template
@@ -0,0 +1,21 @@
+1 {
+ 1: "sample-version"
+ 2: "perf3gpp"
+ 3: 1
+ 4: 1
+ 5: "perf3GPP22"
+ 6: "sample-event-name"
+ 7: "sample-event-type"
+ 8: 1539263857
+ 9: 1539263857
+ 10: "sample-nf-naming-code"
+ 11: "sample-nfc-naming-code"
+ 12: "sample-nf-vendor-name"
+ 13: "sample-reporting-entity-id"
+ 14: "sample-reporting-entity-name"
+ 15: "sample-source-id"
+ 16: "sample-xnf-name"
+ 17: "UTC+02:00"
+ 18: "7.0.2"
+}
+2: "test test test" \ No newline at end of file
diff --git a/robot/resources/global_properties.robot b/robot/resources/global_properties.robot
index da6e3c4c..fc202acd 100644
--- a/robot/resources/global_properties.robot
+++ b/robot/resources/global_properties.robot
@@ -37,4 +37,5 @@ ${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 \ No newline at end of file
diff --git a/robot/resources/test_templates/hvves_template.robot b/robot/resources/test_templates/hvves_template.robot
new file mode 100644
index 00000000..682566fd
--- /dev/null
+++ b/robot/resources/test_templates/hvves_template.robot
@@ -0,0 +1,51 @@
+*** Settings ***
+Documentation Template contains stuff for HV-VES use case.
+Library OperatingSystem
+Library Rammbock
+Library KafkaLibrary
+Library BuiltIn
+
+*** Variables ***
+${hvves_message} 0x0a94020a0e73616d706c652d76657273696f6e12087065726633677070180120012a0a70657266334750503232321173616d706c652d6576656e742d6e616d653a1173616d706c652d6576656e742d7479706540f19afddd0548f19afddd05521573616d706c652d6e662d6e616d696e672d636f64655a1673616d706c652d6e66632d6e616d696e672d636f6465621573616d706c652d6e662d76656e646f722d6e616d656a1a73616d706c652d7265706f7274696e672d656e746974792d6964721c73616d706c652d7265706f7274696e672d656e746974792d6e616d657a1073616d706c652d736f757263652d696482010f73616d706c652d786e662d6e616d658a01095554432b30323a3030920105372e302e32120e7465737420746573742074657374
+${hvves_kafka_topic} HV_VES_PERF3GPP
+
+*** 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}
+ ${msg_number}= Get Number Of Messages In Topics ${kafka_topic}
+ [Return] ${msg_number}
+
+Define WTP Protocol
+ [Documentation] Defines Wire Transfer Protocol.
+ New Protocol WireTransferProtocol
+ u8 magic 0xAA
+ u8 versionMajor 0x01
+ u8 versionMinor 0x00
+ u24 reserved 0x000000
+ u16 payloadId 0x0001
+ u32 payloadLength 0x00000127
+ uint 295 payload ${hvves_message}
+ End Protocol
+
+Start HV-VES TCP Client And Send Message
+ [Documentation] Starts HV-VES TCP client sends message to the collector.
+ [Arguments] ${hvves_server_ip} ${hvves_server_port}
+ Start Tcp Client timeout=5 protocol=WireTransferProtocol
+ Connect ${hvves_server_ip} ${hvves_server_port}
+ 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}
+ [Return] ${msg}
+
diff --git a/robot/testsuites/hvves.robot b/robot/testsuites/hvves.robot
new file mode 100644
index 00000000..c56f7e10
--- /dev/null
+++ b/robot/testsuites/hvves.robot
@@ -0,0 +1,21 @@
+*** 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
+Test Timeout 3 minute
+Resource ${EXECDIR}/robot/resources/global_properties.robot
+Resource ${EXECDIR}/robot/resources/test_templates/hvves_template.robot
+Suite Teardown Reset Rammbock
+
+*** Variables ***
+
+*** 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}
+ Define WTP Protocol
+ Start HV-VES TCP Client And Send Message ${GLOBAL_DNS_HV_VES_NAME} ${GLOBAL_HV_VES_SERVER_PORT}
+ ${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}
+ ${msg_decoded_template}= Get File ${EXECDIR}/robot/assets/templates/hvves/hvves_decoded_msg.template
+ Should Be Equal As Strings ${msg_decoded} ${msg_decoded_template}
diff --git a/setup.sh b/setup.sh
index 4d59eafc..0847080f 100755
--- a/setup.sh
+++ b/setup.sh
@@ -18,7 +18,8 @@ pip install --no-cache-dir --target="$path/robot/library" 'selenium<=3.0.0' 'req
'robotframework-databaselibrary==0.8.1' 'robotframework-extendedselenium2library==0.9.1' 'robotframework-requests==0.4.5' \
'robotframework-sshlibrary==2.1.2' \
'robotframework-sudslibrary==0.8' 'robotframework-ftplibrary==1.3' 'robotframework-rammbock==0.4.0.1' \
-'deepdiff==2.5.1' 'dnspython==1.15.0' 'robotframework-httplibrary==0.4.2' 'robotframework-archivelibrary==0.3.2' 'PyYAML==3.12'
+'deepdiff==2.5.1' 'dnspython==1.15.0' 'robotframework-httplibrary==0.4.2' 'robotframework-archivelibrary==0.3.2' 'PyYAML==3.12' \
+'robotframework-kafkalibrary==0.0.2'
# get the git for the eteutils you will need to add a private key to your ssh before this
@@ -96,3 +97,15 @@ else
curl $CHROMEDRIVER_URL/$CHROMEDRIVER_ZIP -o chromedriver.zip
unzip chromedriver.zip
fi
+
+
+#
+# Install kafkacat : https://github.com/edenhill/kafkacat
+#
+OS=`uname -s`
+case $OS in
+ Darwin)
+ brew install kafkacat ;;
+ Linux)
+ apt-get -y install kafkacat
+esac