diff options
5 files changed, 143 insertions, 129 deletions
diff --git a/tests/dcaegen2/prh-testcases/prh_config_tests.robot b/tests/dcaegen2/prh-testcases/prh_config_tests.robot index 144504d1..2a6b8154 100644 --- a/tests/dcaegen2/prh-testcases/prh_config_tests.robot +++ b/tests/dcaegen2/prh-testcases/prh_config_tests.robot @@ -1,6 +1,7 @@ *** Settings *** Documentation Tests related to updating PRH app config based on CBS config -Suite Setup Run keywords Create sessions +Suite Setup Create sessions +Suite Teardown Set default PRH CBS config Resource resources/prh_sessions.robot Resource resources/prh_config_library.robot Resource resources/prh_library.robot diff --git a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml index ca94dfb2..00a2af1d 100644 --- a/tests/dcaegen2/prh-testcases/resources/docker-compose.yml +++ b/tests/dcaegen2/prh-testcases/resources/docker-compose.yml @@ -53,140 +53,23 @@ services: consul-cfg: image: consul:1.0.6 restart: on-failure - command: ["kv", "put", "-http-addr=http://consul:8500", "dcae-prh", '{ - "cbs.updates-interval": 0, - "logging.level.org.onap.dcaegen2.services.prh": "debug", - "logging.level.org.onap.dcaegen2.services.sdk": "debug", - "logging.level.org.onap.dcaegen2.services.prh.controllers.AppInfoController": "off", - "dmaap.dmaapConsumerConfiguration.dmaapUserName":"admin", - "dmaap.dmaapConsumerConfiguration.dmaapUserPassword":"admin", - "dmaap.dmaapConsumerConfiguration.dmaapContentType": "application/json", - "dmaap.dmaapConsumerConfiguration.consumerId": "c12", - "dmaap.dmaapConsumerConfiguration.consumerGroup": "OpenDCAE-c12", - "dmaap.dmaapConsumerConfiguration.timeoutMs": -1, - "dmaap.dmaapProducerConfiguration.dmaapUserName":"admin", - "dmaap.dmaapProducerConfiguration.dmaapUserPassword":"admin", - "dmaap.dmaapProducerConfiguration.dmaapContentType": "application/json", - "dmaap.dmaapUpdateProducerConfiguration.dmaapUserName": "admin", - "dmaap.dmaapUpdateProducerConfiguration.dmaapUserPassword": "admin", - "dmaap.dmaapUpdateProducerConfiguration.dmaapContentType": "application/json", - "aai.aaiClientConfiguration.pnfUrl":"https://aai:3334/aai/v12/network/pnfs/pnf", - "aai.aaiClientConfiguration.aaiUserName": "DCAE", - "aai.aaiClientConfiguration.aaiUserPassword": "DCAE", - "aai.aaiClientConfiguration.aaiIgnoreSslCertificateErrors": true, - "aai.aaiClientConfiguration.aaiServiceInstancePath":"/business/customers/customer/${customer}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${serviceInstanceId}", - "aai.aaiClientConfiguration.aaiHeaders":{ - "X-FromAppId": "prh", - "X-TransactionId": "9999", - "Accept": "application/json", - "Real-Time": "true", - "Authorization": "Basic QUFJOkFBSQ==" - }, - "security.trustStorePath":"/tmp/certs/truststore.jks", - "security.trustStorePasswordPath":"/tmp/certs/truststore.password", - "security.keyStorePath":"/tmp/certs/keystore.p12", - "security.keyStorePasswordPath":"/tmp/certs/keystore.password", - "security.enableAaiCertAuth":true, - "security.enableDmaapCertAuth":true, - - "streams_publishes":{ - "pnf-update":{ - "type": "message_router", - "dmaap_info":{ - "topic_url":"https://dmaap-mr:2223/events/unauthenticated.PNF_UPDATE" - } - }, - "pnf-ready":{ - "type": "message_router", - "dmaap_info":{ - "topic_url":"https://dmaap-mr:2223/events/unauthenticated.PNF_READY" - } - } - }, - "streams_subscribes":{ - "ves-reg-output":{ - "type": "message_router", - "dmaap_info":{ - "topic_url":"https://dmaap-mr:2223/events/unauthenticated.VES_PNFREG_OUTPUT" - } - } - } - }' - ] + command: ["kv", "put", "-http-addr=http://consul:8500", "dcae-prh", "@/prh_configs/prh-config.json"] container_name: consul-cfg + volumes: + - ./prh_configs/:/prh_configs:Z depends_on: - consul consul-cfg-dcae-ves-collector: image: consul:1.0.6 restart: on-failure - command: ["kv", "put", "-http-addr=http://consul:8500", "dcae-ves-collector",'{ - "collector.dynamic.config.update.frequency": "5", - "event.transform.flag": "0", - "collector.schema.checkflag": "1", - "collector.dmaap.streamid": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration", - "collector.service.port": "8080", - "collector.schema.file":"{ - \"v1\":\"./etc/CommonEventFormat_27.2.json\", - \"v2\":\"./etc/CommonEventFormat_27.2.json\", - \"v3\":\"./etc/CommonEventFormat_27.2.json\", - \"v4\":\"./etc/CommonEventFormat_27.2.json\", - \"v5\":\"./etc/CommonEventFormat_28.4.1.json\", - \"v7\":\"./etc/CommonEventFormat_30.0.1.json\" - }", - "collector.keystore.passwordfile": "/opt/app/VESCollector/etc/passwordfile", - "collector.inputQueue.maxPending": "8096", - "streams_publishes":{ - "ves-measurement": { - "type": "message_router", - "dmaap_info": { - "topic_url": "http://dmaap-mr:2222/events/unauthenticated.VES_MEASUREMENT_OUTPUT/" - } - }, - "ves-fault": { - "type": "message_router", - "dmaap_info": { - "topic_url": "http://dmaap-mr:2222/events/unauthenticated.SEC_FAULT_OUTPUT/" - } - }, - "ves-pnfRegistration": { - "type": "message_router", - "dmaap_info": { - "topic_url": "http://dmaap-mr:2222/events/unauthenticated.VES_PNFREG_OUTPUT/" - } - }, - "ves-other": { - "type": "message_router", - "dmaap_info": { - "topic_url": "http://dmaap-mr:2222/events/unauthenticated.SEC_OTHER_OUTPUT/" - } - }, - "ves-heartbeat": { - "type": "message_router", - "dmaap_info": { - "topic_url": "http://dmaap-mr:2222/events/unauthenticated.SEC_HEARTBEAT_OUTPUT/" - } - }, - "ves-notification": { - "type": "message_router", - "dmaap_info": { - "topic_url": "http://dmaap-mr:2222/events/unauthenticated.VES_NOTIFICATION_OUTPUT/" - } - } - }, - "collector.service.secure.port": "8443", - "header.authflag": "0", - "collector.keystore.file.location": "/opt/app/VESCollector/etc/keystore", - "collector.keystore.alias": - "dynamically generated", - "services_calls": [], - "header.authlist": "sample1,c2FtcGxlMQ==" - }'] + command: ["kv", "put", "-http-addr=http://consul:8500", "dcae-ves-collector", "@/prh_configs/dcae-ves-collector-config.json"] container_name: consul-cfg-dcae-ves-collector + volumes: + - ./prh_configs/:/prh_configs:Z depends_on: - consul - cbs: image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app:2.2.4 ports: diff --git a/tests/dcaegen2/prh-testcases/resources/prh_config_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_config_library.robot index 26a62704..78b47824 100644 --- a/tests/dcaegen2/prh-testcases/resources/prh_config_library.robot +++ b/tests/dcaegen2/prh-testcases/resources/prh_config_library.robot @@ -1,16 +1,19 @@ *** Settings *** Documentation Keywords related to checking and updating PRH app config based on CBS config Library RequestsLibrary +Library OperatingSystem Library Collections +*** Variables *** +${CONFIGS_DIR} %{WORKSPACE}/tests/dcaegen2/prh-testcases/resources/prh_configs/ + *** Keywords *** Put key-value to consul - [Arguments] ${key} ${value} - ${prh_config}= Get PRH config from consul - set to dictionary ${prh_config} ${key} ${value} - put request consul_session /v1/kv/dcae-prh json=${prh_config} - Get PRH config from consul prh config in consul after update + [Arguments] ${key} ${value} + ${prh_config}= Get PRH config from consul + set to dictionary ${prh_config} ${key} ${value} + Set PRH config in consul ${prh_config} Get PRH config from consul [Arguments] ${logMessage}=prh config in consul @@ -18,6 +21,21 @@ Get PRH config from consul log ${logMessage}: ${phr_config_response.content} [Return] ${phr_config_response.json()} +Set PRH config in consul + [Arguments] ${prh_config} + put request consul_session /v1/kv/dcae-prh json=${prh_config} + Get PRH config from consul prh config in consul after update + +Set PRH CBS config from file + [Arguments] ${config_file_name} + ${config_file_content}= get file ${config_file_name} + ${config_json}= to json ${config_file_content} + Set PRH config in consul ${config_json} + Force PRH config refresh + +Set default PRH CBS config + Set PRH CBS config from file ${CONFIGS_DIR}/prh-config.json + Force PRH config refresh ${refresh_response}= post request prh_session /actuator/refresh should be equal as integers ${refresh_response.status_code} 200 diff --git a/tests/dcaegen2/prh-testcases/resources/prh_configs/dcae-ves-collector-config.json b/tests/dcaegen2/prh-testcases/resources/prh_configs/dcae-ves-collector-config.json new file mode 100644 index 00000000..d3be7acd --- /dev/null +++ b/tests/dcaegen2/prh-testcases/resources/prh_configs/dcae-ves-collector-config.json @@ -0,0 +1,54 @@ +{ + "collector.dynamic.config.update.frequency": "5", + "event.transform.flag": "0", + "collector.schema.checkflag": "1", + "collector.dmaap.streamid": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration", + "collector.service.port": "8080", + "collector.schema.file": "{ \"v1\":\"./etc/CommonEventFormat_27.2.json\", \"v2\":\"./etc/CommonEventFormat_27.2.json\", \"v3\":\"./etc/CommonEventFormat_27.2.json\", \"v4\":\"./etc/CommonEventFormat_27.2.json\", \"v5\":\"./etc/CommonEventFormat_28.4.1.json\", \"v7\":\"./etc/CommonEventFormat_30.0.1.json\" }", + "collector.keystore.passwordfile": "/opt/app/VESCollector/etc/passwordfile", + "collector.inputQueue.maxPending": "8096", + "streams_publishes": { + "ves-measurement": { + "type": "message_router", + "dmaap_info": { + "topic_url": "http://dmaap-mr:2222/events/unauthenticated.VES_MEASUREMENT_OUTPUT/" + } + }, + "ves-fault": { + "type": "message_router", + "dmaap_info": { + "topic_url": "http://dmaap-mr:2222/events/unauthenticated.SEC_FAULT_OUTPUT/" + } + }, + "ves-pnfRegistration": { + "type": "message_router", + "dmaap_info": { + "topic_url": "http://dmaap-mr:2222/events/unauthenticated.VES_PNFREG_OUTPUT/" + } + }, + "ves-other": { + "type": "message_router", + "dmaap_info": { + "topic_url": "http://dmaap-mr:2222/events/unauthenticated.SEC_OTHER_OUTPUT/" + } + }, + "ves-heartbeat": { + "type": "message_router", + "dmaap_info": { + "topic_url": "http://dmaap-mr:2222/events/unauthenticated.SEC_HEARTBEAT_OUTPUT/" + } + }, + "ves-notification": { + "type": "message_router", + "dmaap_info": { + "topic_url": "http://dmaap-mr:2222/events/unauthenticated.VES_NOTIFICATION_OUTPUT/" + } + } + }, + "collector.service.secure.port": "8443", + "header.authflag": "0", + "collector.keystore.file.location": "/opt/app/VESCollector/etc/keystore", + "collector.keystore.alias": "dynamically generated", + "services_calls": [], + "header.authlist": "sample1,c2FtcGxlMQ==" +}
\ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/resources/prh_configs/prh-config.json b/tests/dcaegen2/prh-testcases/resources/prh_configs/prh-config.json new file mode 100644 index 00000000..e4c3ba82 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/resources/prh_configs/prh-config.json @@ -0,0 +1,58 @@ +{ + "cbs.updates-interval": 0, + "logging.level.org.onap.dcaegen2.services.prh": "debug", + "logging.level.org.onap.dcaegen2.services.sdk": "debug", + "logging.level.org.onap.dcaegen2.services.prh.controllers.AppInfoController": "off", + "dmaap.dmaapConsumerConfiguration.dmaapUserName": "admin", + "dmaap.dmaapConsumerConfiguration.dmaapUserPassword": "admin", + "dmaap.dmaapConsumerConfiguration.dmaapContentType": "application/json", + "dmaap.dmaapConsumerConfiguration.consumerId": "c12", + "dmaap.dmaapConsumerConfiguration.consumerGroup": "OpenDCAE-c12", + "dmaap.dmaapConsumerConfiguration.timeoutMs": -1, + "dmaap.dmaapProducerConfiguration.dmaapUserName": "admin", + "dmaap.dmaapProducerConfiguration.dmaapUserPassword": "admin", + "dmaap.dmaapProducerConfiguration.dmaapContentType": "application/json", + "dmaap.dmaapUpdateProducerConfiguration.dmaapUserName": "admin", + "dmaap.dmaapUpdateProducerConfiguration.dmaapUserPassword": "admin", + "dmaap.dmaapUpdateProducerConfiguration.dmaapContentType": "application/json", + "aai.aaiClientConfiguration.pnfUrl": "https://aai:3334/aai/v12/network/pnfs/pnf", + "aai.aaiClientConfiguration.aaiUserName": "DCAE", + "aai.aaiClientConfiguration.aaiUserPassword": "DCAE", + "aai.aaiClientConfiguration.aaiIgnoreSslCertificateErrors": true, + "aai.aaiClientConfiguration.aaiServiceInstancePath": "/business/customers/customer/${customer}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${serviceInstanceId}", + "aai.aaiClientConfiguration.aaiHeaders": { + "X-FromAppId": "prh", + "X-TransactionId": "9999", + "Accept": "application/json", + "Real-Time": "true", + "Authorization": "Basic QUFJOkFBSQ==" + }, + "security.trustStorePath": "/tmp/certs/truststore.jks", + "security.trustStorePasswordPath": "/tmp/certs/truststore.password", + "security.keyStorePath": "/tmp/certs/keystore.p12", + "security.keyStorePasswordPath": "/tmp/certs/keystore.password", + "security.enableAaiCertAuth": true, + "security.enableDmaapCertAuth": true, + "streams_publishes": { + "pnf-update": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://dmaap-mr:2223/events/unauthenticated.PNF_UPDATE" + } + }, + "pnf-ready": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://dmaap-mr:2223/events/unauthenticated.PNF_READY" + } + } + }, + "streams_subscribes": { + "ves-reg-output": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://dmaap-mr:2223/events/unauthenticated.VES_PNFREG_OUTPUT" + } + } + } +}
\ No newline at end of file |