From 17621f9c0c63d8a18494506d4f0659da933a48c2 Mon Sep 17 00:00:00 2001 From: Ragavi D Date: Fri, 6 Dec 2019 10:31:07 +0000 Subject: [PATCH] Robot Framework Test case Contribution 1. Added Feature 7181 Test case to the Test Suite 2. Modified the Create Network Service keyword 3. Made changes to Create Network Service With Config keyword Change-Id: I1d82eed6a7d78626982a299e857ee2f64347bb84 Signed-off-by: Ragavi D --- .../nsd/ubuntu-cloudinit_ns/Makefile | 20 +++++ .../src/ubuntu-cloudinit_nsd.yaml | 41 +++++++++ .../vnfd/ubuntu-cloudinit_vnf/Makefile | 21 +++++ .../src/cloud_init/cloud-init.cfg | 20 +++++ .../src/ubuntu-cloudinit_vnfd.yaml | 53 +++++++++++ robot-systest/lib/cli/ns_lib.robot | 6 +- .../resource/cli/ubuntu-cloudinit_ns_data.py | 30 +++++++ ...nstantiation_Parameters_in_CloudInit.robot | 87 +++++++++++++++++++ 8 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 descriptor-packages/nsd/ubuntu-cloudinit_ns/Makefile create mode 100644 descriptor-packages/nsd/ubuntu-cloudinit_ns/src/ubuntu-cloudinit_nsd.yaml create mode 100644 descriptor-packages/vnfd/ubuntu-cloudinit_vnf/Makefile create mode 100644 descriptor-packages/vnfd/ubuntu-cloudinit_vnf/src/cloud_init/cloud-init.cfg create mode 100644 descriptor-packages/vnfd/ubuntu-cloudinit_vnf/src/ubuntu-cloudinit_vnfd.yaml create mode 100644 robot-systest/resource/cli/ubuntu-cloudinit_ns_data.py create mode 100644 robot-systest/testsuite/cli/TS012__Feature_7181_Allow_Instantiation_Parameters_in_CloudInit.robot diff --git a/descriptor-packages/nsd/ubuntu-cloudinit_ns/Makefile b/descriptor-packages/nsd/ubuntu-cloudinit_ns/Makefile new file mode 100644 index 00000000..c5f5f691 --- /dev/null +++ b/descriptor-packages/nsd/ubuntu-cloudinit_ns/Makefile @@ -0,0 +1,20 @@ +# +# Copyright 2017 Sandvine +# +# 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. +# + +DESCRIPTORS_TOPDIR ?= ../.. +include $(DESCRIPTORS_TOPDIR)/mk/pkg.mk + +all: $(BUILD_DIR)/$(PKG_NAME) diff --git a/descriptor-packages/nsd/ubuntu-cloudinit_ns/src/ubuntu-cloudinit_nsd.yaml b/descriptor-packages/nsd/ubuntu-cloudinit_ns/src/ubuntu-cloudinit_nsd.yaml new file mode 100644 index 00000000..0264a726 --- /dev/null +++ b/descriptor-packages/nsd/ubuntu-cloudinit_ns/src/ubuntu-cloudinit_nsd.yaml @@ -0,0 +1,41 @@ +# Copyright 2019 ETSI +# +# 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. + +nsd:nsd-catalog: + nsd: + - id: ubuntu-cloudinit_nsd + name: ubuntu-cloudinit_nsd + short-name: ubuntu-cloudinit_nsd + description: Generated by OSM package generator + vendor: OSM + version: '1.0' + + + constituent-vnfd: + - member-vnf-index: 1 + vnfd-id-ref: ubuntu-cloudinit_vnfd + + vld: + # Networks for the VNFs + - id: mgmtnet + name: mgmtnet + short-name: mgmtnet + type: ELAN + mgmt-network: 'true' + # vim-network-name: + vnfd-connection-point-ref: + - member-vnf-index-ref: 1 + vnfd-id-ref: ubuntu-cloudinit_vnfd + vnfd-connection-point-ref: vnf-cp0 diff --git a/descriptor-packages/vnfd/ubuntu-cloudinit_vnf/Makefile b/descriptor-packages/vnfd/ubuntu-cloudinit_vnf/Makefile new file mode 100644 index 00000000..a08d5882 --- /dev/null +++ b/descriptor-packages/vnfd/ubuntu-cloudinit_vnf/Makefile @@ -0,0 +1,21 @@ +# +# Copyright 2017 Sandvine +# +# 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. +# + +DESCRIPTORS_TOPDIR ?= ../.. + +include $(DESCRIPTORS_TOPDIR)/mk/pkg.mk + +all: $(BUILD_DIR)/$(PKG_NAME) diff --git a/descriptor-packages/vnfd/ubuntu-cloudinit_vnf/src/cloud_init/cloud-init.cfg b/descriptor-packages/vnfd/ubuntu-cloudinit_vnf/src/cloud_init/cloud-init.cfg new file mode 100644 index 00000000..b7fa010f --- /dev/null +++ b/descriptor-packages/vnfd/ubuntu-cloudinit_vnf/src/cloud_init/cloud-init.cfg @@ -0,0 +1,20 @@ +#Copyright 2019 ETSI +# +#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. + +#cloud-config +password: {{ password }} +chpasswd: { expire: False } +ssh_pwauth: True + diff --git a/descriptor-packages/vnfd/ubuntu-cloudinit_vnf/src/ubuntu-cloudinit_vnfd.yaml b/descriptor-packages/vnfd/ubuntu-cloudinit_vnf/src/ubuntu-cloudinit_vnfd.yaml new file mode 100644 index 00000000..b4e92361 --- /dev/null +++ b/descriptor-packages/vnfd/ubuntu-cloudinit_vnf/src/ubuntu-cloudinit_vnfd.yaml @@ -0,0 +1,53 @@ +# Copyright 2019 ETSI +# +# 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. + +vnfd:vnfd-catalog: + vnfd: + - id: ubuntu-cloudinit_vnfd + name: ubuntu-cloudinit_vnfd + short-name: ubuntu-cloudinit_vnfd + description: Generated by OSM package generator + vendor: OSM + version: '1.0' + + # Management interface + mgmt-interface: + cp: vnf-cp0 + + vdu: + - id: ubuntu-cloudinit_vnfd-VM + name: ubuntu-cloudinit_vnfd-VM + description: ubuntu-cloudinit_vnfd-VM + count: 1 + cloud-init-file: cloud-init.cfg + + vm-flavor: + vcpu-count: 2 + memory-mb: 2048 + storage-gb: 10 + + # Image including the full path + image: 'ubuntu1604' + + interface: + - name: eth0 + type: EXTERNAL + virtual-interface: + type: PARAVIRT + external-connection-point-ref: vnf-cp0 + + connection-point: + - name: vnf-cp0 + diff --git a/robot-systest/lib/cli/ns_lib.robot b/robot-systest/lib/cli/ns_lib.robot index 8be124dd..f6bee419 100644 --- a/robot-systest/lib/cli/ns_lib.robot +++ b/robot-systest/lib/cli/ns_lib.robot @@ -31,7 +31,6 @@ ${ns_delete_max_wait_time} 1min ${ns_delete_pol_time} 15sec ${nsconfig} - *** Keywords *** Get NS List [Documentation] Get ns instance list @@ -43,6 +42,7 @@ Get NS List Launch Network Services and Return [Arguments] ${vim_name} ${ns_config}='' + [Documentation] Get Configuration parameter to create Newtork service Run Keyword If ${ns_config}=='' Get NS Config ... ELSE Set NS Config ${ns_config} @@ -56,11 +56,15 @@ Launch Network Services and Return Set NS Config [Arguments] ${ns_config} + [Documentation] Set NS Configuration variable + ${nsconfig}= Get Variable Value ${ns_config} '' Set Test Variable ${nsconfig} Get NS Config + [Documentation] Get NS Configuration from Environment Variable + ${nsconfig}= Get Environment Variable NS_CONFIG '' Set Test Variable ${nsconfig} diff --git a/robot-systest/resource/cli/ubuntu-cloudinit_ns_data.py b/robot-systest/resource/cli/ubuntu-cloudinit_ns_data.py new file mode 100644 index 00000000..ce680372 --- /dev/null +++ b/robot-systest/resource/cli/ubuntu-cloudinit_ns_data.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +## +# Copyright 2019 TATA ELXSI +# +# 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: Ragavi D (ragavi.d@tataelxsi.co.in) + +# VNFD Details +vnfdPckgPath = "/descriptor-packages/vnfd/ubuntu-cloudinit_vnf" +vnfdPckg = '/build/ubuntu-cloudinit_vnf.tar.gz' + +# NSD Details +nsdPckgPath = "/descriptor-packages/nsd/ubuntu-cloudinit_ns" +nsdPckg = '/build/ubuntu-cloudinit_ns.tar.gz' diff --git a/robot-systest/testsuite/cli/TS012__Feature_7181_Allow_Instantiation_Parameters_in_CloudInit.robot b/robot-systest/testsuite/cli/TS012__Feature_7181_Allow_Instantiation_Parameters_in_CloudInit.robot new file mode 100644 index 00000000..68f98fae --- /dev/null +++ b/robot-systest/testsuite/cli/TS012__Feature_7181_Allow_Instantiation_Parameters_in_CloudInit.robot @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- + +## +# Copyright 2019 TATA ELXSI +# +# 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: Ragavi D (ragavi.d@tataelxsi.co.in) + +*** Settings *** +Documentation Test Suite to create hackfest basic nestwork service +Suite Teardown Run Keyword And Ignore Error Test Cleanup +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/ubuntu-cloudinit_ns_data.py + +*** Variables *** +@{vnfd_ids} +${nsd_id} ${EMPTY} +@{nsd_ids} +@{ns_ids} +${ns_config} '{vld: [ {name: mgmtnet, vim-network-name: osm-ext} ], additionalParamsForVnf: [ { member-vnf-index: "1", additionalParams: { password: "PASSWORD" } } ] }' + +*** Test Cases *** +Create Ubuntu CloudInit VNF Descriptor + [Tags] comprehensive ubuntu-cloudinit_ns + Build VNF Descriptor ${vnfdPckgPath} + ${vnfd_id}= Create VNFD '${CURDIR}${/}../../..${vnfdPckgPath}${vnfdPckg}' + Append To List ${vnfd_ids} ${vnfd_id} + +Create Ubuntu CloudInit NS Descriptor + [Tags] comprehensive ubuntu-cloudinit_ns + 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] comprehensive ubuntu-cloudinit_ns + : FOR ${vim_name} IN @{vim} + \ Launch Network Services and Return ${vim_name} ${ns_config} + +Delete NS Instance Test + [Tags] comprehensive ubuntu-cloudinit_ns + : FOR ${ns} IN @{ns_ids} + \ Delete NS ${ns} + +Delete NS Descriptor Test + [Tags] comprehensive ubuntu-cloudinit_ns + : FOR ${nsd} IN @{nsd_ids} + \ Delete NSD ${nsd} + +Delete VNF Descriptor Test + [Tags] comprehensive ubuntu-cloudinit_ns + : FOR ${vnfd_id} IN @{vnfd_ids} + \ Delete VNFD ${vnfd_id} + +*** 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} -- 2.25.1