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