diff options
author | Joanna Jeremicz <joanna.jeremicz@nokia.com> | 2021-09-01 16:03:41 +0200 |
---|---|---|
committer | Joanna Jeremicz <joanna.jeremicz@nokia.com> | 2021-09-02 12:44:39 +0200 |
commit | d97e97cba78f928deda72cb42ca85792b0a91d29 (patch) | |
tree | 47b1fe29343ae16a9577e1bfd811303d2437aee1 /robot/resources | |
parent | 4fa69b4d9ad2faeb137ce390a5f09824fd3f797d (diff) |
Use configMap instead of Consul to configure hv-ves
Issue-ID: DCAEGEN2-2718
Signed-off-by: Joanna Jeremicz <joanna.jeremicz@nokia.com>
Change-Id: I58a5639e7bc224afb9e30ae4ea97518faa3bd42f
Diffstat (limited to 'robot/resources')
-rw-r--r-- | robot/resources/dcae/hvves.robot | 70 |
1 files changed, 62 insertions, 8 deletions
diff --git a/robot/resources/dcae/hvves.robot b/robot/resources/dcae/hvves.robot index ac43bae0..e8a0e6e6 100644 --- a/robot/resources/dcae/hvves.robot +++ b/robot/resources/dcae/hvves.robot @@ -8,16 +8,27 @@ Library ONAPLibrary.Utilities Library String Library ONAPLibrary.Kafka Resource ../mr_interface.robot -Resource ../consul_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 -${HVVES_CONFIG_SSL} {"security.sslDisable": false, "logLevel": "INFO", "security.keys.trustStoreFile": "/tmp/ca.p12", "server.listenPort": 6061, "server.idleTimeoutSec": 300, "cbs.requestIntervalSec": 5, "streams_publishes": {"perf3gpp": {"type": "kafka", "aaf_credentials": {"username": "admin", "password": "admin_secret"}, "kafka_info": {"bootstrap_servers": "message-router-kafka:9092", "topic_name": "HV_VES_PERF3GPP_SSL"}}}, "security.keys.keyStoreFile": "/tmp/server.p12", "security.keys.trustStorePasswordFile": "/dev/null", "security.keys.keyStorePasswordFile": "/dev/null"} -${HVVES_CONFIG} {"security.sslDisable": false, "logLevel": "INFO", "security.keys.trustStoreFile": "/etc/ves-hv/ssl/trust.jks", "server.listenPort": 6061, "server.idleTimeoutSec": 300, "cbs.requestIntervalSec": 5, "streams_publishes": {"perf3gpp": {"type": "kafka", "aaf_credentials": {"username": "admin", "password": "admin_secret"}, "kafka_info": {"bootstrap_servers": "message-router-kafka:9092", "topic_name": "HV_VES_PERF3GPP"}}}, "security.keys.keyStoreFile": "/etc/ves-hv/ssl/cert.jks", "security.keys.trustStorePasswordFile": "/etc/ves-hv/ssl/trust.pass", "security.keys.keyStorePasswordFile": "/etc/ves-hv/ssl/jks.pass"} ${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/currentConfig.yaml +${CM_NAME} dev-dcae-hv-ves-collector-application-config-configmap +${GET_PREV_CM} kubectl -n onap get cm ${CM_NAME} -o json + +${TEST_TRUSTSTORE_PASS_PATH} security.keys.trustStorePasswordFile: /dev/null + +${COPY_CURRENT_CONFIG} kubectl -n onap cp $(kubectl get pods -n onap | grep hv-ves | awk '{print $1}' | grep -v NAME):/app-config-input/..data/application_config.yaml ${CURRENT_CONFIG_FILE} +${GET_TRUSTSTORE_PASS_PATH} cat ${CURRENT_CONFIG_FILE} | grep security.keys.trustStorePasswordFile + +${GET_CONFIG_FROM_CM} kubectl -n onap get cm ${CM_NAME} -o jsonpath="{.data.application_config\\.yaml}" +${TEST_CONFIG_YAML_PATH} ${EXECDIR}/robot/assets/dcae/hvves_test_config.yaml + + *** Keywords *** Check Message Router Api [Documentation] Checks message via message router API. @@ -54,9 +65,52 @@ Decode Last Message From Topic ${msg}= Consume kafka ${kafka_topic} [Return] ${msg} -Mode +Set Test Config [Documentation] Changes HV-VES config. - [Arguments] ${config} - ${resp}= Run Consul Put Request /v1/kv/dcae-hv-ves-collector?dc=dc1 ${config} - Should Be Equal As Strings ${resp.status_code} 200 - Sleep 10s + + ${TEST_CONFIG}= Get File ${TEST_CONFIG_YAML_PATH} encoding=UTF-8 + + ${rc} ${prev_conf} = Run and Return RC and Output ${GET_PREV_CM} + Should Be Equal As Integers ${rc} 0 + Create File ${PREV_CM_FILE} ${prev_conf} + + ${rc} ${prev_conf_yaml} = Run and Return RC and Output ${GET_CONFIG_FROM_CM} + Should Be Equal As Integers ${rc} 0 + Set Environment Variable OLD_CONFIG_YAML ${prev_conf_yaml} + + Set Environment Variable TEST_CONFIG ${TEST_CONFIG} + + ${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} + +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 |