[VOL-3717] Allowing to pass the olt type via pod-configs yaml file
Change-Id: Ic3873d05d15b40bbbac02eb1d221644a7aaa4c56
diff --git a/libraries/k8s.robot b/libraries/k8s.robot
index 59e6544..213246e 100644
--- a/libraries/k8s.robot
+++ b/libraries/k8s.robot
@@ -326,6 +326,20 @@
... kubectl scale --replicas=${count} -n ${namespace} deploy/${name}
Should Be Equal as Integers ${rc} 0
+Get K8s Deployment by Pod Label
+ [Arguments] ${namespace} ${key} ${value}
+ [Documentation] Uses kubectl to scale a deployment given the app name of the pod
+ ${rc} ${name} Run And Return Rc And Output
+ ... kubectl describe rs -n ${namespace} -l ${key}=${value} | grep "Controlled By" | awk -F'/' '{print $2}'
+ Should Be Equal as Integers ${rc} 0
+ [Return] ${name}
+
+Scale K8s Deployment by Pod Label
+ [Arguments] ${namespace} ${key} ${value} ${count}
+ [Documentation] Uses kubectl to scale a deployment given the app name of the pod
+ ${name} Get K8s Deployment by Pod Label ${namespace} ${key} ${value}
+ Scale K8s Deployment ${namespace} ${name} ${count}
+
Pod Exists
[Arguments] ${namespace} ${name}
[Documentation] Succeeds it the named POD exists
@@ -366,6 +380,12 @@
... ELSE Set Variable ${count}
[Return] ${result}
+Check Expected Available Deployment Replicas By Pod Label
+ [Arguments] ${namespace} ${key} ${value} ${expected}
+ [Documentation] Succeeds if the named deployment has the expected number of available replicas
+ ${name} Get K8s Deployment by Pod Label ${namespace} ${key} ${value}
+ Check Expected Available Deployment Replicas ${namespace} ${name} ${expected}
+
Check Expected Available Deployment Replicas
[Arguments] ${namespace} ${name} ${expected}
[Documentation] Succeeds if the named deployment has the expected number of available replicas
diff --git a/libraries/utils.robot b/libraries/utils.robot
index 36ccb6f..e54ea22 100755
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -71,10 +71,11 @@
${pass} Evaluate ${olts}[${I}].get("pass")
${serial_number} Evaluate ${olts}[${I}].get("serial")
${olt_ssh_ip} Evaluate ${olts}[${I}].get("sship")
+ ${type} Evaluate ${olts}[${I}].get("type")
${onu_count}= Get ONU Count For OLT ${hosts.src} ${serial_number}
${onu_list}= Get ONU List For OLT ${hosts.src} ${serial_number}
${olt} Create Dictionary ip ${ip} user ${user} pass
- ... ${pass} sn ${serial_number} onucount ${onu_count}
+ ... ${pass} sn ${serial_number} onucount ${onu_count} type ${type}
... sship ${olt_ssh_ip} onus ${onu_list}
Append To List ${list_olts} ${olt}
END
@@ -89,7 +90,7 @@
Set Suite Variable ${list_olts}
${olt_count}= Get Length ${list_olts}
Set Suite Variable ${olt_count}
- @{container_list}= Create List adapter-open-olt adapter-open-onu voltha-api-server
+ @{container_list}= Create List ${OLT_ADAPTER_APP_LABEL} adapter-open-onu voltha-api-server
... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent
Set Suite Variable ${container_list}
${datetime}= Get Current Date
@@ -555,7 +556,9 @@
${olt_ids} Create List
FOR ${I} IN RANGE 0 ${num_olts}
#create/preprovision device
- ${olt_device_id}= Create Device ${list_olts}[${I}][ip] ${OLT_PORT}
+ ${olt_device_id}= Run Keyword If "${list_olts}[${I}][type]" == "${None}"
+ ... Create Device ${list_olts}[${I}][ip] ${OLT_PORT}
+ ... ELSE Create Device ${list_olts}[${I}][ip] ${OLT_PORT} ${list_olts}[${I}][type]
${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
#Set Suite Variable ${olt_device_id}
#validate olt states