[VOL-3436] Basic ONOS HA Test
Change-Id: Ie9e605a14ea28f62286b148fb6d62c5bd91566cb
diff --git a/libraries/k8s.robot b/libraries/k8s.robot
index 1b865a4..4fe057d 100644
--- a/libraries/k8s.robot
+++ b/libraries/k8s.robot
@@ -134,6 +134,16 @@
${pods_status}= Run ${command}
Should Not Be Equal ${pods_status} ${EMPTY} Can't filter out Pods with exptected status ${expectedStatus}
+Validate Pods Status By Name
+ [Arguments] ${namespace} ${name} ${expectedStatus}
+ [Documentation] To run the kubectl command and check the status of all pods filter
+ ... by label matche the expected status
+ ${command}= Catenate
+ ... kubectl -n ${namespace} get pods ${name}
+ ... -o=jsonpath="{.status.phase}"
+ ${pods_status}= Run ${command}
+ Should Not Be Equal ${pods_status} ${EMPTY} Can't filter out Pods with exptected status ${expectedStatus}
+
Verify All Voltha Pods For Any Error Logs
[Arguments] ${datetime}
[Documentation] This keyword checks for the error occurence in the voltha pods
@@ -289,6 +299,13 @@
... kubectl -n ${namespace} delete pods -l${key}=${value}
Should Be Equal as Integers ${rc} 0
+Delete K8s Pods By Name
+ [Arguments] ${namespace} ${value}
+ [Documentation] Uses kubectl to delete a PODs, filtering by label
+ ${rc}= Run and Return Rc
+ ... kubectl -n ${namespace} delete pods ${value}
+ Should Be Equal as Integers ${rc} 0
+
Scale K8s Deployment
[Arguments] ${namespace} ${name} ${count}
[Documentation] Uses kubectl to scale a named deployment
diff --git a/libraries/onos.robot b/libraries/onos.robot
index 11aa85d..6cc30a4 100755
--- a/libraries/onos.robot
+++ b/libraries/onos.robot
@@ -130,6 +130,15 @@
Should Be True ${matched} No fabric switch found
[Return] ${of_id}
+Get Master Instace in ONOS
+ [Arguments] ${of_id}
+ [Documentation] Returns nodeId of the Master instace for a giver device in ONOS
+ ${resp}= Get Request ONOS onos/v1/mastership/${of_id}/master
+ ${jsondata}= To Json ${resp.content}
+ Should Not Be Empty ${jsondata['nodeId']}
+ ${master_node}= Get From Dictionary ${jsondata} nodeId
+ [Return] ${master_node}
+
Verify Subscriber Access Flows Added for ONU
[Arguments] ${ip} ${port} ${olt_of_id} ${onu_port} ${nni_port} ${c_tag} ${s_tag}
[Documentation] Verifies if the Subscriber Access Flows are added in ONOS for the ONU