From 4236d2f7dca97b175c757a7cea2a69e8946e3523 Mon Sep 17 00:00:00 2001 From: Edyta Krukowska Date: Wed, 19 Aug 2020 12:34:49 +0200 Subject: Added csit tests for StndDefined disabled validation Issue-ID: DCAEGEN2-2254 Signed-off-by: Edyta Krukowska Change-Id: I806648d8d746dc1b9e999b967ca28e66c43c6852 --- .../testcases/resources/collector.properties | 73 ---------------------- .../resources/collector_basic_auth.properties | 73 ++++++++++++++++++++++ .../resources/collector_stnd_defined.properties | 73 ++++++++++++++++++++++ .../testcases/resources/dcae_properties.robot | 3 + .../resources/override_collector_properties.sh | 33 ++++++++++ .../resources/robot_library/DcaeLibrary.py | 18 +++--- .../testcases/resources/vesc_enable_https_auth.sh | 23 ------- 7 files changed, 191 insertions(+), 105 deletions(-) delete mode 100755 tests/dcaegen2/testcases/resources/collector.properties create mode 100755 tests/dcaegen2/testcases/resources/collector_basic_auth.properties create mode 100644 tests/dcaegen2/testcases/resources/collector_stnd_defined.properties create mode 100755 tests/dcaegen2/testcases/resources/override_collector_properties.sh delete mode 100755 tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh (limited to 'tests/dcaegen2/testcases/resources') diff --git a/tests/dcaegen2/testcases/resources/collector.properties b/tests/dcaegen2/testcases/resources/collector.properties deleted file mode 100755 index cd417635..00000000 --- a/tests/dcaegen2/testcases/resources/collector.properties +++ /dev/null @@ -1,73 +0,0 @@ -############################################################################### -## -## Collector Server config -## -## - Default values are shown as commented settings. -## -############################################################################### -## -## HTTP(S) service -## -## Normally: -## -## - 8080 is http service -## - https is disabled by default -## -## - At this time, the server always binds to 0.0.0.0 -## -## -collector.service.port=8080 - -## Authentication is only supported via secure port -## When enabled - require valid keystore defined -collector.service.secure.port=8443 - -# auth.method flags: -# -# noAuth - default option - no security (http) -# certBasicAuth - auth by certificate and basic auth username / password (https) -auth.method=certBasicAuth - -## Combination of userid,hashPassword encoded pwd list to be supported -## userid and pwd comma separated; pipe delimitation between each pair -## Password is generated by crypt-password library using BCrypt algorithm stored in dcaegen2/sdk package -## or https://nexus.onap.org/#nexus-search;quick~crypt-password -header.authlist=sample1,$2a$10$0buh.2WeYwN868YMwnNNEuNEAMNYVU9.FSMJGyIKV3dGET/7oGOi6 - -## The keystore must be setup per installation when secure port is configured -collector.keystore.file.location=etc/keystore -collector.keystore.passwordfile=etc/passwordfile - -collector.cert.subject.matcher=etc/certSubjectMatcher.properties - -## The truststore must be setup per installation when mutual tls support is configured -collector.truststore.file.location=etc/truststore -collector.truststore.passwordfile=etc/trustpasswordfile - -## Schema Validation checkflag -## default no validation checkflag (-1) -## If enabled (1) - schemafile location must be specified -collector.schema.checkflag=1 -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.2_ONAP.json\"} - -## Schema StndDefinedFields Validation checkflag -## default no validation checkflag (-1) -## If enabled (1) - schema files locations must be specified, mapping file path must be specified, schema reference path -## in event json must be specified, path to stndDefined data field in event json must be specified -collector.externalSchema.checkflag=1 -collector.externalSchema.schemasLocation=./etc/externalRepo/ -collector.externalSchema.mappingFileLocation=./etc/externalRepo/schema-map.json -event.externalSchema.schemaRefPath=/event/stndDefinedFields/schemaReference -event.externalSchema.stndDefinedDataPath=/event/stndDefinedFields/data - -## List all streamid per domain to be supported. The streamid should match to channel name on dmaapfile -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|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance -collector.dmaapfile=./etc/DmaapConfig.json - -## Event transformation Flag - when set expects configurable transformation -## defined under ./etc/eventTransform.json -## Enabled by default; to disable set to 0 -event.transform.flag=1 - -# Describes at what frequency (measured in minutes) should application try to fetch config from CBS -collector.dynamic.config.update.frequency=5 diff --git a/tests/dcaegen2/testcases/resources/collector_basic_auth.properties b/tests/dcaegen2/testcases/resources/collector_basic_auth.properties new file mode 100755 index 00000000..cd417635 --- /dev/null +++ b/tests/dcaegen2/testcases/resources/collector_basic_auth.properties @@ -0,0 +1,73 @@ +############################################################################### +## +## Collector Server config +## +## - Default values are shown as commented settings. +## +############################################################################### +## +## HTTP(S) service +## +## Normally: +## +## - 8080 is http service +## - https is disabled by default +## +## - At this time, the server always binds to 0.0.0.0 +## +## +collector.service.port=8080 + +## Authentication is only supported via secure port +## When enabled - require valid keystore defined +collector.service.secure.port=8443 + +# auth.method flags: +# +# noAuth - default option - no security (http) +# certBasicAuth - auth by certificate and basic auth username / password (https) +auth.method=certBasicAuth + +## Combination of userid,hashPassword encoded pwd list to be supported +## userid and pwd comma separated; pipe delimitation between each pair +## Password is generated by crypt-password library using BCrypt algorithm stored in dcaegen2/sdk package +## or https://nexus.onap.org/#nexus-search;quick~crypt-password +header.authlist=sample1,$2a$10$0buh.2WeYwN868YMwnNNEuNEAMNYVU9.FSMJGyIKV3dGET/7oGOi6 + +## The keystore must be setup per installation when secure port is configured +collector.keystore.file.location=etc/keystore +collector.keystore.passwordfile=etc/passwordfile + +collector.cert.subject.matcher=etc/certSubjectMatcher.properties + +## The truststore must be setup per installation when mutual tls support is configured +collector.truststore.file.location=etc/truststore +collector.truststore.passwordfile=etc/trustpasswordfile + +## Schema Validation checkflag +## default no validation checkflag (-1) +## If enabled (1) - schemafile location must be specified +collector.schema.checkflag=1 +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.2_ONAP.json\"} + +## Schema StndDefinedFields Validation checkflag +## default no validation checkflag (-1) +## If enabled (1) - schema files locations must be specified, mapping file path must be specified, schema reference path +## in event json must be specified, path to stndDefined data field in event json must be specified +collector.externalSchema.checkflag=1 +collector.externalSchema.schemasLocation=./etc/externalRepo/ +collector.externalSchema.mappingFileLocation=./etc/externalRepo/schema-map.json +event.externalSchema.schemaRefPath=/event/stndDefinedFields/schemaReference +event.externalSchema.stndDefinedDataPath=/event/stndDefinedFields/data + +## List all streamid per domain to be supported. The streamid should match to channel name on dmaapfile +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|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance +collector.dmaapfile=./etc/DmaapConfig.json + +## Event transformation Flag - when set expects configurable transformation +## defined under ./etc/eventTransform.json +## Enabled by default; to disable set to 0 +event.transform.flag=1 + +# Describes at what frequency (measured in minutes) should application try to fetch config from CBS +collector.dynamic.config.update.frequency=5 diff --git a/tests/dcaegen2/testcases/resources/collector_stnd_defined.properties b/tests/dcaegen2/testcases/resources/collector_stnd_defined.properties new file mode 100644 index 00000000..9712dff5 --- /dev/null +++ b/tests/dcaegen2/testcases/resources/collector_stnd_defined.properties @@ -0,0 +1,73 @@ +############################################################################### +## +## Collector Server config +## +## - Default values are shown as commented settings. +## +############################################################################### +## +## HTTP(S) service +## +## Normally: +## +## - 8080 is http service +## - https is disabled by default +## +## - At this time, the server always binds to 0.0.0.0 +## +## +collector.service.port=8080 + +## Authentication is only supported via secure port +## When enabled - require valid keystore defined +collector.service.secure.port=8443 + +# auth.method flags: +# +# noAuth - default option - no security (http) +# certBasicAuth - auth by certificate and basic auth username / password (https) +auth.method=certBasicAuth + +## Combination of userid,hashPassword encoded pwd list to be supported +## userid and pwd comma separated; pipe delimitation between each pair +## Password is generated by crypt-password library using BCrypt algorithm stored in dcaegen2/sdk package +## or https://nexus.onap.org/#nexus-search;quick~crypt-password +header.authlist=sample1,$2a$10$0buh.2WeYwN868YMwnNNEuNEAMNYVU9.FSMJGyIKV3dGET/7oGOi6 + +## The keystore must be setup per installation when secure port is configured +collector.keystore.file.location=etc/keystore +collector.keystore.passwordfile=etc/passwordfile + +collector.cert.subject.matcher=etc/certSubjectMatcher.properties + +## The truststore must be setup per installation when mutual tls support is configured +collector.truststore.file.location=etc/truststore +collector.truststore.passwordfile=etc/trustpasswordfile + +## Schema Validation checkflag +## default no validation checkflag (-1) +## If enabled (1) - schemafile location must be specified +collector.schema.checkflag=1 +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.2_ONAP.json\"} + +## Schema StndDefinedFields Validation checkflag +## default no validation checkflag (-1) +## If enabled (1) - schema files locations must be specified, mapping file path must be specified, schema reference path +## in event json must be specified, path to stndDefined data field in event json must be specified +collector.externalSchema.checkflag=-1 +collector.externalSchema.schemasLocation=./etc/externalRepo/ +collector.externalSchema.mappingFileLocation=./etc/externalRepo/schema-map.json +event.externalSchema.schemaRefPath=/event/stndDefinedFields/schemaReference +event.externalSchema.stndDefinedDataPath=/event/stndDefinedFields/data + +## List all streamid per domain to be supported. The streamid should match to channel name on dmaapfile +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|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance +collector.dmaapfile=./etc/DmaapConfig.json + +## Event transformation Flag - when set expects configurable transformation +## defined under ./etc/eventTransform.json +## Enabled by default; to disable set to 0 +event.transform.flag=1 + +# Describes at what frequency (measured in minutes) should application try to fetch config from CBS +collector.dynamic.config.update.frequency=5 diff --git a/tests/dcaegen2/testcases/resources/dcae_properties.robot b/tests/dcaegen2/testcases/resources/dcae_properties.robot index f608b713..c6c1e774 100644 --- a/tests/dcaegen2/testcases/resources/dcae_properties.robot +++ b/tests/dcaegen2/testcases/resources/dcae_properties.robot @@ -53,6 +53,9 @@ ${VES_STND_DEFINED_3GPP_PROVISIONING} %{WORKSPACE}/tests/dcaegen2/testcases/a ${VES_STND_DEFINED_3GPP_HEARTBEAT} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-Heartbeat.json ${VES_STND_DEFINED_3GPP_FAULTSUPERVISION} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-FaultSupervision.json ${VES_STND_DEFINED_3GPP_PERFORMANCE_ASSURANCE} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_3GPP-PerformanceAssurance.json +${VES_STND_DEFINED_INVALID_DATA} %{WORKSPACE}/tests/dcaegen2/testcases/assets/json_events/ves_stdnDefined_invalid_data_fields.json +${VES_CERT_BASIC_AUTH_COLLECTOR_PROPERTIES} %{WORKSPACE}/tests/dcaegen2/testcases/resources/collector_basic_auth.properties +${VES_DISABLED_STNDDEFINED_COLLECTOR_PROPERTIES} %{WORKSPACE}/tests/dcaegen2/testcases/resources/collector_stnd_defined.properties #DCAE Health Check ${CONFIG_BINDING_URL} http://localhost:8443 diff --git a/tests/dcaegen2/testcases/resources/override_collector_properties.sh b/tests/dcaegen2/testcases/resources/override_collector_properties.sh new file mode 100755 index 00000000..f6a46e13 --- /dev/null +++ b/tests/dcaegen2/testcases/resources/override_collector_properties.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +if [ $# -ne 1 ]; then + echo "Incorrect number of parameters" + exit 1 +fi + +LOCAL_COLLECTOR_PROPERTIES_PATH=$1 +FILENAME=$(basename $LOCAL_COLLECTOR_PROPERTIES_PATH) +ETC_PATH=/opt/app/VESCollector/etc +APP_CONTROLLER_PATH=/opt/app/VESCollector/bin/appController.sh + +docker exec vesc $APP_CONTROLLER_PATH stop +sleep 2 +docker cp $LOCAL_COLLECTOR_PROPERTIES_PATH vesc:$ETC_PATH +sleep 10 +docker exec vesc mv $ETC_PATH/$FILENAME $ETC_PATH/collector.properties +docker exec vesc $APP_CONTROLLER_PATH start +sleep 5 +echo "VES Collector Restarted with overridden collector.properties" diff --git a/tests/dcaegen2/testcases/resources/robot_library/DcaeLibrary.py b/tests/dcaegen2/testcases/resources/robot_library/DcaeLibrary.py index a467431f..d5dd9721 100644 --- a/tests/dcaegen2/testcases/resources/robot_library/DcaeLibrary.py +++ b/tests/dcaegen2/testcases/resources/robot_library/DcaeLibrary.py @@ -18,37 +18,37 @@ class DcaeLibrary(object): def __init__(self): pass - + @staticmethod - def enable_vesc_with_cert_basic_auth(): + def override_collector_properties(properties_path): global client if 'Windows' in platform.system(): try: - DcaeLibrary.enable_https_auth_for_windows_platform_system() + DcaeLibrary.change_properties_for_windows_platform_system(properties_path) finally: client.close() return - DcaeLibrary.enable_https_auth_for_non_windows_platform_system() + DcaeLibrary.change_properties_for_non_windows_platform_system(properties_path) return @staticmethod - def enable_https_auth_for_non_windows_platform_system(): + def change_properties_for_non_windows_platform_system(properties_path): ws = os.environ['WORKSPACE'] - script2run = ws + "/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh" + script2run = ws + '/tests/dcaegen2/testcases/resources/override_collector_properties.sh' logger.info("Running script: " + script2run) logger.console("Running script: " + script2run) - subprocess.call(script2run) + subprocess.call([script2run, properties_path]) time.sleep(5) @staticmethod - def enable_https_auth_for_windows_platform_system(): + def change_properties_for_windows_platform_system(properties_path): global client client = paramiko.SSHClient() client.load_system_host_keys() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(os.environ['CSIT_IP'], port=22, username=os.environ['CSIT_USER'], password=os.environ['CSIT_PD']) stdin, stdout, stderr = client.exec_command( - '%{WORKSPACE}/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh') + '%{WORKSPACE}' + '/tests/dcaegen2/testcases/resources/override_collector_properties.sh', properties_path) logger.console(stdout.read()) @staticmethod diff --git a/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh b/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh deleted file mode 100755 index 29700bc5..00000000 --- a/tests/dcaegen2/testcases/resources/vesc_enable_https_auth.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -# Copyright 2016-2017 Huawei Technologies Co., Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -docker exec vesc /opt/app/VESCollector/bin/appController.sh stop -sleep 2 -docker cp ${WORKSPACE}/tests/dcaegen2/testcases/resources/collector.properties vesc:/opt/app/VESCollector/etc -sleep 10 -docker exec vesc /opt/app/VESCollector/bin/appController.sh start -sleep 5 -echo "VES Collector Restarted with certBasicAuth" -- cgit 1.2.3-korg