python3 -m pip install -r /robot-systest/conformance-tests/requirements.txt
}
-create_vim(){
+create_k8scluster(){
+ attempts=3
+ while [ $attempts -ge 0 ] ; do
+ echo -e "\n$( date '+%F_%H:%M:%S' ) Creating K8s Cluster"
+
+ osm k8scluster-add --creds ${K8S_CREDENTIALS} --version "v1" --vim ${VIM_TARGET} --k8s-nets "{\"net1\": \"%{VIM_MGMT_NET}\"}" ${VIM_TARGET} --description "Robot cluster"
+
+ STATUS=""
+ i=0
+ while [[ ${STATUS} != "ENABLED" ]]
+ do
+ ((i++))
+ if [[ $i -eq 5 ]]; then
+ echo "K8s cluster stuck for more than 50 seconds:"
+ osm k8scluster-show ${VIM_TARGET}
+ osm k8scluster-delete ${VIM_TARGET}
+ sleep 5
+ break
+ fi
+ sleep 10
+ STATUS=`osm k8scluster-list | grep ${VIM_TARGET} | awk '{print $8}'`
+ done
+ if [[ ${STATUS} = "ENABLED" ]] ; then
+ break
+ fi
+ ((attempts--))
+ done
+ if [ $attempts -lt 0 ] ; then
+ echo "VIM failed to enter ENABLED state"
+ exit 1
+ fi
+}
+
+create_vim(){
attempts=3
while [ $attempts -ge 0 ] ; do
echo -e "\n$( date '+%F_%H:%M:%S' ) Creating VIM ${VIM_TARGET}"
;;
-c|--createvim)
create_vim
+ create_k8scluster
shift 1
;;
-T)
-p <package_branch> [OPTIONAL]: OSM packages repository branch. Default: master
-t <testing_tags> [OPTIONAL]: Robot tests tags. [sanity, daily, regression, particular_test]. Default: sanity
-T <testing_branch> [OPTIONAL]: Run SOL005 Robot conformance tests
- -c To create a VIM for the tests
+ -c To create a VIM and K8s cluster for the tests
Volumes:
<path_to_reports> [OPTIONAL]: It is the absolute path to reports location in the host
Library Process
Resource %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot
+Resource %{ROBOT_DEVOPS_FOLDER}/lib/vim_lib.robot
+
+Variables %{ROBOT_DEVOPS_FOLDER}/resources/basic_01-crud_operations_on_vim_targets_data.py
Force Tags k8s_02 cluster_k8s daily regression
${k8scluster_version} v1
*** Test Cases ***
+Create VIM Target Basic
+ [Documentation] Creates a VIM for the K8s cluster to be anchored against
+
+ ${rand}= Generate Random String 6 [NUMBERS]
+ ${vim_name}= Catenate SEPARATOR=_ ${vim_name_prefix} ${rand}
+ Set Suite Variable ${vim_name}
+ ${created_vim_account_id}= Create VIM Target ${vim_name} ${vim_user} ${vim_password} ${vim_auth_url} ${vim_tenant} ${vim_account_type}
+ Set Suite Variable ${created_vim_account_id}
+
Add K8s Cluster To OSM
- Create K8s Cluster %{K8S_CREDENTIALS} ${k8scluster_version} %{VIM_TARGET} %{VIM_MGMT_NET} ${k8scluster_name}
+ Create K8s Cluster %{K8S_CREDENTIALS} ${k8scluster_version} ${vim_name} %{VIM_MGMT_NET} ${k8scluster_name}
Remove K8s Cluster from OSM
[Tags] cleanup
Delete K8s Cluster ${k8scluster_name}
+Delete VIM Target By ID
+ [Documentation] Delete the VIM Target created in previous test-case by its ID.
+ ... Checks whether the VIM Target was created or not before perform the deletion.
+ [Tags] cleanup
+
+ ${vim_account_id}= Get VIM Target ID ${vim_name}
+ Should Be Equal As Strings ${vim_account_id} ${created_vim_account_id}
+ Delete VIM Target ${vim_account_id}
+
+
*** Keywords ***
Suite Cleanup
[Documentation] Test Suit Cleanup: Deleting K8s Cluster
*** Variables ***
-# K8s cluster name and version
-${k8scluster_name} k8s03
-${k8scluster_version} v1
-
# NS and VNF descriptor package folder and ids
${vnfd_pkg} charm-packages/native_k8s_charm_vnf
${vnfd_name} native_k8s_charm-vnf
Create Simple K8s Descriptor
Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
-Add K8s Cluster To OSM
- Create K8s Cluster %{K8S_CREDENTIALS} ${k8scluster_version} %{VIM_TARGET} %{VIM_MGMT_NET} ${k8scluster_name}
-
Network Service K8s Instance Test
${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
Set Suite Variable ${ns_id} ${id}
[Tags] cleanup
Delete NS ${ns_name}
-Remove K8s Cluster from OSM
- [Tags] cleanup
- Delete K8s Cluster ${k8scluster_name}
-
Delete NS Descriptor Test
[Tags] cleanup
Delete NSD ${nsd_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}
- Run Keyword If Any Tests Failed Delete K8s Cluster ${k8scluster_name}
*** Variables ***
-# K8s cluster name and version
-${k8scluster_name} k8s04
-${k8scluster_version} v1
-
# NS and VNF descriptor package folder and ids
${vnfd_pkg} openldap_knf
${vnfd_name} openldap_knf
[Tags] prepare
Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
-Add K8s Cluster To OSM
- [Tags] prepare
- Create K8s Cluster %{K8S_CREDENTIALS} ${k8scluster_version} %{VIM_TARGET} %{VIM_MGMT_NET} ${k8scluster_name}
-
Create Network Service Instance
[Tags] prepare
${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
[Tags] cleanup
Delete NS ${ns_name}
-Remove K8s Cluster from OSM
- [Tags] cleanup
- Delete K8s Cluster ${k8scluster_name}
-
Delete NS Descriptor Test
[Tags] cleanup
Delete NSD ${nsd_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}
- Run Keyword If Any Tests Failed Delete K8s Cluster ${k8scluster_name}
*** Variables ***
-# K8s cluster name and version
-${k8scluster_name} k8s08
-${k8scluster_version} v1
-
# NS and VNF descriptor package folder and ids
${vnfd_pkg} charm-packages/native_k8s_scale_charm_vnf
${vnfd_name} native_k8s_scale_charm-vnf
Create Simple K8s Scale NS Descriptor
Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
-Add K8s Cluster To OSM
- Create K8s Cluster %{K8S_CREDENTIALS} ${k8scluster_version} %{VIM_TARGET} %{VIM_MGMT_NET} ${k8scluster_name}
-
Network Service K8s Instance Test
${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
Set Suite Variable ${ns_id} ${id}
[Tags] cleanup
Delete NS ${ns_name}
-Remove K8s Cluster from OSM
- [Tags] cleanup
- Delete K8s Cluster ${k8scluster_name}
-
Delete NS Descriptor Test
[Tags] cleanup
Delete NSD ${nsd_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}
- Run Keyword If Any Tests Failed Delete K8s Cluster ${k8scluster_name}
*** Variables ***
-# K8s cluster name and version
-${k8scluster_name} k8s-test
-${k8scluster_version} v1
-
# NS and VNF descriptor package folder and ids
${vnfd_pkg} charm-packages/pebble_charm_vnf
${vnfd_name} pebble_charm-vnf
Create Simple K8s Descriptor
Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
-Add K8s Cluster To OSM
- Create K8s Cluster %{K8S_CREDENTIALS} ${k8scluster_version} %{VIM_TARGET} %{VIM_MGMT_NET} ${k8scluster_name}
-
Network Service K8s Instance Test
${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
Set Suite Variable ${ns_id} ${id}
[Tags] cleanup
Delete NS ${ns_name}
-Remove K8s Cluster from OSM
- [Tags] cleanup
- Delete K8s Cluster ${k8scluster_name}
-
Delete NS Descriptor Test
[Tags] cleanup
Delete NSD ${nsd_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}
- Run Keyword If Any Tests Failed Delete K8s Cluster ${k8scluster_name}