aboutsummaryrefslogtreecommitdiffstats
path: root/robot/resources/dcae/ves_interface.robot
diff options
context:
space:
mode:
Diffstat (limited to 'robot/resources/dcae/ves_interface.robot')
-rw-r--r--robot/resources/dcae/ves_interface.robot41
1 files changed, 41 insertions, 0 deletions
diff --git a/robot/resources/dcae/ves_interface.robot b/robot/resources/dcae/ves_interface.robot
new file mode 100644
index 00000000..4201a4d2
--- /dev/null
+++ b/robot/resources/dcae/ves_interface.robot
@@ -0,0 +1,41 @@
+Documentation The main interface for interacting with VES Collector
+Library RequestsLibrary
+Library OperatingSystem
+Library String
+
+*** Variables ***
+${INVENTORY_SERVER} ${GLOBAL_INVENTORY_SERVER_PROTOCOL}://${GLOBAL_INVENTORY_SERVER_NAME}:${GLOBAL_INVENTORY_SERVER_PORT}
+${DEPLOYMENT_SERVER} ${GLOBAL_DEPLOYMENT_HANDLER_SERVER_PROTOCOL}://${GLOBAL_DEPLOYMENT_HANDLER_SERVER_NAME}:${GLOBAL_DEPLOYMENT_HANDLER_SERVER_PORT}
+${DR_ENDPOINT} ${GLOBAL_DMAAP_DR_PROV_SERVER_PROTOCOL}://${GLOBAL_INJECTED_DMAAP_DR_PROV_IP_ADDR}:${GLOBAL_DMAAP_DR_PROV_SERVER_PORT}
+${DMAAP_BC_SERVER} ${GLOBAL_BC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_BC_IP_ADDR}:${GLOBAL_BC_HTTPS_SERVER_PORT}
+${VES_HEALTH_CHECK_PATH} ${GLOBAL_DCAE_VES_HTTPS_PROTOCOL}://${GLOBAL_INJECTED_DCAE_VES_HOST}:${GLOBAL_DCAE_VES_HTTPS_SERVER_PORT}
+${MR_PUBLISH_TEMPLATE} mr/mr_publish.jinja
+
+*** Keywords ***
+
+
+Send Event to VES Collector
+ [Documentation] keyword wich is used to send events through VES Collector Event Listener path
+ [Arguments] ${event}
+ ${headers}= Create Dictionary content-type=application/json
+ ${event_from_file}= OperatingSystem.Get File ${event}
+ ${auth}= Create List ${GLOBAL_DCAE_VES_USERNAME} ${GLOBAL_DCAE_VES_PASSWORD}
+ ${session}= Create Session ves ${VES_HEALTH_CHECK_PATH} auth=${auth}
+ ${resp}= Post Request ves ${VES_LISTENER_PATH} data=${event_from_file} headers=${headers}
+ Should Be Equal As Strings ${resp.status_code} 202
+
+Topic Validate
+ [Documentation] Keyword checks content of DMAAP topic and evaluate it's content with desired value
+ [Arguments] ${topic_name} ${expected_text}
+ ${timestamp}= Get Current Date
+ ${dict}= Create Dictionary timestamp=${timestamp}
+ Templating.Create Environment mr ${GLOBAL_TEMPLATE_FOLDER}
+ ${data}= Templating.Apply Template mr ${MR_PUBLISH_TEMPLATE} ${dict}
+ ${resp}= Run MR Auth Get Request ${topic_name} ${GLOBAL_DCAE_USERNAME} ${GLOBAL_DCAE_PASSWORD}
+ Should Contain ${resp.text} ${expected_text}
+
+Send Event to VES & Validate Topic
+ [Documentation] Keyword is a test template which alows to send event through VES Collector and check if ivent is routed to proper DMAAP topic
+ [Arguments] ${event} ${topic_name} ${expected_text}
+ Send Event to VES Collector ${event}
+ Wait Until Keyword Succeeds 10x 5s Topic Validate ${topic_name} ${expected_text}