From 8cbfadcfa9bd2cc1b062040f30e02f5be99e0ac8 Mon Sep 17 00:00:00 2001 From: efiacor Date: Thu, 9 Mar 2023 04:36:49 +0000 Subject: [HV-VES] Improve hv-ves suite Remove calls to Message Router Add sleep to allow message to propgate Signed-off-by: efiacor Change-Id: I7728e1ebf59bd50836ad748f933d07edf9266ba8 Issue-ID: DMAAP-1854 --- .gitignore | 1 + robot/assets/dcae/hvves_test_config.yaml | 37 ------------ robot/resources/dcae/hvves.robot | 100 +------------------------------ robot/testsuites/hvves-ci.robot | 19 ++---- 4 files changed, 6 insertions(+), 151 deletions(-) delete mode 100644 robot/assets/dcae/hvves_test_config.yaml diff --git a/.gitignore b/.gitignore index db43f9f6..f8a9ed4e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ /*.zip .project .tox/ +/docker/requirements.txt diff --git a/robot/assets/dcae/hvves_test_config.yaml b/robot/assets/dcae/hvves_test_config.yaml deleted file mode 100644 index b62b9bce..00000000 --- a/robot/assets/dcae/hvves_test_config.yaml +++ /dev/null @@ -1,37 +0,0 @@ -data: - application_config.yaml: | - cbs.requestIntervalSec: 5 - logLevel: INFO - security.keys.keyStoreFile: /tmp/server.p12 - security.keys.keyStorePasswordFile: /dev/null - security.keys.trustStoreFile: /tmp/ca.p12 - security.keys.trustStorePasswordFile: /dev/null - security.sslDisable: true - server.idleTimeoutSec: 300 - server.listenPort: 6061 - streams_publishes: - perf3gpp: - kafka_info: - bootstrap_servers: placeholder - topic_name: HV_VES_PERF3GPP - type: kafka - ves-3gpp-fault-supervision: - kafka_info: - bootstrap_servers: placeholder - topic_name: SEC_3GPP_FAULTSUPERVISION_OUTPUT - type: kafka - ves-3gpp-heartbeat: - kafka_info: - bootstrap_servers: placeholder - topic_name: SEC_3GPP_HEARTBEAT_OUTPUT - type: kafka - ves-3gpp-performance-assurance: - kafka_info: - bootstrap_servers: placeholder - topic_name: SEC_3GPP_PERFORMANCEASSURANCE_OUTPUT - type: kafka - ves-3gpp-provisioning: - kafka_info: - bootstrap_servers: placeholder - topic_name: SEC_3GPP_PROVISIONING_OUTPUT - type: kafka diff --git a/robot/resources/dcae/hvves.robot b/robot/resources/dcae/hvves.robot index 516c9278..9d90b798 100644 --- a/robot/resources/dcae/hvves.robot +++ b/robot/resources/dcae/hvves.robot @@ -7,61 +7,21 @@ Library Collections Library ONAPLibrary.Utilities Library String Library ONAPLibrary.Kafka -Resource ../dmaap/mr_interface.robot *** Variables *** ${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 -${CA_CERT} /tmp/ca.pem -${CLIENT_CERT} /tmp/client.pem -${CLIENT_KEY} /tmp/client.key -${PREV_CM_FILE} /tmp/prevCm.json -${CURRENT_CONFIG_FILE} /tmp/xz.yaml -${COPY_CURRENT_CONFIG} kubectl -n onap -c dcae-hv-ves-collector cp $(kubectl -n onap get --no-headers pods -l app.kubernetes.io/name=dcae-hv-ves-collector --field-selector status.phase=Running -o custom-columns=NAME:.metadata.name):/app-config-input/..data/application_config.yaml ${CURRENT_CONFIG_FILE} -${GET_TRUSTSTORE_PASS_PATH} cat ${CURRENT_CONFIG_FILE} | grep security.keys.trustStorePasswordFile -${TEST_TRUSTSTORE_PASS_PATH} security.keys.trustStorePasswordFile: /dev/null -${TEST_CONFIG_YAML_PATH} ${EXECDIR}/robot/assets/dcae/hvves_test_config.yaml -${GET_CM_NAME} kubectl -n onap get --no-headers cm -l app.kubernetes.io/name=dcae-hv-ves-collector -o custom-columns=NAME:.metadata.name | grep application-config-configmap -${KAFKA_GET_PASSWORD} kubectl -n onap get secret strimzi-kafka-admin -o jsonpath="{.data.password}" | base64 -d +${KAFKA_GET_PASSWORD} kubectl -n onap get secret strimzi-kafka-admin -o jsonpath="{.data.password}" | base64 -d *** Keywords *** -Check Message Router Api - [Documentation] Checks message via message router API. - [Arguments] ${message_router} ${message_router_port} ${topic} - ${session}= Create Session session http://${message_router}:${message_router_port}/events - ${resp}= Get Request session /${topic}/1/1 - Run Keyword If 400 <= ${resp.status_code} < 500 Log Topic ${topic} does not exist. - Run Keyword If 200 <= ${resp.status_code} < 300 Log Topic ${topic} exists. - -Check If Topic Exists - [Documentation] Checks if specific topic exists on kafka. - [Arguments] ${message_router} ${message_router_port} ${topic} - ${session}= Create Session session http://${message_router}:${message_router_port}/topics - ${resp}= Get Request session / - ${value}= Catenate ${resp.json()['topics']} - Should Contain ${value} ${topic} - Send Message [Documentation] Sends message to HV-VES over TCP. [Arguments] ${hvves_server_ip} ${hvves_server_port} ${msg}= Convert To Bytes ${HVVES_MESSAGE} Wait Until Keyword Succeeds 300 sec 15 sec Send Binary Data ${hvves_server_ip} ${hvves_server_port} ${msg} -Send Message Over Ssl - [Documentation] Sends message to HV-VES over TCP wih SSL enabled. - [Arguments] ${hvves_server_ip} ${hvves_server_port} - ${msg}= Convert To Bytes ${HVVES_MESSAGE} - Wait Until Keyword Succeeds 300 sec 15 sec Send Binary Data ${hvves_server_ip} ${hvves_server_port} ${msg} ${TRUE} ${TRUE} ${CA_CERT} ${CLIENT_CERT} ${CLIENT_KEY} - Decode Last Message From Topic [Documentation] Decode last message from Kafka topic. - [Arguments] ${kafka_server} ${kafka_port} ${kafka_topic} ${username} ${password} - Connect kafka ${kafka_server}:${kafka_port} ${username} ${password} - ${msg}= Consume kafka ${kafka_topic} - [Return] ${msg} - -Decode Last Message From Topic STRIMZI User - [Documentation] Decode last message from Kafka topic using STRIMZI User. [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 @@ -69,61 +29,3 @@ Decode Last Message From Topic STRIMZI User Connect kafka ${kafka_server} ${username} ${password} SCRAM-SHA-512 ${msg}= Consume kafka ${kafka_topic} [Return] ${msg} - -Set Test Config - [Documentation] Changes HV-VES config. - [Arguments] ${kafka_server} - ${SED}= Set Variable sed -i 's/placeholder/${kafka_server}/g' ${TEST_CONFIG_YAML_PATH} - Run ${SED} - ${TEST_CONFIG}= Get File ${TEST_CONFIG_YAML_PATH} encoding=UTF-8 - Save Configuration From Config Map - Set Environment Variable TEST_CONFIG ${TEST_CONFIG} - ${cm_name} = Get Config Map Name - ${rc} = Run and Return RC kubectl -n onap patch cm ${cm_name} --type strategic -p "%{TEST_CONFIG}" - Should Be Equal As Integers ${rc} 0 - - Wait Until Keyword Succeeds 2 min 5 sec Check If Config Is Applied ${TEST_TRUSTSTORE_PASS_PATH} - Sleep 5s - -Check If Config Is Applied - [Documentation] Checks if the config is applied. - [Arguments] ${truststore_pass_path} - ${rc} = Run and Return RC ${COPY_CURRENT_CONFIG} - Should Be Equal As Integers ${rc} 0 - ${rc} ${current_trust_pass_path} = Run and Return RC and Output ${GET_TRUSTSTORE_PASS_PATH} - Should Be Equal As Integers ${rc} 0 - Should Be Equal As Strings ${truststore_pass_path} ${current_trust_pass_path} - -Save Configuration From Config Map - [Documentation] Saves current configuration from hv-ves config map in OLD_CONFIG_YAML env - - ${cm_name} = Get Config Map Name - ${rc} ${prev_conf} = Run and Return RC and Output kubectl -n onap get cm ${cm_name} -o json - Should Be Equal As Integers ${rc} 0 - Create File ${PREV_CM_FILE} ${prev_conf} - ${rc} ${prev_conf_yaml} = Run and Return RC and Output kubectl -n onap get cm ${cm_name} -o jsonpath="{.data.application_config\\.yaml}" - Should Be Equal As Integers ${rc} 0 - Set Environment Variable OLD_CONFIG_YAML ${prev_conf_yaml} - -Get Config Map Name - [Documentation] Retrieves HV-VES Config Map name - - ${rc} ${cm_name} = Run and Return RC and Output ${GET_CM_NAME} - Should Be Equal As Integers ${rc} 0 - [Return] ${cm_name} - -Set Old Config - [Documentation] Changes HV-VES config back to normal mode. - - ${rc} = Run and Return RC kubectl -n onap replace --force -f ${PREV_CM_FILE} - Should Be Equal As Integers ${rc} 0 - - ${rc} ${old_trust_pass_path} = Run and Return RC and Output echo "%{OLD_CONFIG_YAML}" | grep security.keys.trustStorePasswordFile - Should Be Equal As Integers ${rc} 0 - - Remove File ${PREV_CM_FILE} - Remove File ${CURRENT_CONFIG_FILE} - - Wait Until Keyword Succeeds 2 min 5 sec Check If Config Is Applied ${old_trust_pass_path} - - Sleep 10s diff --git a/robot/testsuites/hvves-ci.robot b/robot/testsuites/hvves-ci.robot index 5146f50a..0413bb33 100644 --- a/robot/testsuites/hvves-ci.robot +++ b/robot/testsuites/hvves-ci.robot @@ -7,22 +7,11 @@ Resource ../resources/dcae/hvves.robot Library OperatingSystem Library ONAPLibrary.Protobuf -*** Variable *** -${HVVES_KAFKA_TOPIC} HV_VES_PERF3GPP -${HVVES_KAFKA_TOPIC_SSL} HV_VES_PERF3GPP_SSL - *** Test Cases *** HV-VES test case - [Setup] Run Process /app/setup-hvves.sh shell=yes - ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist ${GLOBAL_KAFKA_BOOTSTRAP_SERVICE } - Run Keyword If "${status}"=="FAIL" Set Test Config message-router-kafka:9092 - ... ELSE Set Test Config ${GLOBAL_KAFKA_BOOTSTRAP_SERVICE } - Send Message ${GLOBAL_DCAE_HVVES_SERVER_NAME} ${GLOBAL_DCAE_HVVES_SERVER_PORT} - Run Keyword If "${status}"=="FAIL" Wait Until Keyword Succeeds 10s 2s Check If Topic Exists ${GLOBAL_DMAAP_MESSAGE_ROUTER_SERVER_NAME} ${GLOBAL_DMAAP_MESSAGE_ROUTER_SERVER_PORT} ${HVVES_KAFKA_TOPIC} - Run Keyword If "${status}"=="FAIL" Check Message Router Api ${GLOBAL_DMAAP_MESSAGE_ROUTER_SERVER_NAME} ${GLOBAL_DMAAP_MESSAGE_ROUTER_SERVER_PORT} ${HVVES_KAFKA_TOPIC_SSL} - ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist ${GLOBAL_KAFKA_BOOTSTRAP_SERVICE } - ${msg}= Run Keyword If "${status}"=="FAIL" Decode Last Message From Topic ${GLOBAL_DMAAP_KAFKA_SERVER_NAME} ${GLOBAL_DMAAP_KAFKA_SERVER_PORT} ${HVVES_KAFKA_TOPIC} ${GLOBAL_DMAAP_KAFKA_JAAS_USERNAME} ${GLOBAL_DMAAP_KAFKA_JAAS_PASSWORD} - ... ELSE Decode Last Message From Topic STRIMZI User ${GLOBAL_KAFKA_BOOTSTRAP_SERVICE} ${HVVES_KAFKA_TOPIC} ${GLOBAL_KAFKA_USER} + ${status} ${data}= Run Keyword And Ignore Error Variable Should Exist ${GLOBAL_KAFKA_BOOTSTRAP_SERVICE} + Send Message ${GLOBAL_DCAE_HVVES_SERVER_NAME} ${GLOBAL_DCAE_HVVES_SERVER_PORT} + Sleep 10s + ${msg}= Run Keyword Decode Last Message From Topic ${GLOBAL_KAFKA_BOOTSTRAP_SERVICE} HV_VES_PERF3GPP ${GLOBAL_KAFKA_USER} ${results}= Compare File To Message ${EXECDIR}/robot/assets/dcae/hvves_msg.raw ${msg} Should Be True ${results} - [Teardown] Set Old Config -- cgit 1.2.3-korg