[VOL-4252] Parsing ETCD by label
Change-Id: I157bdd51130f88095a89e933d7c265e044dae928
diff --git a/libraries/k8s.robot b/libraries/k8s.robot
index 815cec4..89c5fca 100755
--- a/libraries/k8s.robot
+++ b/libraries/k8s.robot
@@ -117,10 +117,10 @@
[return] ${stdout} ${stderr}
Copy File To Pod
- [Arguments] ${namespace} ${name} ${src} ${dest}
+ [Arguments] ${namespace} ${label} ${src} ${dest}
[Documentation] Uses kubectl to copy a file to a pod
${rc} ${exec_pod_name}= Run and Return Rc and Output
- ... kubectl get pods -n ${namespace} | grep ${name} | awk 'NR==1{print $1}'
+ ... kubectl get pods -n ${namespace} -l ${label} --no-headers | awk 'NR==1{print $1}'
Log ${exec_pod_name}
Should Not Be Empty ${exec_pod_name} Unable to parse pod name
${rc} ${output}= Run and Return Rc and Output
diff --git a/libraries/onu_utilities.robot b/libraries/onu_utilities.robot
index 3e552be..903b656 100755
--- a/libraries/onu_utilities.robot
+++ b/libraries/onu_utilities.robot
@@ -209,15 +209,17 @@
Log To Console \nTechProfile:${TechProfile}
${namespace}= Set Variable default
${podname}= Set Variable etcd
+ ${label}= Set Variable app.kubernetes.io/name=${podname}
${src}= Set Variable ${data_dir}/TechProfile-${TechProfile}.json
${dest}= Set Variable /tmp/flexpod.json
${command} Catenate
... /bin/sh -c 'cat ${dest} | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/64'
- Copy File To Pod ${namespace} ${podname} ${src} ${dest}
+ Copy File To Pod ${namespace} ${label} ${src} ${dest}
Exec Pod In Kube ${namespace} ${podname} ${command}
${commandget} Catenate
... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
- Exec Pod In Kube ${namespace} ${podname} ${commandget}
+ ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
+ Should Not Be Empty ${result} No Tech Profile stored in etcd!
Remove Tech Profile
[Documentation] This keyword removes TechProfile