diff options
Diffstat (limited to 'tests')
6 files changed, 122 insertions, 4 deletions
diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/libraries/KafkaLibrary.py b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/KafkaLibrary.py new file mode 100644 index 00000000..e262ff01 --- /dev/null +++ b/tests/dcaegen2-collectors-hv-ves/testcases/libraries/KafkaLibrary.py @@ -0,0 +1,61 @@ +# ============LICENSE_START==================================== +# csit-dcaegen2-collectors-hv-ves +# ========================================================= +# Copyright (C) 2019 Nokia. All rights reserved. +# ========================================================= +# 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. +# ============LICENSE_END===================================== + +import docker +from robot.api import logger + +KAFKA_IMAGE_FULL_NAME = "wurstmeister/kafka" +KAFKA_ADDRESS = "kafka:9092" +ZOOKEEPER_ADDRESS = "zookeeper:2181" + +LIST_TOPICS_COMMAND = "kafka-topics.sh --list --zookeeper %s" % ZOOKEEPER_ADDRESS +TOPIC_STATUS_COMMAND = "kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list " + KAFKA_ADDRESS + " --topic %s --time -1" +DELETE_TOPIC_COMMAND = "kafka-topics.sh --zookeeper " + ZOOKEEPER_ADDRESS + " --delete --topic %s" + + +class KafkaLibrary: + + def log_kafka_status(self): + dockerClient = docker.from_env() + kafka = dockerClient.containers.list(filters={"ancestor": KAFKA_IMAGE_FULL_NAME}, all=True)[0] + + topics = self.get_topics(kafka) + logger.info("Topics initialized in Kafka cluster: " + str(topics)) + for topic in topics: + if topic == "__consumer_offsets": + # kafka-internal topic, ignore it + continue + + self.log_topic_status(kafka, topic) + self.reset_topic(kafka, topic) + + dockerClient.close() + + def get_topics(self, kafka): + exitCode, output = kafka.exec_run(LIST_TOPICS_COMMAND) + return output.splitlines() + + def log_topic_status(self, kafka, topic): + _, topic_status = kafka.exec_run(TOPIC_STATUS_COMMAND % topic) + logger.info("Messages on topic: " + str(topic_status)) + + def reset_topic(self, kafka, topic): + logger.info("Removing topic " + str( + topic) + " (note that it will be recreated by dcae-app-simulator/hv-ves-collector, however the offset will be reseted)") + _, output = kafka.exec_run(DELETE_TOPIC_COMMAND % topic) + logger.info(str(output)) diff --git a/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot b/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot index 1c925408..07e886a0 100644 --- a/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot +++ b/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot @@ -19,6 +19,7 @@ *** Settings *** Library XnfSimulatorLibrary Library VesHvContainersUtilsLibrary +Library KafkaLibrary Library Collections *** Keywords *** @@ -63,6 +64,7 @@ VES-HV Collector Test Shutdown VES-HV Collector Suite Teardown + Log Kafka Status Stop And Remove All Xnf Simulators ${SUITE NAME} *** Variables *** diff --git a/tests/sdnc/sdnc_netconf_tls_post_deploy/_init_.robot b/tests/sdnc/sdnc_netconf_tls_post_deploy/_init_.robot new file mode 100644 index 00000000..d7353060 --- /dev/null +++ b/tests/sdnc/sdnc_netconf_tls_post_deploy/_init_.robot @@ -0,0 +1,2 @@ +1 *** Settings *** +2 Documentation SDNC - keystorecheck diff --git a/tests/sdnc/sdnc_netconf_tls_post_deploy/data/mount.xml b/tests/sdnc/sdnc_netconf_tls_post_deploy/data/mount.xml new file mode 100644 index 00000000..108369bc --- /dev/null +++ b/tests/sdnc/sdnc_netconf_tls_post_deploy/data/mount.xml @@ -0,0 +1,14 @@ +<node xmlns="urn:TBD:params:xml:ns:yang:network-topology"> + <node-id>netopeer2</node-id> + <key-based xmlns="urn:opendaylight:netconf-node-topology"> + <key-id xmlns="urn:opendaylight:netconf-node-topology">ODL_private_key_0</key-id> + <username xmlns="urn:opendaylight:netconf-node-topology">netconf</username> + </key-based> + <host xmlns="urn:opendaylight:netconf-node-topology">pnfaddr</host> + <port xmlns="urn:opendaylight:netconf-node-topology">6513</port> + <tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only> + <protocol xmlns="urn:opendaylight:netconf-node-topology"> + <name xmlns="urn:opendaylight:netconf-node-topology">TLS</name> + </protocol> + <max-connection-attempts xmlns="urn:opendaylight:netconf-node-topology">2</max-connection-attempts> +</node> diff --git a/tests/sdnc/sdnc_netconf_tls_post_deploy/sdnc_post_deploy_cert_check.robot b/tests/sdnc/sdnc_netconf_tls_post_deploy/sdnc_post_deploy_cert_check.robot new file mode 100644 index 00000000..f1814144 --- /dev/null +++ b/tests/sdnc/sdnc_netconf_tls_post_deploy/sdnc_post_deploy_cert_check.robot @@ -0,0 +1,39 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json +Library String + +*** Variables *** +${SDNC_KEYSTORE_CONFIG_PATH} /config/netconf-keystore:keystore +${SDNC_MOUNT_PATH} /config/network-topology:network-topology/topology/topology-netconf/node/netopeer2 +${PNFSIM_MOUNT_PATH} /config/network-topology:network-topology/topology/topology-netconf/node/netopeer2/yang-ext:mount/mynetconf:netconflist + + *** Test Cases *** + Test SDNC Keystore + [Documentation] Checking keystore after SDNC installation + Create Session sdnc http://localhost:8282/restconf + &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json Accept=application/json + ${resp}= Get Request sdnc ${SDNC_KEYSTORE_CONFIG_PATH} headers=${headers} + Should Be Equal As Strings ${resp.status_code} 200 + ${keystoreContent}= Convert To String ${resp.content} + Log to console ************************* + Log to console ${resp.content} + Log to console ************************* + + Test SDNC PNF Mount + [Documentation] Checking PNF mount after SDNC installation + Create Session sdnc http://localhost:8282/restconf + ${mount}= Get File ${CURDIR}${/}data${/}mount.xml + Log to console ${mount} + &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/xml Accept=application/xml + ${resp}= Put Request sdnc ${SDNC_MOUNT_PATH} data=${mount} headers=${headers} + Should Be Equal As Strings ${resp.status_code} 201 + Sleep 30 + &{headers1}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json Accept=application/json + ${resp1}= Get Request sdnc ${PNFSIM_MOUNT_PATH} headers=${headers1} + Should Be Equal As Strings ${resp1.status_code} 200 + Log to console ${resp1.content} + Should Contain ${resp1.content} netconf-id + Should Contain ${resp1.content} netconf-param
\ No newline at end of file diff --git a/tests/usecases/5G-bulkpm/BulkpmE2E.robot b/tests/usecases/5G-bulkpm/BulkpmE2E.robot index f8ba0fb1..dcf97210 100644 --- a/tests/usecases/5G-bulkpm/BulkpmE2E.robot +++ b/tests/usecases/5G-bulkpm/BulkpmE2E.robot @@ -20,9 +20,9 @@ ${CLI_EXEC_CLI} curl -k https://${DR_PROV_IP}:8443/inte ${CLI_EXEC_CLI_FILECONSUMER} docker exec fileconsumer-node /bin/sh -c "ls /opt/app/subscriber/delivery | grep .xml" ${CLI_EXEC_CLI_DFC_LOG} docker exec dfc /bin/sh -c "cat /var/log/ONAP/application.log" > /tmp/dfc_docker.log.robot ${CLI_EXEC_CLI_DFC_LOG_GREP} grep "Publish to DR successful!" /tmp/dfc_docker.log.robot +${CLI_EXEC_CLI_FILECONSUMER_CP} docker cp fileconsumer-node:/opt/app/subscriber/delivery/xNF.pm.xml.M %{WORKSPACE} +${CLI_EXEC_RENAME_METADATA} mv %{WORKSPACE}/xNF.pm.xml.M %{WORKSPACE}/metadata.json -${CLI_EXEC_CLI_FILECONSUMER_CP} docker cp fileconsumer-node:/opt/app/subscriber/delivery/oteNB5309_xNF.pm.xml.M %{WORKSPACE} -${CLI_EXEC_RENAME_METADATA} mv %{WORKSPACE}/oteNB5309_xNF.pm.xml.M %{WORKSPACE}/metadata.json ${metadataSchemaPath} %{WORKSPACE}/tests/usecases/5G-bulkpm/assets/metadata.schema.json ${metadataJsonPath} %{WORKSPACE}/metadata.json @@ -86,7 +86,7 @@ Verify Fileconsumer Receive PM file from Data Router ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_FILECONSUMER} shell=yes Log ${cli_cmd_output.stdout} Should Be Equal As Strings ${cli_cmd_output.rc} 0 - Should Contain ${cli_cmd_output.stdout} oteNB5309_xNF.pm.xml + Should Contain ${cli_cmd_output.stdout} xNF.pm.xml Verify File Consumer Receive valid metadata from Data Router [Tags] Bulk_PM_E2E_06 @@ -94,7 +94,7 @@ Verify File Consumer Receive valid metadata from Data Router ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_FILECONSUMER} shell=yes Log ${cli_cmd_output.stdout} Should Be Equal As Strings ${cli_cmd_output.rc} 0 - Should Contain ${cli_cmd_output.stdout} oteNB5309_xNF.pm.xml.M + Should Contain ${cli_cmd_output.stdout} xNF.pm.xml.M ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_FILECONSUMER_CP} shell=yes ${cli_cmd_output}= Run Process ${CLI_EXEC_RENAME_METADATA} shell=yes ${validation_result}= Validate ${metadataSchemaPath} ${metadataJsonPath} |