fix onu reason for disable enable device and minor optimization
Change-Id: I70dde91d976b806d375326d9b919e2ad52ba5a23
diff --git a/libraries/onos.robot b/libraries/onos.robot
index 8ae58e7..c996977 100755
--- a/libraries/onos.robot
+++ b/libraries/onos.robot
@@ -151,6 +151,25 @@
Should Be True ${matched} No match for ${onu_serial_number} found
[Return] ${onu_port}
+Get Onu Ports in ONOS For ALL UNI per ONU
+ [Documentation] Retrieves ONU port(s) for the ONU in ONOS for all UNI-IDs, list of ports will return!
+ [Arguments] ${onu_serial_number} ${olt_of_id}
+ @{uni_id_list}= Create List
+ @{port_list}= Create List
+ FOR ${I} IN RANGE 0 ${num_all_onus}
+ ${src}= Set Variable ${hosts.src[${I}]}
+ Continue For Loop If "${src['onu']}" != "${onu_serial_number}"
+ ${uni_id}= Set Variable ${src['uni_id']}
+ # make sure all actions do only once per uni_id
+ ${id}= Get Index From List ${uni_id_list} ${uni_id}
+ Continue For Loop If -1 != ${id}
+ Append To List ${uni_id_list} ${uni_id}
+ ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${onu_serial_number}
+ ... ${olt_of_id} ${uni_id}
+ Append To List ${port_list} ${onu_port}
+ END
+ [return] ${port_list}
+
Get NNI Port in ONOS
[Arguments] ${olt_of_id}
[Documentation] Retrieves NNI port for the OLT in ONOS
@@ -574,6 +593,38 @@
Log ${onu_port_disabled}
Should Not Be Empty ${onu_port_disabled}
+Wait For All UNI Ports Are Disabled per ONU
+ [Documentation] Verifies all UNI Ports of passed ONU are disabled
+ [Arguments] ${ip} ${port} ${onu_serial_number}
+ @{uni_id_list}= Create List
+ FOR ${I} IN RANGE 0 ${num_all_onus}
+ ${src}= Set Variable ${hosts.src[${I}]}
+ Continue For Loop If "${src['onu']}" != "${onu_serial_number}"
+ ${uni_id}= Set Variable ${src['uni_id']}
+ # make sure all actions do only once per uni_id
+ ${id}= Get Index From List ${uni_id_list} ${uni_id}
+ Continue For Loop If -1 != ${id}
+ Append To List ${uni_id_list} ${uni_id}
+ Wait Until Keyword Succeeds ${timeout} 2s
+ ... Verify UNI Port Is Disabled ${ip} ${port} ${onu_serial_number} ${uni_id}
+ END
+
+Wait For All UNI Ports Are Enabled per ONU
+ [Documentation] Verifies all UNI Ports of passed ONU are enabled
+ [Arguments] ${ip} ${port} ${onu_serial_number}
+ @{uni_id_list}= Create List
+ FOR ${I} IN RANGE 0 ${num_all_onus}
+ ${src}= Set Variable ${hosts.src[${I}]}
+ Continue For Loop If "${src['onu']}" != "${onu_serial_number}"
+ ${uni_id}= Set Variable ${src['uni_id']}
+ # make sure all actions do only once per uni_id
+ ${id}= Get Index From List ${uni_id_list} ${uni_id}
+ Continue For Loop If -1 != ${id}
+ Append To List ${uni_id_list} ${uni_id}
+ Wait Until Keyword Succeeds ${timeout} 2s
+ ... Verify UNI Port Is Enabled ${ip} ${port} ${onu_serial_number} ${uni_id}
+ END
+
Verify ONU in AAA-Users
[Arguments] ${ip} ${port} ${onu_port}
[Documentation] Verifies that the specified onu_port exists in aaa-users output
diff --git a/tests/tt-workflow/Voltha_TT_PODTests.robot b/tests/tt-workflow/Voltha_TT_PODTests.robot
index fee1a55..58398e7 100755
--- a/tests/tt-workflow/Voltha_TT_PODTests.robot
+++ b/tests/tt-workflow/Voltha_TT_PODTests.robot
@@ -223,41 +223,40 @@
[Tags] functionalTT DisableEnableONUTT
[Setup] Run Keywords Start Logging DisableEnableONUTT
... AND Run Keyword If ${has_dataplane} Set Non-Critical Tag for XGSPON Tech
- ... AND Run Keyword If '${has_dataplane}'=='False' Set Tags non-critical
[Teardown] Run Keywords Collect Logs
... AND Stop Logging DisableEnableONUTT
+ @{onu_list}= Create List
FOR ${I} IN RANGE 0 ${num_all_onus}
${src}= Set Variable ${hosts.src[${I}]}
${dst}= Set Variable ${hosts.dst[${I}]}
- ${service_type}= Get Variable Value ${src['service_type']} "null"
+ ${sn}= Set Variable ${src['onu']}
+ # make sure all actions do only once per onu
+ ${onu_id}= Get Index From List ${onu_list} ${sn}
+ Continue For Loop If -1 != ${onu_id}
+ Append To List ${onu_list} ${sn}
${of_id}= Get ofID From OLT List ${src['olt']}
${onu_device_id}= Get Device ID From SN ${src['onu']}
- ${onu_port}= Wait Until Keyword Succeeds ${timeout} 2s Get ONU Port in ONOS ${src['onu']}
- ... ${of_id} ${src['uni_id']}
+ ${onu_port}= Get Onu Ports in ONOS For ALL UNI per ONU ${src['onu']} ${of_id}
+ Log ${onu_port}
Disable Device ${onu_device_id}
Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
... Validate Device DISABLED UNKNOWN
- ... REACHABLE ${src['onu']} onu=True onu_reason=omci-admin-lock
- Wait Until Keyword Succeeds ${timeout} 2s
- ... Verify UNI Port Is Disabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
+ ... REACHABLE ${src['onu']} onu=True onu_reason=tech-profile-config-delete-success
+ Wait For All UNI Ports Are Disabled per ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
... Wait Until Keyword Succeeds ${timeout} 2s
... Check Ping False ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Sleep 5s
Enable Device ${onu_device_id}
- Wait Until Keyword Succeeds ${timeout} 2s
- ... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
+ Wait For All UNI Ports Are Enabled per ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']}
# Workaround for issue seen in VOL-4489. Keep this workaround until VOL-4489 is fixed.
Run Keyword If ${has_dataplane} Reboot XGSPON ONU ${src['olt']} ${src['onu']} omci-flows-pushed
# Workaround ends here for issue seen in VOL-4489.
- Run Keyword If ${has_dataplane} and '${service_type}' == 'mcast' Clean Up Linux
- Wait Until Keyword Succeeds ${timeout} 2s
- ... Verify UNI Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${src['onu']} ${src['uni_id']}
- Run Keyword If '${service_type}' != 'mcast'
- ... Sanity Test TT one ONU ${src} ${dst} ${suppressaddsubscriber}
- ... ELSE IF ${has_dataplane} and '${service_type}' == 'mcast'
- ... Sanity Test TT MCAST one ONU ${src} ${dst} ${suppressaddsubscriber}
+ Run Keyword If ${has_dataplane} Clean Up Linux
+ Run Keyword If ${has_dataplane} Wait For All UNI Ports Are Enabled per ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
+ ... ${src['onu']
+ Perform Sanity Tests TT ${suppressaddsubscriber}
END
*** Keywords ***