Kailash | 4200e57 | 2018-12-11 14:50:46 -0800 | [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 |
| 19 | Library Collections |
| 20 | Library String |
| 21 | Library OperatingSystem |
| 22 | Library XML |
| 23 | Library RequestsLibrary |
| 24 | Library ../../Framework/utils/utils.py |
| 25 | Resource ../../Framework/utils/utils.robot |
| 26 | Library ../../Framework/restApi.py |
| 27 | Resource ../../Framework/Subscriber.robot |
| 28 | Resource ../../Framework/ATTWorkFlowDriver.robot |
| 29 | Resource ../../Framework/Kubernetes.robot |
| 30 | Resource ../../Framework/ONU.robot |
| 31 | Resource ../../Framework/DHCP.robot |
| 32 | Variables ../../Properties/RestApiProperties.py |
| 33 | |
| 34 | *** Variables *** |
Kailash | e81e472 | 2019-01-22 13:00:31 -0800 | [diff] [blame] | 35 | ${number_of_onus} 16 |
Kailash | 4200e57 | 2018-12-11 14:50:46 -0800 | [diff] [blame] | 36 | |
| 37 | *** Test Cases *** |
| 38 | ONUs Discovered |
| 39 | [Documentation] Validates All ONU Devices are discovered and retrieve SNs |
| 40 | [Tags] onudiscovery |
Kailash | e81e472 | 2019-01-22 13:00:31 -0800 | [diff] [blame] | 41 | Wait Until Keyword Succeeds 120s 5s Validate Number of ONU Devices ${number_of_onus} |
Kailash | 4200e57 | 2018-12-11 14:50:46 -0800 | [diff] [blame] | 42 | |
| 43 | Validate ONU States |
| 44 | [Documentation] Validates All ONU Device states are "enabled" and "active" |
| 45 | [Tags] onustates |
| 46 | : FOR ${onu} IN @{serial_numbers} |
Kailash | 02acdf6 | 2019-01-22 14:17:27 -0800 | [diff] [blame] | 47 | \ Wait Until Keyword Succeeds 120s 5s Validate ONU States ACTIVE ENABLED ${onu} |
Kailash | 4200e57 | 2018-12-11 14:50:46 -0800 | [diff] [blame] | 48 | |
| 49 | Validate ATT WF Driver SIs |
| 50 | [Documentation] Validates all service instances per onu devices become "approved" and "dhcpdiscovered" |
| 51 | [Tags] serviceinstances |
| 52 | : FOR ${onu} IN @{serial_numbers} |
Kailash | 2a49a0b | 2019-01-29 14:14:07 -0800 | [diff] [blame] | 53 | \ Wait Until Keyword Succeeds 180s 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${onu} |
Kailash | 0a96667 | 2019-02-27 12:14:30 -0800 | [diff] [blame] | 54 | \ Wait Until Keyword Succeeds 300s 5s Validate ATT Workflow Driver SI DHCP State DHCPACK ${onu} |
Kailash | 4200e57 | 2018-12-11 14:50:46 -0800 | [diff] [blame] | 55 | |
| 56 | *** Keywords *** |
| 57 | Setup |
| 58 | ${auth} = Create List ${XOS_USER} ${XOS_PASSWD} |
| 59 | ${HEADERS} Create Dictionary Content-Type=application/json |
Kailash | 379630d | 2019-01-23 10:38:53 -0800 | [diff] [blame] | 60 | Create Session ${server_ip} http://%{SERVER_IP}:%{SERVER_PORT} auth=${AUTH} headers=${HEADERS} |
Kailash | cafa3d2 | 2019-01-29 19:57:26 -0800 | [diff] [blame] | 61 | @{container_list}= Create List |
| 62 | Append To List ${container_list} att-workflow-att-workflow-driver |
| 63 | Append To List ${container_list} seba-services-volt |
| 64 | Append To List ${container_list} seba-services-rcord |
| 65 | Append To List ${container_list} seba-services-fabric-crossconnect |
| 66 | Append To List ${container_list} seba-services-onos-service |
| 67 | Append To List ${container_list} xos-core |
| 68 | Append To List ${container_list} vcore |
| 69 | Set Suite Variable ${container_list} |
Kailash | 4200e57 | 2018-12-11 14:50:46 -0800 | [diff] [blame] | 70 | |
| 71 | Teardown |
| 72 | Delete All Sessions |
Kailash | cafa3d2 | 2019-01-29 19:57:26 -0800 | [diff] [blame] | 73 | Get Pod Logs |
| 74 | |
| 75 | Get Pod Logs |
| 76 | : FOR ${pod} IN @{container_list} |
| 77 | \ ${full_pod_name}= Run kubectl get pods --all-namespaces | grep '${pod}' | head -1 | awk '{print $2}' |
| 78 | \ ${namespace}= Run kubectl get pods --all-namespaces | grep ' ${pod}' | head -1 | awk '{print $1}' |
| 79 | \ ${output}= Run kubectl logs --timestamps -n ${namespace} ${full_pod_name} |
| 80 | \ Log ${output} |
Kailash | 4200e57 | 2018-12-11 14:50:46 -0800 | [diff] [blame] | 81 | |
| 82 | Validate Number of ONU Devices |
| 83 | [Arguments] ${expected_onus} |
| 84 | ${resp}= CORD Get ${ONU_DEVICE} |
| 85 | ${jsondata}= To Json ${resp.content} |
| 86 | Log ${jsondata} |
| 87 | ${length}= Get Length ${jsondata['items']} |
| 88 | @{serial_numbers}= Create List |
| 89 | : FOR ${INDEX} IN RANGE 0 ${length} |
| 90 | \ ${value}= Get From List ${jsondata['items']} ${INDEX} |
| 91 | \ ${sn}= Get From Dictionary ${value} serial_number |
| 92 | \ ${contains}= Evaluate "BBSM" in """${sn}""" |
| 93 | \ Run Keyword if '${contains}' == 'True' Append To List ${serial_numbers} ${sn} |
| 94 | Set Suite Variable ${serial_numbers} |
| 95 | ${length_of_bbsim_onus}= Get Length ${serial_numbers} |
Kailash | 02acdf6 | 2019-01-22 14:17:27 -0800 | [diff] [blame] | 96 | Should Be Equal as Integers ${length_of_bbsim_onus} ${expected_onus} |