Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 1 | # Copyright 2017-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | *** Settings *** |
| 16 | Documentation Test various E2E conditions for seba-in-a-box |
| 17 | Suite Setup Setup |
| 18 | Suite Teardown Teardown |
Kailash | ca7900f | 2019-03-20 16:17:33 -0700 | [diff] [blame] | 19 | #Test Teardown Debug Tests |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 20 | Library Collections |
| 21 | Library String |
| 22 | Library OperatingSystem |
| 23 | Library XML |
| 24 | Library RequestsLibrary |
| 25 | Library bbsim_utils.py |
| 26 | Library ../../Framework/utils/utils.py |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 27 | Library ../../Framework/restApi.py |
| 28 | Resource ../../Framework/Subscriber.robot |
| 29 | Resource ../../Framework/ATTWorkFlowDriver.robot |
| 30 | Resource ../../Framework/Kubernetes.robot |
| 31 | Resource ../../Framework/ONU.robot |
| 32 | Resource ../../Framework/DHCP.robot |
| 33 | Variables ../../Properties/RestApiProperties.py |
| 34 | |
| 35 | *** Variables *** |
| 36 | ${number_of_onus} 16 |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 37 | ${timeout} 300s |
Kailash | 1ec4787 | 2019-04-12 19:14:05 -0700 | [diff] [blame] | 38 | ${olt_sn} BBSIMOLT000 |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 39 | |
| 40 | *** Test Cases *** |
| 41 | Create Subscriber and Whitelist for ONUs |
| 42 | [Documentation] Creates whitelists in ATT-WF for each onu device |
| 43 | [Tags] create |
| 44 | ${att_workflow_service_id}= Get Service Owner Id ${ATT_SERVICE} |
| 45 | ${volt_service_id}= Get Service Owner Id ${VOLT_SERVICE} |
| 46 | ${rcord_service_id}= Get Service Owner Id /xosapi/v1/rcord/rcordservices |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 47 | @{subscribers}= Generate Subscribers ${number_of_onus} ${rcord_service_id} |
| 48 | : FOR ${subscriber} IN @{subscribers} |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 49 | \ CORD Post ${VOLT_SUBSCRIBER} ${subscriber} |
| 50 | @{whitelists}= Generate Whitelists ${number_of_onus} ${att_workflow_service_id} |
| 51 | : FOR ${whitelist} IN @{whitelists} |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 52 | \ CORD Post ${ATT_WHITELIST} ${whitelist} |
Kailash | 490e70b | 2019-04-09 06:54:01 -0700 | [diff] [blame] | 53 | CORD Post ${VOLT_DEVICE} {'device_type': 'openolt', 'host': 'bbsim.voltha.svc', 'port': 50060, 'switch_datapath_id': 'of:0000000000000002', 'switch_port': '3', 'outer_tpid': '0x8100', 'uplink': '65536', 'nas_id': 'NAS_ID', 'serial_number': '${olt_sn}', 'volt_service_id': ${volt_service_id}} |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 54 | |
Kailash | 498bf1c | 2019-03-18 21:05:05 -0700 | [diff] [blame] | 55 | Validate ONUs in VOLTHA |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 56 | [Documentation] Verify number of onus that appear in voltha and its states |
Kailash | 498bf1c | 2019-03-18 21:05:05 -0700 | [diff] [blame] | 57 | [Tags] voltha |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 58 | Wait Until Keyword Succeeds ${timeout} 5s Validate Voltha ${number_of_onus} |
| 59 | |
| 60 | Validate OLT and AAA-Users in ONOS |
| 61 | [Documentation] Verify olt devices in ONOS and all onus are authenticated via AAA app |
| 62 | [Tags] onos |
Kailash | ec8abf8 | 2019-04-09 16:07:59 -0700 | [diff] [blame] | 63 | Wait Until Keyword Succeeds ${timeout} 1s OLT Device in ONOS |
| 64 | Wait Until Keyword Succeeds ${timeout} 5s Verify Number of AAA-Users ${number_of_onus} |
Kailash | 498bf1c | 2019-03-18 21:05:05 -0700 | [diff] [blame] | 65 | |
| 66 | Validate ONUs in XOS |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 67 | [Documentation] Validates All ONU Devices are discovered in XOS |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 68 | [Tags] onudiscovery |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 69 | Wait Until Keyword Succeeds ${timeout} 5s Validate Number of ONU Devices ${number_of_onus} |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 70 | |
Kailash | 498bf1c | 2019-03-18 21:05:05 -0700 | [diff] [blame] | 71 | Validate ONU States in XOS |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 72 | [Documentation] Validates All ONU Device states are "enabled" and "active" |
| 73 | [Tags] onustates |
| 74 | : FOR ${onu} IN @{serial_numbers} |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 75 | \ Wait Until Keyword Succeeds ${timeout} 5s Validate ONU States ACTIVE ENABLED ${onu} |
| 76 | |
Kailash Khalasi | 190e47f | 2019-04-30 21:38:24 +0000 | [diff] [blame] | 77 | Validate Hosts and DHCP Allocations in ONOS |
| 78 | [Documentation] Verify number of hosts in ONOS match number of onus and verify number of DHCP allocations |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 79 | [Tags] onosdhcp |
Kailash Khalasi | 190e47f | 2019-04-30 21:38:24 +0000 | [diff] [blame] | 80 | #Wait Until Keyword Succeeds ${timeout} 5s Validate Hosts in ONOS ${number_of_onus} |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 81 | Wait Until Keyword Succeeds ${timeout} 5s Validate DHCP Allocations ${number_of_onus} |
| 82 | |
| 83 | Validate ATT WF Driver SIs |
Kailash Khalasi | 190e47f | 2019-04-30 21:38:24 +0000 | [diff] [blame] | 84 | [Documentation] Validates all service instances per onu devices become "approved" and "dhcpdiscovered" |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 85 | [Tags] serviceinstances |
| 86 | : FOR ${onu} IN @{serial_numbers} |
| 87 | \ Wait Until Keyword Succeeds ${timeout} 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${onu} |
| 88 | \ Wait Until Keyword Succeeds ${timeout} 5s Validate ATT Workflow Driver SI DHCP State DHCPACK ${onu} |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 89 | |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 90 | *** Keywords *** |
| 91 | Setup |
Kailash | 45ab7e9 | 2019-06-10 13:12:05 -0700 | [diff] [blame] | 92 | ${server_ip}= Get Environment Variable SERVER_IP 127.0.0.1 |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 93 | ${port}= Get Environment Variable SERVER_PORT 30001 |
| 94 | ${auth} = Create List ${XOS_USER} ${XOS_PASSWD} |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 95 | ${voltha_auth}= Create List voltha admin |
| 96 | ${onos_auth}= Create List karaf karaf |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 97 | ${HEADERS} Create Dictionary Content-Type=application/json |
Kailash | 498bf1c | 2019-03-18 21:05:05 -0700 | [diff] [blame] | 98 | Create Session XOS http://${server_ip}:${port} auth=${AUTH} headers=${HEADERS} |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 99 | Create Session VOLTHA http://${server_ip}:30125 auth=${VOLTHA_AUTH} headers=${HEADERS} |
| 100 | Create Session ONOS http://${server_ip}:30120 auth=${ONOS_AUTH} |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 101 | @{container_list}= Create List |
| 102 | Append To List ${container_list} att-workflow-att-workflow-driver |
| 103 | Append To List ${container_list} seba-services-volt |
| 104 | Append To List ${container_list} seba-services-rcord |
| 105 | Append To List ${container_list} seba-services-fabric-crossconnect |
| 106 | Append To List ${container_list} seba-services-onos-service |
| 107 | Append To List ${container_list} xos-core |
| 108 | Append To List ${container_list} vcore |
| 109 | Set Suite Variable ${container_list} |
| 110 | |
| 111 | Teardown |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 112 | Delete All Sessions |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 113 | |
| 114 | Validate Number of ONU Devices |
| 115 | [Arguments] ${expected_onus} |
| 116 | ${resp}= CORD Get ${ONU_DEVICE} |
Kailash | 498bf1c | 2019-03-18 21:05:05 -0700 | [diff] [blame] | 117 | Validate ONUs in Response ${resp} ${expected_onus} |
| 118 | |
| 119 | Validate Voltha |
| 120 | [Arguments] ${expected_onus} |
| 121 | ${resp}= Get Request VOLTHA api/v1/devices |
| 122 | Log ${resp.content} |
| 123 | Should Be Equal As Strings ${resp.status_code} 200 |
| 124 | Validate ONUs in Response ${resp} ${expected_onus} |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 125 | Validate ONU States in Voltha ${resp} |
Kailash | 498bf1c | 2019-03-18 21:05:05 -0700 | [diff] [blame] | 126 | |
| 127 | Validate ONUs in Response |
| 128 | [Arguments] ${resp} ${expected_onus} |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 129 | ${jsondata}= To Json ${resp.content} |
Kailash | 498bf1c | 2019-03-18 21:05:05 -0700 | [diff] [blame] | 130 | Should Not Be Empty ${jsondata['items']} |
Kailash | 2217967 | 2019-03-18 20:24:55 -0700 | [diff] [blame] | 131 | ${length}= Get Length ${jsondata['items']} |
| 132 | @{serial_numbers}= Create List |
| 133 | : FOR ${INDEX} IN RANGE 0 ${length} |
| 134 | \ ${value}= Get From List ${jsondata['items']} ${INDEX} |
| 135 | \ ${sn}= Get From Dictionary ${value} serial_number |
| 136 | \ ${contains}= Evaluate "BBSM" in """${sn}""" |
| 137 | \ Run Keyword if '${contains}' == 'True' Append To List ${serial_numbers} ${sn} |
| 138 | Set Suite Variable ${serial_numbers} |
| 139 | ${length_of_bbsim_onus}= Get Length ${serial_numbers} |
| 140 | Should Be Equal as Integers ${length_of_bbsim_onus} ${expected_onus} |
| 141 | |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 142 | Validate ONU States in Voltha |
| 143 | [Arguments] ${resp} |
| 144 | ${jsondata}= To Json ${resp.content} |
| 145 | Should Not Be Empty ${jsondata['items']} |
| 146 | ${length}= Get Length ${jsondata['items']} |
| 147 | @{serial_numbers}= Create List |
| 148 | : FOR ${INDEX} IN RANGE 0 ${length} |
| 149 | \ ${value}= Get From List ${jsondata['items']} ${INDEX} |
| 150 | \ ${admin_state}= Get From Dictionary ${value} admin_state |
| 151 | \ ${oper_status}= Get From Dictionary ${value} oper_status |
| 152 | \ Should Be Equal As Strings ${admin_state} ENABLED |
| 153 | \ Should Be Equal As Strings ${oper_status} ACTIVE |
| 154 | |
Kailash | 498bf1c | 2019-03-18 21:05:05 -0700 | [diff] [blame] | 155 | CORD Get |
| 156 | [Documentation] Make a GET call to XOS |
| 157 | [Arguments] ${service} |
| 158 | ${resp}= Get Request XOS ${service} |
| 159 | Log ${resp.content} |
| 160 | Should Be Equal As Strings ${resp.status_code} 200 |
| 161 | [Return] ${resp} |
| 162 | |
| 163 | CORD Post |
| 164 | [Documentation] Make a POST call to XOS |
| 165 | [Arguments] ${service} ${data} |
| 166 | ${data}= Evaluate json.dumps(${data}) json |
| 167 | ${resp}= Post Request XOS uri=${service} data=${data} |
| 168 | Log ${resp.content} |
| 169 | Should Be Equal As Strings ${resp.status_code} 200 |
| 170 | [Return] ${resp} |
Kailash | dc5e78b | 2019-03-19 09:24:23 -0700 | [diff] [blame] | 171 | |
| 172 | CORD Delete |
| 173 | [Documentation] Make a DELETE call to the CORD controller |
| 174 | [Arguments] ${service} ${data_id} |
| 175 | ${resp}= Delete Request XOS uri=${service}/${data_id} |
| 176 | Log ${resp.content} |
| 177 | Should Be Equal As Strings ${resp.status_code} 200 |
| 178 | [Return] ${resp} |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 179 | |
| 180 | Verify Number of AAA-Users |
| 181 | [Arguments] ${expected_onus} |
Kailash | 5e9c161 | 2019-05-22 10:22:55 -0700 | [diff] [blame] | 182 | ${aaa_users}= Execute ONOS Command aaa-users | grep AUTHORIZED | wc -l |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 183 | Should Contain ${aaa_users} ${expected_onus} |
| 184 | |
| 185 | Validate Hosts in ONOS |
| 186 | [Arguments] ${expected_onus} |
| 187 | ${hosts}= Execute ONOS Command hosts | grep -v 65537 | wc -l |
| 188 | Should Contain ${hosts} ${expected_onus} |
| 189 | |
| 190 | Validate DHCP Allocations |
| 191 | [Arguments] ${expected_onus} |
Kailash | 5e9c161 | 2019-05-22 10:22:55 -0700 | [diff] [blame] | 192 | ${allocations}= Execute ONOS Command dhcpl2relay-allocations | grep DHCPACK | wc -l |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 193 | Should Contain ${allocations} ${expected_onus} |
| 194 | |
| 195 | OLT Device in ONOS |
| 196 | ${resp}= Get Request ONOS onos/v1/devices |
| 197 | ${jsondata}= To Json ${resp.content} |
| 198 | Should Not Be Empty ${jsondata['devices']} |
| 199 | ${length}= Get Length ${jsondata['devices']} |
| 200 | @{serial_numbers}= Create List |
| 201 | : FOR ${INDEX} IN RANGE 0 ${length} |
| 202 | \ ${value}= Get From List ${jsondata['devices']} ${INDEX} |
| 203 | \ ${sn}= Get From Dictionary ${value} serial |
| 204 | \ ${dpid}= Get From Dictionary ${value} id |
| 205 | Should Be Equal As Strings ${dpid} of:0000626273696d76 |
Kailash | 54860e3 | 2019-03-21 09:56:30 -0700 | [diff] [blame] | 206 | Should Be Equal As Strings ${sn} ${olt_sn} |
Kailash | 3944340 | 2019-03-19 13:21:04 -0700 | [diff] [blame] | 207 | |
| 208 | Execute ONOS Command |
| 209 | [Arguments] ${cmd} |
| 210 | ${conn_id}= SSHLibrary.Open Connection localhost port=30115 prompt=onos> timeout=300s |
| 211 | SSHLibrary.Login karaf karaf |
| 212 | ${output}= SSHLibrary.Execute Command ${cmd} |
| 213 | SSHLibrary.Close Connection |
| 214 | [Return] ${output} |
| 215 | |
| 216 | Debug Tests |
| 217 | ${flows}= Execute ONOS Command flows |
| 218 | ${onos_logs}= Execute ONOS Command log:display |
| 219 | Log ${flows} |
| 220 | Log ${onos_logs} |