Revert "Feature 11001: Robot framework linting for E2E tests"
[osm/tests.git] / robot-systest / testsuite / slice_02-shared_network_slicing.robot
index d5a376a..869eb45 100644 (file)
@@ -1,4 +1,3 @@
-*** Comments ***
 #   Copyright 2020 Atos
 #
 #   Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +12,6 @@
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 
-
 *** Settings ***
 Documentation   [SLICE-02] Shared Network Slicing.
 
@@ -23,180 +21,227 @@ Library   Collections
 Library   Process
 Library   SSHLibrary
 
-Resource   ../lib/vnfd_lib.resource
-Resource   ../lib/nsd_lib.resource
-Resource   ../lib/nst_lib.resource
-Resource   ../lib/nsi_lib.resource
-Resource   ../lib/ns_lib.resource
-Resource   ../lib/connectivity_lib.resource
-Resource   ../lib/ssh_lib.resource
+Resource   %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
+Resource   %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
+Resource   %{ROBOT_DEVOPS_FOLDER}/lib/nst_lib.robot
+Resource   %{ROBOT_DEVOPS_FOLDER}/lib/nsi_lib.robot
+Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
+Resource   %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot
+Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
 
-Test Tags   slice_02   cluster_slices   daily   regression
+Force Tags   slice_02   cluster_slices   daily   regression
 
 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
 
 
 *** Variables ***
+
 # NS and VNF descriptor package files
-${VNFD1_PKG}   slice_basic_vnf
-${VNFD2_PKG}   slice_basic_middle_vnf
-${NSD1_PKG}   slice_basic_ns
-${NSD2_PKG}   slice_basic_middle_ns
-${NST}   slice_basic_nst/slice_basic_nst.yaml
-${NST2}   slice_basic_nst/slice_basic_2nd_nst.yaml
+${vnfd1_pkg}   slice_basic_vnf
+${vnfd2_pkg}   slice_basic_middle_vnf
+${nsd1_pkg}   slice_basic_ns
+${nsd2_pkg}   slice_basic_middle_ns
+${nst}   slice_basic_nst/slice_basic_nst.yaml
+${nst2}   slice_basic_nst/slice_basic_2nd_nst.yaml
 
 # Instance names
-${SLICE_NAME}   slicebasic
-${SLICE2_NAME}   sliceshared
-${MIDDLE_NS_NAME}   slicebasic.slice_basic_nsd_2
+${slice_name}   slicebasic
+${slice2_name}   sliceshared
+${middle_ns_name}   slicebasic.slice_basic_nsd_2
 
 # Descriptor names
-${NST_NAME}   slice_basic_nst
-${NST2_NAME}   slice_basic_nst2
-${VNFD1_NAME}   slice_basic_vnf
-${VNFD2_NAME}   slice_basic_middle_vnf
-${NSD1_NAME}   slice_basic_ns
-${NSD2_NAME}   slice_basic_middle_ns
+${nst_name}   slice_basic_nst
+${nst2_name}   slice_basic_nst2
+${vnfd1_name}   slice_basic_vnf
+${vnfd2_name}   slice_basic_middle_vnf
+${nsd1_name}   slice_basic_ns
+${nsd2_name}   slice_basic_middle_ns
 
 # SSH keys and username to be used
-${PUBLICKEY}   %{HOME}/.ssh/id_rsa.pub
-${PRIVATEKEY}   %{HOME}/.ssh/id_rsa
-${USERNAME}   ubuntu
-${PASSWORD}   ${EMPTY}
+${publickey}   %{HOME}/.ssh/id_rsa.pub
+${privatekey}   %{HOME}/.ssh/id_rsa
+${username}   ubuntu
+${password}   ${EMPTY}
 
-${VNF_MEMBER_INDEX}   middle
-${VNF_IP_ADDR}   ${EMPTY}
-${NST_CONFIG}   {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] }
+${ns_id}   ${EMPTY}
+${vnf_member_index}   middle
+${vnf_ip_addr}   ${EMPTY}
+${nst_config}   {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] }
 
 
 *** Test Cases ***
 Create Slice VNF Descriptors
     [Documentation]   Onboards all the VNFDs required for the test: vnfd1_pkg and vnfd2_pkg (in the variables file)
-    Create VNFD   '%{PACKAGES_FOLDER}/${VNFD1_PKG}'
-    Create VNFD   '%{PACKAGES_FOLDER}/${VNFD2_PKG}'
+
+    Create VNFD   '%{PACKAGES_FOLDER}/${vnfd1_pkg}'
+    Create VNFD   '%{PACKAGES_FOLDER}/${vnfd2_pkg}'
+
 
 Create Slice NS Descriptors
     [Documentation]   Onboards all the NSDs required for the test: nsd1_pkg and nsd2_pkg (in the variables file)
-    Create NSD   '%{PACKAGES_FOLDER}/${NSD1_PKG}'
-    Create NSD   '%{PACKAGES_FOLDER}/${NSD2_PKG}'
+
+    Create NSD   '%{PACKAGES_FOLDER}/${nsd1_pkg}'
+    Create NSD   '%{PACKAGES_FOLDER}/${nsd2_pkg}'
 
 Create Slice Templates
     [Documentation]   Onboards the Network Slice Templates: nst, nst2 (in the variables file)
