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