From: Dario Faccin Date: Wed, 24 May 2023 15:24:48 +0000 (+0200) Subject: Update from master X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F58%2F13458%2F1;p=osm%2Ftests.git Update from master Squashed commit of the following: 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: Icde649f40b72a6a358ef6686fa8840f8502b2259 Signed-off-by: Dario Faccin --- diff --git a/Dockerfile b/Dockerfile index 6411021..9206d0c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ # devops-stages/stage-build.sh # -FROM ubuntu:20.04 +FROM ubuntu:22.04 ARG APT_PROXY RUN if [ ! -z $APT_PROXY ] ; then \ @@ -33,5 +33,20 @@ RUN if [ ! -z $APT_PROXY ] ; then \ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get -y install \ debhelper \ - dh-make \ - git + dh-python \ + git \ + python3 \ + python3-all \ + python3-dev \ + python3-setuptools \ + python3-pip \ + tox + +RUN DEBIAN_FRONTEND=noninteractive apt-get -y install \ + libcurl4-openssl-dev \ + libssl-dev \ + dh-make + +ENV LC_ALL C.UTF-8 +ENV LANG C.UTF-8 + diff --git a/debian/control b/debian/control index daa9f1a..1aa80b5 100644 --- a/debian/control +++ b/debian/control @@ -18,7 +18,7 @@ Source: osm-tests Section: devel Priority: optional Maintainer: Gerardo Garcia -Build-Depends: debhelper (>=9) +Build-Depends: debhelper (>=9), debhelper-compat (=13) Standards-Version: 3.9.6 Homepage: http://osm.etsi.org diff --git a/devops-stages/stage-archive.sh b/devops-stages/stage-archive.sh index 56a1c5c..cff918d 100755 --- a/devops-stages/stage-archive.sh +++ b/devops-stages/stage-archive.sh @@ -19,8 +19,3 @@ rm -rf dists mkdir -p pool/$MDG mv deb_dist/*.deb pool/$MDG/ -mkdir -p dists/unstable/$MDG/binary-amd64/ -apt-ftparchive packages pool/$MDG > dists/unstable/$MDG/binary-amd64/Packages -gzip -9fk dists/unstable/$MDG/binary-amd64/Packages - -echo "ARCHIVE" diff --git a/devops-stages/stage-test.sh b/devops-stages/stage-test.sh index 31161ac..335f9de 100755 --- a/devops-stages/stage-test.sh +++ b/devops-stages/stage-test.sh @@ -68,6 +68,8 @@ check_spaces_eol () { exit 1 } +echo "Checking syntax of Robot tests" + echo "Checking tabs in robot files. No tabs should be present" check_tabs robot-systest/testsuite check_tabs robot-systest/lib @@ -100,6 +102,6 @@ echo "No presence of spaces at EOL in robot files. Correct!" # - Settings: 1 blank line to separate each kind of setting (all LIbrary together, all Resource together, etc.) # - Test cases: 2 blank lines between test cases, max 1 blank line inside Test case, no blank line after Test Case Keyword -echo "SUCCESS" -exit 0 +echo "Launching tox" +TOX_PARALLEL_NO_SPINNER=1 tox --parallel=auto diff --git a/requirements-dev.txt b/requirements-dev.txt index 5092a8e..f7d2a8d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -18,11 +18,11 @@ 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==2022.12.7 +certifi==2023.5.7 # via # -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas # requests -charset-normalizer==3.0.1 +charset-normalizer==3.1.0 # via # -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas # requests @@ -51,9 +51,9 @@ 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.0 +packaging==23.1 # via -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas -prettytable==3.6.0 +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 @@ -73,13 +73,13 @@ regex==2022.10.31 # via # -r https://osm.etsi.org/gitweb/?p=osm/IM.git;a=blob_plain;f=requirements.txt;hb=paas # pyangbind -requests==2.28.2 +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==1.26.14 +urllib3==2.0.2 # via # -r https://osm.etsi.org/gitweb/?p=osm/osmclient.git;a=blob_plain;f=requirements.txt;hb=paas # requests diff --git a/requirements.txt b/requirements.txt index ef6595a..214e306 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,13 +16,11 @@ ####################################################################################### appdirs==1.4.4 # via openstacksdk -argcomplete==2.0.0 +argcomplete==3.0.8 # via yq async-generator==1.10 - # via - # trio - # trio-websocket -attrs==22.2.0 + # via trio +attrs==23.1.0 # via # cmd2 # jsonschema @@ -32,13 +30,13 @@ autopage==0.5.1 # via cliff bcrypt==4.0.1 # via paramiko -bitarray==2.6.2 +bitarray==2.7.3 # via # -r requirements.in # pyangbind blessings==1.7 # via charm-tools -certifi==2022.12.7 +certifi==2023.5.7 # via # requests # selenium @@ -46,13 +44,13 @@ cffi==1.15.1 # via # cryptography # pynacl -charm-tools==3.0.4 +charm-tools==3.0.6 # via -r requirements.in -charset-normalizer==3.0.1 +charset-normalizer==3.1.0 # via requests cheetah3==3.2.6.post1 # via charm-tools -cliff==4.1.0 +cliff==4.3.0 # via # osc-lib # python-openstackclient @@ -60,7 +58,7 @@ cmd2==2.4.3 # via cliff colander==1.8.3 # via charm-tools -cryptography==39.0.1 +cryptography==40.0.2 # via # openstacksdk # paramiko @@ -80,13 +78,15 @@ dict2colander==0.2 # via charm-tools distlib==0.3.6 # via virtualenv -dogpile-cache==1.1.8 +dogpile-cache==1.2.0 # via openstacksdk enum34==1.1.10 # via pyangbind -exceptiongroup==1.1.0 - # via trio -filelock==3.9.0 +exceptiongroup==1.1.1 + # via + # trio + # trio-websocket +filelock==3.12.0 # via virtualenv h11==0.14.0 # via wsproto @@ -96,14 +96,10 @@ idna==3.4 # via # requests # trio -importlib-metadata==6.0.0 +importlib-metadata==6.6.0 # via # cliff # keyring -importlib-resources==5.10.2 - # via - # jsonschema - # keyring iso8601==1.1.0 # via # colander @@ -139,7 +135,7 @@ jujubundlelib==0.5.7 # via charm-tools keyring==23.13.1 # via charm-tools -keystoneauth1==5.1.1 +keystoneauth1==5.1.2 # via # openstacksdk # osc-lib @@ -150,9 +146,9 @@ lxml==4.9.2 # via # pyang # pyangbind -more-itertools==9.0.0 +more-itertools==9.1.0 # via jaraco-classes -msgpack==1.0.4 +msgpack==1.0.5 # via oslo-serialization netaddr==0.8.0 # via @@ -164,7 +160,7 @@ netifaces==0.11.0 # oslo-utils objectpath==0.6.1 # via robotframework-jsonvalidator -openstacksdk==1.0.0 +openstacksdk==1.1.0 # via # osc-lib # python-openstackclient @@ -172,11 +168,11 @@ os-service-types==1.7.0 # via # keystoneauth1 # openstacksdk -osc-lib==2.6.2 +osc-lib==2.8.0 # via python-openstackclient -oslo-config==9.1.0 +oslo-config==9.1.1 # via python-keystoneclient -oslo-i18n==5.1.0 +oslo-i18n==6.0.0 # via # osc-lib # oslo-config @@ -185,7 +181,7 @@ oslo-i18n==5.1.0 # python-keystoneclient # python-novaclient # python-openstackclient -oslo-serialization==5.0.0 +oslo-serialization==5.1.1 # via # python-keystoneclient # python-novaclient @@ -201,11 +197,11 @@ otherstuf==1.1.0 # via charm-tools outcome==1.2.0 # via trio -packaging==23.0 +packaging==23.1 # via # oslo-utils # python-keystoneclient -paramiko==3.0.0 +paramiko==3.1.0 # via # robotframework-sshlibrary # scp @@ -231,15 +227,13 @@ pbr==5.11.1 # python-novaclient # python-openstackclient # stevedore -pkgutil-resolve-name==1.3.10 - # via jsonschema -platformdirs==3.0.0 +platformdirs==3.5.0 # via virtualenv ply==3.11 # via # jsonpath-ng # jsonpath-rw -prettytable==3.6.0 +prettytable==3.7.0 # via # cliff # python-cinderclient @@ -262,15 +256,15 @@ pyrsistent==0.19.3 # via jsonschema pysocks==1.7.1 # via urllib3 -python-cinderclient==9.2.0 +python-cinderclient==9.3.0 # via python-openstackclient -python-keystoneclient==5.0.1 +python-keystoneclient==5.1.0 # via python-openstackclient -python-novaclient==18.2.0 +python-novaclient==18.3.0 # via python-openstackclient -python-openstackclient==6.0.0 +python-openstackclient==6.2.0 # via -r requirements.in -pytz==2022.7.1 +pytz==2023.3 # via # oslo-serialization # oslo-utils @@ -284,11 +278,11 @@ pyyaml==5.4.1 # oslo-config # robotframework-yamllibrary # yq -regex==2022.10.31 +regex==2023.5.5 # via # -r requirements.in # pyangbind -requests==2.28.2 +requests==2.30.0 # via # -r requirements.in # charm-tools @@ -315,17 +309,17 @@ robotframework-jsonlibrary==0.5 # via -r requirements.in robotframework-jsonvalidator==2.0.0 # via -r requirements.in -robotframework-pythonlibcore==4.1.0 +robotframework-pythonlibcore==4.1.2 # via robotframework-seleniumlibrary robotframework-requests==0.9.4 # via -r requirements.in -robotframework-seleniumlibrary==6.0.0 +robotframework-seleniumlibrary==6.1.0 # via -r requirements.in robotframework-sshlibrary==3.8.0 # via -r requirements.in robotframework-yamllibrary==0.2.8 # via -r requirements.in -ruamel-yaml==0.17.21 +ruamel-yaml==0.17.26 # via charm-tools ruamel-yaml-clib==0.2.7 # via ruamel-yaml @@ -335,9 +329,9 @@ secretstorage==3.3.3 # via # charm-tools # keyring -selenium==4.8.0 +selenium==4.9.1 # via robotframework-seleniumlibrary -simplejson==3.18.3 +simplejson==3.19.1 # via # osc-lib # python-cinderclient @@ -353,7 +347,7 @@ sniffio==1.3.0 # via trio sortedcontainers==2.4.0 # via trio -stevedore==4.1.1 +stevedore==5.0.0 # via # cliff # dogpile-cache @@ -366,7 +360,7 @@ stevedore==4.1.1 # python-openstackclient stuf==0.9.16 # via otherstuf -toml==0.10.2 +tomlkit==0.11.8 # via yq translationstring==1.4 # via colander @@ -374,13 +368,13 @@ trio==0.22.0 # via # selenium # trio-websocket -trio-websocket==0.9.2 +trio-websocket==0.10.2 # via selenium types-docutils==0.19.1.3 # via types-setuptools -types-setuptools==67.2.0.1 +types-setuptools==67.7.0.2 # via requirements-parser -urllib3[socks]==1.26.14 +urllib3[socks]==2.0.2 # via # requests # selenium @@ -388,21 +382,21 @@ verboselogs==1.7 # via -r requirements.in vergit==1.0.2 # via charm-tools -virtualenv==20.19.0 +virtualenv==20.23.0 # via charm-tools wcwidth==0.2.6 # via # cmd2 # prettytable -wrapt==1.14.1 +wrapt==1.15.0 # via debtcollector wsproto==1.2.0 # via trio-websocket xmltodict==0.13.0 # via yq -yq==3.1.0 +yq==3.2.2 # via -r requirements.in -zipp==3.13.0 +zipp==3.15.0 # via # importlib-metadata # importlib-resources diff --git a/robot-systest/lib/ns_lib.robot b/robot-systest/lib/ns_lib.robot index e67636c..36ecd57 100644 --- a/robot-systest/lib/ns_lib.robot +++ b/robot-systest/lib/ns_lib.robot @@ -97,6 +97,13 @@ Get Ns Id [Return] ${stdout} +Get Ns List + ${rc} ${stdout}= Run and Return RC and Output osm ns-list 2>&1 + Log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + Get Ns Vnf List [Arguments] ${ns_id} diff --git a/robot-systest/lib/openstack_lib.robot b/robot-systest/lib/openstack_lib.robot index 1f1020d..80bc22b 100644 --- a/robot-systest/lib/openstack_lib.robot +++ b/robot-systest/lib/openstack_lib.robot @@ -64,7 +64,7 @@ Get Project Quota [Arguments] ${field} Should Not Be Empty ${field} - ${rc} ${stdout}= Run and Return RC and Output openstack quota show -c ${field} -f value + ${rc} ${stdout}= Run and Return RC and Output openstack quota show -f yaml | yq '.[] | select(.Resource=="${field}") | .Limit' Log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} [Return] ${stdout} diff --git a/robot-systest/lib/renderTemplate.py b/robot-systest/lib/renderTemplate.py index d472eaa..2c7bb39 100644 --- a/robot-systest/lib/renderTemplate.py +++ b/robot-systest/lib/renderTemplate.py @@ -14,8 +14,8 @@ from jinja2 import Template -class renderTemplate(): +class renderTemplate: def render_template(self, template_file, config_file, **kwargs): """Renders a template with the values provided diff --git a/robot-systest/lib/sol003_common_lib.robot b/robot-systest/lib/sol003_common_lib.robot index 7262161..d233498 100644 --- a/robot-systest/lib/sol003_common_lib.robot +++ b/robot-systest/lib/sol003_common_lib.robot @@ -35,7 +35,7 @@ ${vnf_instance_lcm_ops} /osm/vnflcm/v1/vnf_lcm_op_occs Get Auth Token [Tags] auth_token Get Hostname - Create Session osmhit ${HOST} + Create Session osmhit ${HOST} disable_warnings=1 &{headers} Create Dictionary Content-Type=application/json Accept=application/json &{data} Create Dictionary username=${osm_user} password=${osm_password} project-id=${osm_project} ${resp}= Post On Session osmhit ${auth_token_uri} json=${data} headers=${headers} @@ -89,7 +89,7 @@ Update Json Value [Arguments] ${JsonInput} ${key} ${json_path}= Read Directory ${json_obj}= Load JSON From File ${json_path}/${JsonInput} - ${updated_json_obj} JSONLibrary.Update Value To Json ${json_obj} $..${key} ${created_vim_account_id} + ${updated_json_obj}= JSONLibrary.Update Value To Json ${json_obj} $..${key} ${created_vim_account_id} Set Suite Variable ${updated_json_obj} Get Api Request diff --git a/robot-systest/lib/vnf_lib.robot b/robot-systest/lib/vnf_lib.robot index 78f971d..b3d4aa7 100644 --- a/robot-systest/lib/vnf_lib.robot +++ b/robot-systest/lib/vnf_lib.robot @@ -15,6 +15,13 @@ ${success_return_code} 0 *** Keywords *** +Get Vnf List + ${rc} ${stdout}= Run and Return RC and Output osm vnf-list 2>&1 + Log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + Get VNF VIM ID [Arguments] ${vnf_id} diff --git a/robot-systest/resources/__init__.py b/robot-systest/resources/__init__.py index d10c534..04f7d49 100644 --- a/robot-systest/resources/__init__.py +++ b/robot-systest/resources/__init__.py @@ -14,4 +14,3 @@ # See the License for the specific language governing permissions and # limitations under the License. ####################################################################################### - diff --git a/robot-systest/resources/basic_01-crud_operations_on_vim_targets_data.py b/robot-systest/resources/basic_01-crud_operations_on_vim_targets_data.py index c56d51a..101f3d5 100644 --- a/robot-systest/resources/basic_01-crud_operations_on_vim_targets_data.py +++ b/robot-systest/resources/basic_01-crud_operations_on_vim_targets_data.py @@ -45,19 +45,19 @@ if cloud_type == "openstack": raise Exception("Openstack clouds file not found") with clouds_file_path.open() as clouds_file: clouds = yaml.safe_load(clouds_file) - if not os_cloud in clouds["clouds"]: + if os_cloud not in clouds["clouds"]: raise Exception("Openstack cloud '" + os_cloud + "' not found") cloud = clouds["clouds"][os_cloud] - if not "username" in cloud["auth"]: + if "username" not in cloud["auth"]: raise Exception("Username not found in Openstack cloud '" + os_cloud + "'") vim_user = cloud["auth"]["username"] - if not "password" in cloud["auth"]: + if "password" not in cloud["auth"]: raise Exception("Password not found in Openstack cloud '" + os_cloud + "'") vim_password = cloud["auth"]["password"] - if not "auth_url" in cloud["auth"]: + if "auth_url" not in cloud["auth"]: raise Exception("Auth url not found in Openstack cloud '" + os_cloud + "'") vim_auth_url = cloud["auth"]["auth_url"] - if not "project_name" in cloud["auth"]: + if "project_name" not in cloud["auth"]: raise Exception( "Project name not found in Openstack cloud '" + os_cloud + "'" ) diff --git a/robot-systest/resources/basic_08-disable_port_security_network_level_data.py b/robot-systest/resources/basic_08-disable_port_security_network_level_data.py index 62cb9c3..b35ed87 100644 --- a/robot-systest/resources/basic_08-disable_port_security_network_level_data.py +++ b/robot-systest/resources/basic_08-disable_port_security_network_level_data.py @@ -44,19 +44,19 @@ if not clouds_file_path.exists(): raise Exception("Openstack clouds file not found") with clouds_file_path.open() as clouds_file: clouds = yaml.safe_load(clouds_file) - if not os_cloud in clouds["clouds"]: + if os_cloud not in clouds["clouds"]: raise Exception("Openstack cloud '" + os_cloud + "' not found") cloud = clouds["clouds"][os_cloud] - if not "username" in cloud["auth"]: + if "username" not in cloud["auth"]: raise Exception("Username not found in Openstack cloud '" + os_cloud + "'") vim_user = cloud["auth"]["username"] - if not "password" in cloud["auth"]: + if "password" not in cloud["auth"]: raise Exception("Password not found in Openstack cloud '" + os_cloud + "'") vim_password = cloud["auth"]["password"] - if not "auth_url" in cloud["auth"]: + if "auth_url" not in cloud["auth"]: raise Exception("Auth url not found in Openstack cloud '" + os_cloud + "'") vim_auth_url = cloud["auth"]["auth_url"] - if not "project_name" in cloud["auth"]: + if "project_name" not in cloud["auth"]: raise Exception("Project name not found in Openstack cloud '" + os_cloud + "'") vim_tenant = cloud["auth"]["project_name"] vim_user_domain_name = ( diff --git a/robot-systest/resources/epa_03-crud_operations_on_sdnc_data.py b/robot-systest/resources/epa_03-crud_operations_on_sdnc_data.py index 3267dd2..c11054a 100644 --- a/robot-systest/resources/epa_03-crud_operations_on_sdnc_data.py +++ b/robot-systest/resources/epa_03-crud_operations_on_sdnc_data.py @@ -11,9 +11,6 @@ # limitations under the License. import os -from pathlib import Path - -import yaml from common_helpers import get_prometheus_info diff --git a/robot-systest/resources/sa_01-vnf_with_vim_metrics_data.py b/robot-systest/resources/sa_01-vnf_with_vim_metrics_data.py index 27f448f..a7a3456 100644 --- a/robot-systest/resources/sa_01-vnf_with_vim_metrics_data.py +++ b/robot-systest/resources/sa_01-vnf_with_vim_metrics_data.py @@ -10,8 +10,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from pathlib import Path - from common_helpers import get_prometheus_info diff --git a/robot-systest/resources/sa_02-vnf_with_vim_metrics_and_autoscaling_data.py b/robot-systest/resources/sa_02-vnf_with_vim_metrics_and_autoscaling_data.py index 27f448f..a7a3456 100644 --- a/robot-systest/resources/sa_02-vnf_with_vim_metrics_and_autoscaling_data.py +++ b/robot-systest/resources/sa_02-vnf_with_vim_metrics_and_autoscaling_data.py @@ -10,8 +10,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from pathlib import Path - from common_helpers import get_prometheus_info diff --git a/robot-systest/resources/sa_07-alarms_from_sa-related_vnfs_data.py b/robot-systest/resources/sa_07-alarms_from_sa-related_vnfs_data.py index 27f448f..a7a3456 100644 --- a/robot-systest/resources/sa_07-alarms_from_sa-related_vnfs_data.py +++ b/robot-systest/resources/sa_07-alarms_from_sa-related_vnfs_data.py @@ -10,8 +10,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from pathlib import Path - from common_helpers import get_prometheus_info diff --git a/robot-systest/resources/sa_08-vnf_with_vnf_indicators_snmp_data.py b/robot-systest/resources/sa_08-vnf_with_vnf_indicators_snmp_data.py index 27f448f..a7a3456 100644 --- a/robot-systest/resources/sa_08-vnf_with_vnf_indicators_snmp_data.py +++ b/robot-systest/resources/sa_08-vnf_with_vnf_indicators_snmp_data.py @@ -10,8 +10,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from pathlib import Path - from common_helpers import get_prometheus_info diff --git a/robot-systest/resources/sol003_01-vnf-lifecycle-management.json b/robot-systest/resources/sol003_01-vnf-lifecycle-management.json index 267dd03..70bfbe1 100644 --- a/robot-systest/resources/sol003_01-vnf-lifecycle-management.json +++ b/robot-systest/resources/sol003_01-vnf-lifecycle-management.json @@ -1,38 +1,38 @@ -{ - "data":[ - { - "vnfdId":"hackfest_basic_metrics-vnf", - "vnfInstanceName":"sol003-instance", - "vnfInstanceDescription":"Test vnfm instance description", - "vimAccountId":"8dc2f11d-e08a-4ec7-920c-6b8a88bff1e5", - "additionalParams":{ - "virtual-link-desc":[ - { - "id":"mgmtnet", - "mgmt-network":true - } - ], - "constituent-cpd-id":"vnf-cp0-ext", - "virtual-link-profile-id":"mgmtnet" - } - }, - { - "vnfName":"sol003-instance", - "vnfDescription":"vnf package", - "vnfId":"70b47595-fafa-4f63-904b-fc3ada60eebb", - "vimAccountId":"8dc2f11d-e08a-4ec7-920c-6b8a88bff1e5" - }, - { - "type":"SCALE_OUT", - "aspectId":"vdu_autoscale", - "numberOfSteps":"1", - "additionalParams":{ - "member-vnf-index":"1" - } - }, - { - "terminationType":"GRACEFUL", - "gracefulTerminationTimeout":"5" - } - ] -} +{ + "data":[ + { + "vnfdId":"hackfest_basic_metrics-vnf", + "vnfInstanceName":"sol003-instance", + "vnfInstanceDescription":"Test vnfm instance description", + "vimAccountId":"8dc2f11d-e08a-4ec7-920c-6b8a88bff1e5", + "additionalParams":{ + "virtual-link-desc":[ + { + "id":"mgmtnet", + "mgmt-network":true + } + ], + "constituent-cpd-id":"vnf-cp0-ext", + "virtual-link-profile-id":"mgmtnet" + } + }, + { + "vnfName":"sol003-instance", + "vnfDescription":"vnf package", + "vnfId":"70b47595-fafa-4f63-904b-fc3ada60eebb", + "vimAccountId":"8dc2f11d-e08a-4ec7-920c-6b8a88bff1e5" + }, + { + "type":"SCALE_OUT", + "aspectId":"vdu_autoscale", + "numberOfSteps":"1", + "additionalParams":{ + "member-vnf-index":"1" + } + }, + { + "terminationType":"GRACEFUL", + "gracefulTerminationTimeout":"5" + } + ] +} diff --git a/robot-systest/resources/sol003_01-vnf_lifecycle_management.py b/robot-systest/resources/sol003_01-vnf_lifecycle_management.py index a722445..a411cd2 100644 --- a/robot-systest/resources/sol003_01-vnf_lifecycle_management.py +++ b/robot-systest/resources/sol003_01-vnf_lifecycle_management.py @@ -10,8 +10,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from pathlib import Path - from common_helpers import get_osm_info diff --git a/robot-systest/run_test.sh b/robot-systest/run_test.sh index 038ea03..01792dd 100755 --- a/robot-systest/run_test.sh +++ b/robot-systest/run_test.sh @@ -67,7 +67,7 @@ create_k8scluster(){ ((attempts--)) done if [ $attempts -lt 0 ] ; then - echo "VIM failed to enter ENABLED state" + echo "K8s cluster failed to enter ENABLED state" exit 1 fi } diff --git a/robot-systest/testsuite/sa_02-vnf_with_vim_metrics_and_autoscaling.robot b/robot-systest/testsuite/sa_02-vnf_with_vim_metrics_and_autoscaling.robot index d550810..3d1a3b3 100644 --- a/robot-systest/testsuite/sa_02-vnf_with_vim_metrics_and_autoscaling.robot +++ b/robot-systest/testsuite/sa_02-vnf_with_vim_metrics_and_autoscaling.robot @@ -72,7 +72,7 @@ Create VNF Descriptor Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' -Get Scale-Out Threshold From VNF +Get Thresholds From VNF ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-show ${vnfd_name} --literal | yq '.df[0]."scaling-aspect"[0]."scaling-policy"[0]."scaling-criteria"[0]."scale-out-threshold"' | tr -d \\" Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False @@ -80,6 +80,12 @@ Get Scale-Out Threshold From VNF Set Suite Variable ${metric_threshold} ${scaleout_threshold} Log ${metric_threshold} + ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-show ${vnfd_name} --literal | yq '.df[0]."scaling-aspect"[0]."scaling-policy"[0]."threshold-time"' | tr -d \\" + Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + ${threshold_time_value}= Convert To Number ${stdout} + Set Suite Variable ${threshold_time} ${threshold_time_value} + Log ${threshold_time} + Create NS Descriptor @@ -131,6 +137,17 @@ Wait VIM-based Metric To Exceed Threshold Wait Until Keyword Succeeds ${prometheus_poll_retries} ${prometheus_poll_timeout} Check VIM-based Metric Exceeds Threshold +Wait Threshold Time + + ${threshold_time_sleep}= Evaluate ${threshold_time} + 1 + Sleep ${threshold_time_sleep} minutes Wait scale-out threshold time plus 1 minute + + +Check VIM-based Metric Exceeds Threshold After Threshold-time + + Check VIM-based Metric Exceeds Threshold + + Get VDUs After Auto-scaling Sleep 2 minutes Wait for auto-scale to take place @@ -176,4 +193,3 @@ Check VIM-based Metric Exceeds Threshold ${metric_value}= Get Metric ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} ${metric_name} Run Keyword If ${metric_value} <= ${metric_threshold} Fail msg=The metric '${metric_name}' value is '${metric_value}' which is lower than '${metric_threshold}' - diff --git a/robot-systest/testsuite/sol003_01-vnf-lifecycle-management.robot b/robot-systest/testsuite/sol003_01-vnf-lifecycle-management.robot index dcae4f4..750ea84 100644 --- a/robot-systest/testsuite/sol003_01-vnf-lifecycle-management.robot +++ b/robot-systest/testsuite/sol003_01-vnf-lifecycle-management.robot @@ -23,6 +23,8 @@ Library JSONLibrary Resource %{ROBOT_DEVOPS_FOLDER}/lib/sol003_common_lib.robot Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot Resource %{ROBOT_DEVOPS_FOLDER}/lib/vim_lib.robot Force Tags sol003_01 cluster_sol003 daily @@ -38,6 +40,7 @@ ${vnfd_name} hackfest_basic_metrics-vnf *** Test Cases *** Create VNF package from JSON file descriptor [Documentation] Test case to create a VNF Identifier + Get VNFDs List ${id}= Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' Set Suite Variable ${vnfid} ${id} ${created_vim_account_id}= Get VIM Target ID %{VIM_TARGET} @@ -46,29 +49,37 @@ Create VNF package from JSON file descriptor ${json_path}= Read Directory ${json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json ${json_obj}= Get Variable Value ${json_obj['data'][0]} - ${updated_json_obj} JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} - ${updated_json_obj} JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-desc[0][id] %{VIM_MGMT_NET} - ${updated_json_obj} JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-profile-id %{VIM_MGMT_NET} + ${updated_json_obj}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} + Log ${updated_json_obj} + ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-desc[0][id] %{VIM_MGMT_NET} + Log ${updated_json_obj} + ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-profile-id %{VIM_MGMT_NET} + Log ${updated_json_obj} Set Test Variable ${updated_json_obj} Post API Request ${vnf_instance_uri} Pass Execution If ${request_response.status_code} in ${success_status_code_list} Query VNF Instance completed ${id}= Get Value From Json ${request_response.json()} $..id Set Suite Variable ${createid} ${id[0]} + Get VNFDs List Instantiate VNF [Documentation] Test case to Instantiate a VNF + Get Ns List + Get Vnf List Get Auth Token ${json_path}= Read Directory ${json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json ${json_obj}= Get Variable Value ${json_obj['data'][1]} - ${updated_json_obj} JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} - ${updated_json_obj} JSONLibrary.Update Value To Json ${json_obj} $..vnfId ${createid} + ${updated_json_obj}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} + ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..vnfId ${createid} Set Test Variable ${updated_json_obj} Post API Request ${vnf_instantiate_uri}/${createid}/instantiate Pass Execution If ${request_response.status_code} in ${success_status_code_list} Instantiate VNF Instance completed ${id}= Get Value From Json ${request_response.json()} $..id Set Suite Variable ${instantiateid} ${id[0]} Sleep 12s + Get Ns List + Get Vnf List Query VNF Instances [Documentation] Test case to query VNF Instance diff --git a/tox.ini b/tox.ini index 81860e5..729a3e0 100644 --- a/tox.ini +++ b/tox.ini @@ -23,24 +23,25 @@ toxworkdir = /tmp/.tox [testenv] usedevelop = True -basepython = python3.8 +basepython = python3.10 setenv = VIRTUAL_ENV={envdir} PYTHONDONTWRITEBYTECODE = 1 deps = -r{toxinidir}/requirements.txt +parallel_show_output = true ####################################################################################### [testenv:black] deps = black skip_install = true commands = - - black --check --diff robot-systest --fast + black --check --diff robot-systest --fast ####################################################################################### [testenv:cover] commands = sh -c 'echo No unit tests' -whitelist_externals = sh +allowlist_externals = sh ####################################################################################### @@ -56,7 +57,7 @@ deps = {[testenv]deps} -r{toxinidir}/requirements-dev.txt pylint commands = - pylint -E robot-systest/resources + - pylint -E robot-systest/resources ####################################################################################### @@ -72,15 +73,15 @@ commands = ####################################################################################### [testenv:pip-compile] -deps = pip-tools==6.6.2 +deps = pip-tools==6.13.0 skip_install = true -whitelist_externals = bash +allowlist_externals = bash [ commands = - bash -c "for file in requirements*.in ; do \ UNSAFE="" ; \ if [[ $file =~ 'dist' ]] ; then UNSAFE='--allow-unsafe' ; fi ; \ - pip-compile -rU --no-header $UNSAFE $file ;\ + pip-compile --resolver=backtracking -rU --no-header $UNSAFE $file ;\ out=`echo $file | sed 's/.in/.txt/'` ; \ sed -i -e '1 e head -16 tox.ini' $out ;\ done"