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 |
DR695H | 0ca56d1 | 2019-05-14 11:48:20 -0400 | [diff] [blame] | 4 | Library RequestsLibrary |
marekpl | 503647c | 2018-10-24 14:33:25 +0200 | [diff] [blame] | 5 | Library BuiltIn |
marekpl | 62c91a9 | 2018-10-29 12:13:58 +0100 | [diff] [blame] | 6 | Library Collections |
DR695H | 02293ad | 2019-06-13 17:24:01 -0400 | [diff] [blame] | 7 | Library ONAPLibrary.Utilities |
DR695H | 2742633 | 2019-05-21 11:26:28 -0400 | [diff] [blame] | 8 | Library String |
DR695H | 02293ad | 2019-06-13 17:24:01 -0400 | [diff] [blame] | 9 | Library ONAPLibrary.Kafka |
DR695H | 2742633 | 2019-05-21 11:26:28 -0400 | [diff] [blame] | 10 | Resource ../mr_interface.robot |
marekpl | 503647c | 2018-10-24 14:33:25 +0200 | [diff] [blame] | 11 | |
| 12 | *** Variables *** |
DR695H | 9d810d0 | 2019-06-18 17:16:25 -0400 | [diff] [blame] | 13 | ${HVVES_MESSAGE} \xaa\x01\x00\x00\x00\x00\x00\x01\x00\x00\x01'\n\x94\x02\n\x0esample-version\x12\x08perf3gpp\x18\x01 \x01*\nperf3GPP222\x11sample-event-name:\x11sample-event-type@\xf1\x9a\xfd\xdd\x05H\xf1\x9a\xfd\xdd\x05R\x15sample-nf-naming-codeZ\x16sample-nfc-naming-codeb\x15sample-nf-vendor-namej\x1asample-reporting-entity-idr\x1csample-reporting-entity-namez\x10sample-source-id\x82\x01\x0fsample-xnf-name\x8a\x01\tUTC+02:00\x92\x01\x057.0.2\x12\x0etest test test |
marekpl | 503647c | 2018-10-24 14:33:25 +0200 | [diff] [blame] | 14 | |
| 15 | *** Keywords *** |
marekpl | f989890 | 2019-05-14 15:14:51 +0200 | [diff] [blame] | 16 | Check Message Router Api |
marekpl | 615214f | 2019-05-07 17:03:56 +0200 | [diff] [blame] | 17 | [Documentation] Checks message via message router API. |
marekpl | f989890 | 2019-05-14 15:14:51 +0200 | [diff] [blame] | 18 | [Arguments] ${message_router} ${message_router_port} ${topic} |
DR695H | 0ca56d1 | 2019-05-14 11:48:20 -0400 | [diff] [blame] | 19 | ${session}= Create Session session http://${message_router}:${message_router_port}/events |
| 20 | ${resp}= Get Request session /${topic}/1/1 |
| 21 | Run Keyword If 400 <= ${resp.status_code} < 500 Log Topic ${topic} does not exist. |
| 22 | Run Keyword If 200 <= ${resp.status_code} < 300 Log Topic ${topic} exists. |
marekpl | 503647c | 2018-10-24 14:33:25 +0200 | [diff] [blame] | 23 | |
marekpl | 62c91a9 | 2018-10-29 12:13:58 +0100 | [diff] [blame] | 24 | Check If Topic Exists |
| 25 | [Documentation] Checks if specific topic exists on kafka. |
marekpl | 615214f | 2019-05-07 17:03:56 +0200 | [diff] [blame] | 26 | [Arguments] ${message_router} ${message_router_port} ${topic} |
DR695H | 0ca56d1 | 2019-05-14 11:48:20 -0400 | [diff] [blame] | 27 | ${session}= Create Session session http://${message_router}:${message_router_port}/topics |
| 28 | ${resp}= Get Request session / |
| 29 | ${value}= Catenate ${resp.json()['topics']} |
marekpl | 615214f | 2019-05-07 17:03:56 +0200 | [diff] [blame] | 30 | Should Contain ${value} ${topic} |
marekpl | 62c91a9 | 2018-10-29 12:13:58 +0100 | [diff] [blame] | 31 | |
marekpl | 503647c | 2018-10-24 14:33:25 +0200 | [diff] [blame] | 32 | Start HV-VES TCP Client And Send Message |
| 33 | [Documentation] Starts HV-VES TCP client sends message to the collector. |
| 34 | [Arguments] ${hvves_server_ip} ${hvves_server_port} |
DR695H | 9d810d0 | 2019-06-18 17:16:25 -0400 | [diff] [blame] | 35 | ${msg}= Convert To Bytes ${${HVVES_MESSAGE}} |
DR695H | 2742633 | 2019-05-21 11:26:28 -0400 | [diff] [blame] | 36 | Send Binary Data ${hvves_server_ip} ${hvves_server_port} ${msg} |
marekpl | 503647c | 2018-10-24 14:33:25 +0200 | [diff] [blame] | 37 | |
marekpl | 503647c | 2018-10-24 14:33:25 +0200 | [diff] [blame] | 38 | Decode Last Message From Topic |
| 39 | [Documentation] Decode last message from Kafka topic. |
DR695H | 9d810d0 | 2019-06-18 17:16:25 -0400 | [diff] [blame] | 40 | [Arguments] ${kafka_server} ${kafka_port} ${kafka_topic} ${username} ${password} |
| 41 | Connect kakfa ${kafka_server}:${kafka_port} ${username} ${password} |
| 42 | ${msg}= Consume kakfa ${kafka_topic} |
marekpl | 503647c | 2018-10-24 14:33:25 +0200 | [diff] [blame] | 43 | [Return] ${msg} |
| 44 | |