Move variables from resources to testsuite for SA tests
[osm/tests.git] / robot-systest / testsuite / slice_01-network_slicing.robot
index 5831e36..8f666d1 100644 (file)
@@ -13,7 +13,7 @@
 #   limitations under the License.
 
 *** Settings ***
-Documentation     [SLICE-01] Network Slicing.
+Documentation   [SLICE-01] Network Slicing.
 
 Library   OperatingSystem
 Library   String
@@ -30,25 +30,44 @@ Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot
 Resource   %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
 
-Variables   %{ROBOT_DEVOPS_FOLDER}/resources/slice_01-network_slicing_data.py
-
 Force Tags   slice_01   cluster_slices   daily   regression
 
 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
 
 
 *** Variables ***
-
-${ns_id}   ${EMPTY}
+# 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
+
+# Descriptor names
+${nst_name}   slice_basic_nst
+${vnfd1_name}   slice_basic_vnf
+${vnfd2_name}   slice_basic_middle_vnf
+${nsd1_name}   slice_basic_ns
+${nsd2_name}   slice_basic_middle_ns
+
+# Instance names
+${slice_name}   slicebasic
+${middle_ns_name}   slicebasic.slice_basic_nsd_2
+
+# SSH keys and username to be used
+${publickey}   %{HOME}/.ssh/id_rsa.pub
+${privatekey}   %{HOME}/.ssh/id_rsa
 ${username}   ubuntu
 ${password}   ${EMPTY}
+
+${ns_id}   ${EMPTY}
 ${vnf_member_index}   middle
 ${vnf_ip_addr}   ${EMPTY}
 ${mgmt_vnf_ip}   ${EMPTY}
 ${nst_config}   {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] }
 
-*** Test Cases ***
 
+*** Test Cases ***
 Create Slice VNF Descriptors
     [Documentation]   Onboards all the VNFDs required for the test: vnfd1_pkg and vnfd2_pkg (in the variables file)
 
@@ -70,7 +89,7 @@ Create Slice Template
 Network Slice Instance Test
     [Documentation]   Instantiates the NST recently onboarded and sets the instantiation id as a suite variable (nsi_id)
 
-    ${id}=   Create Network Slice      ${nst_name}   %{VIM_TARGET}   ${slice_name}   ${nst_config}   ${publickey}
+    ${id}=   Create Network Slice   ${nst_name}   %{VIM_TARGET}   ${slice_name}   ${nst_config}   ${publickey}
     Set Suite Variable   ${nsi_id}   ${id}
 
 
@@ -79,7 +98,7 @@ Get Middle Vnf Management 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
+    Run Keyword If   '${vnf_ip}' == '${EMPTY}'   Fatal Error   Variable \$\{ vnf_ip\} Empty
     Set Suite Variable   ${mgmt_vnf_ip}   ${vnf_ip}
 
 
@@ -87,16 +106,16 @@ Get Slice Vnf Ip Addresses
     [Documentation]   Obtains the list of IPs addresses in the slice and sets the list as a suite variable (slice_vnfs_ips)
 
     # Get all the ns_id in the slice except the middle one to avoid self ping
-    @{slice_ns_list}  Get Slice Ns List Except One   ${slice_name}    ${middle_ns_name}
+    @{slice_ns_list}   Get Slice Ns List Except One   ${slice_name}   ${middle_ns_name}
     log many   @{slice_ns_list}
-    @{temp_list}=    Create List
+    @{temp_list}=   Create List
     # For each ns_id in the list, get all the vnf_id and their IP addresses
     FOR   ${ns_id}   IN   @{slice_ns_list}
         log   ${ns_id}
         @{vnf_id_list}   Get Ns Vnf List   ${ns_id}
         # For each vnf_id in the list, get all its IP addresses
         @{ns_ip_list}   Get Ns Ip List   @{vnf_id_list}
-        @{temp_list}=   Combine Lists   ${temp_list}    ${ns_ip_list}
+        @{temp_list}=   Combine Lists   ${temp_list}   ${ns_ip_list}
     END
     Log List   ${temp_list}
     Set Suite Variable   ${slice_vnfs_ips}   ${temp_list}
@@ -107,22 +126,22 @@ Test Middle Ns Ping
 
     Sleep   60s   Waiting for the network to be up
     # Ping to the middle VNF
-    log    ${mgmt_vnf_ip}
-    Test Connectivity  ${mgmt_vnf_ip}
+    log   ${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 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 (slice_vnfs_ips)
+    ...               and pings all the IP addresses in the list (slice_vnfs_ips)
 
-    Ping Many   ${mgmt_vnf_ip}  ${username}  ${password}  ${privatekey}   @{slice_vnfs_ips}
+    Ping Many   ${mgmt_vnf_ip}   ${username}   ${password}   ${privatekey}   @{slice_vnfs_ips}
 
 
 Delete Slice Instance
@@ -157,17 +176,17 @@ Delete VNF Descriptors
 
 *** Keywords ***
 Suite Cleanup
-    [Documentation]  Test Suit Cleanup: Deleting Descriptors, instance and template
+    [Documentation]   Test Suit Cleanup: Deleting Descriptors, instance and template
 
-    Run Keyword If Any Tests Failed  Delete NSI   ${slice_name}
+    Run Keyword If Any Tests Failed   Delete NSI   ${slice_name}
 
-    Run Keyword If Any Tests Failed  Delete NST   ${nst_name}
+    Run Keyword If Any Tests Failed   Delete NST   ${nst_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 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 VNFD   ${vnfd1_name}
+    Run Keyword If Any Tests Failed   Delete VNFD   ${vnfd2_name}