aboutsummaryrefslogtreecommitdiffstats
path: root/robot/resources/strimzi_kafka.robot
blob: 262d28e6bf3011002a55097f36ed150bece4a29c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
*** Settings ***
Documentation    Template for interfacing with strimzi kafka.
Library    OperatingSystem
Library    RequestsLibrary
Library    BuiltIn
Library    Collections
Library    ONAPLibrary.Utilities
Library    String
Library    ONAPLibrary.Kafka

*** Variables ***
${KAFKA_GET_PASSWORD}      kubectl -n onap get secret strimzi-kafka-admin -o jsonpath="{.data.password}" | base64 -d

*** Keywords ***
Get Last Message From Topic
    [Documentation]     Decode last message from Kafka topic.
    [Arguments]     ${kafka_server}   ${kafka_topic}    ${username}
    ${command_output} =                 Run And Return Rc And Output        ${KAFKA_GET_PASSWORD}
    Should Be Equal As Integers         ${command_output[0]}                0
    ${password}   Set Variable  ${command_output[1]}
    Connect    kafka    ${kafka_server}    ${username}    ${password}   SCRAM-SHA-512
    ${msg}=     Consume    kafka    ${kafka_topic}
    [Return]    ${msg}