From: Dario Faccin Date: Wed, 31 May 2023 13:05:03 +0000 (+0200) Subject: Update from master part 2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F78%2F13478%2F1;p=osm%2Ftests.git Update from master part 2 Squashed commit of the following: commit b91fc76ef46323c88e27610c06316af168549834 Author: Gabriel Cuba Date: Fri May 19 18:30:19 2023 -0500 Feature 10972: Add tests for volume multiattach Change-Id: Ib7c918cd8d3a160cfeb69503e10b135893be244b Signed-off-by: Gabriel Cuba commit 6373cc958e17809f45cbd229323b591f93f821fa Author: garciadeblas Date: Tue May 23 11:17:09 2023 +0200 Avoid execution of tests in run_test.sh if no tag is provided The idea of this commit is to enable the use of run_test.sh for other purposes like running TST010 conformance tests or register VIM and K8s clusters, so that the VIM and cluster registration can be decoupled. In that way, daily jobs could run several tests, one after the other, with different VIMs. Change-Id: If0791f9562d23a861f8491c144cdc7f539efec46 Signed-off-by: garciadeblas commit 437637ceb4f984b3d3d9a0f31201cd171b37efd9 Author: garciadeblas Date: Tue May 23 11:31:29 2023 +0200 Updated README with cleaner instructions Change-Id: Iac797372e88e71afb1322e2bd0e71feba4535f21 Signed-off-by: garciadeblas commit 8f994ccfd43dbc1db7c3fdb3410d98dd235a3529 Author: Gabriel Cuba Date: Fri May 12 13:44:16 2023 -0500 Feature 10975: Modify heal_02 to test instantiation, scaling and healing using an existing flavor-id Change-Id: Ic9c02b13dda5c2e8eac3b8bfe027bd858d49a367 Signed-off-by: Gabriel Cuba commit 245b04f08965d65f323de1197c082468829b6bf6 Author: Gabriel Cuba Date: Tue May 9 12:37:29 2023 -0500 Feature 10978: add tests for ipv6 profiles in vnfd and nsd Change-Id: If62b1489249fe4135a14b9c2720573ba8fe1a5c1 Signed-off-by: Gabriel Cuba commit 541f9cf287bf6c7dca45fe911f8e844988711fa3 Author: garciadeblas Date: Tue May 23 11:59:47 2023 +0200 Fix Fail01 to get openstack quota properly after updating client version Change-Id: Ief7b4d5f150d67cecf944021c2598456672a30e0 Signed-off-by: garciadeblas commit a86e6938d53e345b08a7ca9cc9615115f14a002a Author: garciadeblas Date: Fri May 19 12:47:09 2023 +0200 Update SA02 to take into account the VNF threshold-time Change-Id: Idde7fa330e8e9b141053c15edb266817c4e699c6 Signed-off-by: garciadeblas commit c753f67c813fa82926b3d64db759fd7d0d7aa2cc Author: garciadeblas Date: Thu May 18 15:06:49 2023 +0200 Fix error message in run_test.sh for create_k8scluster Change-Id: Ice2e0bc5e829e31a81cbde30ea6784de64d8ca63 Signed-off-by: garciadeblas commit b9dfe0317c4935294747897dc2fd1645c4983067 Author: garciadeblas Date: Wed May 10 17:25:47 2023 +0200 Support of Python3.10 This change includes required changes to make tests work in Python3.10. It also enables tox running as part of stage-test, which was not included before. For the moment, only flake8 and black envs will be checked. Some pylint errors have been fixed, but a few remain unsolved. That's why pylint is run, but its result is ignored. Change-Id: I29105bf849eab8b47f92627a7eea1ede31b8e05b Signed-off-by: garciadeblas commit 3d7579ccc2356a23ea32878e8f0fbb0e75f59b68 Author: garciadeblas Date: Tue Apr 18 15:04:57 2023 +0200 Clean stage-archive.sh and use allowlist_extenals in tox.ini Change-Id: I690598c770f52d805ee3516fead7fa191c90205f Signed-off-by: garciadeblas commit 43f34481b4c5ccfda407a7f82a124012aab0dccc Author: garciadeblas Date: Thu Feb 23 17:37:47 2023 +0100 Fix bug 2220 to solve sol003_01 test Change-Id: Ic4376067a8b42e470c09ba0668c545db8ce08e55 Signed-off-by: garciadeblas Change-Id: Ide1e04dc7598e80885c2d504da8b89fb4a2f902f Signed-off-by: Dario Faccin --- diff --git a/README.md b/README.md index 03d6054..6759fc0 100644 --- a/README.md +++ b/README.md @@ -21,77 +21,97 @@ This repository contains tools and configuration files for testing and automatio ## Prerequisites -- **Robot Framework** -- **Packages**: ssh ping yq git -- **Python3 packages**: haikunator requests robotframework robotframework-seleniumlibrary robotframework-requests robotframework-jsonlibrary robotframework-sshlibrary -- Clone **osm-packages** from gitlab -- Environment config file for your infrastructure `envfile.rc` +- OSM running +- VIM already registered in OSM +- K8s cluster already registered in OSM (for tests involving a K8s cluster) -## Installing +## Quickstart (run tests using docker) -This bash script can be used to setup your environment to execute the tests. +### Configure the environment file -```bash -python3 -m pip install -r requirements.txt -python3 -m pip install -r requirements-dev.txt -# Download community packages -PACKAGES_FOLDER=osm-packages -git clone https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git ${PACKAGES_FOLDER} +``` +export OSM_HOSTNAME= +export VIM_TARGET= +export VIM_MGMT_NET= +export K8S_CREDENTIALS= # path to the kubeconfig file of the K8s cluster to be tested +export OS_CLOUD= # OpenStack Cloud defined in $HOME/.config/openstack/clouds.yaml or in /etc/openstack/clouds.yaml ``` -## Configure the environment - -Create a file `envfile.rc` copying from `envconfig-local.rc` and set the required variables. - -## Running the tests +### Create the docker container -### From the host machine +```bash +docker build -f docker/Dockerfile -t osmtests . +``` -If you have installed all the dependencies, the way of executing the tests is via the following command: +### Run the tests ```bash -source envfile.rc -robot -d reports -i testsuite/ +docker run --rm=true --name tests -t --env-file envconfig.rc \ + -v ~/.config/openstack/clouds.yaml:/etc/openstack/clouds.yaml \ + -v ~/tests/reports:/robot-systest/reports \ + osmtests \ + -t sol003_01 ``` -### From docker container +You can use a different robot tag instead of `sol003_01`. The whole list of tags are gathered below in this README. -It is possible to run the tests directly from the repository or using a docker container with the tests. +## How to mount local tests folder for developing purposes -Create the docker container: +The following line will mount the required files for SOL003_01 testuite and will execute the test `sol003_01` ```bash -docker build -f docker/Dockerfile -t osmtests . +docker run --rm=true --name tests -t --env-file envconfig.rc \ + -v ~/.config/openstack/clouds.yaml:/etc/openstack/clouds.yaml \ + -v ~/tests/reports:/robot-systest/reports \ + -v ~/tests/robot-systest/lib/sol003_common_lib.robot:/robot-systest/lib/sol003_common_lib.robot \ + osmtests \ + -t sol003_01 ``` -Options: +Relevant volumes to be mounted are: + +- [OPTIONAL]: the absolute path to reports location in the host +- [OPTIONAL]: the absolute path to the clouds.yaml file in the host +- [OPTIONAL]: the absolute path to the sdncs.yaml file in the host +- [OPTIONAL]: the kubeconfig file to be used for k8s clusters + +Other relevant options to run tests are: - `--env-file`: It is the environmental file where is described the OSM target and VIM - `-o ` [OPTIONAL]: It is used to specify a particular osmclient version. Default: latest - `-p ` [OPTIONAL]: OSM packages repository branch. Default: master - `-t ` [OPTIONAL]: Robot tests tags. [sanity, regression, particular_test]. Default: sanity -Volumes: -- [OPTIONAL]: It is the absolute path to reports location in the host -- [OPTIONAL]: It is the absolute path to the clouds.yaml file in the host -- [OPTIONAL]: It is the absolute path to the sdncs.yaml file in the host -- [OPTIONAL]: It is the kubeconfig file to be used for k8s clusters +## How to run tests from a host -Then, run the tests: +### Installing + +This bash script can be used to setup your environment to execute the tests. ```bash -docker run --rm=true -t osmtests --env-file \ - -v :/reports osmtests \ - -v :/robot-systest/clouds.yaml \ - -v :/robot-systest/sdncs.yaml \ - -v :/root/.kube/config \ - -o \ - -p \ - -t +sudo apt-get update +sudo apt-get install ssh ping yq git +# Python packages used for the tests +python3 -m pip install -r requirements.txt +python3 -m pip install -r requirements-dev.txt +# Download community packages +git clone https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git +``` + +### Configure the environment + +Create a file `envfile.rc` copying from `envconfig-local.rc` and set the required variables. + +### Running the tests + +```bash +source envfile.rc +mkdir reports +robot -d reports -i testsuite/ ``` -### From an environment identical to OSM CICD +## How to run tests from an environment identical to OSM CICD ```bash git clone https://osm.etsi.org/gerrit/osm/devops @@ -121,9 +141,7 @@ docker run --rm=true -t osmtests --env-file \ ## Test tags -All tests in the testsuites have tags. Tags allow to run only a set of tests -identified by a tag. Several tags can be specified when running robot in the -following way: +All tests in the testsuites have tags. Tags allow to run only a set of tests identified by a tag. Several tags can be specified when running robot in the following way: ```bash robot -i -i testsuite/ diff --git a/requirements-dev.in b/requirements-dev.in index ee8b383..a1c82ff 100644 --- a/requirements-dev.in +++ b/requirements-dev.in @@ -13,8 +13,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -git+https://osm.etsi.org/gerrit/osm/IM.git@paas#egg=osm-im --r https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=paas - -git+https://osm.etsi.org/gerrit/osm/osmclient.git@paas#egg=osm-osmclient +git+https://osm.etsi.org/gerrit/osm/osmclient.git@paas#egg=osmclient -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas diff --git a/requirements-dev.txt b/requirements-dev.txt index f7d2a8d..4d6c19f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -14,10 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. ####################################################################################### -bitarray==2.6.2 - # via - # -r https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=paas - # pyangbind certifi==2023.5.7 # via # -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas @@ -28,57 +24,30 @@ charset-normalizer==3.1.0 # requests click==8.1.3 # via -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas -enum34==1.1.10 - # via - # -r https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=paas - # pyangbind idna==3.4 # via # -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas # requests jinja2==3.1.2 # via -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas -lxml==4.9.2 - # via - # -r https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=paas - # pyang - # pyangbind markupsafe==2.1.2 # via # -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas # jinja2 -osm-im @ git+https://osm.etsi.org/gerrit/osm/IM.git@paas - # via -r requirements-dev.in osmclient @ git+https://osm.etsi.org/gerrit/osm/osmclient.git@paas # via -r requirements-dev.in packaging==23.1 # via -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas prettytable==3.7.0 # via -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas -pyang==2.5.3 - # via - # -r https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=paas - # pyangbind -pyangbind==0.8.1 - # via -r https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=paas pycurl==7.45.2 # via -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas python-magic==0.4.27 # via -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas pyyaml==5.4.1 - # via - # -r https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=paas - # -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas -regex==2022.10.31 - # via - # -r https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=paas - # pyangbind + # via -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas requests==2.30.0 # via -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas -six==1.16.0 - # via - # -r https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=paas - # pyangbind urllib3==2.0.2 # via # -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas diff --git a/requirements.txt b/requirements.txt index 214e306..4dba31e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -332,9 +332,7 @@ secretstorage==3.3.3 selenium==4.9.1 # via robotframework-seleniumlibrary simplejson==3.19.1 - # via - # osc-lib - # python-cinderclient + # via osc-lib six==1.16.0 # via # blessings diff --git a/robot-systest/lib/openstack_lib.robot b/robot-systest/lib/openstack_lib.robot index 80bc22b..bdf49aa 100644 --- a/robot-systest/lib/openstack_lib.robot +++ b/robot-systest/lib/openstack_lib.robot @@ -147,6 +147,17 @@ Delete Volume [Return] ${stdout} +Get Subnet + [Documentation] Get subnet information in JSON format + [Arguments] ${subnet_id} + + Should Not Be Empty ${subnet_id} + ${rc} ${stdout}= Run and Return RC and Output openstack subnet show ${subnet_id} -f json + Log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + Stop Server [Documentation] Stop a server [Arguments] ${server_id} @@ -180,3 +191,23 @@ Delete Server [Return] ${stdout} +Create Flavor + [Documentation] Create a Flavor + [Arguments] ${flavor_name} ${cpu}=1 ${ram}=1024 ${disk}=10 + + Should Not Be Empty ${flavor_name} + ${rc} ${flavor_id}= Run and Return RC and Output openstack flavor create ${flavor_name} --ram ${ram} --disk ${disk} --vcpus ${cpu} -f yaml | yq '.id' | tr -d \\" + Log ${flavor_id} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${flavor_id} + + +Delete Flavor + [Documentation] Delete a Flavor + [Arguments] ${flavor_id} + + Should Not Be Empty ${flavor_id} + ${rc} ${stdout}= Run and Return RC and Output openstack flavor delete ${flavor_id} + Log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} diff --git a/robot-systest/run_test.sh b/robot-systest/run_test.sh index 01792dd..d4d5e97 100755 --- a/robot-systest/run_test.sh +++ b/robot-systest/run_test.sh @@ -227,17 +227,10 @@ if [ "$RUN_CONFORMANCE_TESTS" = true ] ; then python3 ${ROBOT_DEVOPS_FOLDER}/conformance-tests/run_conformance_tests.py fi -if [[ -z "${TEST}" ]]; then - printf "Test not provided. \nRunning default test: sanity\n" - TEST="sanity" -fi - if [[ -n "${TEST}" ]]; then robot -d ${ROBOT_DEVOPS_FOLDER}/reports -i ${TEST} ${ROBOT_DEVOPS_FOLDER}/testsuite/ - exit 0 else - echo "Wrong test provided" - exit 1 + echo "No test was provided. Exiting..." fi -exit 1 +exit 0 diff --git a/robot-systest/testsuite/basic_29-vnf_ipv6_profile.robot b/robot-systest/testsuite/basic_29-vnf_ipv6_profile.robot new file mode 100644 index 0000000..d47e12a --- /dev/null +++ b/robot-systest/testsuite/basic_29-vnf_ipv6_profile.robot @@ -0,0 +1,130 @@ +# 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. + +*** Settings *** +Documentation [BASIC-29] NS with a single VNF and two VDU linked by a VLD with ipv6-profile. + +Library OperatingSystem +Library String +Library Collections +Library SSHLibrary +Library JSONLibrary + +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot + +Force Tags basic_29 cluster_main daily + +Suite Teardown Run Keyword And Ignore Error Suite Cleanup + + +*** Variables *** +# NS and VNF descriptor package folder and ids +${vnfd_pkg} ipv6profile_2vm_vnf +${vnfd_name} ipv6profile_2vm-vnf +${nsd_pkg} ipv6profile_2vm_ns +${nsd_name} ipv6profile_2vm-ns + +# NS instance name and configuration +${ns_name} basic_29 +${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } + +# SSH keys and username to be used +${publickey} %{HOME}/.ssh/id_rsa.pub +${username} ubuntu + +# VNFs data +${vnf_member_index_1} vnf +${internal_prefix} ^2001:db8::* + +${success_return_code} 0 + + +*** Test Cases *** +Create VNF Descriptor + + Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + + +Create NS Descriptor + + Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + + +Instantiate Network Service + + ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} + Set Suite Variable ${ns_id} ${id} + + +Get Vnf Info + + Variable Should Exist ${ns_id} msg=Network service instance is not available + @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} + Log List ${vnfr_list} + Set Suite Variable ${vnf_id} ${vnfr_list}[0] + ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} + Set Suite Variable ${vnf_ipmgmt} ${ip} + Log ${vnf_ipmgmt} + + +Check Vnf IPs + + Variable Should Exist ${vnf_id} msg=VNF is not available + ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[0].interfaces[] | select(."vnf-vld-id" == "internal")' | yq '."ip-address"' | tr -d \\" + Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + Should Match Regexp ${stdout} ${internal_prefix} msg=${stdout} doesn't match subnet's regexp ${internal_prefix} + ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[1].interfaces[] | select(."vnf-vld-id" == "internal")' | yq '."ip-address"' | tr -d \\" + Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + Should Match Regexp ${stdout} ${internal_prefix} msg=${stdout} doesn't match subnet's regexp ${internal_prefix} + +Check that ipv6 address_mode and ra_mode are set + + ${rc} ${vim_info}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(."count-index" == 0)' | yq '.vim_info[].interfaces[].vim_info' | tr -d \\" + ${subnet_id}= Get Regexp Matches ${vim_info} {ip_address: '2001:db8::.*', subnet_id: ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})} 1 + ${subnet_info}= Get Subnet ${subnet_id}[0] + ${json_object}= Convert String to JSON ${subnet_info} + ${address_mode}= Get From Dictionary ${json_object} ipv6_address_mode + ${ra_mode}= Get From Dictionary ${json_object} ipv6_ra_mode + Should Be Equal ${address_mode} dhcpv6-stateful msg=ipv6_address_mode does not equals to dhcpv6-stateful + Should Be Equal ${ra_mode} dhcpv6-stateful msg=ipv6_ra_mode does not equals to dhcpv6-stateful + + +Delete NS Instance + [Tags] cleanup + + Delete NS ${ns_name} + + +Delete NS Descriptor + [Tags] cleanup + + Delete NSD ${nsd_name} + + +Delete VNF Descriptor + [Tags] cleanup + + Delete VNFD ${vnfd_name} + + +*** Keywords *** +Suite Cleanup + [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance + + Run Keyword If Any Tests Failed Delete NS ${ns_name} + Run Keyword If Any Tests Failed Delete NSD ${nsd_name} + Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} diff --git a/robot-systest/testsuite/basic_30-ns_ipv6_profile.robot b/robot-systest/testsuite/basic_30-ns_ipv6_profile.robot new file mode 100644 index 0000000..ee60b39 --- /dev/null +++ b/robot-systest/testsuite/basic_30-ns_ipv6_profile.robot @@ -0,0 +1,166 @@ +# 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. + +*** Settings *** +Documentation [BASIC-30] NS with a single VNF and two VDU linked by a VLD with ipv6-profile. + +Library OperatingSystem +Library String +Library Collections +Library SSHLibrary +Library JSONLibrary + +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot + +Force Tags basic_30 cluster_main daily + +Suite Teardown Run Keyword And Ignore Error Suite Cleanup + + +*** Variables *** +# NS and VNF descriptor package folder and ids +${vnfd_pkg} ubuntu_4ifaces_vnf +${vnfd_name} ubuntu_4ifaces-vnf +${nsd_pkg} ubuntu_4ifaces_ipv6_ns +${nsd_name} ubuntu_4ifaces-ipv6-ns + +# NS instance name and configuration +${ns_name} basic_30 +${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } + +# SSH keys and username to be used +${publickey} %{HOME}/.ssh/id_rsa.pub +${privatekey} %{HOME}/.ssh/id_rsa +${username} ubuntu + +# VNFs data +${vnf_member_index_1} vnf1 +${vnf_member_index_2} vnf2 +${iface1_name} eth1 +${datanet1_prefix} ^2001:db8::* + +${success_return_code} 0 + + +*** Test Cases *** +Create VNF Descriptor + + Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + + +Create NS Descriptor + + Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + + +Instantiate Network Service + + ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} + Set Suite Variable ${ns_id} ${id} + + +Get Vnfs Info + + Variable Should Exist ${ns_id} msg=Network service instance is not available + @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} + Log List ${vnfr_list} + Set Suite Variable ${vnf_id1} ${vnfr_list}[0] + Set Suite Variable ${vnf_id2} ${vnfr_list}[1] + ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} + Set Suite Variable ${vnf1_ipmgmt} ${ip} + Log ${vnf1_ipmgmt} + ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} + Set Suite Variable ${vnf2_ipmgmt} ${ip} + Log ${vnf2_ipmgmt} + + +Check Vnf1 IPs + + Variable Should Exist ${vnf_id1} msg=VNF1 is not available + ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface1_name}")' | yq '."ip-address"' | tr -d \\" + Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + Should Match Regexp ${stdout} ${datanet1_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet1_prefix} + Set Suite Variable ${vnf1_ip1} ${stdout} + + +Check Vnf2 IPs + + Variable Should Exist ${vnf_id2} msg=VNF2 is not available + ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface1_name}")' | yq '."ip-address"' | tr -d \\" + Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + Should Match Regexp ${stdout} ${datanet1_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet1_prefix} + Set Suite Variable ${vnf2_ip1} ${stdout} + + +Verify Vnf1 Interfaces + + Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_1}' is not available + Variable Should Exist ${privatekey} msg=SSH private key not available + Sleep 120 seconds Wait for SSH daemon to be up + ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} sudo dhclient -6 ens4 ; ip --brief addr show up | grep -v "^lo" | awk '{print $3}' + Log ${stdout} + @{ip} = Split String ${stdout} + Should Match Regexp ${ip}[1] ${datanet1_prefix} msg=${ip}[1] doesn't match subnet's regexp ${datanet1_prefix} + + +Verify Vnf2 Interfaces + + Variable Should Exist ${vnf2_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_2}' is not available + Variable Should Exist ${privatekey} msg=SSH private key not available + ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} sudo dhclient -6 ens4 ; ip --brief addr show up | grep -v "^lo" | awk '{print $3}' + Log ${stdout} + @{ip} = Split String ${stdout} + Should Match Regexp ${ip}[1] ${datanet1_prefix} msg=${ip}[1] doesn't match subnet's regexp ${datanet1_prefix} + + +Check that ipv6 address_mode and ra_mode are set + + ${rc} ${vim_info}= Run and Return RC and Output osm vnf-show ${vnf_id1} --literal | yq '.vdur[] | select(."count-index" == 0)' | yq '.vim_info[].interfaces[].vim_info' | tr -d \\" + ${subnet_id}= Get Regexp Matches ${vim_info} {ip_address: '2001:db8::.*', subnet_id: ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})} 1 + ${subnet_info}= Get Subnet ${subnet_id}[0] + ${json_object}= Convert String to JSON ${subnet_info} + ${address_mode}= Get From Dictionary ${json_object} ipv6_address_mode + ${ra_mode}= Get From Dictionary ${json_object} ipv6_ra_mode + Should Be Equal ${address_mode} dhcpv6-stateful msg=ipv6_address_mode does not equal dhcpv6-stateful + Should Be Equal ${ra_mode} dhcpv6-stateful msg=ipv6_ra_mode does not equal dhcpv6-stateful + + +Delete NS Instance + [Tags] cleanup + + Delete NS ${ns_name} + + +Delete NS Descriptor + [Tags] cleanup + + Delete NSD ${nsd_name} + + +Delete VNF Descriptor + [Tags] cleanup + + Delete VNFD ${vnfd_name} + + +*** Keywords *** +Suite Cleanup + [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance + + Run Keyword If Any Tests Failed Delete NS ${ns_name} + Run Keyword If Any Tests Failed Delete NSD ${nsd_name} + Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} diff --git a/robot-systest/testsuite/basic_31-multivdu_volume_multiattach.robot b/robot-systest/testsuite/basic_31-multivdu_volume_multiattach.robot new file mode 100644 index 0000000..f8fe60f --- /dev/null +++ b/robot-systest/testsuite/basic_31-multivdu_volume_multiattach.robot @@ -0,0 +1,125 @@ +# 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. + +*** Settings *** +Documentation [BASIC-31] Basic NS with two multi-VDU VNF + +Library OperatingSystem +Library String +Library Collections +Library Process +Library SSHLibrary + +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot + +Force Tags basic_31 cluster_main daily + +Suite Teardown Run Keyword And Ignore Error Suite Cleanup + + +*** Variables *** +# NS and VNF descriptor package folder and ids +${vnfd_pkg} multivdu_multiattach_vnf +${vnfd_name} multivdu_multiattach-vnf +${nsd_pkg} multivdu_multiattach_ns +${nsd_name} multivdu_multiattach-ns + +# NS instance name and configuration +${ns_name} multivdu_multiattach +${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } + +# SSH keys and username to be used +${publickey} %{HOME}/.ssh/id_rsa.pub +${privatekey} %{HOME}/.ssh/id_rsa +${username} ubuntu +${password} ${EMPTY} + +${ns_id} ${EMPTY} +${vnf_member_index} vnf +${vnf_ip_addr} ${EMPTY} +${wait_guard_for_vm_boot} 50s + + +*** Test Cases *** +Create Hackfest multivdu VNF Descriptor + + Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + + +Create Hackfest Multivdu NS Descriptor + + Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + + +Network Service Instance Test + + ${status} ${message}= Run Keyword And Ignore Error Variable Should Exist ${publickey} + Run Keyword If "${status}" == "FAIL" Set Global Variable ${publickey} ${EMPTY} + ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} + Set Suite Variable ${ns_id} ${id} + Sleep ${wait_guard_for_vm_boot} Waiting for VM's daemons to be up and running + + +Get Vnf ID + + ${_vnf_id}= Get Vnf Id ${ns_id} ${vnf_member_index} + Set Suite Variable ${vnf_id} ${_vnf_id} + + +Get Vnf Management Ip Addresses + + ${rc} ${vdu0_ip}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[0].interfaces[]."ip-address"' | tr -d \\" + ${rc} ${vdu1_ip}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[1].interfaces[]."ip-address"' | tr -d \\" + Set Suite Variable ${mgmnt_ip_addr_0} ${vdu0_ip} + Set Suite Variable ${mgmnt_ip_addr_1} ${vdu1_ip} + + +Ensure that VDUs can share data + + Execute Remote Command Check Rc Return Output ${mgmnt_ip_addr_0} ${username} ${EMPTY} ${privatekey} sudo mkfs.ext3 -F /dev/vdb && sudo mkdir /shared && sudo mount /dev/vdb /shared && sudo chown ubuntu /shared && echo "osmtest" > /shared/test_file + Execute Remote Command Check Rc Return Output ${mgmnt_ip_addr_1} ${username} osmpass ${privatekey} sudo mkdir /shared && sudo mount /dev/vdb /shared && cat /shared/test_file + ${stdout}= Execute Remote Command Check Rc Return Output ${mgmnt_ip_addr_0} ${username} ${EMPTY} ${privatekey} cat /shared/test_file + Log ${stdout} + Should Be Equal ${stdout} osmtest Shared data can't be read + + +Delete NS Instance Test + [Tags] cleanup + + Delete NS ${ns_name} + + +Delete NS Descriptor Test + [Tags] cleanup + + Delete NSD ${nsd_name} + + +Delete VNF Descriptor Test + [Tags] cleanup + + Delete VNFD ${vnfd_name} + + +*** Keywords *** +Suite Cleanup + [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim + + Run Keyword If Any Tests Failed Delete NS ${ns_name} + + Run Keyword If Any Tests Failed Delete NSD ${nsd_name} + + Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} diff --git a/robot-systest/testsuite/heal_02-scale_vdu_healing.robot b/robot-systest/testsuite/heal_02-scale_vdu_healing.robot index edb7a1a..edeec97 100644 --- a/robot-systest/testsuite/heal_02-scale_vdu_healing.robot +++ b/robot-systest/testsuite/heal_02-scale_vdu_healing.robot @@ -49,8 +49,8 @@ ${nsd_pkg} volumes_nativecharm_ns ${nsd_name} volumes_nativecharm-ns # NS instance name and configuration +${flavor_name} osm.heal_02 ${ns_name} heal_02 -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } ${scale_wait_time} 4min # SSH keys and username to be used @@ -75,7 +75,13 @@ Create NS Descriptor Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' +Create Test Flavor + ${id}= Create Flavor ${flavor_name} + Set Suite Variable ${flavor_id} ${id} + + Network Service Instance Test + ${ns_config}= Set Variable {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}}],vnf: [ {member-vnf-index: charm_vnf, vdu: [{ id: mgmtVM, vim-flavor-id: ${flavor_id}}]}] } ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} Set Suite Variable ${ns_id} ${id} @@ -166,6 +172,8 @@ Check VNF After Healing ${stdout}= Execute Remote Command Check Rc Return Output ${ip} ${username} ${password} ${privatekey} sudo ls ${vnf_charm_cloudinit_file} Log ${stdout} Check If remote File Exists ${ip} ${username} ${password} ${privatekey} ${vnf_charm_day1_file} + ${vim_info}= Get Vdu Attribute ${vnf_charm_id} vim_info + Should Contain ${vim_info} flavor: {id: ${flavor_id}, msg=Flavor ID is incorrect Update VIM Objects @@ -238,6 +246,10 @@ Delete Objects in VIM END +Delete flavor + Delete Flavor ${flavor_id} + + *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim @@ -247,3 +259,4 @@ Suite Cleanup Run Keyword If Any Tests Failed Delete VNFD ${vnfd_volumes_name} Run Keyword If Any Tests Failed Delete VNFD ${vnfd_charm_name} Run Keyword If Any Tests Failed Delete Objects in VIM + Run Keyword If Any Tests Failed Delete Flavor ${flavor_id} \ No newline at end of file