[VOL-3751] ONU adapter restart test for TT
- modified skip handling
Change-Id: I9ef02c1e4b6d67ed81601f307872411cc7da06ac
diff --git a/Makefile b/Makefile
index 38106ae..8a27f0a 100755
--- a/Makefile
+++ b/Makefile
@@ -162,6 +162,13 @@
reconcile-openonu-go-adapter-test-dt: ROBOT_FILE := Voltha_ONUReconcileTests.robot
reconcile-openonu-go-adapter-test-dt: openonu-go-adapter-tests
+# target to invoke reconcile tests with openonu go adapter at single ONU with TT workflow
+reconcile-openonu-go-adapter-test-tt: ROBOT_MISC_ARGS += -v logging:True -i functionalOnuGo -v workflow:TT
+reconcile-openonu-go-adapter-test-tt: ROBOT_MISC_ARGS += -e notreadyOnuGo -X $(ROBOT_DEBUG_LOG_OPT)
+reconcile-openonu-go-adapter-test-tt: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_TT_SINGLE_PON_FILE)
+reconcile-openonu-go-adapter-test-tt: ROBOT_FILE := Voltha_ONUReconcileTests.robot
+reconcile-openonu-go-adapter-test-tt: openonu-go-adapter-tests
+
sanity-single-kind: ROBOT_MISC_ARGS += -i sanity $(ROBOT_DEBUG_LOG_OPT)
sanity-single-kind: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_SINGLE_PON_FILE)
sanity-single-kind: bbsim-kind
diff --git a/libraries/onu_utilities.robot b/libraries/onu_utilities.robot
index 41f598e..e9c4e57 100755
--- a/libraries/onu_utilities.robot
+++ b/libraries/onu_utilities.robot
@@ -121,18 +121,26 @@
Disable Onu Device
[Documentation] This keyword disables all onus.
+ ${onu_list} Create List
FOR ${I} IN RANGE 0 ${num_all_onus}
${src}= Set Variable ${hosts.src[${I}]}
${onu_device_id}= Get Device ID From SN ${src['onu']}
+ ${onu_id}= Get Index From List ${onu_list} ${onu_device_id}
+ Continue For Loop If -1 != ${onu_id}
+ Append To List ${onu_list} ${onu_device_id}
Disable Device ${onu_device_id}
Wait Until Keyword Succeeds 20s 2s Test Devices Disabled in VOLTHA Id=${onu_device_id}
END
Enable Onu Device
[Documentation] This keyword enables all onus.
+ ${onu_list} Create List
FOR ${I} IN RANGE 0 ${num_all_onus}
${src}= Set Variable ${hosts.src[${I}]}
${onu_device_id}= Get Device ID From SN ${src['onu']}
+ ${onu_id}= Get Index From List ${onu_list} ${onu_device_id}
+ Continue For Loop If -1 != ${onu_id}
+ Append To List ${onu_list} ${onu_device_id}
Enable Device ${onu_device_id}
END
diff --git a/libraries/utils.robot b/libraries/utils.robot
index d850b42..64be39b 100755
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -379,11 +379,23 @@
... ${List_ONU_Serial} ${onu_flows}
END
+Perform Sanity Tests TT
+ [Documentation] This keyword performs both Sanity Test Procedure for TT Workflow
+ ... Sanity Test TT for HSIA, VoD, VoIP services and Sanity Test TT for MCAST
+ ... For repeating sanity tests without subscriber changes set flag supress_add_subscriber=True.
+ ... In all other (common) cases flag has to be set False (default).
+ [Arguments] ${supress_add_subscriber}=False
+ Perform Sanity Test TT ${supress_add_subscriber}
+ Perform Sanity Test TT MCAST ${supress_add_subscriber}
+
Perform Sanity Test TT
[Documentation] This keyword performs Sanity Test Procedure for TT Workflow
... Sanity test performs dhcp and pings (without EAPOL and DHCP flows) for all the ONUs given for the POD
... This keyword can be used to call in any other tests where sanity check is required
... and avoids duplication of code.
+ ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
+ ... In all other (common) cases flag has to be set False (default).
+ [Arguments] ${supress_add_subscriber}=False
FOR ${I} IN RANGE 0 ${num_all_onus}
${src}= Set Variable ${hosts.src[${I}]}
${dst}= Set Variable ${hosts.dst[${I}]}
@@ -397,7 +409,9 @@
[Documentation] This keyword performs sanity test for a single ONU for TT workflow
... Tests for one ONU
... Assertions apply to HSIA, VoD, VoIP services
- [Arguments] ${src} ${dst}
+ ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
+ ... In all other (common) cases flag has to be set False (default).
+ [Arguments] ${src} ${dst} ${supress_add_subscriber}=False
${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${src['olt']}
Set Global Variable ${of_id}
${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
@@ -413,8 +427,8 @@
... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
... volt-add-subscriber-access ${of_id} ${onu_port}
Sleep 30s
- # Verify ONU state in voltha
- ${onu_reasons}= Create List tech-profile-config-download-success omci-flows-pushed
+ # Verify ONU state in voltha, in case of previous dis- and enable of ONU state will be onu-reenabled
+ ${onu_reasons}= Create List tech-profile-config-download-success omci-flows-pushed onu-reenabled
Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
... ENABLED ACTIVE REACHABLE
... ${src['onu']} onu=True onu_reason=${onu_reasons}
@@ -435,6 +449,9 @@
[Documentation] This keyword performs Sanity Test Procedure for TT Workflow
... Adds subscribers
... Validates for MCAST
+ ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
+ ... In all other (common) cases flag has to be set False (default).
+ [Arguments] ${supress_add_subscriber}=False
FOR ${I} IN RANGE 0 ${num_all_onus}
${src}= Set Variable ${hosts.src[${I}]}
${dst}= Set Variable ${hosts.dst[${I}]}
@@ -449,7 +466,9 @@
[Documentation] This keyword performs sanity test for a single ONU for TT workflow
... Tests for one ONU
... Assertions apply to MCAST services
- [Arguments] ${src} ${dst}
+ ... For repeating sanity test without subscriber changes set flag supress_add_subscriber=True.
+ ... In all other (common) cases flag has to be set False (default).
+ [Arguments] ${src} ${dst} ${supress_add_subscriber}=False
# Check for iperf and jq tools
${stdout} ${stderr} ${rc}= Execute Remote Command which iperf jq
... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']}
@@ -489,8 +508,8 @@
... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
... volt-add-subscriber-access ${of_id} ${onu_port}
Sleep 30s
- # Verify ONU state in voltha
- ${onu_reasons}= Create List tech-profile-config-download-success omci-flows-pushed
+ # Verify ONU state in voltha, in case of previous dis- and enable of ONU state will be onu-reenabled
+ ${onu_reasons}= Create List tech-profile-config-download-success omci-flows-pushed onu-reenabled
Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
... ENABLED ACTIVE REACHABLE
... ${src['onu']} onu=True onu_reason=${onu_reasons}
@@ -1262,7 +1281,7 @@
... ${onu_user} ${onu_pass} ${container_type}=${None} ${container_name}=${None}
${output}= Login And Run Command On Remote System sudo ifconfig ${onu_ifname} 192.168.1.3/24
... ${rg_ip} ${rg_user} ${rg_pass} ${container_type} ${container_name}
- ${cmd} Catenate
+ ${cmd} Catenate
... (echo open "192.168.1.1"; sleep 1;
... echo "${onu_user}"; sleep 1;
... echo "${onu_pass}"; sleep 1;
@@ -1300,3 +1319,15 @@
... Should Match Regexp ${output} \\.${target_port}: UDP,
... ELSE Should Match Regexp ${output} , p ${pbit},.*\\.${target_port}: UDP,
END
+
+Determine Number Of ONU
+ [Arguments] ${olt_serial_number}=${EMPTY} ${num_onus}=${num_all_onus}
+ [Documentation] Determine the number of different ONUs for the given OLT taken from host.src
+ ${onu_list} Create List
+ FOR ${INDEX} IN RANGE 0 ${num_onus}
+ Continue For Loop If "${olt_serial_number}"!="${hosts.src[${INDEX}].olt}" and "${olt_serial_number}"!="${EMPTY}"
+ ${onu_id}= Get Index From List ${onu_list} ${hosts.src[${INDEX}].onu}
+ Run Keyword If -1 == ${onu_id} Append To List ${onu_list} ${hosts.src[${INDEX}].onu}
+ END
+ ${real_num_onus}= Get Length ${onu_list}
+ [Return] ${real_num_onus}
diff --git a/tests/openonu-go-adapter/Voltha_ONUReconcileTests.robot b/tests/openonu-go-adapter/Voltha_ONUReconcileTests.robot
index 30ba316..61642ca 100755
--- a/tests/openonu-go-adapter/Voltha_ONUReconcileTests.robot
+++ b/tests/openonu-go-adapter/Voltha_ONUReconcileTests.robot
@@ -69,6 +69,7 @@
# example: -v usekill2restart:True
${usekill2restart} False
${data_dir} ../data
+${suppressaddsubscriber} True
*** Test Cases ***
@@ -85,7 +86,7 @@
[Setup] Run Keywords Start Logging ReconcileStartingOpenOmciOnuGo
... AND Setup Test
Run Keyword If ${has_dataplane} Clean Up Linux
- Run Keyword If '${num_all_onus}'=='1'
+ Run Keyword If ${no_skip}
... Do Reconcile In Determined State starting-openomci
... ELSE Pass Execution ${skip_message} skipped
[Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
@@ -105,7 +106,7 @@
[Setup] Run Keywords Start Logging ReconcileInitialMibDownloadedOnuGo
... AND Setup Test
Run Keyword If ${has_dataplane} Clean Up Linux
- Run Keyword If '${num_all_onus}'=='1'
+ Run Keyword If ${no_skip}
... Do Reconcile In Determined State initial-mib-downloaded
... ELSE Pass Execution ${skip_message} skipped
[Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
@@ -131,7 +132,7 @@
[Setup] Run Keywords Start Logging ReconcileOmciFlowsPushedOnuGo
... AND Setup Test
Run Keyword If ${has_dataplane} Clean Up Linux
- Run Keyword If '${num_all_onus}'=='1'
+ Run Keyword If ${no_skip}
... Do Reconcile In Omci-Flows-Pushed
... ELSE Pass Execution ${skip_message} skipped
[Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
@@ -156,7 +157,7 @@
[Setup] Run Keywords Start Logging ReconcileDisabledOnuDeviceOnuGo
... AND Setup Test
Run Keyword If ${has_dataplane} Clean Up Linux
- Run Keyword If '${num_all_onus}'=='1'
+ Run Keyword If ${no_skip}
... Do Reconcile For Disabled Onu Device
... ELSE Pass Execution ${skip_message} skipped
[Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
@@ -172,16 +173,22 @@
... print2console:${print2console}, usekill2restart:${usekill2restart}, workflow:${workflow}
Log ${LogInfo} console=yes
Common Test Suite Setup
+ # determine real number of onus
+ ${num_real_onus}= Determine Number Of ONU
+ ${no_skip}= Set Variable If '${num_real_onus}'=='1' True False
+ Set Suite Variable ${no_skip}
# prepare skip message in yellow for console log
${skip}= Evaluate "\\033[33mSKIP\\033[0m"
- ${skipped}= Evaluate "\\033[33m${SPACE*14} ===> Test case above was skipped! <=== ${SPACE*15}\\033[0m"
- ${skip_message} Catenate ${skipped} | ${skip} |
+ ${skipping}= Evaluate
+ ... "\\033[33m${SPACE*5} ===> Test case above was skipped! Too much ONUs (${num_real_onus})! <=== ${SPACE*5}\\033[0m"
+ ${skip_message} Catenate ${skipping} | ${skip} |
Set Suite Variable ${skip_message}
${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
Set Suite Variable ${onos_ssh_connection}
# delete etcd MIB Template Data
Delete MIB Template Data
+
Teardown Suite
[Documentation] Replaces the Suite Teardown in utils.robot.
... Cleans up and checks all ONU ports disabled in ONOS.
@@ -226,7 +233,8 @@
Teardown Test
[Documentation] Post-test Teardown
- Run Keyword If ${teardown_device} Delete All Devices and Verify
+ Run Keyword If ${teardown_device} and ${no_skip} Delete All Devices and Verify
+ ... ELSE IF ${teardown_device} Delete Devices In Voltha Root=true
# delete etcd MIB Template Data
Delete MIB Template Data
Sleep 5s
@@ -255,7 +263,7 @@
Run Keyword If ${usekill2restart} Kill And Check Onu Adaptor ${namespace}
... ELSE Restart And Check Onu Adaptor ${namespace}
Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT
- ... ELSE IF "${workflow}"=="TT" Perform Sanity Test TT
+ ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT
... ELSE Perform Sanity Test
Do Reconcile For Disabled Onu Device
@@ -280,7 +288,7 @@
Enable Device ${olt_device_id}
END
Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT
- ... ELSE IF "${workflow}"=="TT" Perform Sanity Test TT
+ ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT
... ELSE Perform Sanity Test
Disable Onu Device
${alternativeonustates}= Create List omci-flows-deleted omci-admin-lock
@@ -290,9 +298,9 @@
Current State Test All Onus tech-profile-config-delete-success alternativeonustate=${alternativeonustates}
Wait for all ONU Ports in ONOS Disabled ${onos_ssh_connection}
Enable Onu Device
- Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT True
- ... ELSE IF "${workflow}"=="TT" Perform Sanity Test TT True
- ... ELSE Perform Sanity Test True
+ Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT ${suppressaddsubscriber}
+ ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT ${suppressaddsubscriber}
+ ... ELSE Perform Sanity Test ${suppressaddsubscriber}
Do Reconcile In Omci-Flows-Pushed
[Documentation] This keyword reconciles ONU device in omci-flows-pushed and check the state afterwards.
@@ -315,18 +323,18 @@
Enable Device ${olt_device_id}
END
Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT
- ... ELSE IF "${workflow}"=="TT" Perform Sanity Test TT
+ ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT
... ELSE Perform Sanity Test
Run Keyword If ${usekill2restart} Kill And Check Onu Adaptor ${namespace}
... ELSE Restart And Check Onu Adaptor ${namespace}
- Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT True
- ... ELSE IF "${workflow}"=="TT" Perform Sanity Test TT True
- ... ELSE Perform Sanity Test True
+ Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT ${suppressaddsubscriber}
+ ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT ${suppressaddsubscriber}
+ ... ELSE Perform Sanity Test ${suppressaddsubscriber}
Disable Onu Device
${alternativeonustates}= Create List omci-flows-deleted omci-admin-lock
Current State Test All Onus tech-profile-config-delete-success alternativeonustate=${alternativeonustates}
Wait for all ONU Ports in ONOS Disabled ${onos_ssh_connection}
Enable Onu Device
- Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT True
- ... ELSE IF "${workflow}"=="TT" Perform Sanity Test TT True
- ... ELSE Perform Sanity Test True
+ Run Keyword If "${workflow}"=="DT" Perform Sanity Test DT ${suppressaddsubscriber}
+ ... ELSE IF "${workflow}"=="TT" Perform Sanity Tests TT ${suppressaddsubscriber}
+ ... ELSE Perform Sanity Test ${suppressaddsubscriber}