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