blob: 829a624796576d2b9f5232822d90b3fa4d9e24d5 [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
24Library ../../Framework/utils/utils.py
25Resource ../../Framework/utils/utils.robot
26Library ../../Framework/restApi.py
27Resource ../../Framework/Subscriber.robot
28Resource ../../Framework/ATTWorkFlowDriver.robot
29Resource ../../Framework/Kubernetes.robot
30Resource ../../Framework/ONU.robot
31Resource ../../Framework/DHCP.robot
32Variables ../../Properties/RestApiProperties.py
33
34*** Variables ***
Kailashe81e4722019-01-22 13:00:31 -080035${number_of_onus} 16
Kailash4200e572018-12-11 14:50:46 -080036
37*** Test Cases ***
38ONUs Discovered
39 [Documentation] Validates All ONU Devices are discovered and retrieve SNs
40 [Tags] onudiscovery
Kailashe81e4722019-01-22 13:00:31 -080041 Wait Until Keyword Succeeds 120s 5s Validate Number of ONU Devices ${number_of_onus}
Kailash4200e572018-12-11 14:50:46 -080042
43Validate ONU States
44 [Documentation] Validates All ONU Device states are "enabled" and "active"
45 [Tags] onustates
46 : FOR ${onu} IN @{serial_numbers}
Kailash02acdf62019-01-22 14:17:27 -080047 \ Wait Until Keyword Succeeds 120s 5s Validate ONU States ACTIVE ENABLED ${onu}
Kailash4200e572018-12-11 14:50:46 -080048
49Validate 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}
Kailash2a49a0b2019-01-29 14:14:07 -080053 \ Wait Until Keyword Succeeds 180s 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${onu}
Kailashd30bc452019-02-25 10:29:07 -080054 \ Wait Until Keyword Succeeds 360s 5s Validate ATT Workflow Driver SI DHCP State DHCPACK ${onu}
Kailash4200e572018-12-11 14:50:46 -080055
56*** Keywords ***
57Setup
58 ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
59 ${HEADERS} Create Dictionary Content-Type=application/json
Kailash379630d2019-01-23 10:38:53 -080060 Create Session ${server_ip} http://%{SERVER_IP}:%{SERVER_PORT} auth=${AUTH} headers=${HEADERS}
Kailashcafa3d22019-01-29 19:57:26 -080061 @{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}
Kailash4200e572018-12-11 14:50:46 -080070
71Teardown
72 Delete All Sessions
Kailashcafa3d22019-01-29 19:57:26 -080073 Get Pod Logs
74
75Get 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}
Kailash4200e572018-12-11 14:50:46 -080081
82Validate 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}
Kailash02acdf62019-01-22 14:17:27 -080096 Should Be Equal as Integers ${length_of_bbsim_onus} ${expected_onus}