[ROBOT] Clean up 5gbulkpm
[testsuite.git] / robot / resources / strimzi_kafka.robot
diff --git a/robot/resources/strimzi_kafka.robot b/robot/resources/strimzi_kafka.robot
new file mode 100644 (file)
index 0000000..262d28e
--- /dev/null
@@ -0,0 +1,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}