[VOL-4267] Added openolt-adapter restart scenario with continuous ping running in background for DT
Change-Id: I4a51f8fbc5b84bde8ea02f274fab8139d4126315
diff --git a/libraries/utils.robot b/libraries/utils.robot
index c08d1ac..4d31cb0 100755
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -1341,9 +1341,12 @@
[Arguments] ${ip} ${user} ${pass}=${None}
... ${container_type}=${None} ${container_name}=${None}
[Documentation] Stops the 'ping' running in background on remote system
+ ${cmd}= Run Keyword If '${container_type}' == 'LXC' or '${container_type}' == 'K8S'
+ ... Set Variable kill -SIGINT `pgrep ping`
+ ... ELSE
+ ... Set Variable sudo kill -SIGINT `pgrep ping`
${result}= Login And Run Command On Remote System
- ... sudo kill -SIGINT `pgrep ping`
- ... ${ip} ${user} ${pass} ${container_type} ${container_name}
+ ... ${cmd} ${ip} ${user} ${pass} ${container_type} ${container_name}
Log ${result}
Retrieve Remote File Contents
diff --git a/tests/dt-workflow/Voltha_DT_FailureScenarios.robot b/tests/dt-workflow/Voltha_DT_FailureScenarios.robot
index 11663b8..9f0c04f 100755
--- a/tests/dt-workflow/Voltha_DT_FailureScenarios.robot
+++ b/tests/dt-workflow/Voltha_DT_FailureScenarios.robot
@@ -607,6 +607,55 @@
Check Ping Result True ${ping_output}
END
+Verify restart openolt-adapter container while continuously running ping in background for DT
+ [Documentation] Restart openolt-adapter container after VOLTHA is operational.
+ ... Run the ping continuously in background during container restart,
+ ... and verify that there should be no affect on the dataplane.
+ [Tags] functionalDt RestartOpenOltPingDt
+ [Setup] Start Logging RestartOpenOltPingDt
+ [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
+ ... AND Stop Logging RestartOpenOltPingDt
+ Clear All Devices Then Create New Device
+ # Performing Sanity Test to make sure subscribers are all DHCP and pingable
+ Run Keyword If ${has_dataplane} Clean Up Linux
+ Wait Until Keyword Succeeds ${timeout} 2s Perform Sanity Test DT
+ FOR ${I} IN RANGE 0 ${num_all_onus}
+ ${src}= Set Variable ${hosts.src[${I}]}
+ ${dst}= Set Variable ${hosts.dst[${I}]}
+ ${ping_output_file}= Set Variable /tmp/${src['onu']}_ping
+ Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
+ ... Wait Until Keyword Succeeds 60s 2s
+ ... Run Ping In Background ${ping_output_file} ${dst['dp_iface_ip_qinq']} ${src['dp_iface_name']}
+ ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
+ END
+ ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
+ Log ${podStatusOutput}
+ ${countBeforeRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
+ ${podName} Set Variable ${OLT_ADAPTER_APP_LABEL}
+ Wait Until Keyword Succeeds ${timeout} 15s Delete K8s Pods By Label ${NAMESPACE} app ${podName}
+ Wait Until Keyword Succeeds ${timeout} 2s Validate Pods Status By Label ${NAMESPACE}
+ ... app ${podName} Running
+ # Wait for 1 min after openolt adapter is restarted
+ Sleep 60s
+ ${podStatusOutput}= Run kubectl get pods -n ${NAMESPACE}
+ Log ${podStatusOutput}
+ ${countAfterRestart}= Run kubectl get pods -n ${NAMESPACE} | grep Running | wc -l
+ Should Be Equal As Strings ${countAfterRestart} ${countBeforeRestart}
+ FOR ${I} IN RANGE 0 ${num_all_onus}
+ ${src}= Set Variable ${hosts.src[${I}]}
+ ${dst}= Set Variable ${hosts.dst[${I}]}
+ ${ping_output_file}= Set Variable /tmp/${src['onu']}_ping
+ Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
+ ... Wait Until Keyword Succeeds 60s 2s
+ ... Stop Ping Running In Background ${src['ip']} ${src['user']} ${src['pass']}
+ ... ${src['container_type']} ${src['container_name']}
+ ${ping_output}= Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure
+ ... Wait Until Keyword Succeeds 60s 2s
+ ... Retrieve Remote File Contents ${ping_output_file} ${src['ip']} ${src['user']} ${src['pass']}
+ ... ${src['container_type']} ${src['container_name']}
+ Check Ping Result True ${ping_output}
+ END
+
*** Keywords ***
Setup Suite
[Documentation] Set up the test suite