blob: 07288a6e5f5e04a32e7c8c69c22d3de74bde72ea [file] [log] [blame]
marekpl503647c2018-10-24 14:33:25 +02001*** Settings ***
2Documentation Template contains stuff for HV-VES use case.
3Library OperatingSystem
DR695H0ca56d12019-05-14 11:48:20 -04004Library RequestsLibrary
marekpl503647c2018-10-24 14:33:25 +02005Library BuiltIn
marekpl62c91a92018-10-29 12:13:58 +01006Library Collections
DR695H02293ad2019-06-13 17:24:01 -04007Library ONAPLibrary.Utilities
DR695H27426332019-05-21 11:26:28 -04008Library String
DR695H02293ad2019-06-13 17:24:01 -04009Library ONAPLibrary.Kafka
DR695H27426332019-05-21 11:26:28 -040010Resource ../mr_interface.robot
marekpl503647c2018-10-24 14:33:25 +020011
12*** Variables ***
DR695H9d810d02019-06-18 17:16:25 -040013${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
marekpl503647c2018-10-24 14:33:25 +020014
15*** Keywords ***
marekplf9898902019-05-14 15:14:51 +020016Check Message Router Api
marekpl615214f2019-05-07 17:03:56 +020017 [Documentation] Checks message via message router API.
marekplf9898902019-05-14 15:14:51 +020018 [Arguments] ${message_router} ${message_router_port} ${topic}
DR695H0ca56d12019-05-14 11:48:20 -040019 ${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.
marekpl503647c2018-10-24 14:33:25 +020023
marekpl62c91a92018-10-29 12:13:58 +010024Check If Topic Exists
25 [Documentation] Checks if specific topic exists on kafka.
marekpl615214f2019-05-07 17:03:56 +020026 [Arguments] ${message_router} ${message_router_port} ${topic}
DR695H0ca56d12019-05-14 11:48:20 -040027 ${session}= Create Session session http://${message_router}:${message_router_port}/topics
28 ${resp}= Get Request session /
29 ${value}= Catenate ${resp.json()['topics']}
marekpl615214f2019-05-07 17:03:56 +020030 Should Contain ${value} ${topic}
marekpl62c91a92018-10-29 12:13:58 +010031
marekpl503647c2018-10-24 14:33:25 +020032Start 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}
DR695H9d810d02019-06-18 17:16:25 -040035 ${msg}= Convert To Bytes ${${HVVES_MESSAGE}}
DR695H27426332019-05-21 11:26:28 -040036 Send Binary Data ${hvves_server_ip} ${hvves_server_port} ${msg}
marekpl503647c2018-10-24 14:33:25 +020037
marekpl503647c2018-10-24 14:33:25 +020038Decode Last Message From Topic
39 [Documentation] Decode last message from Kafka topic.
DR695H9d810d02019-06-18 17:16:25 -040040 [Arguments] ${kafka_server} ${kafka_port} ${kafka_topic} ${username} ${password}
41 Connect kakfa ${kafka_server}:${kafka_port} ${username} ${password}
42 ${msg}= Consume kakfa ${kafka_topic}
marekpl503647c2018-10-24 14:33:25 +020043 [Return] ${msg}
44