From: yadavmr Date: Thu, 30 Jan 2020 10:37:59 +0000 (+0530) Subject: Robot Test: Included Test are X-Git-Tag: release-v8.0-start~66^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;ds=inline;h=f3ec8f4cfb29ba0605f2b9263dcac169b4849593;hp=d7b6ab0f6ff6c5870d724dc1cfdc4c3d17eb1e35;p=osm%2Fdevops.git Robot Test: Included Test are Feature 1415 RBAC visibility of packeges and instances Feature 7921 MongoDb File system Feature 8047 osmclient package creation and validation Manual VNF/VDU scaling using osmclient Feature 7326 Disable port security for ns at network level Change-Id: I1e936595a4af9e6c707f22c2719438310e646b35 Signed-off-by: yadavmr --- diff --git a/descriptor-packages/nsd/no_port_security_ns/Makefile b/descriptor-packages/nsd/no_port_security_ns/Makefile new file mode 100644 index 00000000..91f87927 --- /dev/null +++ b/descriptor-packages/nsd/no_port_security_ns/Makefile @@ -0,0 +1,22 @@ +# +# Copyright 2020 Tech Mahindra Limited +# +# 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. +# +# Author: Mrityunjay Yadav , Jayant Madavi +# + +DESCRIPTORS_TOPDIR ?= ../.. +include $(DESCRIPTORS_TOPDIR)/mk/pkg.mk + +all: $(BUILD_DIR)/$(PKG_NAME) diff --git a/descriptor-packages/nsd/no_port_security_ns/src/icons/osm.png b/descriptor-packages/nsd/no_port_security_ns/src/icons/osm.png new file mode 100644 index 00000000..62012d2a Binary files /dev/null and b/descriptor-packages/nsd/no_port_security_ns/src/icons/osm.png differ diff --git a/descriptor-packages/nsd/no_port_security_ns/src/no_port_security_nsd.yaml b/descriptor-packages/nsd/no_port_security_ns/src/no_port_security_nsd.yaml new file mode 100644 index 00000000..097e6155 --- /dev/null +++ b/descriptor-packages/nsd/no_port_security_ns/src/no_port_security_nsd.yaml @@ -0,0 +1,41 @@ +## +# Copyright 2020 Tech Mahindra Limited +# +# 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. +# +# Author: Mrityunjay Yadav , Jayant Madavi +## + + +nsd:nsd-catalog: + nsd: + - id: no_port_security-ns + name: no_port_security-ns + short-name: no_port_security-ns + description: Simple NS with a single VNF and a single VL + version: '1.0' + logo: osm.png + constituent-vnfd: + - vnfd-id-ref: hackfest_basic-vnf + member-vnf-index: '1' + vld: + - id: noPortSecurity + name: noPortSecurity + short-name: noPortSecurity + type: ELAN + vnfd-connection-point-ref: + - vnfd-id-ref: hackfest_basic-vnf + member-vnf-index-ref: '1' + vnfd-connection-point-ref: vnf-cp0 diff --git a/robot-systest/lib/cli/network_slicing_lib.robot b/robot-systest/lib/cli/network_slicing_lib.robot index 8ed3e637..9a3ff370 100644 --- a/robot-systest/lib/cli/network_slicing_lib.robot +++ b/robot-systest/lib/cli/network_slicing_lib.robot @@ -36,8 +36,8 @@ Create NST [Arguments] ${nst_pkg} ${rc} ${stdout}= Run and Return RC and Output osm nst-create ${nst_pkg} - Should Be Equal As Integers ${rc} ${success_return_code} log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} [Return] ${stdout} @@ -46,8 +46,8 @@ Delete NST [Arguments] ${nst} ${rc} ${stdout}= Run and Return RC and Output osm nst-delete ${nst} - Should Be Equal As Integers ${rc} ${success_return_code} log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} [Return] ${stdout} @@ -66,8 +66,8 @@ Create Network Slice With Config [Arguments] ${nsi_name} ${nst_name} ${vim} ${config} ${rc} ${stdout}= Run and Return RC and Output osm nsi-create --nsi_name ${nsi_name} --nst_name ${nst_name} --vim_account ${vim} --config ${config} - Should Be Equal As Integers ${rc} ${success_return_code} log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} Append To List ${nsi_list} ${nsi_name} @@ -75,8 +75,8 @@ Create Network Slice Without Config [Arguments] ${nsi_name} ${nst_name} ${vim} ${rc} ${stdout}= Run and Return RC and Output osm nsi-create --nsi_name ${nsi_name} --nst_name ${nst_name} --vim_account ${vim} - Should Be Equal As Integers ${rc} ${success_return_code} log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} Append To List ${nsi_list} ${nsi_name} @@ -84,8 +84,8 @@ Check For Network Slice Instance For Failure [Arguments] ${nsi_name} ${rc} ${stdout}= Run and Return RC and Output osm nsi-list --filter name="${nsi_name}" - Should Be Equal As Integers ${rc} ${success_return_code} log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} Should Not Contain ${stdout} failed @@ -93,8 +93,8 @@ Check For Network Slice Instance To Configured [Arguments] ${nsi_name} ${rc} ${stdout}= Run and Return RC and Output osm nsi-list --filter name="${nsi_name}" - Should Be Equal As Integers ${rc} ${success_return_code} log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} Should Contain Any ${stdout} configured failed @@ -103,8 +103,8 @@ Delete Network Slice Instance [Arguments] ${nsi} ${rc} ${stdout}= Run and Return RC and Output osm nsi-delete ${nsi} - Should Be Equal As Integers ${rc} ${success_return_code} log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For NSI Instance To Be Delete ${nsi} @@ -113,6 +113,6 @@ Check For NSI Instance To Be Delete [Arguments] ${nsi} ${rc} ${stdout}= Run and Return RC and Output osm nsi-list - Should Be Equal As Integers ${rc} ${success_return_code} log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} Should Not Contain ${stdout} ${nsi} diff --git a/robot-systest/lib/cli/ns_lib.robot b/robot-systest/lib/cli/ns_lib.robot index 254bc6a7..e0eb0c2b 100644 --- a/robot-systest/lib/cli/ns_lib.robot +++ b/robot-systest/lib/cli/ns_lib.robot @@ -40,6 +40,23 @@ Get NS List Should Be Equal As Integers ${rc} ${success_return_code} +Get NS Instance ID + [Arguments] ${ns_name} + + ${rc} ${stdout}= Run and Return RC and Output osm ns-list --filter name="${ns_name}" | awk 'NR==4{print $4}' + log ${stdout} + [Return] ${stdout} + + +Verify All JUJU Applications Status + [Arguments] ${ns} ${api_ip} ${api_port} ${username} ${password} ${api_cert_path} + + ${juju_model}= Get NS Instance ID ${ns} + + Import Library robot_juju.JujuLibrary ${api_ip} ${api_port} ${juju_model} ${username} ${password} ${api_cert_path} + Assert status of applications is ${status_active} + + Launch Network Services and Return [Arguments] ${vim_name} ${ns_config}='' [Documentation] Get Configuration parameter to create Newtork service @@ -144,3 +161,33 @@ Force Delete NS log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} WAIT UNTIL KEYWORD SUCCEEDS ${ns_delete_max_wait_time} ${ns_delete_pol_time} Check For NS Instance To Be Delete ${ns} + + +Perform VNF Scale-in Operation + [Arguments] ${ns} ${vnf_member} ${scaling_group} + + ${rc} ${nsr}= Run and Return RC and Output osm ns-show ${ns} --literal + ${scaled_vnf}= Get Scaled Vnf ${nsr} + log to console Scaled VNF befor scale-in operation is ${scaled_vnf} + ${rc} ${stdout}= Run and Return RC and Output osm vnf-scale --scale-in --scaling-group ${scaling_group} ${ns} ${vnf_member} + Should Be Equal As Integers ${rc} ${success_return_code} + log ${stdout} + Sleep 1m Waiting for scale-in operation to complete + ${rc} ${nsr}= Run and Return RC and Output osm ns-show ${ns} --literal + ${scaled_vnf}= Get Scaled Vnf ${nsr} + log to console Scaled VNF after scale-in operation is ${scaled_vnf} + + +Perform VNF Scale-out Operation + [Arguments] ${ns} ${vnf_member} ${scaling_group} + + ${rc} ${nsr}= Run and Return RC and Output osm ns-show ${ns} --literal + ${scaled_vnf}= Get Scaled Vnf ${nsr} + log to console Scaled VNF befor scale-out operation is ${scaled_vnf} + ${rc} ${stdout}= Run and Return RC and Output osm vnf-scale --scale-out --scaling-group ${scaling_group} ${ns} ${vnf_member} + Should Be Equal As Integers ${rc} ${success_return_code} + log ${stdout} + Sleep 1m Waiting for scale-out operation to complete + ${rc} ${nsr}= Run and Return RC and Output osm ns-show ${ns} --literal + ${scaled_vnf}= Get Scaled Vnf ${nsr} + log to console Scaled VNF befor scale-out operation is ${scaled_vnf} diff --git a/robot-systest/lib/cli/osm_package_tools_lib.robot b/robot-systest/lib/cli/osm_package_tools_lib.robot new file mode 100644 index 00000000..c8a864c4 --- /dev/null +++ b/robot-systest/lib/cli/osm_package_tools_lib.robot @@ -0,0 +1,88 @@ +# 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. +## + +## Change log: +# 1. Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 18-Dec-2019 +## + +*** Keywords *** +Create OSM NS Package + [Arguments] ${pkg_name} + ${ns_pkg}= Catenate SEPARATOR=_ ${pkg_name} ns + ${ns_yaml}= Catenate SEPARATOR=_ ${pkg_name} nsd + ${ns_yaml}= Catenate SEPARATOR=. ${ns_yaml} yaml + ${nsd_path}= Join Path ${ns_pkg} ${ns_yaml} + ${rc} ${stdout}= Run and Return RC and Output osm package-create ns ${pkg_name} + Should Be Equal As Integers ${rc} ${success_return_code} + File Should Exist ${nsd_path} + log ${stdout} + + +Create OSM VNF Package + [Arguments] ${pkg_name} + ${vnf_pkg}= Catenate SEPARATOR=_ ${pkg_name} vnf + ${vnf_yaml}= Catenate SEPARATOR=_ ${pkg_name} vnfd + ${vnf_yaml}= Catenate SEPARATOR=. ${vnf_yaml} yaml + ${vnfd_path}= Join Path ${vnf_pkg} ${vnf_yaml} + ${rc} ${stdout}= Run and Return RC and Output osm package-create vnf ${pkg_name} + Should Be Equal As Integers ${rc} ${success_return_code} + File Should Exist ${vnfd_path} + log ${stdout} + + +Validate OSM NS Package + [Arguments] ${pkg_name} + ${ns_pkg}= Catenate SEPARATOR=_ ${pkg_name} ns + ${rc} ${stdout}= Run and Return RC and Output osm package-validate ${ns_pkg} + Should Be Equal As Integers ${rc} ${success_return_code} + Verify Package Validation Result ${ns_pkg} + log ${stdout} + + +Validate OSM VNF Package + [Arguments] ${pkg_name} + ${vnf_pkg}= Catenate SEPARATOR=_ ${pkg_name} vnf + ${rc} ${stdout}= Run and Return RC and Output osm package-validate ${vnf_pkg} + Should Be Equal As Integers ${rc} ${success_return_code} + Verify Package Validation Result ${vnf_pkg} + log ${stdout} + + +Verify Package Validation Result + [Arguments] ${pkg} + ${rc} ${stdout}= Run and Return RC and Output osm package-validate ${pkg} | awk 'NR==6{print $6}' + Should Be Equal As Integers ${rc} ${success_return_code} + Should Not Contain ${stdout} ERROR + log ${stdout} + + +Build OSM VNF Package + [Arguments] ${pkg_name} + ${vnf_pkg}= Catenate SEPARATOR=_ ${pkg_name} vnf + ${vnf_pkg_tar}= Catenate SEPARATOR=. ${vnf_pkg} tar gz + ${rc} ${stdout}= Run and Return RC and Output osm package-build ${vnf_pkg} + Should Be Equal As Integers ${rc} ${success_return_code} + File Should Exist ${vnf_pkg_tar} + log ${stdout} + + +Build OSM NS Package + [Arguments] ${pkg_name} + ${ns_pkg}= Catenate SEPARATOR=_ ${pkg_name} ns + ${ns_pkg_tar}= Catenate SEPARATOR=. ${ns_pkg} tar gz + ${rc} ${stdout}= Run and Return RC and Output osm package-build ${ns_pkg} + Should Be Equal As Integers ${rc} ${success_return_code} + File Should Exist ${ns_pkg_tar} + log ${stdout} diff --git a/robot-systest/lib/cli/vim_account_lib.robot b/robot-systest/lib/cli/vim_account_lib.robot index 8d01b39b..c3c8242f 100644 --- a/robot-systest/lib/cli/vim_account_lib.robot +++ b/robot-systest/lib/cli/vim_account_lib.robot @@ -63,8 +63,9 @@ Get Vim List Delete Vim Account [Documentation] delete vim account details + [Arguments] ${vim_name}=${vim-name} - ${rc} ${stdout}= Run and Return RC and Output osm vim-delete ${vim-name} + ${rc} ${stdout}= Run and Return RC and Output osm vim-delete ${vim_name} log ${stdout} Should Be Equal As Integers ${rc} ${success_return_code} diff --git a/robot-systest/lib/custom_lib.py b/robot-systest/lib/custom_lib.py index 4603f449..2a3d23fa 100644 --- a/robot-systest/lib/custom_lib.py +++ b/robot-systest/lib/custom_lib.py @@ -19,11 +19,18 @@ ## ## Change log: -# 1. Feature 7829: Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 06-aug-2019 : Improvement to the code, robot framework initial seed code. -## +# Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com +##Ì¥ + import random from haikunator import Haikunator +import yaml +from os.path import basename +import hashlib + +from robot.api import logger +from robot.api.deco import keyword def generate_name(): @@ -35,3 +42,26 @@ def generate_name(): def get_random_item_from_list(l): assert isinstance(l, list), "List should be provided" return random.choice(l) + + +def get_scaled_vnf(nsr): + nsr = yaml.load(nsr) + if 'scaling-group' in nsr['_admin']: + return nsr['_admin']['scaling-group'][0]['nb-scale-op'] + else: + return 0 + + +@keyword('Get File Name From Path') +def get_filename(path): + filename = basename(path) + return filename, filename.split('.')[0] + + +@keyword('Generate MD5') +def generate_md5(fpath): + hash_md5 = hashlib.md5() + with open(fpath, "rb") as f: + for chunk in iter(lambda: f.read(1024), b""): + hash_md5.update(chunk) + return hash_md5.hexdigest() diff --git a/robot-systest/resource/cli/disable_port_security_ns_data.py b/robot-systest/resource/cli/disable_port_security_ns_data.py new file mode 100644 index 00000000..e1383bd4 --- /dev/null +++ b/robot-systest/resource/cli/disable_port_security_ns_data.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +## +# Copyright 2020 Tech Mahindra Limited +# +# 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. +# Author: Mrityunjay Yadav < MY00514913@techmahindra.com >, Jayant Madavi +## + + +# VNFD Details +vnfdPckgPath = "/descriptor-packages/vnfd/hackfest_basic_vnf" +vnfdPckg = '/build/hackfest_basic_vnf.tar.gz' + +# NSD Details +nsdPckgPath = "/descriptor-packages/nsd/no_port_security_ns" +nsdPckg = '/build/no_port_security_ns.tar.gz' diff --git a/robot-systest/testsuite/cli/TS013__Feature_1415_RBAC_Visibility_Of_Packages_And_Instances.robot b/robot-systest/testsuite/cli/TS013__Feature_1415_RBAC_Visibility_Of_Packages_And_Instances.robot new file mode 100644 index 00000000..43029516 --- /dev/null +++ b/robot-systest/testsuite/cli/TS013__Feature_1415_RBAC_Visibility_Of_Packages_And_Instances.robot @@ -0,0 +1,144 @@ +## +# Copyright 2019 Tech Mahindra Limited +# +# 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. +## + +## Change log: +# 1. Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 18-Dec-2019 +## + +*** Settings *** +Documentation Test RBAC for platform - Visibility of packages and instances test +Library OperatingSystem +Library String +Library Collections +Resource ../../lib/cli/rbac_lib.robot +Resource ../../lib/cli/vnfd_lib.robot +Resource ../../lib/cli/nsd_lib.robot +Resource ../../lib/cli/ns_lib.robot +Resource ../../lib/cli/vim_account_lib.robot +Library ../../lib/custom_lib.py + +Suite Setup Prerequisite For Test +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +${success_return_code} 0 + +@{vim} +@{vnfd_ids} +${nsd_id} +@{nsd_ids} +@{ns_ids} +${vnfdPckg} hackfest_basic_vnf.tar.gz +${nsdPckg} hackfest_basic_ns.tar.gz +${vnfdftpPath} https://osm-download.etsi.org/ftp/osm-5.0-five/6th-hackfest/packages/hackfest_basic_vnf.tar.gz +${nsdftpPath} https://osm-download.etsi.org/ftp/osm-5.0-five/6th-hackfest/packages/hackfest_basic_ns.tar.gz + +# Test data for Users Operations test +${user_id} ${EMPTY} + +# Test data for Project Operations test +${project_id} ${EMPTY} + + +*** Test Cases *** +Create VIM Account For New User + [Documentation] Test to create VIM account for newly created user + [Tags] rabc rabc_vim comprehensive nbi + + Wait Until Keyword Succeeds 2x 30sec VIM Setup To Launch Network Services + + +Create VNF Descriptor For New User + [Documentation] Test to create vnfd for new user + [Tags] rabc rabc_vnfd comprehensive nbi + + ${rc} ${stdout}= Run and Return RC and Output wget -P '${CURDIR}${/}../../resource/cli/rbac/' ${vnfdftpPath} + ${vnfd_id}= Create VNFD '${CURDIR}${/}../../resource/cli/rbac${/}${vnfdPckg}' + Append To List ${vnfd_ids} ${vnfd_id} + + +Create NS Descriptor For New User + [Documentation] Test to create nsd for new user + [Tags] rabc rabc_nsd comprehensive nbi + + ${rc} ${stdout}= Run and Return RC and Output wget -P '${CURDIR}${/}../../resource/cli/rbac/' ${nsdftpPath} + ${nsd_id}= Create VNFD '${CURDIR}${/}../../resource/cli/rbac${/}${nsdPckg}' + Append To List ${nsd_ids} ${nsd_id} + + +Instanciate Network Service For New User + [Documentation] Launch network services for new user + [Tags] rabc rabc_ns comprehensive nbi + + :FOR ${vim_name} IN @{vim} + \ Launch Network Services and Return ${vim_name} + + +Delete NS Instance Test + [Tags] rabc rabc_ns comprehensive nbi + + :FOR ${ns} IN @{ns_ids} + \ Delete NS ${ns} + + +Delete NS Descriptor Test + [Tags] rabc rabc_nsd comprehensive nbi + + :FOR ${nsd} IN @{nsd_ids} + \ Delete NSD ${nsd} + + +Delete VNF Descriptor Test + [Tags] rabc rabc_vnfd comprehensive nbi + + :FOR ${vnfd_id} IN @{vnfd_ids} + \ Delete VNFD ${vnfd_id} + + +*** Keywords *** +Prerequisite For Test + ${user-name}= Generate Random String 8 [NUMBERS] + ${user-name}= Catenate SEPARATOR= user_ ${user-name} + set global variable ${user-name} + ${user-password}= Generate Random String 8 [NUMBERS] + set global variable ${user-password} + ${user_id}= Create User ${user-name} ${user-password} + + ${project-name}= Generate Random String 8 [NUMBERS] + ${project-name}= Catenate SEPARATOR= project_ ${project-name} + set global variable ${project-name} + ${project_id}= Create Project ${project-name} + + &{update_field1}= Create Dictionary --add-project-role=admin,project_user + &{update_field2}= Create Dictionary --add-project-role=${project-name},account_manager + @{update_user}= Create List ${update_field1} ${update_field2} + Update User And Verify Info ${user-name} @{update_user} + Login With User And Perform Operation ${user-name} ${user-password} ${project-name} + + +Test Cleanup + [Documentation] Test Suit Cleanup: Deliting Descriptor, instance and vim + +# :FOR ${vim_id} IN @{vim} +# \ Delete Vim Account ${vim_id} + + Logout and Login With Admin + + Delete User ${user-name} + Delete Project ${project-name} diff --git a/robot-systest/testsuite/cli/TS014__Feature_7921_MongoDB_Filesystem_Test.robot b/robot-systest/testsuite/cli/TS014__Feature_7921_MongoDB_Filesystem_Test.robot new file mode 100644 index 00000000..3070d419 --- /dev/null +++ b/robot-systest/testsuite/cli/TS014__Feature_7921_MongoDB_Filesystem_Test.robot @@ -0,0 +1,124 @@ +## +# Copyright 2019 Tech Mahindra Limited +# +# 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. +## + +## Change log: +# 1. Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 18-Dec-2019 +## + +*** Settings *** +Library OperatingSystem +Library String +Library Collections +Resource ../../lib/cli/vnfd_lib.robot +Resource ../../lib/cli/nsd_lib.robot +Resource ../../lib/cli/ns_lib.robot +Resource ../../lib/cli/vim_account_lib.robot +Library ../../lib/custom_lib.py + +Suite Setup Prerequisite For Test +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +${success_return_code} 0 + +@{vim} +@{vnfd_ids} +${nsd_id} +@{nsd_ids} +@{ns_ids} +${vnfdPckg} hackfest_basic_vnf.tar.gz +${nsdPckg} hackfest_basic_ns.tar.gz +${vnfdftpPath} https://osm-download.etsi.org/ftp/osm-5.0-five/6th-hackfest/packages/hackfest_basic_vnf.tar.gz +${nsdftpPath} https://osm-download.etsi.org/ftp/osm-5.0-five/6th-hackfest/packages/hackfest_basic_ns.tar.gz + + +*** Test Cases *** +Create VNF Descriptor Test + [Tags] comprehensive feature7921 + + ${rc} ${stdout}= Run and Return RC and Output wget -P '${CURDIR}${/}../../resource/' ${vnfdftpPath} + ${vnfd_id}= Create VNFD '${CURDIR}${/}../../resource${/}${vnfdPckg}' + Append To List ${vnfd_ids} ${vnfd_id} + + +Create NS Descriptor Test + [Tags] comprehensive feature7921 + + ${rc} ${stdout}= Run and Return RC and Output wget -P '${CURDIR}${/}../../resource/' ${nsdftpPath} + ${nsd_id}= Create VNFD '${CURDIR}${/}../../resource${/}${nsdPckg}' + Append To List ${nsd_ids} ${nsd_id} + + +Instanciate Network Service Test + [Tags] comprehensive feature7921 + [Setup] Wait Until Keyword Succeeds 2x 30sec VIM Setup To Launch Network Services + + :FOR ${vim_name} IN @{vim} + \ Launch Network Services and Return ${vim_name} + + +Delete NS Instance Test + [Tags] comprehensive feature7921 + + :FOR ${ns} IN @{ns_ids} + \ Delete NS ${ns} + + +Delete NS Descriptor Test + [Tags] comprehensive feature7921 + + :FOR ${nsd} IN @{nsd_ids} + \ Delete NSD ${nsd} + + +Delete VNF Descriptor Test + [Tags] comprehensive feature7921 + + :FOR ${vnfd_id} IN @{vnfd_ids} + \ Delete VNFD ${vnfd_id} + + +*** Keywords *** +Prerequisite For Test + [Documentation] Update docker service to use mongodb as file system + + Update NBI Service + Update LCM Service + + +Update NBI Service + ${rc} ${stdout}= Run and Return RC and Output docker service update osm_nbi --force --env-add OSMNBI_STORAGE_DRIVER=mongo --env-add OSMNBI_STORAGE_PATH=/app/storage --env-add OSMNBI_STORAGE_COLLECTION=files --env-add OSMNBI_STORAGE_URI=mongodb://mongo:27017 + Should Be Equal As Integers ${rc} ${success_return_code} + Sleep 30s Wait for NBI service to be update + + +Update LCM Service + ${rc} ${stdout}= Run and Return RC and Output docker service update osm_lcm --force --env-add OSMLCM_STORAGE_DRIVER=mongo --env-add OSMLCM_STORAGE_PATH=/app/storage --env-add OSMLCM_STORAGE_COLLECTION=files --env-add OSMLCM_STORAGE_URI=mongodb://mongo:27017 + Should Be Equal As Integers ${rc} ${success_return_code} + Sleep 30s Wait for LCM service to be update + + +Test Cleanup +# :FOR ${vim_id} IN @{vim} +# \ Delete Vim Account ${vim_id} + + ${rc} ${stdout}= Run and Return RC and Output docker service rollback osm_nbi + Should Be Equal As Integers ${rc} ${success_return_code} + ${rc} ${stdout}= Run and Return RC and Output docker service rollback osm_lcm + Should Be Equal As Integers ${rc} ${success_return_code} diff --git a/robot-systest/testsuite/cli/TS015__Feature_8047_OSMClient_Package_Creation_And_Validation.robot b/robot-systest/testsuite/cli/TS015__Feature_8047_OSMClient_Package_Creation_And_Validation.robot new file mode 100644 index 00000000..e717c105 --- /dev/null +++ b/robot-systest/testsuite/cli/TS015__Feature_8047_OSMClient_Package_Creation_And_Validation.robot @@ -0,0 +1,84 @@ +## +# Copyright 2019 Tech Mahindra Limited +# +# 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. +## + +## Change log: +# 1. Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 18-Dec-2019 +## + +*** Settings *** +Documentation Test Suite to test OSMClient Package Createtion and Validation Tool +Library OperatingSystem +Library String +Library Collections +Resource ../../lib/cli/osm_package_tools_lib.robot + +Suite Setup Prerequisite For Test +Suite Teardown Test Cleanup + + +*** Variables *** +${success_return_code} 0 +${base_dir} ${EXECDIR} +${pkg_dir} ${CURDIR}${/}../../resource/cli/packages +${ns_pkg} vEPC +${vnf_pkg} vEPC + + +*** Test Cases *** +Test OSM NS Package Create + [Tags] comprehensive feature8047 + Create OSM NS Package ${ns_pkg} + + +Test OSM VNF Package Create + [Tags] comprehensive feature8047 + Create OSM VNF Package ${vnf_pkg} + + +Test OSM NS Package Validate + [Tags] comprehensive feature8047 + Validate OSM NS Package ${ns_pkg} + + +Test OSM VNF Package Validate + [Tags] comprehensive feature8047 + Validate OSM VNF Package ${vnf_pkg} + + +Test OSM VNF Package Build + [Tags] comprehensive feature8047 + Build OSM VNF Package ${vnf_pkg} + + +Test OSM NS Package Build + [Tags] comprehensive feature8047 + Build OSM NS Package ${ns_pkg} + + +*** Keywords *** +Prerequisite For Test + Create Directory ${pkg_dir} + ${rc} ${stdout}= Run and Return RC and Output cd ${pkg_dir} + Should Be Equal As Integers ${rc} ${success_return_code} + + +Test Cleanup + ${rc} ${stdout}= Run and Return RC and Output cd ${base_dir} + Should Be Equal As Integers ${rc} ${success_return_code} + + Remove Directory ${pkg_dir} recursive=${TRUE} \ No newline at end of file diff --git a/robot-systest/testsuite/cli/TS016__Manual_VNF_VDU_Scaling_Test.robot b/robot-systest/testsuite/cli/TS016__Manual_VNF_VDU_Scaling_Test.robot new file mode 100644 index 00000000..3f7bce8d --- /dev/null +++ b/robot-systest/testsuite/cli/TS016__Manual_VNF_VDU_Scaling_Test.robot @@ -0,0 +1,129 @@ +## +# Copyright 2019 Tech Mahindra Limited +# +# 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. +## + +## Change log: +# 1. Mrityunjay Yadav, Jayant Madavi : MY00514913@techmahindra.com : 27-Nov-19 +## + +*** Settings *** +Documentation Test Suite to test manual scale-in/out cirros VNF and NS using osm-client +Library OperatingSystem +Library String +Library Collections +Resource ../../lib/cli/vnfd_lib.robot +Resource ../../lib/cli/nsd_lib.robot +Resource ../../lib/cli/ns_lib.robot +Resource ../../lib/cli/vim_account_lib.robot +Library ../../lib/custom_lib.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +# VNFD Details +@{vnfd_ids} +${vnfdPckgPath} /descriptor-packages/vnfd/cirros_vnf +${vnfdPckg} /build/cirros_vnf.tar.gz + +# NSD Details +@{nsd_ids} +${nsdPckgPath} /descriptor-packages/nsd/cirros_ns +${nsdPckg} /build/cirros_ns.tar.gz +${scaling_group} scaling_cirros_vnf +${vnf_member_index} 1 + +@{ns_ids} + + +*** Test Cases *** +Create VNF Descriptor Test + [Documentation] Build and onboard cirros VNF package with scaling parameter + [Tags] comprehensive manual_scaling + + Build VNF Descriptor ${vnfdPckgPath} + ${vnfd_id}= Create VNFD '${CURDIR}${/}../../..${vnfdPckgPath}${vnfdPckg}' + Append To List ${vnfd_ids} ${vnfd_id} + + +Create NS Descriptor Test + [Documentation] Build and onboard cirros NS package with scaling parameter + [Tags] comprehensive manual_scaling + + Build NS Descriptor ${nsdPckgPath} + ${nsd_id}= Create NSD '${CURDIR}${/}../../..${nsdPckgPath}${nsdPckg}' + Append To List ${nsd_ids} ${nsd_id} + + +Network Service Instance Test + [Documentation] Launch cirros ns with scaling parameter + [Tags] comprehensive manual_scaling + + :FOR ${vim_name} IN @{vim} + \ Launch Network Services and Return ${vim_name} + + +Perform VNF/VDU Scaling-out Operation Over Launched NS Test + [Documentation] scale-out cirros ns + [Tags] comprehensive manual_scaling + :FOR ${ns} IN @{ns_ids} + \ Perform VNF Scale-out Operation ${ns} ${vnf_member_index} ${scaling_group} + + +Perform VNF/VDU Scaling-in Operation Over Launched NS Test + [Documentation] scale-in cirros ns + [Tags] comprehensive manual_scaling + :FOR ${ns} IN @{ns_ids} + \ Perform VNF Scale-in Operation ${ns} ${vnf_member_index} ${scaling_group} + + +Delete NS Instance Test + [Tags] comprehensive manual_scaling + + :FOR ${ns} IN @{ns_ids} + \ Delete NS ${ns} + + +Delete NS Descriptor Test + [Tags] comprehensive manual_scaling + + :FOR ${nsd} IN @{nsd_ids} + \ Delete NSD ${nsd} + + +Delete VNF Descriptor Test + [Tags] comprehensive manual_scaling + + :FOR ${vnfd} IN @{vnfd_ids} + \ Delete VNFD ${vnfd} + + +*** Keywords *** +Test Cleanup + [Documentation] Test Suit Cleanup: Deliting Descriptor, instance and vim + + :FOR ${ns} IN @{ns_ids} + \ Delete NS ${ns} + + :FOR ${nsd} IN @{nsd_ids} + \ Delete NSD ${nsd} + + :FOR ${vnfd} IN @{vnfd_ids} + \ Delete VNFD ${vnfd} + +# :FOR ${vim_id} IN @{vim} +# \ Delete Vim Account ${vim_id} diff --git a/robot-systest/testsuite/cli/TS017__Feature_7326_Disable_Port_Security_at_Network_level.robot b/robot-systest/testsuite/cli/TS017__Feature_7326_Disable_Port_Security_at_Network_level.robot new file mode 100644 index 00000000..562dc15d --- /dev/null +++ b/robot-systest/testsuite/cli/TS017__Feature_7326_Disable_Port_Security_at_Network_level.robot @@ -0,0 +1,122 @@ +# -*- coding: utf-8 -*- + +## +# Copyright 2020 Tech Mahindra Limited +# +# 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. +# +# Author: Mrityunjay Yadav , Jayant Madavi +## + + +*** Settings *** +Documentation Test Suite to test disable network port security NS +Library OperatingSystem +Library String +Library Collections +Resource ../../lib/cli/vnfd_lib.robot +Resource ../../lib/cli/nsd_lib.robot +Resource ../../lib/cli/ns_lib.robot +Resource ../../lib/cli/vim_account_lib.robot +Library ../../lib/custom_lib.py +Variables ../../resource/cli/disable_port_security_ns_data.py + +Suite Teardown Run Keyword And Ignore Error Test Cleanup + + +*** Variables *** +@{vnfd_ids} +${nsd_id} +@{nsd_ids} +@{ns_ids} + + +*** Test Cases *** +Create VNF Descriptor + [Tags] disable_port_security comprehensive + + Build VNF Descriptor ${vnfdPckgPath} + ${vnfd_id}= Create VNFD '${CURDIR}${/}../../..${vnfdPckgPath}${vnfdPckg}' + Append To List ${vnfd_ids} ${vnfd_id} + + +Create NS Descriptor + [Tags] disable_port_security comprehensive + + Build NS Descriptor ${nsdPckgPath} + ${nsd_id}= Create NSD '${CURDIR}${/}../../..${nsdPckgPath}${nsdPckg}' + Append To List ${nsd_ids} ${nsd_id} + + +Network Service Instance Test + [Documentation] Launch and terminate network services + [Tags] disable_port_security comprehensive + + :FOR ${vim_name} IN @{vim} + \ Launch Network Services and Return ${vim_name} + + +Verify Port Security + [Tags] disable_port_security comprehensive + + :FOR ${ns} IN @{ns_ids} + \ Check For Network Port Security ${ns} + + +Delete NS Instance Test + [Tags] disable_port_security comprehensive + + :FOR ${ns} IN @{ns_ids} + \ Delete NS ${ns} + + +Delete NS Descriptor Test + [Tags] disable_port_security comprehensive + + :FOR ${nsd} IN @{nsd_ids} + \ Delete NSD ${nsd} + + +Delete VNF Descriptor Test + [Tags] disable_port_security comprehensive + + :FOR ${vnfd_id} IN @{vnfd_ids} + \ Delete VNFD ${vnfd_id} + + +*** Keywords *** +Check For Network Port Security + [Arguments] ${ns_name} + ${rc} ${network_id}= Run and Return RC and Output openstack network list | grep ${ns_name} | awk '{print $2}' + Log ${network_id} + ${rc} ${stdout}= Run and Return RC and Output openstack network show ${network_id} -f json | jq '.port_security_enabled' + Log ${stdout} + Should Be Equal As Strings ${stdout} true + + +Test Cleanup + [Documentation] Test Suit Cleanup: Deliting Descriptor, instance and vim + + :FOR ${ns} IN @{ns_ids} + \ Delete NS ${ns} + + :FOR ${nsd} IN @{nsd_ids} + \ Delete NSD ${nsd} + + :FOR ${vnfd} IN @{vnfd_ids} + \ Delete VNFD ${vnfd} + +# :FOR ${vim_id} IN @{vim} +# \ Delete Vim Account ${vim_id}