New test gitops02 for cluster registration, OKA and KSU in imported clusters 72/15172/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 23 Apr 2025 15:05:03 +0000 (17:05 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 23 Apr 2025 15:30:23 +0000 (17:30 +0200)
Change-Id: I5ab0daa91ef593ad613211951ba175f49c67dda2
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
robot-systest/lib/advanced_cluster_mgmt_lib.resource
robot-systest/testsuite/gitops_01-advanced_cluster_management.robot [deleted file]
robot-systest/testsuite/gitops_01-declarative_cluster_creation_oka_ksu.robot [new file with mode: 0644]
robot-systest/testsuite/gitops_02-declarative_cluster_registration_oka_ksu.robot [new file with mode: 0644]

index dc1621d..23b3c02 100644 (file)
@@ -25,6 +25,8 @@ Library   String
 ${SUCCESS_RETURN_CODE}   0
 ${CLUSTER_LAUNCH_MAX_WAIT_TIME}   12min
 ${CLUSTER_LAUNCH_POL_TIME}   30sec
+${CLUSTER_REGISTER_MAX_WAIT_TIME}   7min
+${CLUSTER_REGISTER_POL_TIME}   30sec
 ${CLUSTER_DELETE_MAX_WAIT_TIME}   12min
 ${CLUSTER_DELETE_POL_TIME}   30sec
 ${OKA_OPERATION_MAX_WAIT_TIME}   5min
@@ -54,6 +56,31 @@ Create Cluster
     ${cluster_id}=   Set Variable   ${stdout}
     Log   ${cluster_id}
     Check Cluster Age Keys   ${cluster_id}
+    IF   ${wait_flag} == True
+        Wait Until Keyword Succeeds   ${CLUSTER_REGISTER_MAX_WAIT_TIME}   ${CLUSTER_REGISTER_POL_TIME}
+        ...   Check For Cluster To Be Ready   ${name}
+    END
+    RETURN   ${cluster_id}
+
+Register Cluster
+    [Documentation]   Register a Kubernetes cluster in OSM using a provided name and kubeconfig credentials.
+    [Arguments]   ${name}   ${vim_account}   ${creds}   ${description}   ${bootstrap_flag}=True   ${wait_flag}=True
+    ${command}=   Catenate
+    ...   osm cluster-register ${name}
+    ...   --vim-account ${vim_account}
+    ...   --creds ${creds}
+    ...   --description ${description}
+    IF   ${bootstrap_flag} == True
+        Catenate   ${command}   --bootstrap
+    ELSE
+        Catenate   ${command}   --no-bootstrap
+    END
+    ${rc}   ${stdout}=   Run And Return Rc And Output   ${command}
+    Log   ${rc},${stdout}
+    Should Be Equal As Integers   ${rc}   ${SUCCESS_RETURN_CODE}   msg=Cluster registration failed: ${stdout}
+    ${cluster_id}=   Set Variable   ${stdout}
+    Log   ${cluster_id}
+    Check Cluster Age Keys   ${cluster_id}
     IF   ${wait_flag} == True
         Wait Until Keyword Succeeds   ${CLUSTER_LAUNCH_MAX_WAIT_TIME}   ${CLUSTER_LAUNCH_POL_TIME}
         ...   Check For Cluster To Be Ready   ${name}
@@ -75,7 +102,7 @@ Check Cluster Age Keys
     Log   pubkey is ${stdout}
 
 Delete Cluster
-    [Documentation]   Unregister/delete a Kubernetes cluster from OSM.
+    [Documentation]   Delete a Kubernetes cluster from OSM.
     [Arguments]   ${cluster_name}   ${wait_flag}=True
     ${rc}   ${stdout}=   Run And Return Rc And Output   osm cluster-delete ${cluster_name}
     Log   ${rc},${stdout}
@@ -85,6 +112,17 @@ Delete Cluster
         ...    Check For Cluster Deletion Status   ${cluster_name}
     END
 
+Deregister Cluster
+    [Documentation]   Deregister a Kubernetes cluster from OSM.
+    [Arguments]   ${cluster_name}   ${wait_flag}=True
+    ${rc}   ${stdout}=   Run And Return Rc And Output   osm cluster-deregister ${cluster_name}
+    Log   ${rc},${stdout}
+    Should Be Equal As Integers   ${rc}   ${SUCCESS_RETURN_CODE}   msg=Cluster deregistration failed: ${stdout}
+    IF   ${wait_flag} == True
+        Wait Until Keyword Succeeds   ${CLUSTER_DELETE_MAX_WAIT_TIME}   ${CLUSTER_DELETE_POL_TIME}
+        ...    Check For Cluster Deletion Status   ${cluster_name}
+    END
+
 Check For Cluster Deletion Status
     [Documentation]   Check if a Kubernetes cluster identified by name is deleted or in error state.
     [Arguments]   ${cluster_name}
@@ -236,10 +274,12 @@ Check For KSU To Be Deleted
     Log   ${matches}
     IF   ${matches} != @{EMPTY}
        Log   ${ksu_name} is a valid UUID
-       ${rc}   ${stdout}=   Run And Return Rc And Output   osm ksu-list --filter _id="${ksu_name}" | grep ${ksu_name}
+       # ${rc}   ${stdout}=   Run And Return Rc And Output   osm ksu-list --filter _id="${ksu_name}" | grep ${ksu_name}
+       ${rc}   ${stdout}=   Run And Return Rc And Output   osm ksu-list --filter _id="${ksu_name}" -o jsonpath='[*].name'| grep -E "\^${ksu_name}\$""
     ELSE
        Log   ${ksu_name} is not a valid UUID, so it will be treated as a name
-       ${rc}   ${stdout}=   Run And Return Rc And Output   osm ksu-list --filter name="${ksu_name}" | grep ${ksu_name}
+       # ${rc}   ${stdout}=   Run And Return Rc And Output   osm ksu-list --filter name="${ksu_name}" | grep ${ksu_name}
+       ${rc}   ${stdout}=   Run And Return Rc And Output   osm ksu-list --filter name="${ksu_name}" -o jsonpath='[*].name'| grep -E "\^${ksu_name}\$"
     END
     Log   ${rc},${stdout}
     Should Be Empty   ${stdout}
diff --git a/robot-systest/testsuite/gitops_01-advanced_cluster_management.robot b/robot-systest/testsuite/gitops_01-advanced_cluster_management.robot
deleted file mode 100644 (file)
index 14c31af..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-*** 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
-#
-#       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.
-
-
-*** Settings ***
-Documentation   [GITOPS-01] Advanced Cluster Management.
-
-Library   OperatingSystem
-Library   String
-Library   Collections
-Library   Process
-
-Resource   ../lib/advanced_cluster_mgmt_lib.resource
-
-Test Tags   gitops_01   cluster_gitops
-
-# Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
-
-
-*** Variables ***
-# OKA packages
-${OKA_FOLDER}   '%{PACKAGES_FOLDER}/oka'
-${OKA1_PKG}   apps/testacme
-${OKA1_NAME}   testacme
-${OKA1_PROFILE}   app-profile
-${OKA2_PKG}   apps/jenkins
-${OKA2_NAME}   jenkins
-${OKA2_PROFILE}   app-profile
-${OKA_NS_PKG}   apps/namespace
-${OKA_NS_NAME}   namespace
-${OKA_NS_PROFILE}   app-profile
-
-# Cluster
-${CLUSTER_NAME}   gitops01
-${CLUSTER_DESCRIPTION}   "Cluster for gitops01 Robot test suite"
-${CLUSTER_VM_SIZE}   Standard_D2_v2
-${CLUSTER_NODES}   2
-${REGION_NAME}   northeurope
-${RESOURCE_GROUP}   OSM-CTIO
-${KUBERNETES_VERSION}   "1.30"
-
-# KSUs
-${KSU1_NAME}   testacme
-${KSU_NS_NAME}   jenkins-ns
-${KSU2_NAME}   jenkins
-${KSU3_NAME}   jenkinsbis
-
-
-*** Test Cases ***
-Add OKA Packages For The Testsuite
-    [Documentation]   Add OKA packages for the testsuite.
-    [Tags]   oka   create
-    Add OKA Package   ${OKA_NS_NAME}   '${OKA_FOLDER}/${OKA_NS_PKG}'   ${OKA_NS_PROFILE}
-    Add OKA Package   ${OKA1_NAME}   '${OKA_FOLDER}/${OKA1_PKG}'   ${OKA1_PROFILE}
-    Add OKA Package   ${OKA2_NAME}   '${OKA_FOLDER}/${OKA2_PKG}'   ${OKA2_PROFILE}
-
-Create Cluster For Testsuite in Azure
-    [Documentation]   Create K8s cluster for the testsuite.
-    [Tags]   cluster   create
-    ${id}=   Create Cluster   ${CLUSTER_NAME}   %{VIM_TARGET}   ${CLUSTER_DESCRIPTION}   ${CLUSTER_VM_SIZE}   ${KUBERNETES_VERSION}   ${CLUSTER_NODES}   ${REGION_NAME}   ${RESOURCE_GROUP}
-    Set Suite Variable   ${CLUSTER_ID}   ${id}
-    Log   ${CLUSTER_ID}
-
-Get Cluster Kubeconfig
-    [Documentation]   Get Kubeconfig for the cluster.
-    [Tags]   cluster
-    ${rc}   ${stdout}=   Run And Return Rc And Output
-    ...    osm cluster-show ${CLUSTER_NAME} -o jsonpath='{.credentials}' | yq -y
-    Should Be Equal As Integers   ${rc}   ${SUCCESS_RETURN_CODE}
-    Log   ${stdout}
-
-Create KSU Namespace For All KSUs
-    [Documentation]   Create KSU based on ${OKA_NS_NAME} with params.
-    [Tags]   ksu   ksu-ns   create
-    ${id}=   Create KSU   ${KSU_NS_NAME}   ${KSU_NS_NAME}   ${CLUSTER_NAME}   app-profile   ${OKA_NS_NAME}   ${OKA_FOLDER}/apps/jenkins-ns-params.yaml
-    Set Suite Variable   ${KSU_NS_ID}   ${id}
-    Log   ${KSU_NS_ID}
-
-Create KSU1 Without Params
-    [Documentation]   Create KSU based on ${OKA1_NAME} without params (default namespace).
-    [Tags]   ksu   ksu1   create
-    ${id}=   Create KSU   ${KSU1_NAME}   ${KSU1_NAME}   ${CLUSTER_NAME}   app-profile   ${OKA1_NAME}
-    Set Suite Variable   ${KSU1_ID}   ${id}
-    Log   ${KSU1_ID}
-
-Create KSU2 With Params
-    [Documentation]   Create KSU based on ${OKA2_NAME} with params.
-    [Tags]   ksu   ksu2   create
-    ${id}=   Create KSU   ${KSU2_NAME}   ${KSU2_NAME}   ${CLUSTER_NAME}   app-profile   ${OKA2_NAME}   ${OKA_FOLDER}/apps/jenkins-params.yaml
-    Set Suite Variable   ${KSU2_ID}   ${id}
-    Log   ${KSU2_ID}
-
-Create KSU3 With Params
-    [Documentation]   Create KSU based on ${OKA2_NAME} with same params as KSU2.
-    [Tags]   ksu   ksu3   create
-    ${id}=   Create KSU   ${KSU3_NAME}   ${KSU3_NAME}   ${CLUSTER_NAME}   app-profile   ${OKA2_NAME}   ${OKA_FOLDER}/apps/jenkins-params.yaml
-    Set Suite Variable   ${KSU3_ID}   ${id}
-    Log   ${KSU3_ID}
-
-Delete KSU3
-    [Documentation]   Delete KSU3 based on ${OKA2_NAME}.
-    [Tags]   cleanup   ksu   ksu3
-    Delete KSU   ${KSU3_ID}
-
-Delete KSU2
-    [Documentation]   Delete KSU2 based on ${OKA2_NAME}.
-    [Tags]   cleanup   ksu   ksu2
-    Delete KSU   ${KSU2_ID}
-
-Delete KSU1
-    [Documentation]   Delete KSU1 based on ${OKA1_NAME}.
-    [Tags]   cleanup   ksu   ksu1
-    Delete KSU   ${KSU1_NAME}
-
-Delete KSU Namespace
-    [Documentation]   Delete KSU based on ${OKA_NS_NAME}.
-    [Tags]   cleanup   ksu   ksu-ns
-    Delete KSU   ${KSU_NS_ID}
-
-Delete Cluster For Testsuite
-    [Documentation]   Delete K8s cluster for the testsuite.
-    [Tags]   cleanup   cluster
-    Delete Cluster   ${CLUSTER_NAME}
-
-Delete OKA Packages For The Testsuite
-    [Documentation]   Delete OKA packages for the testsuite.
-    [Tags]   cleanup   oka
-    Delete OKA Package   ${OKA_NS_NAME}
-    Delete OKA Package   ${OKA1_NAME}
-    Delete OKA Package   ${OKA2_NAME}
-
-
-*** Keywords ***
-Suite Cleanup
-    [Documentation]   Test Suit Cleanup: Deleting cluster, KSUs, OKAs
-    Run Keyword If Any Tests Failed   Delete Cluster   ${CLUSTER_NAME}
-    Run Keyword If Any Tests Failed   Delete OKA Package   ${OKA_NS_NAME}
-    Run Keyword If Any Tests Failed   Delete OKA Package   ${OKA1_NAME}
-    Run Keyword If Any Tests Failed   Delete OKA Package   ${OKA2_NAME}
diff --git a/robot-systest/testsuite/gitops_01-declarative_cluster_creation_oka_ksu.robot b/robot-systest/testsuite/gitops_01-declarative_cluster_creation_oka_ksu.robot
new file mode 100644 (file)
index 0000000..a6bb19a
--- /dev/null
@@ -0,0 +1,149 @@
+*** 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
+#
+#       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.
+
+
+*** Settings ***
+Documentation   [GITOPS-01] Advanced Cluster Management. Cluster creation
+
+Library   OperatingSystem
+Library   String
+Library   Collections
+Library   Process
+
+Resource   ../lib/advanced_cluster_mgmt_lib.resource
+
+Test Tags   gitops_01   cluster_gitops
+
+Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
+
+
+*** Variables ***
+# OKA packages
+${OKA_FOLDER}   '%{PACKAGES_FOLDER}/oka'
+${OKA1_PKG}   apps/testacme
+${OKA1_NAME}   testacme
+${OKA1_PROFILE}   app-profile
+${OKA2_PKG}   apps/jenkins
+${OKA2_NAME}   jenkins
+${OKA2_PROFILE}   app-profile
+${OKA_NS_PKG}   apps/namespace
+${OKA_NS_NAME}   namespace
+${OKA_NS_PROFILE}   app-profile
+
+# Cluster
+${CLUSTER_NAME}   gitops01
+${CLUSTER_DESCRIPTION}   "Cluster for gitops01 Robot test suite"
+${CLUSTER_VM_SIZE}   Standard_D2_v2
+${CLUSTER_NODES}   2
+${REGION_NAME}   northeurope
+${RESOURCE_GROUP}   OSM-CTIO
+${KUBERNETES_VERSION}   "1.30"
+
+# KSUs
+${KSU1_NAME}   testacme
+${KSU_NS_NAME}   jenkins-ns
+${KSU2_NAME}   jenkins
+${KSU3_NAME}   jenkinsbis
+
+
+*** Test Cases ***
+Add OKA Packages For The Testsuite
+    [Documentation]   Add OKA packages for the testsuite.
+    [Tags]   oka   create
+    Add OKA Package   ${OKA_NS_NAME}   '${OKA_FOLDER}/${OKA_NS_PKG}'   ${OKA_NS_PROFILE}
+    Add OKA Package   ${OKA1_NAME}   '${OKA_FOLDER}/${OKA1_PKG}'   ${OKA1_PROFILE}
+    Add OKA Package   ${OKA2_NAME}   '${OKA_FOLDER}/${OKA2_PKG}'   ${OKA2_PROFILE}
+
+Create Cluster For Testsuite in Azure
+    [Documentation]   Create K8s cluster for the testsuite.
+    [Tags]   cluster   create
+    ${id}=   Create Cluster   ${CLUSTER_NAME}   %{VIM_TARGET}   ${CLUSTER_DESCRIPTION}   ${CLUSTER_VM_SIZE}   ${KUBERNETES_VERSION}   ${CLUSTER_NODES}   ${REGION_NAME}   ${RESOURCE_GROUP}
+    Set Suite Variable   ${CLUSTER_ID}   ${id}
+    Log   ${CLUSTER_ID}
+
+Get Cluster Kubeconfig
+    [Documentation]   Get Kubeconfig for the cluster.
+    [Tags]   cluster
+    ${rc}   ${stdout}=   Run And Return Rc And Output
+    ...    osm cluster-show ${CLUSTER_NAME} -o jsonpath='{.credentials}' | yq -y
+    Should Be Equal As Integers   ${rc}   ${SUCCESS_RETURN_CODE}
+    Log   ${stdout}
+
+Create KSU Namespace For All KSUs
+    [Documentation]   Create KSU based on ${OKA_NS_NAME} with params.
+    [Tags]   ksu   ksu-ns   create
+    ${id}=   Create KSU   ${KSU_NS_NAME}   ${KSU_NS_NAME}   ${CLUSTER_NAME}   app-profile   ${OKA_NS_NAME}   ${OKA_FOLDER}/apps/jenkins-ns-params.yaml
+    Set Suite Variable   ${KSU_NS_ID}   ${id}
+    Log   ${KSU_NS_ID}
+
+Create KSU1 Without Params
+    [Documentation]   Create KSU based on ${OKA1_NAME} without params (default namespace).
+    [Tags]   ksu   ksu1   create
+    ${id}=   Create KSU   ${KSU1_NAME}   ${KSU1_NAME}   ${CLUSTER_NAME}   app-profile   ${OKA1_NAME}
+    Set Suite Variable   ${KSU1_ID}   ${id}
+    Log   ${KSU1_ID}
+
+Create KSU2 With Params
+    [Documentation]   Create KSU based on ${OKA2_NAME} with params.
+    [Tags]   ksu   ksu2   create
+    ${id}=   Create KSU   ${KSU2_NAME}   ${KSU2_NAME}   ${CLUSTER_NAME}   app-profile   ${OKA2_NAME}   ${OKA_FOLDER}/apps/jenkins-params.yaml
+    Set Suite Variable   ${KSU2_ID}   ${id}
+    Log   ${KSU2_ID}
+
+Create KSU3 With Params
+    [Documentation]   Create KSU based on ${OKA2_NAME} with same params as KSU2.
+    [Tags]   ksu   ksu3   create
+    ${id}=   Create KSU   ${KSU3_NAME}   ${KSU3_NAME}   ${CLUSTER_NAME}   app-profile   ${OKA2_NAME}   ${OKA_FOLDER}/apps/jenkins-params.yaml
+    Set Suite Variable   ${KSU3_ID}   ${id}
+    Log   ${KSU3_ID}
+
+Delete KSU3
+    [Documentation]   Delete KSU3 based on ${OKA2_NAME}.
+    [Tags]   cleanup   ksu   ksu3
+    Delete KSU   ${KSU3_ID}
+
+Delete KSU2
+    [Documentation]   Delete KSU2 based on ${OKA2_NAME}.
+    [Tags]   cleanup   ksu   ksu2
+    Delete KSU   ${KSU2_ID}
+
+Delete KSU1
+    [Documentation]   Delete KSU1 based on ${OKA1_NAME}.
+    [Tags]   cleanup   ksu   ksu1
+    Delete KSU   ${KSU1_NAME}
+
+Delete KSU Namespace
+    [Documentation]   Delete KSU based on ${OKA_NS_NAME}.
+    [Tags]   cleanup   ksu   ksu-ns
+    Delete KSU   ${KSU_NS_ID}
+
+Delete Cluster For Testsuite
+    [Documentation]   Delete K8s cluster for the testsuite.
+    [Tags]   cleanup   cluster
+    Delete Cluster   ${CLUSTER_NAME}
+
+Delete OKA Packages For The Testsuite
+    [Documentation]   Delete OKA packages for the testsuite.
+    [Tags]   cleanup   oka
+    Delete OKA Package   ${OKA_NS_NAME}
+    Delete OKA Package   ${OKA1_NAME}
+    Delete OKA Package   ${OKA2_NAME}
+
+
+*** Keywords ***
+Suite Cleanup
+    [Documentation]   Test Suit Cleanup: Deleting cluster, KSUs, OKAs
+    Run Keyword If Any Tests Failed   Delete Cluster   ${CLUSTER_NAME}
+    Run Keyword If Any Tests Failed   Delete OKA Package   ${OKA_NS_NAME}
+    Run Keyword If Any Tests Failed   Delete OKA Package   ${OKA1_NAME}
+    Run Keyword If Any Tests Failed   Delete OKA Package   ${OKA2_NAME}
diff --git a/robot-systest/testsuite/gitops_02-declarative_cluster_registration_oka_ksu.robot b/robot-systest/testsuite/gitops_02-declarative_cluster_registration_oka_ksu.robot
new file mode 100644 (file)
index 0000000..4f3a07a
--- /dev/null
@@ -0,0 +1,149 @@
+*** 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
+#
+#       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.
+
+
+*** Settings ***
+Documentation   [GITOPS-02] Advanced Cluster Management. Cluster registration
+
+Library   OperatingSystem
+Library   String
+Library   Collections
+Library   Process
+
+Resource   ../lib/advanced_cluster_mgmt_lib.resource
+
+Test Tags   gitops_02   cluster_gitops
+
+# Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
+
+
+*** Variables ***
+# OKA packages
+${OKA_FOLDER}   '%{PACKAGES_FOLDER}/oka'
+${OKA1_PKG}   apps/testacme
+${OKA1_NAME}   testacme
+${OKA1_PROFILE}   app-profile
+${OKA2_PKG}   apps/jenkins
+${OKA2_NAME}   jenkins
+${OKA2_PROFILE}   app-profile
+${OKA_NS_PKG}   apps/namespace
+${OKA_NS_NAME}   namespace
+${OKA_NS_PROFILE}   app-profile
+
+# Cluster
+${CLUSTER_NAME}   cl-madrid-norte1
+${CLUSTER_DESCRIPTION}   "Cluster for gitops02 Robot test suite"
+
+# KSUs
+${KSU_NS_NAME}   jenkins-ns
+${KSU1_NAME}   testacme
+${KSU2_NAME}   jenkins
+${KSU_NS_ID}   ${EMPTY}
+${KSU1_ID}   ${EMPTY}
+${KSU2_ID}   ${EMPTY}
+
+
+*** Test Cases ***
+Add OKA Packages For The Testsuite
+    [Documentation]   Add OKA packages for the testsuite.
+    [Tags]   oka   create
+    Add OKA Package   ${OKA_NS_NAME}   '${OKA_FOLDER}/${OKA_NS_PKG}'   ${OKA_NS_PROFILE}
+    Add OKA Package   ${OKA1_NAME}   '${OKA_FOLDER}/${OKA1_PKG}'   ${OKA1_PROFILE}
+    Add OKA Package   ${OKA2_NAME}   '${OKA_FOLDER}/${OKA2_PKG}'   ${OKA2_PROFILE}
+
+Register Cluster For Testsuite
+    [Documentation]   Register K8s cluster for the testsuite.
+    [Tags]   cluster   create
+    ${id}=   Register Cluster   ${CLUSTER_NAME}   %{VIM_TARGET}   %{CLUSTER_KUBECONFIG_CREDENTIALS}   ${CLUSTER_DESCRIPTION}
+    Set Suite Variable   ${CLUSTER_ID}   ${id}
+    Log   ${CLUSTER_ID}
+
+Get Cluster Kubeconfig
+    [Documentation]   Get Kubeconfig for the cluster.
+    [Tags]   cluster
+    ${rc}   ${stdout}=   Run And Return Rc And Output
+    ...    osm cluster-show ${CLUSTER_NAME} -o jsonpath='{.credentials}' | yq -y
+    Should Be Equal As Integers   ${rc}   ${SUCCESS_RETURN_CODE}
+    Log   ${stdout}
+
+Create KSU Namespace For All KSUs
+    [Documentation]   Create KSU based on ${OKA_NS_NAME} with params.
+    [Tags]   ksu   ksu-ns   create
+    ${id}=   Create KSU   ${KSU_NS_NAME}   ${KSU_NS_NAME}   ${CLUSTER_NAME}   app-profile   ${OKA_NS_NAME}   ${OKA_FOLDER}/apps/jenkins-ns-params.yaml
+    Set Suite Variable   ${KSU_NS_ID}   ${id}
+    Log   ${KSU_NS_ID}
+
+Create KSU1 Without Params
+    [Documentation]   Create KSU based on ${OKA1_NAME} without params (default namespace).
+    [Tags]   ksu   ksu1   create
+    ${id}=   Create KSU   ${KSU1_NAME}   ${KSU1_NAME}   ${CLUSTER_NAME}   app-profile   ${OKA1_NAME}
+    Set Suite Variable   ${KSU1_ID}   ${id}
+    Log   ${KSU1_ID}
+
+Create KSU2 With Params
+    [Documentation]   Create KSU based on ${OKA2_NAME} with params.
+    [Tags]   ksu   ksu2   create
+    ${id}=   Create KSU   ${KSU2_NAME}   ${KSU2_NAME}   ${CLUSTER_NAME}   app-profile   ${OKA2_NAME}   ${OKA_FOLDER}/apps/jenkins-params.yaml
+    Set Suite Variable   ${KSU2_ID}   ${id}
+    Log   ${KSU2_ID}
+
+Delete KSU2
+    [Documentation]   Delete KSU2 based on ${OKA2_NAME}.
+    [Tags]   cleanup   ksu   ksu2
+    IF   '${KSU2_ID}' != ''
+       ${KSU_TO_BE_DELETED}=   Set Variable   ${KSU2_ID}
+    ELSE
+       ${KSU_TO_BE_DELETED}=   Set Variable   ${KSU2_NAME}
+    END
+    Delete KSU   ${KSU_TO_BE_DELETED}
+
+Delete KSU1
+    [Documentation]   Delete KSU1 based on ${OKA1_NAME}.
+    [Tags]   cleanup   ksu   ksu1
+    IF   '${KSU1_ID}' != ''
+       ${KSU_TO_BE_DELETED}=   Set Variable   ${KSU1_ID}
+    ELSE
+       ${KSU_TO_BE_DELETED}=   Set Variable   ${KSU1_NAME}
+    END
+    Delete KSU   ${KSU_TO_BE_DELETED}
+
+Delete KSU Namespace
+    [Documentation]   Delete KSU based on ${OKA_NS_NAME}.
+    [Tags]   cleanup   ksu   ksu-ns
+    IF   '${KSU_NS_ID}' != ''
+       ${KSU_TO_BE_DELETED}=   Set Variable   ${KSU_NS_ID}
+    ELSE
+       ${KSU_TO_BE_DELETED}=   Set Variable   ${KSU_NS_NAME}
+    END
+    Delete KSU   ${KSU_TO_BE_DELETED}
+
+Deregister Cluster For Testsuite
+    [Documentation]   Deregister K8s cluster for the testsuite.
+    [Tags]   cleanup   cluster
+    Deregister Cluster   ${CLUSTER_NAME}
+
+Delete OKA Packages For The Testsuite
+    [Documentation]   Delete OKA packages for the testsuite.
+    [Tags]   cleanup   oka
+    Delete OKA Package   ${OKA_NS_NAME}
+    Delete OKA Package   ${OKA1_NAME}
+    Delete OKA Package   ${OKA2_NAME}
+
+
+*** Keywords ***
+Suite Cleanup
+    [Documentation]   Test Suit Cleanup: Deleting cluster, KSUs, OKAs
+    Run Keyword If Any Tests Failed   Deregister Cluster   ${CLUSTER_NAME}
+    Run Keyword If Any Tests Failed   Delete OKA Package   ${OKA_NS_NAME}
+    Run Keyword If Any Tests Failed   Delete OKA Package   ${OKA1_NAME}
+    Run Keyword If Any Tests Failed   Delete OKA Package   ${OKA2_NAME}