aboutsummaryrefslogtreecommitdiffstats
path: root/robot/resources/strimzi_kafka.robot
diff options
context:
space:
mode:
Diffstat (limited to 'robot/resources/strimzi_kafka.robot')
-rw-r--r--robot/resources/strimzi_kafka.robot23
1 files changed, 23 insertions, 0 deletions
diff --git a/robot/resources/strimzi_kafka.robot b/robot/resources/strimzi_kafka.robot
new file mode 100644
index 00000000..262d28e6
--- /dev/null
+++ b/robot/resources/strimzi_kafka.robot
@@ -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}