TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test states of ONU Go adapter |
| 3 | Suite Setup Setup Suite |
| 4 | Suite Teardown Teardown Suite |
| 5 | Test Setup Setup |
| 6 | Test Teardown Teardown |
| 7 | Library Collections |
| 8 | Library String |
| 9 | Library OperatingSystem |
| 10 | Library XML |
| 11 | Library RequestsLibrary |
| 12 | Library ../../libraries/DependencyLibrary.py |
| 13 | Resource ../../libraries/onos.robot |
| 14 | Resource ../../libraries/voltctl.robot |
| 15 | Resource ../../libraries/voltha.robot |
| 16 | Resource ../../libraries/utils.robot |
| 17 | Resource ../../libraries/k8s.robot |
| 18 | Resource ../../variables/variables.robot |
| 19 | |
| 20 | *** Variables *** |
| 21 | ${POD_NAME} flex-ocp-cord |
| 22 | ${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf |
| 23 | ${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs |
| 24 | #${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf |
| 25 | ${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml |
| 26 | ${HELM_CHARTS_DIR} ~/helm-charts |
| 27 | ${VOLTHA_POD_NUM} 8 |
| 28 | ${NAMESPACE} voltha |
| 29 | # For below variable value, using deployment name as using grep for |
| 30 | # parsing radius pod name, we can also use full radius pod name |
| 31 | ${RESTART_POD_NAME} radius |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 32 | ${timeout} 180s |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 33 | ${of_id} 0 |
| 34 | ${logical_id} 0 |
| 35 | ${has_dataplane} True |
| 36 | ${external_libs} True |
| 37 | ${teardown_device} True |
| 38 | ${scripts} ../../scripts |
| 39 | # Per-test logging on failure is turned off by default; set this variable to enable |
| 40 | ${container_log_dir} ${None} |
| 41 | # state to test variable, can be passed via the command line too |
| 42 | ${state2test} 6 |
| 43 | ${testmode} SingleState |
| 44 | ${porttest} True |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 45 | ${debugmode} False |
TorstenThieme | 5e324e4 | 2020-07-27 09:36:16 +0000 | [diff] [blame] | 46 | ${logging} False |
TorstenThieme | b41007d | 2020-06-22 12:14:12 +0000 | [diff] [blame] | 47 | ${pausebeforecleanup} False |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 48 | |
| 49 | *** Test Cases *** |
| 50 | ONU State Test |
| 51 | [Documentation] Validates the ONU Go adapter states |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 52 | [Tags] statetest onutest |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 53 | [Setup] Run Keywords Start Logging ONUStateTest |
| 54 | ... AND Setup Test |
| 55 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 56 | Enable Device ${olt_device_id} |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 57 | ${timeStart} = Get Current Date |
| 58 | Set Global Variable ${timeStart} |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 59 | Run Keyword If "${testmode}"=="SingleState" Do ONU Single State Test |
| 60 | ... ELSE IF "${testmode}"=="Up2State" Do ONU Up To State Test |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 61 | ... ELSE IF "${testmode}"=="SingleStateTime" Do ONU Single State Test Time |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 62 | ... ELSE Fail The testmode (${testmode}) is not valid! |
TorstenThieme | 5e324e4 | 2020-07-27 09:36:16 +0000 | [diff] [blame] | 63 | [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 64 | ... AND Stop Logging ONUStateTest |
| 65 | |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 66 | Onu Port Check |
| 67 | [Documentation] Validates the ONU Go adapter states |
TorstenThieme | 0095868 | 2020-06-19 11:29:31 +0000 | [diff] [blame] | 68 | ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state! |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 69 | [Tags] onutest |
| 70 | [Setup] Start Logging ONUPortTest |
| 71 | Run Keyword If ${porttest} Do Onu Port Check |
TorstenThieme | 5e324e4 | 2020-07-27 09:36:16 +0000 | [diff] [blame] | 72 | [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 73 | ... AND Stop Logging ONUPortTest |
| 74 | |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 75 | *** Keywords *** |
| 76 | Setup Suite |
| 77 | [Documentation] Set up the test suite |
| 78 | Common Test Suite Setup |
| 79 | Run Keyword If ${num_onus}>4 Calculate Timeout |
| 80 | |
TorstenThieme | b41007d | 2020-06-22 12:14:12 +0000 | [diff] [blame] | 81 | Teardown Suite |
| 82 | [Documentation] Replaces the Suite Teardown in utils.robot. |
| 83 | ... Cleans up and checks all ONU ports disabled in ONOS. |
| 84 | ... Furthermore gives the possibility to pause the execution. |
| 85 | Run Keyword If ${pausebeforecleanup} Import Library Dialogs |
| 86 | Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up! |
| 87 | Run Keyword If ${teardown_device} Delete All Devices and Verify |
| 88 | Wait for Ports in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM |
| 89 | |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 90 | Setup Test |
| 91 | [Documentation] Pre-test Setup |
| 92 | #test for empty device list |
| 93 | Test Empty Device List |
| 94 | Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up |
Suchitra Vemuri | b7253a5 | 2020-07-14 22:35:17 -0700 | [diff] [blame] | 95 | ... ${olt_ssh_ip} ${olt_user} ${olt_pass} |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 96 | Run Keyword If ${has_dataplane} Sleep 60s |
| 97 | #create/preprovision device |
| 98 | ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT} |
| 99 | Set Suite Variable ${olt_device_id} |
| 100 | #validate olt states |
| 101 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN |
| 102 | ... ${olt_device_id} |
| 103 | Sleep 5s |
| 104 | |
| 105 | Calculate Timeout |
| 106 | [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus |
| 107 | ${timeout} Fetch From Left ${timeout} s |
| 108 | ${timeout}= evaluate ${timeout}+((${num_onus}-4)*30) |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 109 | ${timeout}= Set Variable If (not ${debugmode}) and (${timeout}>600) 600 ${timeout} |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 110 | ${timeout}= Catenate SEPARATOR= ${timeout} s |
| 111 | Set Suite Variable ${timeout} |
| 112 | #Log \r\nTimeout: ${timeout} INFO console=True |
| 113 | |
| 114 | Do ONU Up To State Test |
| 115 | [Documentation] This keyword performs Up2State Test |
| 116 | ... All states up to the passed have to be checked |
| 117 | FOR ${I} IN RANGE 0 ${num_onus} |
| 118 | ${src}= Set Variable ${hosts.src[${I}]} |
| 119 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 120 | Run Keyword If ${state2test}>=1 |
| 121 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 122 | ... Validate Device ENABLED ACTIVATING REACHABLE |
| 123 | ... ${src['onu']} onu=True onu_reason=activating-onu |
| 124 | Run Keyword If ${state2test}>=2 |
| 125 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 126 | ... Validate Device ENABLED ACTIVATING REACHABLE |
| 127 | ... ${src['onu']} onu=True onu_reason=starting-openomci |
| 128 | Run Keyword If ${state2test}>=3 |
| 129 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 130 | ... Validate Device ENABLED ACTIVATING REACHABLE |
| 131 | ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete |
| 132 | Run Keyword If ${state2test}>=4 |
| 133 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 134 | ... Validate Device ENABLED ACTIVE REACHABLE |
| 135 | ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded |
| 136 | Run Keyword If ${state2test}>=5 |
| 137 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 138 | ... Validate Device ENABLED ACTIVE REACHABLE |
| 139 | ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success |
| 140 | Run Keyword If ${state2test}>=6 |
| 141 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 142 | ... Validate Device ENABLED ACTIVE REACHABLE |
| 143 | ... ${src['onu']} onu=True onu_reason=omci-flows-pushed |
| 144 | END |
| 145 | |
| 146 | Do ONU Single State Test |
| 147 | [Documentation] This keyword performs SingleState Test |
| 148 | ... Only the passed state has to be checked |
| 149 | FOR ${I} IN RANGE 0 ${num_onus} |
| 150 | ${src}= Set Variable ${hosts.src[${I}]} |
| 151 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 152 | Run Keyword If ${state2test}==1 |
| 153 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 154 | ... Validate Device ENABLED ACTIVATING REACHABLE |
| 155 | ... ${src['onu']} onu=True onu_reason=activating-onu |
| 156 | ... ELSE IF ${state2test}==2 |
| 157 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 158 | ... Validate Device ENABLED ACTIVATING REACHABLE |
| 159 | ... ${src['onu']} onu=True onu_reason=starting-openomci |
| 160 | ... ELSE IF ${state2test}==3 |
| 161 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 162 | ... Validate Device ENABLED ACTIVATING REACHABLE |
| 163 | ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete |
| 164 | ... ELSE IF ${state2test}==4 |
| 165 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 166 | ... Validate Device ENABLED ACTIVE REACHABLE |
| 167 | ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded |
| 168 | ... ELSE IF ${state2test}==5 |
| 169 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 170 | ... Validate Device ENABLED ACTIVE REACHABLE |
| 171 | ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success |
| 172 | ... ELSE IF ${state2test}==6 |
| 173 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 174 | ... Validate Device ENABLED ACTIVE REACHABLE |
| 175 | ... ${src['onu']} onu=True onu_reason=omci-flows-pushed |
| 176 | ... ELSE Fail The state to test (${state2test}) is not valid! |
| 177 | END |
| 178 | |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 179 | Do ONU Single State Test Time |
| 180 | [Documentation] This keyword performs SingleState Test with calculate running time |
| 181 | ... Only the passed state has to be checked and the duration each single onu adapter needed |
| 182 | ... will be calculated and printed out |
| 183 | ${ListfinishedONUs} Create List |
| 184 | Set Global Variable ${ListfinishedONUs} |
| 185 | Create File ONU_Startup_Time.txt This file contains the startup times of all ONUs. |
| 186 | ${list_onus} Create List |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 187 | Build ONU SN List ${list_onus} |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 188 | Run Keyword If ${state2test}==1 |
| 189 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
TorstenThieme | 9949b17 | 2020-06-16 10:00:15 +0000 | [diff] [blame] | 190 | ... Validate ONU Devices MIB State With Duration |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 191 | ... activating-onu ${list_onus} ${timeStart} print2console=True |
| 192 | ... output_file=ONU_Startup_Time.txt |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 193 | ... ELSE IF ${state2test}==2 |
| 194 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
TorstenThieme | 9949b17 | 2020-06-16 10:00:15 +0000 | [diff] [blame] | 195 | ... Validate ONU Devices MIB State With Duration |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 196 | ... starting-openomci ${list_onus} ${timeStart} print2console=True |
| 197 | ... output_file=ONU_Startup_Time.txt |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 198 | ... ELSE IF ${state2test}==3 |
| 199 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
TorstenThieme | 9949b17 | 2020-06-16 10:00:15 +0000 | [diff] [blame] | 200 | ... Validate ONU Devices MIB State With Duration |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 201 | ... discovery-mibsync-complete ${list_onus} ${timeStart} print2console=True |
| 202 | ... output_file=ONU_Startup_Time.txt |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 203 | ... ELSE IF ${state2test}==4 |
| 204 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
TorstenThieme | 9949b17 | 2020-06-16 10:00:15 +0000 | [diff] [blame] | 205 | ... Validate ONU Devices MIB State With Duration |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 206 | ... initial-mib-downloaded ${list_onus} ${timeStart} print2console=True |
| 207 | ... output_file=ONU_Startup_Time.txt |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 208 | ... ELSE IF ${state2test}==5 |
| 209 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
TorstenThieme | 9949b17 | 2020-06-16 10:00:15 +0000 | [diff] [blame] | 210 | ... Validate ONU Devices MIB State With Duration |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 211 | ... tech-profile-config-download-success ${list_onus} ${timeStart} print2console=True |
| 212 | ... output_file=ONU_Startup_Time.txt |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 213 | ... ELSE IF ${state2test}==6 |
| 214 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
TorstenThieme | 9949b17 | 2020-06-16 10:00:15 +0000 | [diff] [blame] | 215 | ... Validate ONU Devices MIB State With Duration |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 216 | ... omci-flows-pushed ${list_onus} ${timeStart} print2console=True |
| 217 | ... output_file=ONU_Startup_Time.txt |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 218 | ... ELSE Fail The state to test (${state2test}) is not valid! |
| 219 | |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 220 | Do Onu Port Check |
TorstenThieme | 0095868 | 2020-06-19 11:29:31 +0000 | [diff] [blame] | 221 | [Documentation] Check that all the UNI ports show up in ONOS |
| 222 | Wait for Ports in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${num_onus} BBSM |
TorstenThieme | 9949b17 | 2020-06-16 10:00:15 +0000 | [diff] [blame] | 223 | |