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} |
| 70 | Set Global Variable ${VOLTCTL_CONFIG} export VOLTCONFIG=%{VOLTCONFIG} |
| 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} |
| 115 | @{container_list}= Create List adapter-open-olt adapter-open-onu voltha-api-server |
| 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} |
| 134 | ${olt_device_id}= Create Device ${list_olts}[${I}][ip] ${OLT_PORT} |
| 135 | Set Suite Variable ${olt_device_id} |
| 136 | #validate olt states |
| 137 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN |
| 138 | ... ${olt_device_id} |
| 139 | Sleep 5s |
| 140 | Enable Device ${olt_device_id} |
| 141 | Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE |
| 142 | ... ${olt_serial_number} |
| 143 | ${logical_id}= Get Logical Device ID From SN ${olt_serial_number} |
| 144 | Set Suite Variable ${logical_id} |
| 145 | END |
| 146 | |
| 147 | Do Sanity Test |
| 148 | [Arguments] ${host_src} ${host_dst} |
| 149 | [Documentation] This keyword performs Sanity Test Procedure |
| 150 | ... Sanity test performs authentication, dhcp and pings for all the ONUs given for the POD |
| 151 | ... This keyword can be used to call in any other tests where sanity check is required |
| 152 | ... and avoids duplication of code. |
| 153 | ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number} |
| 154 | Set Global Variable ${of_id} |
| 155 | ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 156 | ... Get NNI Port in ONOS ${of_id} |
| 157 | Set Global Variable ${nni_port} |
| 158 | ${num_onus}= Get Length ${host_src} |
| 159 | ${num_onus}= Convert to String ${num_onus} |
| 160 | FOR ${I} IN RANGE 0 ${num_onus} |
| 161 | ${src}= Set Variable ${host_src[${I}]} |
| 162 | ${dst}= Set Variable ${host_dst[${I}]} |
| 163 | Run Keyword and Ignore Error Collect Logs |
| 164 | ${onu_device_id}= Get Device ID From SN ${src['onu']} |
| 165 | ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 166 | ... Get ONU Port in ONOS ${src['onu']} ${of_id} |
| 167 | # Check ONU port is Enabled in ONOS |
| 168 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s |
| 169 | ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 170 | # Verify EAPOL flows are added for the ONU port |
| 171 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 172 | ... Verify Eapol Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 173 | # Verify ONU state in voltha |
| 174 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device |
| 175 | ... ENABLED ACTIVE REACHABLE |
| 176 | ... ${src['onu']} onu=True onu_reason=omci-flows-pushed |
| 177 | # Perform Authentication |
| 178 | ${wpa_log}= Run Keyword If ${has_dataplane} Catenate SEPARATOR=. |
| 179 | ... /tmp/wpa ${src['dp_iface_name']} log |
| 180 | Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate Authentication True |
| 181 | ... ${src['dp_iface_name']} wpa_supplicant.conf ${src['ip']} ${src['user']} ${src['pass']} |
| 182 | ... ${src['container_type']} ${src['container_name']} ${wpa_log} |
| 183 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 184 | ... Verify ONU in AAA-Users ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 185 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2 |
| 186 | ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT} |
| 187 | ... volt-add-subscriber-access ${of_id} ${onu_port} |
| 188 | # Verify that no pending flows exist for the ONU port |
| 189 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 190 | ... Verify No Pending Flows For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 191 | # Verify subscriber access flows are added for the ONU port |
| 192 | # Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s |
| 193 | # ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id} |
| 194 | # ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']} |
| 195 | Run Keyword If ${has_dataplane} Run Keyword And Continue On Failure Validate DHCP and Ping True |
| 196 | ... True ${src['dp_iface_name']} ${src['s_tag']} ${src['c_tag']} ${dst['dp_iface_ip_qinq']} |
| 197 | ... ${src['ip']} ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']} |
| 198 | ... ${dst['dp_iface_name']} ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} |
| 199 | ... ${dst['container_name']} |
| 200 | Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s |
| 201 | ... Validate Subscriber DHCP Allocation ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port} |
| 202 | Run Keyword and Ignore Error Get Device Output from Voltha ${onu_device_id} |
| 203 | Run Keyword and Ignore Error Collect Logs |
| 204 | END |
| 205 | |