-    Create NST   '%{PACKAGES_FOLDER}/${NST}'
-    Create NST   '%{PACKAGES_FOLDER}/${NST2}'
+
+    Create NST   '%{PACKAGES_FOLDER}/${nst}'
+    Create NST   '%{PACKAGES_FOLDER}/${nst2}'
 
 Network Slice First Instance
     [Documentation]   Instantiates the First NST recently onboarded (nst_name) and sets the instantiation id as a suite variable (nsi_id)
     ...               The slice contains 3 NS (1 shared)
-    ${id}=   Create Network Slice   ${NST_NAME}   %{VIM_TARGET}   ${SLICE_NAME}   ${NST_CONFIG}   ${PUBLICKEY}
-    Set Suite Variable   ${NSI_ID}   ${id}
+
+    ${id}=   Create Network Slice   ${nst_name}   %{VIM_TARGET}   ${slice_name}   ${nst_config}   ${publickey}
+    Set Suite Variable   ${nsi_id}   ${id}
+
 
 Network Slice Second Instance
     [Documentation]   Instantiates the Second NST recently onboarded (nst2_name) and sets the instantiation id as a suite variable (nsi2_id)
     ...               The slice contains 2 NS (1 shared)
-    ${id}=   Create Network Slice   ${NST2_NAME}   %{VIM_TARGET}   ${SLICE2_NAME}   ${NST_CONFIG}   ${PUBLICKEY}
-    Set Suite Variable   ${NSI2_ID}   ${id}
+
+    ${id}=   Create Network Slice   ${nst2_name}   %{VIM_TARGET}   ${slice2_name}   ${nst_config}   ${publickey}
+    Set Suite Variable   ${nsi2_id}   ${id}
+
 
 First Network Slice Ns Count
     [Documentation]   Counts the NS in both slice instances and shoul be equal to 4
-    ${slice1_count}=   Get Slice Ns Count   ${SLICE_NAME}
-    ${slice2_count}=   Get Slice Ns Count   ${SLICE2_NAME}
+
+    ${slice1_count}=   Get Slice Ns Count   ${slice_name}
+    ${slice2_count}=   Get Slice Ns Count   ${slice2_name}
     ${together}=   Evaluate   ${slice1_count} + ${slice2_count}
     Should Be Equal As Integers   ${together}   4
 
+
 Get Middle Vnf Management Ip
     [Documentation]   Obtains the management IP of the shared NS main (only) VNF and sets it as a suite variable (mgmt_vnf_ip)
-    ${middle_ns_id}=   Run And Return RC And Output   osm ns-list | grep ${MIDDLE_NS_NAME} | awk '{print $4}' 2>&1
-    ${vnf_ip}=   Get Vnf Management Ip Address   ${middle_ns_id}[1]   ${VNF_MEMBER_INDEX}
-    IF   ${vnf_ip} == ${EMPTY}   Fatal Error   Variable \$\{ vnf_ip\} Empty
-    Set Suite Variable   ${MGMT_VNF_IP}   ${vnf_ip}
+
+    ${middle_ns_id}=   Run and Return RC and Output   osm ns-list | grep ${middle_ns_name} | awk '{print $4}' 2>&1
+    ${vnf_ip}   Get Vnf Management Ip Address   ${middle_ns_id}[1]   ${vnf_member_index}
+    Run Keyword If   '${vnf_ip}' == '${EMPTY}'   Fatal Error   Variable \$\{ vnf_ip\} Empty
+    Set Suite Variable   ${mgmt_vnf_ip}   ${vnf_ip}
+
 
 Get First Slice Vnf IPs
     [Documentation]   Obtains the list of IPs addresses in the first slice and sets the list as a suite variable (slice1_vnfs_ips)
+
     # Get all the ns_id in the slice except the middle one
-    @{ip_list}=   Get Slice Vnf Ip Addresses   ${SLICE_NAME}
+    @{ip_list}   Get Slice Vnf Ip Addresses   ${slice_name}
     Should Be True   ${ip_list} is not None
-    Set Suite Variable   ${SLICE1_VNFS_IPS}   ${ip_list}
+    Set Suite Variable   ${slice1_vnfs_ips}   ${ip_list}
+
 
 Test Middle Ns Ping
     [Documentation]   Pings the slice middle vnf (mgmt_vnf_ip)
+
     Sleep   60s   Waiting for the network to be up
     # Ping to the middle VNF
-    Test Connectivity   ${MGMT_VNF_IP}
+    Test Connectivity   ${mgmt_vnf_ip}
+
 
 Test Middle Vnf SSH Access
     [Documentation]   SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
+
     Sleep   30s   Waiting ssh daemon to be up
-    Test SSH Connection   ${MGMT_VNF_IP}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}
+    Test SSH Connection   ${mgmt_vnf_ip}   ${username}   ${password}   ${privatekey}
+
 
 Test First Slice Connectivity
     [Documentation]   SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
     ...               and pings all the IP addresses in the list (slice1_vnfs_ips)
