Robot Framework Test case Contribution 39/8339/9
authorRagavi D <ragavi.d@tataelxsi.co.in>
Fri, 6 Dec 2019 10:31:07 +0000 (10:31 +0000)
committermadavi <jm00553988@techmahindra.com>
Mon, 20 Jan 2020 10:44:42 +0000 (11:44 +0100)
 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 <ragavi.d@tataelxsi.co.in>
descriptor-packages/nsd/ubuntu-cloudinit_ns/Makefile [new file with mode: 0644]
descriptor-packages/nsd/ubuntu-cloudinit_ns/src/ubuntu-cloudinit_nsd.yaml [new file with mode: 0644]
descriptor-packages/vnfd/ubuntu-cloudinit_vnf/Makefile [new file with mode: 0644]
descriptor-packages/vnfd/ubuntu-cloudinit_vnf/src/cloud_init/cloud-init.cfg [new file with mode: 0644]
descriptor-packages/vnfd/ubuntu-cloudinit_vnf/src/ubuntu-cloudinit_vnfd.yaml [new file with mode: 0644]
robot-systest/lib/cli/ns_lib.robot
robot-systest/resource/cli/ubuntu-cloudinit_ns_data.py [new file with mode: 0644]
robot-systest/testsuite/cli/TS012__Feature_7181_Allow_Instantiation_Parameters_in_CloudInit.robot [new file with mode: 0644]

diff --git a/descriptor-packages/nsd/ubuntu-cloudinit_ns/Makefile b/descriptor-packages/nsd/ubuntu-cloudinit_ns/Makefile
new file mode 100644 (file)
index 0000000..c5f5f69
--- /dev/null
@@ -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 (file)
index 0000000..0264a72
--- /dev/null
@@ -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: <update>
+            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 (file)
index 0000000..a08d588
--- /dev/null
@@ -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 (file)
index 0000000..b7fa010
--- /dev/null
@@ -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 (file)
index 0000000..b4e9236
--- /dev/null
@@ -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
+
index 8be124d..f6bee41 100644 (file)
@@ -31,7 +31,6 @@ ${ns_delete_max_wait_time}    1min
 ${ns_delete_pol_time}    15sec
 ${nsconfig}
 
 ${ns_delete_pol_time}    15sec
 ${nsconfig}
 
-
 *** Keywords ***
 Get NS List
     [Documentation]  Get ns instance list
 *** 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}=''
 
 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}
 
     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}
 
 Set NS Config
     [Arguments]   ${ns_config}
+    [Documentation]  Set NS Configuration variable
+
     ${nsconfig}=    Get Variable Value    ${ns_config}    ''
     Set Test Variable    ${nsconfig}
 
 
 Get NS Config
     ${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}
 
     ${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 (file)
index 0000000..ce68037
--- /dev/null
@@ -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 (file)
index 0000000..68f98fa
--- /dev/null
@@ -0,0 +1,87 @@
+# -*- coding: utf-8 -*-\r
+\r
+##\r
+# Copyright 2019 TATA ELXSI\r
+#\r
+# All Rights Reserved.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License"); you may\r
+# not use this file except in compliance with the License. You may obtain\r
+# a copy of the License at\r
+#\r
+#         http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r
+# License for the specific language governing permissions and limitations\r
+# under the License.\r
+##\r
+\r
+## Author: Ragavi D (ragavi.d@tataelxsi.co.in)\r
+\r
+*** Settings ***\r
+Documentation     Test Suite to create hackfest basic nestwork service\r
+Suite Teardown    Run Keyword And Ignore Error    Test Cleanup\r
+Library           OperatingSystem\r
+Library           String\r
+Library           Collections\r
+Resource          ../../lib/cli/vnfd_lib.robot\r
+Resource          ../../lib/cli/nsd_lib.robot\r
+Resource          ../../lib/cli/ns_lib.robot\r
+Resource          ../../lib/cli/vim_account_lib.robot\r
+Library           ../../lib/custom_lib.py\r
+Variables         ../../resource/cli/ubuntu-cloudinit_ns_data.py\r
+\r
+*** Variables ***\r
+@{vnfd_ids}\r
+${nsd_id}         ${EMPTY}\r
+@{nsd_ids}\r
+@{ns_ids}\r
+${ns_config}      '{vld: [ {name: mgmtnet, vim-network-name: osm-ext} ], additionalParamsForVnf: [ { member-vnf-index: "1", additionalParams: { password: "PASSWORD" } } ] }'\r
+\r
+*** Test Cases ***\r
+Create Ubuntu CloudInit VNF Descriptor\r
+    [Tags]    comprehensive    ubuntu-cloudinit_ns\r
+    Build VNF Descriptor    ${vnfdPckgPath}\r
+    ${vnfd_id}=    Create VNFD    '${CURDIR}${/}../../..${vnfdPckgPath}${vnfdPckg}'\r
+    Append To List    ${vnfd_ids}    ${vnfd_id}\r
+\r
+Create Ubuntu CloudInit NS Descriptor\r
+    [Tags]    comprehensive    ubuntu-cloudinit_ns\r
+    Build NS Descriptor    ${nsdPckgPath}\r
+    ${nsd_id}=    Create NSD    '${CURDIR}${/}../../..${nsdPckgPath}${nsdPckg}'\r
+    Append To List    ${nsd_ids}    ${nsd_id}\r
+\r
+Network Service Instance Test\r
+    [Documentation]    Launch and terminate network services\r
+    [Tags]    comprehensive    ubuntu-cloudinit_ns\r
+    : FOR    ${vim_name}    IN    @{vim}\r
+    \    Launch Network Services and Return    ${vim_name}    ${ns_config}\r
+\r
+Delete NS Instance Test\r
+    [Tags]    comprehensive    ubuntu-cloudinit_ns\r
+    : FOR    ${ns}    IN    @{ns_ids}\r
+    \    Delete NS    ${ns}\r
+\r
+Delete NS Descriptor Test\r
+    [Tags]    comprehensive    ubuntu-cloudinit_ns\r
+    : FOR    ${nsd}    IN    @{nsd_ids}\r
+    \    Delete NSD    ${nsd}\r
+\r
+Delete VNF Descriptor Test\r
+    [Tags]    comprehensive    ubuntu-cloudinit_ns\r
+    : FOR    ${vnfd_id}    IN    @{vnfd_ids}\r
+    \    Delete VNFD    ${vnfd_id}\r
+\r
+*** Keywords ***\r
+Test Cleanup\r
+    [Documentation]    Test Suit Cleanup: Deliting Descriptor, instance and vim\r
+    : FOR    ${ns}    IN    @{ns_ids}\r
+    \    Delete NS    ${ns}\r
+    : FOR    ${nsd}    IN    @{nsd_ids}\r
+    \    Delete NSD    ${nsd}\r
+    : FOR    ${vnfd}    IN    @{vnfd_ids}\r
+    \    Delete VNFD    ${vnfd}\r
+    #    :FOR    ${vim_id}    IN    @{vim}\r
+    #    Delete Vim Account    ${vim_id}\r