New test gitops02 for cluster registration, OKA and KSU in imported clusters
Change-Id: I5ab0daa91ef593ad613211951ba175f49c67dda2
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/robot-systest/lib/advanced_cluster_mgmt_lib.resource b/robot-systest/lib/advanced_cluster_mgmt_lib.resource
index dc1621d..23b3c02 100644
--- a/robot-systest/lib/advanced_cluster_mgmt_lib.resource
+++ b/robot-systest/lib/advanced_cluster_mgmt_lib.resource
@@ -25,6 +25,8 @@
${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
@@ -55,6 +57,31 @@
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}
END
@@ -75,7 +102,7 @@
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 @@
... 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 @@
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}