Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Scale up models in a SEBA deployment with no backends |
| 3 | Library KafkaLibrary |
| 4 | Library RequestsLibrary |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 5 | Library Collections |
| 6 | Library String |
| 7 | Library OperatingSystem |
Matteo Scandolo | 1a2f9dd | 2019-01-29 10:57:05 -0800 | [diff] [blame] | 8 | Library DateTime |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 9 | Library ./utils/devices.py |
| 10 | Suite Setup Setup |
| 11 | Suite Teardown Teardown |
| 12 | |
| 13 | *** Variables *** |
| 14 | ${xos_chameleon_url} xos-chameleon |
| 15 | ${xos_chameleon_port} 9101 |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 16 | ${num_olts} 1 |
| 17 | ${num_pon_ports} 1 |
| 18 | ${num_onus} 1 |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 19 | ${timeout} 300s |
| 20 | |
| 21 | *** Test Cases *** |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 22 | Check OLTs Created |
| 23 | ${res} = CORD Get /xosapi/v1/volt/oltdevices |
| 24 | ${jsondata} = To Json ${res.content} |
| 25 | ${length} = Get Length ${jsondata['items']} |
| 26 | ${total} = Convert To Integer ${num_olts} |
| 27 | Should Be Equal ${length} ${total} |
| 28 | |
| 29 | Check PON Ports Created |
| 30 | ${res} = CORD Get /xosapi/v1/volt/ponports |
| 31 | ${jsondata} = To Json ${res.content} |
| 32 | ${length} = Get Length ${jsondata['items']} |
| 33 | ${total} = Evaluate ${num_olts} * ${num_pon_ports} |
| 34 | Should Be Equal ${length} ${total} |
| 35 | |
| 36 | Check ONUs Created |
| 37 | ${res} = CORD Get /xosapi/v1/volt/onudevices |
| 38 | ${jsondata} = To Json ${res.content} |
| 39 | ${length} = Get Length ${jsondata['items']} |
| 40 | ${total} = Evaluate ${num_olts} * ${num_pon_ports} * ${num_onus} |
| 41 | Should Be Equal ${length} ${total} |
| 42 | |
| 43 | Check UNI Ports Created |
| 44 | ${res} = CORD Get /xosapi/v1/volt/uniports |
| 45 | ${jsondata} = To Json ${res.content} |
| 46 | ${length} = Get Length ${jsondata['items']} |
| 47 | ${total} = Evaluate ${num_olts} * ${num_pon_ports} * ${num_onus} |
| 48 | Should Be Equal ${length} ${total} |
| 49 | |
| 50 | Check Whitelist Created |
| 51 | ${res} = CORD Get /xosapi/v1/att-workflow-driver/attworkflowdriverwhitelistentries |
| 52 | ${jsondata} = To Json ${res.content} |
| 53 | ${length} = Get Length ${jsondata['items']} |
| 54 | ${total} = Evaluate ${num_olts} * ${num_pon_ports} * ${num_onus} |
| 55 | Should Be Equal ${length} ${total} |
| 56 | |
| 57 | Activate ONUs |
| 58 | [Documentation] Send activation events for all the ONUs and waits for the model_policies of ATT Workflow Driver Service Instances to have completed |
| 59 | ${events} = Generate Onu Events |
| 60 | : FOR ${e} IN @{events} |
| 61 | \ Send Kafka Event onu.events ${e} |
Matteo Scandolo | 1a2f9dd | 2019-01-29 10:57:05 -0800 | [diff] [blame] | 62 | ${start} = Get Time |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 63 | Wait Until Keyword Succeeds ${timeout} 5s Validate ATT_SI Number ${events} |
Kailash | 2abefa8 | 2019-02-01 12:40:07 -0800 | [diff] [blame] | 64 | Wait Until Keyword Succeeds ${timeout} 5s ModelPolicy completed |
Matteo Scandolo | 1a2f9dd | 2019-01-29 10:57:05 -0800 | [diff] [blame] | 65 | ${end} = Get Time |
| 66 | Log To Console Test started at: ${start} |
| 67 | Log To Console Test ended at: ${end} |
| 68 | ${duration} = Subtract Date From Date ${end} ${start} |
| 69 | Log To Console Test duration: ${duration} |
| 70 | |
Matteo Scandolo | 6ccc990 | 2019-03-01 13:07:35 -0800 | [diff] [blame] | 71 | Authenticate Subscribers |
| 72 | [Documentation] Send authentication events for all the ONUs and waits for the model_policies of ATT Workflow Driver Service Instances to have completed |
| 73 | ${events} = Generate Auth Events |
| 74 | : FOR ${e} IN @{events} |
| 75 | \ Send Kafka Event authentication.events ${e} |
| 76 | ${start} = Get Time |
| 77 | Wait Until Keyword Succeeds ${timeout} 5s AuthCompleted |
| 78 | Wait Until Keyword Succeeds ${timeout} 5s ModelPolicy completed |
| 79 | # TODO validate that: |
| 80 | # - subscriber status has changed |
| 81 | # - vOLT SI have been created and policed (we can't test sync'ed without a backend) |
| 82 | # - fabric-xconnect have been created and policed (we can't test sync'ed without a backend) |
| 83 | ${end} = Get Time |
| 84 | Log To Console Test started at: ${start} |
| 85 | Log To Console Test ended at: ${end} |
| 86 | ${duration} = Subtract Date From Date ${end} ${start} |
| 87 | Log To Console Test duration: ${duration} |
| 88 | |
| 89 | DHCP Subscribers |
| 90 | [Documentation] Send dhcp events for all the ONUs and waits for the model_policies of ATT Workflow Driver Service Instances to have completed |
| 91 | ${events} = Generate Dhcp Events |
| 92 | : FOR ${e} IN @{events} |
| 93 | \ Send Kafka Event dhcp.events ${e} |
| 94 | ${start} = Get Time |
| 95 | Wait Until Keyword Succeeds ${timeout} 5s DHCPCompleted |
| 96 | Wait Until Keyword Succeeds ${timeout} 5s ModelPolicy completed |
| 97 | # TODO validate that: |
| 98 | # - subscriber has an IP address |
| 99 | ${end} = Get Time |
| 100 | Log To Console Test started at: ${start} |
| 101 | Log To Console Test ended at: ${end} |
| 102 | ${duration} = Subtract Date From Date ${end} ${start} |
| 103 | Log To Console Test duration: ${duration} |
| 104 | |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 105 | |
| 106 | *** Keywords *** |
| 107 | |
| 108 | Validate ATT_SI Number |
| 109 | [Arguments] ${events} |
| 110 | ${res} = CORD Get /xosapi/v1/att-workflow-driver/attworkflowdriverserviceinstances |
| 111 | ${jsondata} = To Json ${res.content} |
| 112 | ${length} = Get Length ${jsondata['items']} |
| 113 | ${total} = Get Length ${events} |
Matteo Scandolo | 1a2f9dd | 2019-01-29 10:57:05 -0800 | [diff] [blame] | 114 | Log To Console ${length} Service Instances created, expecting ${total} |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 115 | Should Be Equal ${length} ${total} |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 116 | |
Matteo Scandolo | 6ccc990 | 2019-03-01 13:07:35 -0800 | [diff] [blame] | 117 | DHCPCompleted |
| 118 | [Documentation] Check that all ATT_SI have an ip address |
Kailash | 2abefa8 | 2019-02-01 12:40:07 -0800 | [diff] [blame] | 119 | ${res} = CORD Get /xosapi/v1/att-workflow-driver/attworkflowdriverserviceinstances |
| 120 | ${jsondata} = To Json ${res.content} |
Matteo Scandolo | 6ccc990 | 2019-03-01 13:07:35 -0800 | [diff] [blame] | 121 | Log To Console Checking DHCP |
Kailash | 2abefa8 | 2019-02-01 12:40:07 -0800 | [diff] [blame] | 122 | : FOR ${i} IN @{jsondata['items']} |
Matteo Scandolo | 6ccc990 | 2019-03-01 13:07:35 -0800 | [diff] [blame] | 123 | \ Should Not Be Empty ${i['ip_address']} |
| 124 | |
| 125 | AuthCompleted |
| 126 | [Documentation] Check that all ATT_SI have status=authenticated |
| 127 | ${res} = CORD Get /xosapi/v1/att-workflow-driver/attworkflowdriverserviceinstances |
| 128 | ${jsondata} = To Json ${res.content} |
| 129 | Log To Console Checking Authentication |
| 130 | : FOR ${i} IN @{jsondata['items']} |
| 131 | \ Should Be Equal ${i['authentication_state']} APPROVED |
| 132 | |
| 133 | ModelPolicy completed |
| 134 | # TODO make this method configurable to check model_policies on arbitrary models |
| 135 | [Documentation] Check that model_policies had run for all the items in the list |
| 136 | ${res} = CORD Get /xosapi/v1/att-workflow-driver/attworkflowdriverserviceinstances |
| 137 | ${jsondata} = To Json ${res.content} |
| 138 | Log To Console Checking ModelPolicy |
| 139 | : FOR ${i} IN @{jsondata['items']} |
| 140 | \ Should Be True ${i['policed']} >= ${i['updated']} |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 141 | |
| 142 | Setup |
Matteo Scandolo | 6ccc990 | 2019-03-01 13:07:35 -0800 | [diff] [blame] | 143 | # TODO remove all JSON files that a previous run may have left around |
Kailash | 48ef41a | 2019-03-05 13:08:37 -0800 | [diff] [blame] | 144 | ${cord_kafka}= Get Environment Variable CORD_KAFKA_IP cord-kafka |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 145 | ${target} = Evaluate ${num_olts} * ${num_pon_ports} * ${num_onus} |
| 146 | Log Testing with ${target} ONUs |
Matteo Scandolo | 1a2f9dd | 2019-01-29 10:57:05 -0800 | [diff] [blame] | 147 | Log To Console Testing with ${target} ONUs |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 148 | Connect Producer ${cord_kafka}:9092 onu.events |
| 149 | Connect Producer ${cord_kafka}:9092 authentication.events |
| 150 | Connect Producer ${cord_kafka}:9092 dhcp.events |
| 151 | ${auth} = Create List admin@opencord.org letmein |
| 152 | ${HEADERS} Create Dictionary Content-Type=application/json allow_modify_feedback=True |
| 153 | Create Session XOS http://${xos_chameleon_url}:${xos_chameleon_port} auth=${AUTH} headers=${HEADERS} |
| 154 | Store Data |
| 155 | Mock Data |
| 156 | ${mock} = Get Mock Data |
| 157 | Log ${mock} |
| 158 | |
| 159 | Teardown |
| 160 | [Documentation] Delete all models created |
| 161 | Log Teardown |
Matteo Scandolo | 6ccc990 | 2019-03-01 13:07:35 -0800 | [diff] [blame] | 162 | Log To Console Teardown |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 163 | Delete OLTs |
| 164 | Delete Whitelist |
| 165 | Delete ServiceInstances |
| 166 | Delete All Sessions |
| 167 | Clean Storage |
| 168 | |
| 169 | Mock Data |
| 170 | [Documentation] Mock all the data needed from the test |
| 171 | Create Mock Olts ${num_olts} ${voltservice_id} |
| 172 | Create Olts |
| 173 | Create Mock Pon Ports ${num_pon_ports} |
| 174 | Create Pon Ports |
| 175 | Create Mock Onus ${num_onus} |
| 176 | Create Onus |
| 177 | Create Mock Unis |
| 178 | Create Unis |
| 179 | Create Whitelist |
| 180 | |
| 181 | Create Olts |
| 182 | [Documentation] Stub OLT for the test |
| 183 | ${olts} = Get Rest Olts |
| 184 | : FOR ${OLT} IN @{olts} |
| 185 | \ Log ${OLT} |
Matteo Scandolo | 6ccc990 | 2019-03-01 13:07:35 -0800 | [diff] [blame] | 186 | \ Log To Console Creating OLT ${OLT['name']} |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 187 | \ ${res} = CORD Post /xosapi/v1/volt/oltdevices ${OLT} |
| 188 | \ ${jsondata} = To Json ${res.content} |
| 189 | \ Update Olt Id ${OLT} ${jsondata['id']} |
| 190 | |
| 191 | Create Pon Ports |
| 192 | ${pon_ports} = Get Rest Pon Ports |
| 193 | : FOR ${port} IN @{pon_ports} |
| 194 | \ Log ${port} |
Matteo Scandolo | 6ccc990 | 2019-03-01 13:07:35 -0800 | [diff] [blame] | 195 | \ Log To Console Creating PON Port ${port['name']} |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 196 | \ ${res} = CORD Post /xosapi/v1/volt/ponports ${port} |
| 197 | \ ${jsondata} = To Json ${res.content} |
| 198 | \ Update Pon Port Id ${port} ${jsondata['id']} |
| 199 | |
| 200 | Create Onus |
| 201 | ${onus} = Get Rest Onus |
| 202 | : FOR ${onu} IN @{onus} |
| 203 | \ Log ${onu} |
Matteo Scandolo | 6ccc990 | 2019-03-01 13:07:35 -0800 | [diff] [blame] | 204 | \ Log To Console Creating ONU ${onu['serial_number']} |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 205 | \ ${res} = CORD Post /xosapi/v1/volt/onudevices ${onu} |
| 206 | \ ${jsondata} = To Json ${res.content} |
| 207 | \ Update Onu Id ${onu} ${jsondata['id']} |
| 208 | |
| 209 | Create Unis |
| 210 | ${unis} = Get Rest Unis |
| 211 | : FOR ${uni} IN @{unis} |
| 212 | \ Log ${uni} |
Matteo Scandolo | 6ccc990 | 2019-03-01 13:07:35 -0800 | [diff] [blame] | 213 | \ Log To Console Creating UNI ${uni['name']} |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 214 | \ ${res} = CORD Post /xosapi/v1/volt/uniports ${uni} |
| 215 | \ ${jsondata} = To Json ${res.content} |
| 216 | \ Update Uni Id ${uni} ${jsondata['id']} |
| 217 | |
| 218 | Create Whitelist |
| 219 | [Documentation] Create a whitelist for the tests |
| 220 | ${whitelist} = Create Mock Whitelist ${attworkflowservice_id} |
| 221 | : FOR ${e} IN @{whitelist} |
| 222 | \ Log ${e} |
Matteo Scandolo | 6ccc990 | 2019-03-01 13:07:35 -0800 | [diff] [blame] | 223 | \ Log To Console Creating Whitelist Entry ${e['serial_number']} |
Matteo Scandolo | 564009f | 2019-01-16 14:11:02 -0800 | [diff] [blame] | 224 | \ ${res} = CORD Post /xosapi/v1/att-workflow-driver/attworkflowdriverwhitelistentries ${e} |
| 225 | |
| 226 | Delete Olts |
| 227 | [Documentation] Remove all the OLTs created for the test |
| 228 | ${res} = CORD Get /xosapi/v1/volt/oltdevices |
| 229 | ${jsondata} = To Json ${res.content} |
| 230 | :FOR ${ELEMENT} IN @{jsondata['items']} |
| 231 | \ ${id}= Get From Dictionary ${ELEMENT} id |
| 232 | \ CORD Delete /xosapi/v1/volt/oltdevices ${id} |
| 233 | |
| 234 | Delete Whitelist |
| 235 | [Documentation] Clean the whitelist |
| 236 | ${res} = CORD Get /xosapi/v1/att-workflow-driver/attworkflowdriverwhitelistentries |
| 237 | ${jsondata} = To Json ${res.content} |
| 238 | :FOR ${ELEMENT} IN @{jsondata['items']} |
| 239 | \ ${id}= Get From Dictionary ${ELEMENT} id |
| 240 | \ CORD Delete /xosapi/v1/att-workflow-driver/attworkflowdriverwhitelistentries ${id} |
| 241 | |
| 242 | Delete ServiceInstances |
| 243 | [Documentation] Clean the whitelist |
| 244 | ${res} = CORD Get /xosapi/v1/att-workflow-driver/attworkflowdriverserviceinstances |
| 245 | ${jsondata} = To Json ${res.content} |
| 246 | :FOR ${ELEMENT} IN @{jsondata['items']} |
| 247 | \ ${id}= Get From Dictionary ${ELEMENT} id |
| 248 | \ CORD Delete /xosapi/v1/att-workflow-driver/attworkflowdriverserviceinstances ${id} |
| 249 | |
| 250 | Store Data |
| 251 | [Documentation] Store all the ids needed for the test to work |
| 252 | # Get AttWorkflowDriverService id |
| 253 | ${resp}= CORD Get /xosapi/v1/att-workflow-driver/attworkflowdriverservices |
| 254 | ${jsondata}= To Json ${resp.content} |
| 255 | ${attworkflowservice}= Get From List ${jsondata['items']} 0 |
| 256 | ${attworkflowservice_id}= Get From Dictionary ${attworkflowservice} id |
| 257 | Set Suite Variable ${attworkflowservice_id} |
| 258 | |
| 259 | # Get VoltService id |
| 260 | ${resp}= CORD Get /xosapi/v1/volt/voltservices |
| 261 | ${jsondata}= To Json ${resp.content} |
| 262 | ${voltservice}= Get From List ${jsondata['items']} 0 |
| 263 | ${voltservice_id}= Get From Dictionary ${voltservice} id |
| 264 | Set Suite Variable ${voltservice_id} |
| 265 | |
| 266 | Send Kafka Event |
| 267 | [Documentation] Send event |
| 268 | [Arguments] ${topic} ${message} |
| 269 | Log Sending event |
| 270 | ${event}= evaluate json.dumps(${message}) json |
| 271 | Send ${topic} ${event} |
| 272 | Flush |
| 273 | |
| 274 | CORD Get |
| 275 | [Documentation] Make a GET call to XOS |
| 276 | [Arguments] ${service} |
| 277 | ${resp}= Get Request XOS ${service} |
| 278 | Log ${resp.content} |
| 279 | Should Be Equal As Strings ${resp.status_code} 200 |
| 280 | [Return] ${resp} |
| 281 | |
| 282 | CORD Post |
| 283 | [Documentation] Make a POST call to XOS |
| 284 | [Arguments] ${service} ${data} |
| 285 | ${data}= Evaluate json.dumps(${data}) json |
| 286 | ${resp}= Post Request XOS uri=${service} data=${data} |
| 287 | Log ${resp.content} |
| 288 | Should Be Equal As Strings ${resp.status_code} 200 |
| 289 | [Return] ${resp} |
| 290 | |
| 291 | CORD Delete |
| 292 | [Documentation] Make a DELETE call to the CORD controller |
| 293 | [Arguments] ${service} ${data_id} |
| 294 | ${resp}= Delete Request XOS uri=${service}/${data_id} |
| 295 | Log ${resp.content} |
| 296 | Should Be Equal As Strings ${resp.status_code} 200 |
Kailash | 2abefa8 | 2019-02-01 12:40:07 -0800 | [diff] [blame] | 297 | [Return] ${resp} |