TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 1 | *** Settings *** |
TorstenThieme | 109683b | 2020-09-24 12:35:41 +0000 | [diff] [blame] | 2 | Documentation Test states of ONU Go adapter with ATT workflows only (not for DT/TT workflow!) |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 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 *** |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 21 | ${timeout} 180s |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 22 | ${of_id} 0 |
| 23 | ${logical_id} 0 |
| 24 | ${has_dataplane} True |
| 25 | ${external_libs} True |
| 26 | ${teardown_device} True |
| 27 | ${scripts} ../../scripts |
| 28 | # Per-test logging on failure is turned off by default; set this variable to enable |
| 29 | ${container_log_dir} ${None} |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 30 | # state to test variable, can be passed via the command line too, valid values: 1-6 |
| 31 | # 1 -> activating-onu |
| 32 | # 2 -> starting-openomci |
| 33 | # 3 -> discovery-mibsync-complete |
| 34 | # 4 -> initial-mib-downloaded |
| 35 | # 5 -> tech-profile-config-download-success |
| 36 | # 6 -> omci-flows-pushed |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 37 | # example: -v state2test:5 |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 38 | ${state2test} 6 |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 39 | # test mode variable, can be passed via the command line too, valid values: SingleState, Up2State, SingleStateTime |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 40 | # example: -v testmode:SingleStateTime |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 41 | ${testmode} SingleState |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 42 | # flag for execute Tech Profile check, can be passed via the command line too |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 43 | # example: -v profiletest:False |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 44 | ${profiletest} True |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 45 | # used tech profile, can be passed via the command line too, valid values: default (=1T1GEM), 1T4GEM, 1T8GEM |
| 46 | # example: -v techprofile:1T4GEM |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 47 | ${techprofile} default |
| 48 | # flag for execute port test, can be passed via the command line too |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 49 | # example: -v porttest:False |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 50 | ${porttest} True |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 51 | # flag for execute flow test, can be passed via the command line too |
TorstenThieme | 109683b | 2020-09-24 12:35:41 +0000 | [diff] [blame] | 52 | # example: -v flowtest:True |
| 53 | ${flowtest} False |
TorstenThieme | e3841a0 | 2020-09-23 08:20:43 +0000 | [diff] [blame] | 54 | # flag for execute disable/enable onu device test, can be passed via the command line too |
| 55 | # example: -v disableenabletest:True |
TorstenThieme | 17becfc | 2020-10-08 09:46:27 +0000 | [diff] [blame] | 56 | ${disableenabletest} True |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 57 | # flag for execute reconcile onu device test, can be passed via the command line too |
| 58 | # example: -v reconciletest:True |
TorstenThieme | 17becfc | 2020-10-08 09:46:27 +0000 | [diff] [blame] | 59 | ${reconciletest} True |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 60 | # flag debugmode is used, if true timeout calculation various, can be passed via the command line too |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 61 | # example: -v debugmode:True |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 62 | ${debugmode} False |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 63 | # logging flag to enable Collect Logs, can be passed via the command line too |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 64 | # example: -v logging:True |
TorstenThieme | 5e324e4 | 2020-07-27 09:36:16 +0000 | [diff] [blame] | 65 | ${logging} False |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 66 | # if True execution will be paused before clean up |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 67 | # example: -v pausebeforecleanup:True |
TorstenThieme | b41007d | 2020-06-22 12:14:12 +0000 | [diff] [blame] | 68 | ${pausebeforecleanup} False |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 69 | ${data_dir} ../data |
| 70 | |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 71 | |
| 72 | *** Test Cases *** |
| 73 | ONU State Test |
| 74 | [Documentation] Validates the ONU Go adapter states |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 75 | [Tags] statetest onutest |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 76 | [Setup] Run Keywords Start Logging ONUStateTest |
| 77 | ... AND Setup Test |
| 78 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 79 | Enable Device ${olt_device_id} |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 80 | ${timeStart} = Get Current Date |
| 81 | Set Global Variable ${timeStart} |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 82 | Run Keyword If "${testmode}"=="SingleState" Do ONU Single State Test |
| 83 | ... ELSE IF "${testmode}"=="Up2State" Do ONU Up To State Test |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 84 | ... ELSE IF "${testmode}"=="SingleStateTime" Do ONU Single State Test Time |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 85 | ... ELSE Fail The testmode (${testmode}) is not valid! |
TorstenThieme | 5e324e4 | 2020-07-27 09:36:16 +0000 | [diff] [blame] | 86 | [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 87 | ... AND Stop Logging ONUStateTest |
| 88 | |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 89 | Check Loaded Tech Profile |
| 90 | [Documentation] Validates the loaded Tech Profile |
| 91 | ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state! |
| 92 | ... Check will be executed only the reached ONU state is 5 (tech-profile-config-download-success) or higher |
| 93 | [Tags] onutest |
| 94 | [Setup] Start Logging ONUCheckTechProfile |
| 95 | Run Keyword If ${state2test}>=5 and ${profiletest} Do Check Tech Profile |
TorstenThieme | 5a205ba | 2020-09-29 08:08:29 +0000 | [diff] [blame] | 96 | ... ELSE Pass Execution ${skip_message} skipped |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 97 | [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs |
| 98 | ... AND Stop Logging ONUCheckTechProfile |
| 99 | |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 100 | Onu Port Check |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 101 | [Documentation] Validates that all the UNI ports show up in ONOS |
TorstenThieme | 0095868 | 2020-06-19 11:29:31 +0000 | [diff] [blame] | 102 | ... 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] | 103 | [Tags] onutest |
| 104 | [Setup] Start Logging ONUPortTest |
| 105 | Run Keyword If ${porttest} Do Onu Port Check |
TorstenThieme | 5a205ba | 2020-09-29 08:08:29 +0000 | [diff] [blame] | 106 | ... ELSE Pass Execution ${skip_message} skipped |
TorstenThieme | 5e324e4 | 2020-07-27 09:36:16 +0000 | [diff] [blame] | 107 | [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 108 | ... AND Stop Logging ONUPortTest |
| 109 | |
TorstenThieme | 109683b | 2020-09-24 12:35:41 +0000 | [diff] [blame] | 110 | Onu Flow Check |
| 111 | [Documentation] Validates the onu flows in ONOS and Voltha |
| 112 | ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state! |
| 113 | [Tags] onutest |
| 114 | [Setup] Start Logging ONUFlowTest |
| 115 | Run Keyword If ${state2test}>=6 and ${flowtest} Do Onu Flow Check |
TorstenThieme | 5a205ba | 2020-09-29 08:08:29 +0000 | [diff] [blame] | 116 | ... ELSE Pass Execution ${skip_message} skipped |
TorstenThieme | 109683b | 2020-09-24 12:35:41 +0000 | [diff] [blame] | 117 | [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs |
| 118 | ... AND Stop Logging ONUFlowTest |
| 119 | |
TorstenThieme | e3841a0 | 2020-09-23 08:20:43 +0000 | [diff] [blame] | 120 | Disable Enable Onu Device |
| 121 | [Documentation] Disables/enables ONU Device and check states |
| 122 | ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state! |
| 123 | [Tags] onutest |
| 124 | [Setup] Start Logging DisableEnableONUDevice |
| 125 | Run Keyword If ${state2test}>=5 and ${disableenabletest} Do Disable Enable Onu Test |
TorstenThieme | 5a205ba | 2020-09-29 08:08:29 +0000 | [diff] [blame] | 126 | ... ELSE Pass Execution ${skip_message} skipped |
TorstenThieme | e3841a0 | 2020-09-23 08:20:43 +0000 | [diff] [blame] | 127 | [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs |
| 128 | ... AND Stop Logging DisableEnableONUDevice |
| 129 | |
TorstenThieme | 015d5c0 | 2020-09-11 09:53:34 +0000 | [diff] [blame] | 130 | Reconcile Onu Device |
| 131 | [Documentation] Reconciles ONU Device and check state |
| 132 | ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state! |
| 133 | [Tags] onutest |
| 134 | [Setup] Start Logging ReconcileONUDevice |
| 135 | Run Keyword If ${state2test}>=5 and ${reconciletest} Do Reconcile Onu Device |
TorstenThieme | 5a205ba | 2020-09-29 08:08:29 +0000 | [diff] [blame] | 136 | ... ELSE Pass Execution ${skip_message} skipped |
TorstenThieme | 015d5c0 | 2020-09-11 09:53:34 +0000 | [diff] [blame] | 137 | [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs |
| 138 | ... AND Stop Logging ReconcileONUDevice |
| 139 | |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 140 | *** Keywords *** |
| 141 | Setup Suite |
| 142 | [Documentation] Set up the test suite |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 143 | ${LogInfo}= Catenate |
| 144 | ... \r\nPassed arguments: |
| 145 | ... state2test:${state2test}, testmode:${testmode}, profiletest:${profiletest}, techprofile:${techprofile}, |
| 146 | ... porttest:${porttest}, flowtest:${flowtest}, reconciletest:${reconciletest}, |
TorstenThieme | e3841a0 | 2020-09-23 08:20:43 +0000 | [diff] [blame] | 147 | ... disableenabletest:${disableenabletest}, |
TorstenThieme | 015d5c0 | 2020-09-11 09:53:34 +0000 | [diff] [blame] | 148 | ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup}, |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 149 | Log ${LogInfo} console=yes |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 150 | Common Test Suite Setup |
TorstenThieme | 5a205ba | 2020-09-29 08:08:29 +0000 | [diff] [blame] | 151 | # prepare skip message in yellow for console log |
| 152 | ${skip}= Evaluate "\\033[33mSKIP\\033[0m" |
| 153 | ${skipped}= Evaluate "\\033[33m${SPACE*14} ===> Test case above was skipped! <=== ${SPACE*15}\\033[0m" |
| 154 | ${skip_message} Catenate ${skipped} | ${skip} | |
| 155 | Set Suite Variable ${skip_message} |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 156 | Run Keyword If ${num_onus}>4 Calculate Timeout |
TorstenThieme | 1488d77 | 2020-09-28 10:52:43 +0000 | [diff] [blame] | 157 | ${techprofile}= Set Variable If "${techprofile}"=="1T1GEM" default ${techprofile} |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 158 | Run Keyword If "${techprofile}"=="default" Log To Console \nTechProfile:default (1T1GEM) |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 159 | ... ELSE IF "${techprofile}"=="1T4GEM" Set Tech Profile 1T4GEM |
| 160 | ... ELSE IF "${techprofile}"=="1T8GEM" Set Tech Profile 1T8GEM |
| 161 | ... ELSE Fail The TechProfile (${techprofile}) is not valid! |
| 162 | ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 163 | Set Suite Variable ${onos_ssh_connection} |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 164 | |
TorstenThieme | b41007d | 2020-06-22 12:14:12 +0000 | [diff] [blame] | 165 | Teardown Suite |
| 166 | [Documentation] Replaces the Suite Teardown in utils.robot. |
| 167 | ... Cleans up and checks all ONU ports disabled in ONOS. |
| 168 | ... Furthermore gives the possibility to pause the execution. |
| 169 | Run Keyword If ${pausebeforecleanup} Import Library Dialogs |
| 170 | Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up! |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 171 | Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes |
TorstenThieme | b41007d | 2020-06-22 12:14:12 +0000 | [diff] [blame] | 172 | Run Keyword If ${teardown_device} Delete All Devices and Verify |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 173 | # Wait for Ports in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM |
| 174 | Wait for Ports in ONOS ${onos_ssh_connection} 0 BBSM |
| 175 | Close ONOS SSH Connection ${onos_ssh_connection} |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 176 | Remove Tech Profile |
TorstenThieme | b41007d | 2020-06-22 12:14:12 +0000 | [diff] [blame] | 177 | |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 178 | Setup Test |
| 179 | [Documentation] Pre-test Setup |
| 180 | #test for empty device list |
| 181 | Test Empty Device List |
| 182 | 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] | 183 | ... ${olt_ssh_ip} ${olt_user} ${olt_pass} |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 184 | Run Keyword If ${has_dataplane} Sleep 60s |
| 185 | #create/preprovision device |
| 186 | ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT} |
| 187 | Set Suite Variable ${olt_device_id} |
| 188 | #validate olt states |
| 189 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN |
| 190 | ... ${olt_device_id} |
| 191 | Sleep 5s |
| 192 | |
| 193 | Calculate Timeout |
| 194 | [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus |
| 195 | ${timeout} Fetch From Left ${timeout} s |
| 196 | ${timeout}= evaluate ${timeout}+((${num_onus}-4)*30) |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 197 | ${timeout}= Set Variable If (not ${debugmode}) and (${timeout}>600) 600 ${timeout} |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 198 | ${timeout}= Catenate SEPARATOR= ${timeout} s |
| 199 | Set Suite Variable ${timeout} |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 200 | |
| 201 | Do ONU Up To State Test |
| 202 | [Documentation] This keyword performs Up2State Test |
| 203 | ... All states up to the passed have to be checked |
| 204 | FOR ${I} IN RANGE 0 ${num_onus} |
| 205 | ${src}= Set Variable ${hosts.src[${I}]} |
| 206 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 207 | Run Keyword If ${state2test}>=1 |
| 208 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 209 | ... Validate Device ENABLED ACTIVATING REACHABLE |
| 210 | ... ${src['onu']} onu=True onu_reason=activating-onu |
| 211 | Run Keyword If ${state2test}>=2 |
| 212 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 213 | ... Validate Device ENABLED ACTIVATING REACHABLE |
| 214 | ... ${src['onu']} onu=True onu_reason=starting-openomci |
| 215 | Run Keyword If ${state2test}>=3 |
| 216 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 217 | ... Validate Device ENABLED ACTIVATING REACHABLE |
| 218 | ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete |
| 219 | Run Keyword If ${state2test}>=4 |
| 220 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 221 | ... Validate Device ENABLED ACTIVE REACHABLE |
| 222 | ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded |
| 223 | Run Keyword If ${state2test}>=5 |
| 224 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 225 | ... Validate Device ENABLED ACTIVE REACHABLE |
| 226 | ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success |
| 227 | Run Keyword If ${state2test}>=6 |
| 228 | ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 229 | ... Validate Device ENABLED ACTIVE REACHABLE |
| 230 | ... ${src['onu']} onu=True onu_reason=omci-flows-pushed |
| 231 | END |
| 232 | |
| 233 | Do ONU Single State Test |
| 234 | [Documentation] This keyword performs SingleState Test |
| 235 | ... Only the passed state has to be checked |
| 236 | FOR ${I} IN RANGE 0 ${num_onus} |
| 237 | ${src}= Set Variable ${hosts.src[${I}]} |
| 238 | ${dst}= Set Variable ${hosts.dst[${I}]} |
TorstenThieme | 015d5c0 | 2020-09-11 09:53:34 +0000 | [diff] [blame] | 239 | ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state2test} |
| 240 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 241 | ... Validate Device ${admin_state} ${oper_status} ${connect_status} |
| 242 | ... ${src['onu']} onu=True onu_reason=${onu_state} |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 243 | END |
| 244 | |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 245 | Do ONU Single State Test Time |
| 246 | [Documentation] This keyword performs SingleState Test with calculate running time |
| 247 | ... Only the passed state has to be checked and the duration each single onu adapter needed |
| 248 | ... will be calculated and printed out |
TorstenThieme | 17becfc | 2020-10-08 09:46:27 +0000 | [diff] [blame] | 249 | #${ListfinishedONUs} Create List |
| 250 | #Set Global Variable ${ListfinishedONUs} |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 251 | Create File ONU_Startup_Time.txt This file contains the startup times of all ONUs. |
| 252 | ${list_onus} Create List |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 253 | Build ONU SN List ${list_onus} |
TorstenThieme | 015d5c0 | 2020-09-11 09:53:34 +0000 | [diff] [blame] | 254 | ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state2test} |
| 255 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
TorstenThieme | 9949b17 | 2020-06-16 10:00:15 +0000 | [diff] [blame] | 256 | ... Validate ONU Devices MIB State With Duration |
TorstenThieme | 015d5c0 | 2020-09-11 09:53:34 +0000 | [diff] [blame] | 257 | ... ${onu_state} ${list_onus} ${timeStart} print2console=True |
TorstenThieme | 401af43 | 2020-06-11 15:53:53 +0000 | [diff] [blame] | 258 | ... output_file=ONU_Startup_Time.txt |
TorstenThieme | 94e4ae4 | 2020-05-18 13:01:42 +0000 | [diff] [blame] | 259 | |
TorstenThieme | 1619db2 | 2020-04-03 12:01:15 +0000 | [diff] [blame] | 260 | Do Onu Port Check |
TorstenThieme | 0095868 | 2020-06-19 11:29:31 +0000 | [diff] [blame] | 261 | [Documentation] Check that all the UNI ports show up in ONOS |
TorstenThieme | 17becfc | 2020-10-08 09:46:27 +0000 | [diff] [blame] | 262 | Wait for Ports in ONOS ${onos_ssh_connection} ${num_onus} BBSM |
TorstenThieme | 9949b17 | 2020-06-16 10:00:15 +0000 | [diff] [blame] | 263 | |
TorstenThieme | 109683b | 2020-09-24 12:35:41 +0000 | [diff] [blame] | 264 | Do Onu Flow Check |
| 265 | [Documentation] Check that all ONU flows show up in ONOS and Voltha |
| 266 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number} |
| 267 | ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 268 | ... Get NNI Port in ONOS ${of_id} |
| 269 | FOR ${I} IN RANGE 0 ${num_onus} |
| 270 | ${src}= Set Variable ${hosts.src[${I}]} |
| 271 | ${dst}= Set Variable ${hosts.dst[${I}]} |
| 272 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 273 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 274 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 275 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 276 | ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 277 | ... volt-add-subscriber-access ${of_id} ${onu_port} |
| 278 | # Verify subscriber access flows are added for the ONU port |
| 279 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s |
| 280 | ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} |
| 281 | ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']} |
| 282 | #check for previous state is kept (normally omci-flows-pushed) |
| 283 | Do Current State Test ${state2test} ${src['onu']} |
| 284 | END |
| 285 | |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 286 | Set Tech Profile |
| 287 | [Documentation] This keyword set the passed TechProfile for the test |
| 288 | [Arguments] ${TechProfile} |
TorstenThieme | 87cd620 | 2020-09-09 10:01:28 +0000 | [diff] [blame] | 289 | Log To Console \nTechProfile:${TechProfile} |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 290 | ${namespace}= Set Variable default |
Andrea Campanella | 60dde30 | 2020-09-09 18:42:56 +0200 | [diff] [blame] | 291 | ${podname}= Set Variable etcd |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 292 | ${src}= Set Variable ${data_dir}/TechProfile-${TechProfile}.json |
| 293 | ${dest}= Set Variable /tmp/flexpod.json |
| 294 | ${command} Catenate |
| 295 | ... /bin/sh -c 'cat ${dest} | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/64' |
| 296 | Copy File To Pod ${namespace} ${podname} ${src} ${dest} |
| 297 | Exec Pod ${namespace} ${podname} ${command} |
| 298 | ${commandget} Catenate |
| 299 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64' |
| 300 | Exec Pod ${namespace} ${podname} ${commandget} |
| 301 | |
| 302 | Remove Tech Profile |
| 303 | [Documentation] This keyword removes TechProfile |
TorstenThieme | 015d5c0 | 2020-09-11 09:53:34 +0000 | [diff] [blame] | 304 | Log To Console \nTechProfile:${TechProfile} |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 305 | ${namespace}= Set Variable default |
Andrea Campanella | 60dde30 | 2020-09-09 18:42:56 +0200 | [diff] [blame] | 306 | ${podname}= Set Variable etcd |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 307 | ${command} Catenate |
| 308 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/64' |
| 309 | Exec Pod ${namespace} ${podname} ${command} |
| 310 | ${commandget} Catenate |
| 311 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64' |
| 312 | Exec Pod ${namespace} ${podname} ${commandget} |
| 313 | |
| 314 | Do Check Tech Profile |
| 315 | [Documentation] This keyword checks the loaded TechProfile |
| 316 | ${namespace}= Set Variable default |
Andrea Campanella | 60dde30 | 2020-09-09 18:42:56 +0200 | [diff] [blame] | 317 | ${podname}= Set Variable etcd |
TorstenThieme | e0e5bba | 2020-08-05 11:20:13 +0000 | [diff] [blame] | 318 | ${commandget} Catenate |
| 319 | ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64' |
| 320 | ${result}= Exec Pod ${namespace} ${podname} ${commandget} |
| 321 | ${num_gem_ports}= Set Variable 1 |
| 322 | ${num_gem_ports}= Set Variable If |
| 323 | ... "${techprofile}"=="default" 1 |
| 324 | ... "${techprofile}"=="1T4GEM" 4 |
| 325 | ... "${techprofile}"=="1T8GEM" 8 |
| 326 | @{resultList} Split String ${result} separator=, |
| 327 | ${num_of_count_matches}= Get Match Count ${resultList} "num_gem_ports": ${num_gem_ports} |
| 328 | ... whitespace_insensitive=True |
| 329 | ${num_of_expected_matches}= Run Keyword If "${techprofile}"=="default" Evaluate ${num_onus} |
| 330 | ... ELSE Evaluate ${num_onus}+1 |
| 331 | Run Keyword If ${num_of_expected_matches}!=${num_of_count_matches} Log To Console |
| 332 | ... \nTechProfile (${TechProfile}) not loaded correctly:${num_of_count_matches} of ${num_of_expected_matches} |
TorstenThieme | 015d5c0 | 2020-09-11 09:53:34 +0000 | [diff] [blame] | 333 | |
| 334 | Do Disable Enable Onu Test |
| 335 | [Documentation] This keyword disables/enables all onus and checks the states. |
TorstenThieme | 17becfc | 2020-10-08 09:46:27 +0000 | [diff] [blame] | 336 | [Arguments] ${state2check}=${state2test} |
| 337 | Do Current State Test All Onus ${state2check} |
| 338 | Do Disable Onu ${state2check} |
| 339 | Do Current State Test All Onus omci-admin-lock |
| 340 | Log Ports |
| 341 | #check no port is enabled in ONOS |
| 342 | Wait for Ports in ONOS ${onos_ssh_connection} 0 BBSM |
| 343 | Do Enable Onu tech-profile-config-download-success |
| 344 | Do Current State Test All Onus ${state2check} |
| 345 | Log Ports onlyenabled=True |
| 346 | #check that all the UNI ports show up in ONOS again |
| 347 | Wait for Ports in ONOS ${onos_ssh_connection} ${num_onus} BBSM |
TorstenThieme | 015d5c0 | 2020-09-11 09:53:34 +0000 | [diff] [blame] | 348 | |
| 349 | Do Reconcile Onu Device |
| 350 | [Documentation] This keyword reconciles ONU device and check the state afterwards. |
| 351 | ... Following steps will be executed: |
| 352 | ... - restart openonu adaptor |
| 353 | ... - check openonu adaptor is ready again |
| 354 | ... - check previous state is kept |
| 355 | ... - ONU-Disable |
| 356 | ... - wait some seconds |
| 357 | ... - check for state omci-admin-lock |
| 358 | ... - ONU-Enable |
| 359 | ... - wait some seconds |
| 360 | ... - check for state onu-reenabled |
| 361 | ... - port check |
TorstenThieme | 015d5c0 | 2020-09-11 09:53:34 +0000 | [diff] [blame] | 362 | ${list_openonu_apps} Create List adapter-open-onu |
| 363 | ${namespace}= Set Variable voltha |
| 364 | ${adaptorname}= Set Variable open-onu |
TorstenThieme | 015d5c0 | 2020-09-11 09:53:34 +0000 | [diff] [blame] | 365 | Kill Adaptor ${namespace} ${adaptorname} |
| 366 | Sleep 5s |
| 367 | Wait For Pods Ready ${namespace} ${list_openonu_apps} |
| 368 | Do Disable Enable Onu Test |
| 369 | Run Keyword If ${porttest} Do Onu Port Check |
| 370 | |
TorstenThieme | 17becfc | 2020-10-08 09:46:27 +0000 | [diff] [blame] | 371 | Do Disable Onu |
| 372 | [Documentation] This keyword disables all onus and checks the states. |
| 373 | [Arguments] ${state2check} |
| 374 | FOR ${I} IN RANGE 0 ${num_onus} |
| 375 | ${src}= Set Variable ${hosts.src[${I}]} |
| 376 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 377 | Disable Device ${onu_device_id} |
| 378 | Wait Until Keyword Succeeds 20s 2s Test Devices Disabled in VOLTHA Id=${onu_device_id} |
| 379 | END |
| 380 | |
| 381 | Do Enable Onu |
| 382 | [Documentation] This keyword enables all onus and checks the states. |
| 383 | [Arguments] ${state2check} |
| 384 | FOR ${I} IN RANGE 0 ${num_onus} |
| 385 | ${src}= Set Variable ${hosts.src[${I}]} |
| 386 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 387 | Enable Device ${onu_device_id} |
| 388 | END |
| 389 | |
TorstenThieme | 015d5c0 | 2020-09-11 09:53:34 +0000 | [diff] [blame] | 390 | Do Current State Test |
| 391 | [Documentation] This keyword checks the passed state of the given onu. |
| 392 | [Arguments] ${state} ${onu} |
| 393 | ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state} |
| 394 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 395 | ... Validate Device ${admin_state} ${oper_status} ${connect_status} |
| 396 | ... ${onu} onu=True onu_reason=${onu_state} |
| 397 | |
TorstenThieme | 17becfc | 2020-10-08 09:46:27 +0000 | [diff] [blame] | 398 | Do Current State Test All Onus |
| 399 | [Documentation] This keyword checks the passed state of all onus. |
| 400 | ... Hint: ${timeStart} will be not evaluated here! |
| 401 | [Arguments] ${state} |
| 402 | ${list_onus} Create List |
| 403 | Build ONU SN List ${list_onus} |
| 404 | ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state} |
| 405 | #Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 406 | #... Validate ONU Devices MIB State With Duration |
| 407 | #... ${onu_state} ${list_onus} ${timeStart} |
| 408 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms |
| 409 | ... Validate ONU Devices With Duration |
| 410 | ... ${admin_state} ${oper_status} ${connect_status} |
| 411 | ... ${onu_state} ${list_onus} ${timeStart} |
| 412 | Log Ports |
| 413 | [Documentation] This keyword logs all port data available in ONOS of first port per ONU |
| 414 | [Arguments] ${onlyenabled}=False |
| 415 | ${cmd} Set Variable If ${onlyenabled} ports -e ports |
| 416 | ${onu_ports}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} ${cmd} |
| 417 | ${lines} = Get Lines Matching Regexp ${onu_ports} .*portName=BBSM[0-9]{8}-1 |
| 418 | Log ${lines} |
| 419 | |
TorstenThieme | 015d5c0 | 2020-09-11 09:53:34 +0000 | [diff] [blame] | 420 | Kill Adaptor |
| 421 | [Documentation] This keyword kills the passed adaptor. |
| 422 | [Arguments] ${namespace} ${name} |
| 423 | ${cmd} Catenate |
| 424 | ... kubectl exec -it -n voltha $(kubectl get pods -n ${namespace} | grep ${name} | awk 'NR==1{print $1}') |
| 425 | ... -- /bin/sh -c "kill 1" |
| 426 | ${rc} ${output}= Run and Return Rc and Output ${cmd} |
| 427 | Log ${output} |
| 428 | |
| 429 | Map State |
| 430 | [Documentation] This keyword converts the passed numeric value or name of a onu state to its state values. |
| 431 | [Arguments] ${state} |
| 432 | # create state lists with corresponding return values |
| 433 | # ADMIN-STATE OPER-STATUS CONNECT-STATUS ONU-STATE |
| 434 | ${state1} Create List ENABLED ACTIVATING REACHABLE activating-onu |
| 435 | ${state2} Create List ENABLED ACTIVATING REACHABLE starting-openomci |
| 436 | ${state3} Create List ENABLED ACTIVATING REACHABLE discovery-mibsync-complete |
| 437 | ${state4} Create List ENABLED ACTIVE REACHABLE initial-mib-downloaded |
| 438 | ${state5} Create List ENABLED ACTIVE REACHABLE tech-profile-config-download-success |
| 439 | ${state6} Create List ENABLED ACTIVE REACHABLE omci-flows-pushed |
TorstenThieme | 17becfc | 2020-10-08 09:46:27 +0000 | [diff] [blame] | 440 | ${state7} Create List DISABLED UNKNOWN REACHABLE omci-admin-lock |
TorstenThieme | 015d5c0 | 2020-09-11 09:53:34 +0000 | [diff] [blame] | 441 | ${state8} Create List ENABLED ACTIVE REACHABLE onu-reenabled |
| 442 | ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Set Variable If |
| 443 | ... '${state}'=='1' or '${state}'=='activating-onu' ${state1} |
| 444 | ... '${state}'=='2' or '${state}'=='starting-openomci' ${state2} |
| 445 | ... '${state}'=='3' or '${state}'=='discovery-mibsync-complete' ${state3} |
| 446 | ... '${state}'=='4' or '${state}'=='initial-mib-downloaded' ${state4} |
| 447 | ... '${state}'=='5' or '${state}'=='tech-profile-config-download-success' ${state5} |
| 448 | ... '${state}'=='6' or '${state}'=='omci-flows-pushed' ${state6} |
| 449 | ... '${state}'=='7' or '${state}'=='omci-admin-lock' ${state7} |
| 450 | ... '${state}'=='8' or '${state}'=='onu-reenabled' ${state8} |
| 451 | [Return] ${admin_state} ${oper_status} ${connect_status} ${onu_state} |