blob: 9924b821d955997868bdf30716abf6f23fba81b5 [file] [log] [blame]
marekpl503647c2018-10-24 14:33:25 +02001*** Settings ***
2Documentation Template contains stuff for HV-VES use case.
3Library OperatingSystem
4Library Rammbock
5Library KafkaLibrary
6Library BuiltIn
marekpl62c91a92018-10-29 12:13:58 +01007Library Collections
marekpl503647c2018-10-24 14:33:25 +02008
9*** Variables ***
10${hvves_message} 0x0a94020a0e73616d706c652d76657273696f6e12087065726633677070180120012a0a70657266334750503232321173616d706c652d6576656e742d6e616d653a1173616d706c652d6576656e742d7479706540f19afddd0548f19afddd05521573616d706c652d6e662d6e616d696e672d636f64655a1673616d706c652d6e66632d6e616d696e672d636f6465621573616d706c652d6e662d76656e646f722d6e616d656a1a73616d706c652d7265706f7274696e672d656e746974792d6964721c73616d706c652d7265706f7274696e672d656e746974792d6e616d657a1073616d706c652d736f757263652d696482010f73616d706c652d786e662d6e616d658a01095554432b30323a3030920105372e302e32120e7465737420746573742074657374
11${hvves_kafka_topic} HV_VES_PERF3GPP
12
13*** Keywords ***
14Check Number Of Messages On Topic
15 [Documentation] Checks number of messages published on kafka topic.
16 [Arguments] ${kafka_server} ${kafka_port} ${kafka_topic}
17 [Teardown] Close
18 Connect Consumer bootstrap_servers=${kafka_server}:${kafka_port}
marekpl906dab02018-10-25 11:38:24 +020019 ${status} ${msg_number}= Run Keyword And Ignore Error Get Number Of Messages In Topics ${kafka_topic}
20 Run Keyword If '${status}' == 'FAIL' Return From Keyword 0
21 Run Keyword If '${status}' == 'PASS' Return From Keyword ${msg_number}
marekpl503647c2018-10-24 14:33:25 +020022
marekpl62c91a92018-10-29 12:13:58 +010023Check If Topic Exists
24 [Documentation] Checks if specific topic exists on kafka.
25 [Arguments] ${kafka_server} ${kafka_port} ${kafka_topic}
26 [Teardown] Close
27 Connect Consumer bootstrap_servers=${kafka_server}:${kafka_port}
28 ${topics}= Get Kafka Topics
29 List Should Contain Value ${topics} ${kafka_topic}
30
marekpl503647c2018-10-24 14:33:25 +020031Define WTP Protocol
32 [Documentation] Defines Wire Transfer Protocol.
33 New Protocol WireTransferProtocol
34 u8 magic 0xAA
35 u8 versionMajor 0x01
36 u8 versionMinor 0x00
37 u24 reserved 0x000000
38 u16 payloadId 0x0001
39 u32 payloadLength 0x00000127
40 uint 295 payload ${hvves_message}
41 End Protocol
42
43Start HV-VES TCP Client And Send Message
44 [Documentation] Starts HV-VES TCP client sends message to the collector.
45 [Arguments] ${hvves_server_ip} ${hvves_server_port}
46 Start Tcp Client timeout=5 protocol=WireTransferProtocol
47 Connect ${hvves_server_ip} ${hvves_server_port}
48 New Message HvVesMessage protocol=WireTransferProtocol
49 Client Sends Message
50
51Download VesEvent Proto File
52 [Documentation] Download proto file.
53 [Arguments] ${path}
54 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
55
56Decode Last Message From Topic
57 [Documentation] Decode last message from Kafka topic.
58 [Arguments] ${kafka_server} ${kafka_port} ${kafka_topic} ${proto_file_dir}
59 ${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}
60 [Return] ${msg}
61