Change necessary due to switch over to bitnami versions of etcd and kafka
Change-Id: I67d549b607958416737c10790747bd5d89e706d0
diff --git a/libraries/k8s.robot b/libraries/k8s.robot
old mode 100755
new mode 100644
index 09db866..59e6544
--- a/libraries/k8s.robot
+++ b/libraries/k8s.robot
@@ -63,6 +63,19 @@
Log ${output}
[return] ${output}
+Exec Pod In Kube
+ [Arguments] ${namespace} ${name} ${command}
+ [Documentation] Uses kubectl to execute a command in the pod and return the output
+ ${rc} ${exec_pod_name}= Run and Return Rc and Output
+ ... kubectl -n ${namespace} get pods -l app.kubernetes.io/name=${name} -o name
+ Log ${exec_pod_name}
+ Should Not Be Empty ${exec_pod_name} Unable to parse pod name
+ ${rc} ${output}= Run and Return Rc and Output
+ ... kubectl exec -i ${exec_pod_name} -n ${namespace} -- ${command}
+ Log ${output}
+ [return] ${output}
+
+
Exec Pod Separate Stderr
[Arguments] ${namespace} ${name} ${command}
[Documentation] Uses kubectl to execute a command in the pod and return the stderr and stdout
diff --git a/tests/openonu-go-adapter/Voltha_ONUStateTests.robot b/tests/openonu-go-adapter/Voltha_ONUStateTests.robot
index 61b2211..608580b 100755
--- a/tests/openonu-go-adapter/Voltha_ONUStateTests.robot
+++ b/tests/openonu-go-adapter/Voltha_ONUStateTests.robot
@@ -397,10 +397,10 @@
${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}
- Exec Pod ${namespace} ${podname} ${command}
+ 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 ${namespace} ${podname} ${commandget}
+ Exec Pod In Kube ${namespace} ${podname} ${commandget}
Remove Tech Profile
[Documentation] This keyword removes TechProfile
@@ -409,10 +409,10 @@
${podname}= Set Variable etcd
${command} Catenate
... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/64'
- Exec Pod ${namespace} ${podname} ${command}
+ 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 ${namespace} ${podname} ${commandget}
+ Exec Pod In Kube ${namespace} ${podname} ${commandget}
Do Check Tech Profile
[Documentation] This keyword checks the loaded TechProfile
@@ -420,7 +420,7 @@
${podname}= Set Variable etcd
${commandget} Catenate
... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
- ${result}= Exec Pod ${namespace} ${podname} ${commandget}
+ ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
${num_gem_ports}= Set Variable 1
${num_gem_ports}= Set Variable If
... "${techprofile}"=="default" 1
@@ -521,6 +521,6 @@
${namespace}= Set Variable voltha
FOR ${I} IN RANGE 0 ${num_all_onus}
${src}= Set Variable ${hosts.src[${I}]}
- ${result}= Exec Pod ${namespace} bbsim bbsimctl onu shutdown ${src['onu']}
+ ${result}= Exec Pod In Kube ${namespace} bbsim bbsimctl onu shutdown ${src['onu']}
Should Contain ${result} successfully msg=Can not shutdown ${src['onu']} values=False
END
diff --git a/tests/openonu-go-adapter/Voltha_ONUTemplateTests.robot b/tests/openonu-go-adapter/Voltha_ONUTemplateTests.robot
index 9dc0c55..9dc86d0 100755
--- a/tests/openonu-go-adapter/Voltha_ONUTemplateTests.robot
+++ b/tests/openonu-go-adapter/Voltha_ONUTemplateTests.robot
@@ -102,7 +102,7 @@
# Start first Onu
${src}= Set Variable ${hosts.src[${0}]}
Log \r\nONU ${src['onu']}: startup with MIB upload cycle and storage of template data to etcd. console=yes
- ${result}= Exec Pod ${NAMESPACE} bbsim bbsimctl onu poweron ${src['onu']}
+ ${result}= Exec Pod In Kube ${NAMESPACE} bbsim bbsimctl onu poweron ${src['onu']}
Should Contain ${result} successfully msg=Can not poweron ${src['onu']} values=False
${timeStart}= Get Current Date
${firstonustartup}= Get ONU Startup Duration ${firstonu} ${timeStart}
@@ -112,7 +112,7 @@
# Start second Onu
${src}= Set Variable ${hosts.src[${1}]}
Log ONU ${src['onu']}: startup without MIB upload cycle by using of template data of etcd. console=yes
- ${result}= Exec Pod ${NAMESPACE} bbsim bbsimctl onu poweron ${src['onu']}
+ ${result}= Exec Pod In Kube ${NAMESPACE} bbsim bbsimctl onu poweron ${src['onu']}
Should Contain ${result} successfully msg=Can not poweron ${src['onu']} values=False
${timeStart}= Get Current Date
${secondonustartup}= Get ONU Startup Duration ${secondonu} ${timeStart}
diff --git a/tests/openonu-go-adapter/Voltha_ONUUtilities.robot b/tests/openonu-go-adapter/Voltha_ONUUtilities.robot
index ad0e6c3..84cc738 100755
--- a/tests/openonu-go-adapter/Voltha_ONUUtilities.robot
+++ b/tests/openonu-go-adapter/Voltha_ONUUtilities.robot
@@ -22,7 +22,7 @@
${namespace}= Set Variable voltha
FOR ${I} IN RANGE 0 ${num_all_onus}
${src}= Set Variable ${hosts.src[${I}]}
- ${result}= Exec Pod ${namespace} bbsim bbsimctl onu poweron ${src['onu']}
+ ${result}= Exec Pod In Kube ${namespace} bbsim bbsimctl onu poweron ${src['onu']}
Should Contain ${result} successfully msg=Can not poweron ${src['onu']} values=False
END
@@ -90,7 +90,7 @@
${podname}= Set Variable etcd
${commandget} Catenate
... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/omci_mibs/go_templates/'
- ${result}= Exec Pod ${namespace} ${podname} ${commandget}
+ ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
Should Not Be Empty ${result} No MIB Template Data stored in etcd!
Delete MIB Template Data
@@ -99,11 +99,11 @@
${podname}= Set Variable etcd
${commanddel} Catenate
... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/omci_mibs/go_templates/'
- ${result}= Exec Pod ${namespace} ${podname} ${commanddel}
+ ${result}= Exec Pod In Kube ${namespace} ${podname} ${commanddel}
Sleep 3s
${commandget} Catenate
... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/omci_mibs/go_templates/'
- ${result}= Exec Pod ${namespace} ${podname} ${commandget}
+ ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
Should Be Empty ${result} Could not delete MIB Template Data stored in etcd!
Validate Onu Data In Etcd
@@ -187,7 +187,7 @@
${podname}= Set Variable etcd
${commandget} Catenate
... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix --prefix service/voltha/openonu'
- ${result}= Exec Pod ${namespace} ${podname} ${commandget}
+ ${result}= Exec Pod In Kube ${namespace} ${podname} ${commandget}
log ${result}
[Return] ${result}