Feature 11001: Robot framework linting for E2E tests
[osm/tests.git] / robot-systest / testsuite / fail_01-insufficient_resources.robot
index 022ae5a..6c14e57 100644 (file)
@@ -1,3 +1,4 @@
+*** Comments ***
 #   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
@@ -10,6 +11,7 @@
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 
+
 *** Settings ***
 Documentation   [FAIL-01] A single VNF with 2 VDUs, one of them unallocatable because of resources.
 
@@ -18,102 +20,96 @@ Library   String
 Library   Collections
 Library   SSHLibrary
 
-Resource   %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
-Resource   %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
-Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
-Resource   %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot
+Resource   ../lib/vnfd_lib.resource
+Resource   ../lib/nsd_lib.resource
+Resource   ../lib/ns_lib.resource
+Resource   ../lib/openstack_lib.resource
 
-Force Tags   fail_01   cluster_main   daily   regression
+Test Tags   fail_01   cluster_main   daily   regression
 
 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
 
 
 *** Variables ***
 # NS and VNF descriptor package folder and ids
-${vnfd_pkg}   simple_2vm_vnf
-${vnfd_name}   simple_2vm-vnf
-${nsd_pkg}   simple_2vm_ns
-${nsd_name}   simple_2vm-ns
+${VNFD_PKG}   simple_2vm_vnf
+${VNFD_NAME}   simple_2vm-vnf
+${NSD_PKG}   simple_2vm_ns
+${NSD_NAME}   simple_2vm-ns
 
 # NS instance name and configuration
