[VOL-3325] OpenOnu-Go-Adapter: Test for OpenOnu-Go soft Reboot
Change-Id: I91eb741b5911a69f807d3da71199080734c846e5
diff --git a/libraries/voltctl.robot b/libraries/voltctl.robot
index ac249eb..f45518c 100755
--- a/libraries/voltctl.robot
+++ b/libraries/voltctl.robot
@@ -378,6 +378,50 @@
END
Should Be Empty ${List_ONU_Serial} List ${List_ONU_Serial} not empty
+Validate ONU Device By Device Id
+ [Documentation]
+ ... Parses the output of "voltctl device list" filtered by device id and inspects states including reason.
+ [Arguments] ${admin_state} ${oper_status} ${connect_status} ${onu_reason} ${onu_id}
+ ${cmd} Catenate ${VOLTCTL_CONFIG}; voltctl device list --filter=Id=${onu_id} -m 8MB -o json
+ ${rc} ${output}= Run and Return Rc and Output ${cmd}
+ Should Be Equal As Integers ${rc} 0
+ ${jsondata}= To Json ${output}
+ ${length}= Get Length ${jsondata}
+ Should Be Equal As Integers ${length} 1 No match found for ${onu_id} to validate device
+ ${value}= Get From List ${jsondata} 0
+ Log ${value}
+ ${jsonCamelCaseFieldnames}= Run Keyword And Return Status
+ ... Dictionary Should Contain Key ${value} adminState
+ ${astate}= Run Keyword If ${jsonCamelCaseFieldNames}
+ ... Get From Dictionary ${value} adminState
+ ... ELSE
+ ... Get From Dictionary ${value} adminstate
+ ${opstatus}= Run Keyword If ${jsonCamelCaseFieldNames}
+ ... Get From Dictionary ${value} operStatus
+ ... ELSE
+ ... Get From Dictionary ${value} operstatus
+ ${cstatus}= Run Keyword If ${jsonCamelCaseFieldNames}
+ ... Get From Dictionary ${value} connectStatus
+ ... ELSE
+ ... Get From Dictionary ${value} connectstatus
+ ${sn}= Run Keyword If ${jsonCamelCaseFieldNames}
+ ... Get From Dictionary ${value} serialNumber
+ ... ELSE
+ ... Get From Dictionary ${value} serialnumber
+ ${devId}= Get From Dictionary ${value} id
+ ${mib_state}= Get From Dictionary ${value} reason
+ Should Be Equal '${devId}' '${onu_id}' No match found for ${onu_id} to validate device
+ ... values=False
+ Should Be Equal '${astate}' '${admin_state}' Device ${sn} admin_state != ${admin_state}
+ ... values=False
+ Should Be Equal '${opstatus}' '${oper_status}' Device ${sn} oper_status != ${oper_status}
+ ... values=False
+ Should Be Equal '${cstatus}' '${connect_status}' Device ${sn} conn_status != ${connect_status}
+ ... values=False
+ Should Be Equal '${mib_state}' '${onu_reason}'
+ ... Device ${sn} mib_state incorrect (${mib_state}) values=False
+
+
Compare Lists
[Documentation]
... Compares both lists and put all matches in the returned list
@@ -658,12 +702,12 @@
List Should Not Contain Value ${ids} ${id}
Reboot ONU
- [Arguments] ${onu_id} ${src} ${dst}
+ [Arguments] ${onu_id}
[Documentation] Using voltctl command reboot ONU and verify that ONU comes up to running state
${rc} ${devices}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device reboot ${onu_id}
Should Be Equal As Integers ${rc} 0
- Run Keyword and Ignore Error Wait Until Keyword Succeeds 60s 1s Validate Device
- ... ENABLED DISCOVERED UNREACHABLE ${onu_id} onu=True
+ Run Keyword And Continue On Failure Wait Until Keyword Succeeds 60s 1s Validate ONU Device By Device Id
+ ... ENABLED DISCOVERED REACHABLE rebooting ${onu_id}
Assert ONUs in Voltha
[Arguments] ${count}