TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test various end-to-end scenarios with multiple OLTs |
| 3 | Suite Setup Setup Suite |
| 4 | Suite Teardown Teardown Suite |
| 5 | Test 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 |
| 32 | ${timeout} 60s |
| 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 | |
| 42 | *** Test Cases *** |
| 43 | Sanity E2E Test for OLTs/ONUs on POD |
| 44 | [Documentation] Validates E2E Ping Connectivity and object states for the given scenario: |
| 45 | ... Validate successful authentication/DHCP/E2E ping for the tech profile that is used |
| 46 | [Tags] sanityMultiOLT |
| 47 | [Setup] Run Keywords Start Logging SanityMultiOLT |
| 48 | ... AND Setup Test |
| 49 | Run Keyword If ${has_dataplane} Clean Up Linux |
| 50 | FOR ${I} IN RANGE 0 ${num_olts} |
| 51 | ${olt_ip}= Evaluate ${olts}[${I}].get("ip") |
| 52 | ${olt_user}= Evaluate ${olts}[${I}].get("user") |
| 53 | ${olt_pass}= Evaluate ${olts}[${I}].get("pass") |
| 54 | ${olt_serial_number}= Evaluate ${olts}[${I}].get("serial") |
| 55 | ${src}= Evaluate ${hosts}[${I}].get("src") |
| 56 | ${dst}= Evaluate ${hosts}[${I}].get("dst") |
| 57 | Set Suite Variable ${olt_serial_number} |
| 58 | Set Suite Variable ${olt_ip} |
| 59 | Set Suite Variable ${olt_user} |
| 60 | Set Suite Variable ${olt_pass} |
| 61 | Wait Until Keyword Succeeds ${timeout} 2s Do Sanity Test ${src} ${dst} |
| 62 | END |
| 63 | [Teardown] Run Keywords Collect Logs |
| 64 | ... AND Stop Logging SanityTest |
| 65 | |
| 66 | *** Keywords *** |
| 67 | Setup Suite |
| 68 | [Documentation] Setup the test suite |
| 69 | Set Global Variable ${KUBECTL_CONFIG} export KUBECONFIG=%{KUBECONFIG} |
Matteo Scandolo | 5899be1 | 2020-11-11 15:38:07 -0800 | [diff] [blame] | 70 | Set Global Variable ${VOLTCTL_CONFIG} %{VOLTCONFIG} |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 71 | ${k8s_node_ip}= Evaluate ${nodes}[0].get("ip") |
| 72 | ${ONOS_REST_IP}= Get Environment Variable ONOS_REST_IP ${k8s_node_ip} |
| 73 | ${ONOS_SSH_IP}= Get Environment Variable ONOS_SSH_IP ${k8s_node_ip} |
| 74 | Set Global Variable ${ONOS_REST_IP} |
| 75 | Set Global Variable ${ONOS_SSH_IP} |
| 76 | ${k8s_node_user}= Evaluate ${nodes}[0].get("user") |
| 77 | ${k8s_node_pass}= Evaluate ${nodes}[0].get("pass") |
| 78 | Check CLI Tools Configured |
| 79 | ${onos_auth}= Create List karaf karaf |
| 80 | ${HEADERS} Create Dictionary Content-Type=application/json |
| 81 | Create Session ONOS http://${ONOS_REST_IP}:${ONOS_REST_PORT} auth=${ONOS_AUTH} |
| 82 | ${num_olts} Get Length ${olts} |
| 83 | ${num_olts} Convert to String ${num_olts} |
| 84 | ${list_olts} Create List |
| 85 | FOR ${I} IN RANGE 0 ${num_olts} |
| 86 | ${ip} Evaluate ${olts}[${I}].get("ip") |
| 87 | ${user} Evaluate ${olts}[${I}].get("user") |
| 88 | ${pass} Evaluate ${olts}[${I}].get("pass") |
| 89 | ${serial_number} Evaluate ${olts}[${I}].get("serial") |
| 90 | ${olt} Create Dictionary ip ${ip} user ${user} pass |
| 91 | ... ${pass} sn ${serial_number} |
| 92 | Append To List ${list_olts} ${olt} |
| 93 | END |
| 94 | ${olt_ip}= Evaluate ${olts}[0].get("ip") |
| 95 | ${olt_user}= Evaluate ${olts}[0].get("user") |
| 96 | ${olt_pass}= Evaluate ${olts}[0].get("pass") |
| 97 | ${olt_serial_number}= Evaluate ${olts}[0].get("serial") |
| 98 | ${num_onus}= Evaluate ${hosts}[0].get("src") |
| 99 | ${num_onus}= Get Length ${num_onus} |
| 100 | ${num_onus}= Convert to String ${num_onus} |
| 101 | #send sadis file to onos |
| 102 | ${sadis_file}= Get Variable Value ${sadis.file} |
| 103 | Log To Console \nSadis File:${sadis_file} |
| 104 | Run Keyword Unless '${sadis_file}' is '${None}' Send File To Onos ${sadis_file} apps/ |
| 105 | Set Suite Variable ${num_onus} |
| 106 | Set Suite Variable ${num_olts} |
| 107 | Set Suite Variable ${list_olts} |
| 108 | Set Suite Variable ${olt_serial_number} |
| 109 | Set Suite Variable ${olt_ip} |
| 110 | Set Suite Variable ${olt_user} |
| 111 | Set Suite Variable ${olt_pass} |
| 112 | Set Suite Variable ${k8s_node_ip} |
| 113 | Set Suite Variable ${k8s_node_user} |
| 114 | Set Suite Variable ${k8s_node_pass} |
Andrea Campanella | 3dcce27 | 2021-01-15 16:04:47 +0100 | [diff] [blame] | 115 | @{container_list}= Create List ${OLT_ADAPTER_APP_LABEL} adapter-open-onu voltha-api-server |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 116 | ... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent |
| 117 | Set Suite Variable ${container_list} |
| 118 | ${datetime}= Get Current Date |
| 119 | Set Suite Variable ${datetime} |
| 120 | |
| 121 | Setup Test |
| 122 | [Documentation] Pre-test Setup |
| 123 | #test for empty device list |
| 124 | Test Empty Device List |
| 125 | Sleep 60s |
| 126 | #create/preprovision device |
| 127 | #read all bbsims |
| 128 | ${rc} ${num_bbsims} Run And Return Rc And Output kubectl get pod -n voltha | grep bbsim | wc -l |
| 129 | Should Be Equal As Integers ${rc} 0 |
| 130 | Should Not Be Empty ${num_bbsims} |
| 131 | Should Not Be Equal As Integers ${num_bbsims} 0 |
| 132 | Run Keyword Unless ${has_dataplane} Set Suite Variable ${num_olts} ${num_bbsims} |
| 133 | FOR ${I} IN RANGE 0 ${num_olts} |
Andrea Campanella | 3dcce27 | 2021-01-15 16:04:47 +0100 | [diff] [blame] | 134 | ${olt_device_id}= Run Keyword If "${list_olts}[${I}][type]" == "${None}" |
| 135 | ... Create Device ${list_olts}[${I}][ip] ${OLT_PORT} |
| 136 | ... ELSE Create Device ${list_olts}[${I}][ip] ${OLT_PORT} ${list_olts}[${I}][type] |
TorstenThieme | bccd3ae | 2020-02-20 12:56:44 +0000 | [diff] [blame] | 137 | Set Suite Variable ${olt_device_id} |
| 138 | #validate olt states |
| 139 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN |
| 140 | ... ${olt_device_id} |
| 141 | Sleep 5s |
| 142 | Enable Device ${olt_device_id} |
| 143 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE |
| 144 | ... ${olt_serial_number} |
| 145 | ${logical_id}= Get Logical Device ID From SN ${olt_serial_number} |
| 146 | Set Suite Variable ${logical_id} |
| 147 | END |
| 148 | |
| 149 | Do Sanity Test |
| 150 | [Arguments] ${host_src} ${host_dst} |
| 151 | [Documentation] This keyword performs Sanity Test Procedure |
| 152 | ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD |
| 153 | ... This keyword can be used to call in any other tests where sanity check is required |
| 154 | ... and avoids duplication of code. |
| 155 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number} |
| 156 | Set Global Variable ${of_id} |
| 157 | ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 158 | ... Get NNI Port in ONOS ${of_id} |
| 159 | Set Global Variable ${nni_port} |
| 160 | ${num_onus}= Get Length ${host_src} |
| 161 | ${num_onus}= Convert to String ${num_onus} |
| 162 | FOR ${I} IN RANGE 0 ${num_onus} |
| 163 | ${src}= Set Variable ${host_src[${I}]} |
| 164 | ${dst}= Set Variable ${host_dst[${I}]} |
| 165 | Run Keyword and Ignore Error Collect Logs |
| 166 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 167 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 168 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 169 | # Check ONU port is Enabled in ONOS |
| 170 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s |
| 171 | ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 172 | # Verify EAPOL flows are added for the ONU port |
| 173 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 174 | ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 175 | # Verify ONU state in voltha |
| 176 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device |
| 177 | ... ENABLED ACTIVE REACHABLE |
| 178 | ... ${src['onu']} onu=True onu_reason=omci-flows-pushed |
| 179 | # Perform Authentication |
| 180 | ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=. |
| 181 | ... /tmp/wpa ${src['dp_iface_name']} log |
| 182 | Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True |
| 183 | ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']} |
| 184 | ... ${src['container_type']} ${src['container_name']} ${wpa_log} |
| 185 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 186 | ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 187 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 188 | ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 189 | ... volt-add-subscriber-access ${of_id} ${onu_port} |
| 190 | # Verify that no pending flows exist for the ONU port |
| 191 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 192 | ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 193 | # Verify subscriber access flows are added for the ONU port |
| 194 | # Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s |
| 195 | # ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} |
| 196 | # ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']} |
| 197 | Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True |
| 198 | ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']} |
| 199 | ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 200 | ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} |
| 201 | ... ${dst['container_name']} |
| 202 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 203 | ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 204 | Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id} |
| 205 | Run Keyword and Ignore Error Collect Logs |
| 206 | END |
| 207 | |