-    Ping Many   ${MGMT_VNF_IP}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}   @{SLICE1_VNFS_IPS}
+
+    Ping Many   ${mgmt_vnf_ip}   ${username}   ${password}   ${privatekey}   @{slice1_vnfs_ips}
+
 
 Delete Slice One Instance
     [Documentation]   Stops the slice instance (slice_name)
+
     [Tags]   cleanup
-    Delete NSI   ${SLICE_NAME}
+
+    Delete NSI   ${slice_name}
+
 
 Second Network Slice Ns Count
     [Documentation]   Counts the NS in both slice instances and should be equal to 2
-    ${slice1_count}=   Get Slice Ns Count   ${SLICE_NAME}
-    ${slice2_count}=   Get Slice Ns Count   ${SLICE2_NAME}
+
+    ${slice1_count}=   Get Slice Ns Count   ${slice_name}
+    ${slice2_count}=   Get Slice Ns Count   ${slice2_name}
     ${together}=   Evaluate   ${slice1_count} + ${slice2_count}
     Should Be Equal As Integers   ${together}   2
 
 Get Second Slice Vnf IPs
     [Documentation]   Obtains the list of IPs addresses in the second slice and sets the list as a suite variable (slice2_vnfs_ips)
+
     # Get all the ns_id in the slice
-    @{ip_list}=   Get Slice Vnf Ip Addresses   ${SLICE2_NAME}
+    @{ip_list}   Get Slice Vnf Ip Addresses   ${slice2_name}
     Should Be True   ${ip_list} is not None
-    Set Suite Variable   ${SLICE2_VNFS_IPS}   ${ip_list}
+    Set Suite Variable   ${slice2_vnfs_ips}   ${ip_list}
+
 
 Test Second Slice Connectivity
     [Documentation]   SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file
     ...               and pings all the IP addresses in the list (slice2_vnfs_ips)
-    Ping Many   ${MGMT_VNF_IP}   ${USERNAME}   ${PASSWORD}   ${PRIVATEKEY}   @{SLICE2_VNFS_IPS}
+
+    Ping Many   ${mgmt_vnf_ip}   ${username}   ${password}   ${privatekey}   @{slice2_vnfs_ips}
+
 
 Delete Slice Two Instance
     [Documentation]   Stops the slice instance (slice2_name)
+
     [Tags]   cleanup
-    Delete NSI   ${SLICE2_NAME}
+
+    Delete NSI   ${slice2_name}
+
 
 Delete Slice One Template
     [Documentation]   Deletes the NST (nst_name) from OSM
+
     [Tags]   cleanup
-    Delete NST   ${NST_NAME}
+
+    Delete NST   ${nst_name}
+
 
 Delete Slice Two Template
     [Documentation]   Deletes the NST (nst2_name) from OSM
+
     [Tags]   cleanup
-    Delete NST   ${NST2_NAME}
+
+    Delete NST   ${nst2_name}
+
 
 Delete NS Descriptors
     [Documentation]   Deletes all the NSDs created for the test: nsd1_name, nsd2_name
+
     [Tags]   cleanup
-    Delete NSD   ${NSD1_NAME}
-    Delete NSD   ${NSD2_NAME}
+
+    Delete NSD   ${nsd1_name}
+    Delete NSD   ${nsd2_name}
+
 
 Delete VNF Descriptors
     [Documentation]   Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name
+
     [Tags]   cleanup
-    Delete VNFD   ${VNFD1_NAME}
-    Delete VNFD   ${VNFD2_NAME}
+
+    Delete VNFD   ${vnfd1_name}
+    Delete VNFD   ${vnfd2_name}
 
 
 *** Keywords ***
 Suite Cleanup
     [Documentation]   Test Suit Cleanup: Deleting Descriptors, instance and templates
-    Run Keyword If Any Tests Failed   Delete NSI   ${SLICE_NAME}
-    Run Keyword If Any Tests Failed   Delete NSI   ${SLICE2_NAME}
 
-    Run Keyword If Any Tests Failed   Delete NST   ${NST_NAME}
-    Run Keyword If Any Tests Failed   Delete NST   ${NST2_NAME}
+    Run Keyword If Any Tests Failed   Delete NSI   ${slice_name}
+    Run Keyword If Any Tests Failed   Delete NSI   ${slice2_name}
+
+    Run Keyword If Any Tests Failed   Delete NST   ${nst_name}
+    Run Keyword If Any Tests Failed   Delete NST   ${nst2_name}
+
+    Run Keyword If Any Tests Failed   Delete NSD   ${nsd1_name}
+    Run Keyword If Any Tests Failed   Delete NSD   ${nsd2_name}
+
+    Run Keyword If Any Tests Failed   Delete VNFD   ${vnfd1_name}
+    Run Keyword If Any Tests Failed   Delete VNFD   ${vnfd2_name}
 
-    Run Keyword If Any Tests Failed   Delete NSD   ${NSD1_NAME}
-    Run Keyword If Any Tests Failed   Delete NSD   ${NSD2_NAME}
 
-    Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD1_NAME}
-    Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD2_NAME}