-${ns_name_prefix}   fail_01
-${ns_config}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
+${NS_NAME_PREFIX}   fail_01
+${NS_CONFIG}   {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
 
 # SSH keys to be used
-${publickey}   %{HOME}/.ssh/id_rsa.pub
+${PUBLICKEY}   %{HOME}/.ssh/id_rsa.pub
 
 # Default memory in GB for dataVM VDU (can be overwritten by VM_MEMORY_OVERRIDE environment variable)
 # Only used if no quota is defined in Openstack's project (VDU tries to allocate the full memory of the quota)
-${default_memory}   250
+${DEFAULT_MEMORY}   250
 
 # NS launch timeout and polling time
-${ns_launch_max_wait_time}   5min
-${ns_launch_pol_time}   15
+${NS_LAUNCH_MAX_WAIT_TIME}   5min
+${NS_LAUNCH_POL_TIME}   15
 
 # Openstack delete operation timeout and polling time
-${os_delete_max_wait_time}   6min
-${os_delete_pol_time}   20
+${OS_DELETE_MAX_WAIT_TIME}   6min
+${OS_DELETE_POL_TIME}   20
 
 
 *** Test Cases ***
 Create VNF Descriptor
-
+    [Documentation]   Upload VNF package for the testsuite.
     ${ram_quota}=   Get Project Quota   ram
     IF   ${ram_quota} == -1
-        ${memory}=   Get Environment Variable   VM_MEMORY_OVERRIDE   default=${default_memory}
+        ${memory}=   Get Environment Variable   VM_MEMORY_OVERRIDE   default=${DEFAULT_MEMORY}
     ELSE
         ${memory}=   Evaluate   ${ram_quota} / 1000
     END
     Log   ${memory}
-    Create VNFD Overriding Fields   '%{PACKAGES_FOLDER}/${vnfd_pkg}'   virtual-compute-desc.1.virtual-memory.size=${memory}
-
+    Create VNFD Overriding Fields   '%{PACKAGES_FOLDER}/${VNFD_PKG}'   virtual-compute-desc.1.virtual-memory.size=${memory}
 
 Create NS Descriptor
-
-    Create NSD   '%{PACKAGES_FOLDER}/${nsd_pkg}'
-
+    [Documentation]   Upload NS package for the testsuite.
+    Create NSD   '%{PACKAGES_FOLDER}/${NSD_PKG}'
 
 Cannot Instantiate Network Service
-
+    [Documentation]   Assert failure when trying to instantiate the NS instance and there are not enough resources in the VIM.
     ${rand}=   Generate Random String   4   [NUMBERS]
-    ${ns_name}=   Catenate   SEPARATOR=_   ${ns_name_prefix}   ${rand}
-    Set Suite Variable   ${ns_name}
-    Log   ${ns_name}
-    ${id}=   Instantiate Network Service   ${ns_name}   ${nsd_name}   %{VIM_TARGET}   --config '${ns_config}' --ssh_keys ${publickey}
+    ${ns_name}=   Catenate   SEPARATOR=_   ${NS_NAME_PREFIX}   ${rand}
+    Set Suite Variable   ${NS_NAME}
+    Log   ${NS_NAME}
+    ${id}=   Instantiate Network Service   ${NS_NAME}   ${NSD_NAME}   %{VIM_TARGET}   --config '${NS_CONFIG}' --ssh_keys ${PUBLICKEY}
     Log   ${id}
-    Set Suite Variable   ${ns_id}   ${id}
-    WAIT UNTIL KEYWORD SUCCEEDS   ${ns_launch_max_wait_time}   ${ns_launch_pol_time}   Check For Ns Instance To Configured   ${ns_name}
-    ${rc}   ${stdout}=   run and return rc and output   osm ns-list --filter id="${ns_id}" | grep ${ns_id} | awk '{print $8}'
-    Log   ${stdout}
+    Set Suite Variable   ${NS_ID}   ${id}
+    WAIT UNTIL KEYWORD SUCCEEDS   ${NS_LAUNCH_MAX_WAIT_TIME}   ${NS_LAUNCH_POL_TIME}   Check For Ns Instance To Configured   ${NS_NAME}
+    ${rc}   ${stdout}=   Run And Return Rc And Output   osm ns-list --filter id="${NS_ID}" | grep ${NS_ID} | awk '{print $8}'
+    Log   ${rc},${stdout}
     Should Contain   ${stdout}   BROKEN
-    ${rc}   ${stdout}=   run and return rc and output   osm ns-show ${ns_id} --literal | yq .errorDetail
-    Log   ${stdout}
+    ${rc}   ${stdout}=   Run And Return Rc And Output   osm ns-show ${NS_ID} --literal | yq .errorDetail
+    Log   ${rc},${stdout}
     Should Contain   ${stdout}   Deploying at VIM: Error at create vdu
 
-
 Delete NS Instance And Check VIM
+    [Documentation]   Delete NS instance and check that the VMs have been deleted.
     [Tags]   cleanup
-
-    Delete NS   ${ns_name}
-    WAIT UNTIL KEYWORD SUCCEEDS   ${os_delete_max_wait_time}   ${os_delete_pol_time}   Check NS Servers In VIM   ${ns_name}   0
-
+    Delete NS   ${NS_NAME}
+    WAIT UNTIL KEYWORD SUCCEEDS   ${OS_DELETE_MAX_WAIT_TIME}   ${OS_DELETE_POL_TIME}   Check NS Servers In VIM   ${NS_NAME}   0
 
 Delete NS Descriptor
+    [Documentation]   Delete NS package from OSM.
     [Tags]   cleanup
-
-    Delete NSD   ${nsd_name}
-
+    Delete NSD   ${NSD_NAME}
 
 Delete VNF Descriptor
+    [Documentation]   Delete VNF package from OSM.
     [Tags]   cleanup
-
-    Delete VNFD   ${vnfd_name}
+    Delete VNFD   ${VNFD_NAME}
 
 
 *** Keywords ***
 Suite Cleanup
     [Documentation]   Test Suite Cleanup: Deleting descriptors and NS instance
-
-    Run Keyword If Any Tests Failed   Delete NS   ${ns_name}
-    Run Keyword If Any Tests Failed   Delete NSD   ${nsd_name}
-    Run Keyword If Any Tests Failed   Delete VNFD   ${vnfd_name}
+    Run Keyword If Any Tests Failed   Delete NS   ${NS_NAME}
+    Run Keyword If Any Tests Failed   Delete NSD   ${NSD_NAME}
+    Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}