marekpl | 503647c | 2018-10-24 14:33:25 +0200 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Template contains stuff for HV-VES use case. |
| 3 | Library OperatingSystem |
| 4 | Library Rammbock |
| 5 | Library KafkaLibrary |
| 6 | Library BuiltIn |
| 7 | |
| 8 | *** Variables *** |
| 9 | ${hvves_message} 0x0a94020a0e73616d706c652d76657273696f6e12087065726633677070180120012a0a70657266334750503232321173616d706c652d6576656e742d6e616d653a1173616d706c652d6576656e742d7479706540f19afddd0548f19afddd05521573616d706c652d6e662d6e616d696e672d636f64655a1673616d706c652d6e66632d6e616d696e672d636f6465621573616d706c652d6e662d76656e646f722d6e616d656a1a73616d706c652d7265706f7274696e672d656e746974792d6964721c73616d706c652d7265706f7274696e672d656e746974792d6e616d657a1073616d706c652d736f757263652d696482010f73616d706c652d786e662d6e616d658a01095554432b30323a3030920105372e302e32120e7465737420746573742074657374 |
| 10 | ${hvves_kafka_topic} HV_VES_PERF3GPP |
| 11 | |
| 12 | *** Keywords *** |
| 13 | Check Number Of Messages On Topic |
| 14 | [Documentation] Checks number of messages published on kafka topic. |
| 15 | [Arguments] ${kafka_server} ${kafka_port} ${kafka_topic} |
| 16 | [Teardown] Close |
| 17 | Connect Consumer bootstrap_servers=${kafka_server}:${kafka_port} |
marekpl | 906dab0 | 2018-10-25 11:38:24 +0200 | [diff] [blame] | 18 | ${status} ${msg_number}= Run Keyword And Ignore Error Get Number Of Messages In Topics ${kafka_topic} |
| 19 | Run Keyword If '${status}' == 'FAIL' Return From Keyword 0 |
| 20 | Run Keyword If '${status}' == 'PASS' Return From Keyword ${msg_number} |
marekpl | 503647c | 2018-10-24 14:33:25 +0200 | [diff] [blame] | 21 | |
| 22 | Define WTP Protocol |
| 23 | [Documentation] Defines Wire Transfer Protocol. |
| 24 | New Protocol WireTransferProtocol |
| 25 | u8 magic 0xAA |
| 26 | u8 versionMajor 0x01 |
| 27 | u8 versionMinor 0x00 |
| 28 | u24 reserved 0x000000 |
| 29 | u16 payloadId 0x0001 |
| 30 | u32 payloadLength 0x00000127 |
| 31 | uint 295 payload ${hvves_message} |
| 32 | End Protocol |
| 33 | |
| 34 | Start HV-VES TCP Client And Send Message |
| 35 | [Documentation] Starts HV-VES TCP client sends message to the collector. |
| 36 | [Arguments] ${hvves_server_ip} ${hvves_server_port} |
| 37 | Start Tcp Client timeout=5 protocol=WireTransferProtocol |
| 38 | Connect ${hvves_server_ip} ${hvves_server_port} |
| 39 | New Message HvVesMessage protocol=WireTransferProtocol |
| 40 | Client Sends Message |
| 41 | |
| 42 | Download VesEvent Proto File |
| 43 | [Documentation] Download proto file. |
| 44 | [Arguments] ${path} |
| 45 | 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 |
| 46 | |
| 47 | Decode Last Message From Topic |
| 48 | [Documentation] Decode last message from Kafka topic. |
| 49 | [Arguments] ${kafka_server} ${kafka_port} ${kafka_topic} ${proto_file_dir} |
| 50 | ${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} |
| 51 | [Return] ${msg} |
| 52 | |