blob: b9fc8f2eff9c08aa454fcdc905edcece11d719c5 [file] [log] [blame]
Kailash4200e572018-12-11 14:50:46 -08001# 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 ***
16Documentation Test various E2E conditions for seba-in-a-box
17Suite Setup Setup
18Suite Teardown Teardown
19Library Collections
20Library String
21Library OperatingSystem
22Library XML
23Library RequestsLibrary
Zack Williams821c5022020-01-15 15:11:46 -070024Library CORDRobot
25Library ImportResource resources=CORDRobot
Kailash4200e572018-12-11 14:50:46 -080026Variables ../../Properties/RestApiProperties.py
27
28*** Variables ***
Kailashe81e4722019-01-22 13:00:31 -080029${number_of_onus} 16
Kailash4200e572018-12-11 14:50:46 -080030
31*** Test Cases ***
32ONUs Discovered
33 [Documentation] Validates All ONU Devices are discovered and retrieve SNs
34 [Tags] onudiscovery
Kailashe81e4722019-01-22 13:00:31 -080035 Wait Until Keyword Succeeds 120s 5s Validate Number of ONU Devices ${number_of_onus}
Kailash4200e572018-12-11 14:50:46 -080036
37Validate ONU States
38 [Documentation] Validates All ONU Device states are "enabled" and "active"
39 [Tags] onustates
40 : FOR ${onu} IN @{serial_numbers}
Kailash02acdf62019-01-22 14:17:27 -080041 \ Wait Until Keyword Succeeds 120s 5s Validate ONU States ACTIVE ENABLED ${onu}
Kailash4200e572018-12-11 14:50:46 -080042
43Validate ATT WF Driver SIs
44 [Documentation] Validates all service instances per onu devices become "approved" and "dhcpdiscovered"
45 [Tags] serviceinstances
46 : FOR ${onu} IN @{serial_numbers}
Kailash2a49a0b2019-01-29 14:14:07 -080047 \ Wait Until Keyword Succeeds 180s 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${onu}
Kailash0a966672019-02-27 12:14:30 -080048 \ Wait Until Keyword Succeeds 300s 5s Validate ATT Workflow Driver SI DHCP State DHCPACK ${onu}
Kailash4200e572018-12-11 14:50:46 -080049
50*** Keywords ***
51Setup
52 ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
53 ${HEADERS} Create Dictionary Content-Type=application/json
Kailash379630d2019-01-23 10:38:53 -080054 Create Session ${server_ip} http://%{SERVER_IP}:%{SERVER_PORT} auth=${AUTH} headers=${HEADERS}
Kailashcafa3d22019-01-29 19:57:26 -080055 @{container_list}= Create List
56 Append To List ${container_list} att-workflow-att-workflow-driver
57 Append To List ${container_list} seba-services-volt
58 Append To List ${container_list} seba-services-rcord
59 Append To List ${container_list} seba-services-fabric-crossconnect
60 Append To List ${container_list} seba-services-onos-service
61 Append To List ${container_list} xos-core
62 Append To List ${container_list} vcore
63 Set Suite Variable ${container_list}
Kailash4200e572018-12-11 14:50:46 -080064
65Teardown
66 Delete All Sessions
Kailashcafa3d22019-01-29 19:57:26 -080067 Get Pod Logs
68
69Get Pod Logs
70 : FOR ${pod} IN @{container_list}
71 \ ${full_pod_name}= Run kubectl get pods --all-namespaces | grep '${pod}' | head -1 | awk '{print $2}'
72 \ ${namespace}= Run kubectl get pods --all-namespaces | grep ' ${pod}' | head -1 | awk '{print $1}'
73 \ ${output}= Run kubectl logs --timestamps -n ${namespace} ${full_pod_name}
74 \ Log ${output}
Kailash4200e572018-12-11 14:50:46 -080075
76Validate Number of ONU Devices
77 [Arguments] ${expected_onus}
78 ${resp}= CORD Get ${ONU_DEVICE}
79 ${jsondata}= To Json ${resp.content}
80 Log ${jsondata}
81 ${length}= Get Length ${jsondata['items']}
82 @{serial_numbers}= Create List
83 : FOR ${INDEX} IN RANGE 0 ${length}
84 \ ${value}= Get From List ${jsondata['items']} ${INDEX}
85 \ ${sn}= Get From Dictionary ${value} serial_number
86 \ ${contains}= Evaluate "BBSM" in """${sn}"""
87 \ Run Keyword if '${contains}' == 'True' Append To List ${serial_numbers} ${sn}
88 Set Suite Variable ${serial_numbers}
89 ${length_of_bbsim_onus}= Get Length ${serial_numbers}
Kailash02acdf62019-01-22 14:17:27 -080090 Should Be Equal as Integers ${length_of_bbsim_onus} ${expected_onus}