blob: 17dcf5befdc5e1f78e4195b661090639f1fcb9cb [file] [log] [blame]
Kailashd48db7b2019-04-24 09:19:04 -07001# 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 bbsim_utils.py
25Library ../../Framework/utils/utils.py
26Resource ../../Framework/utils/utils.robot
27Library ../../Framework/restApi.py
28Resource ../../Framework/Subscriber.robot
29Resource ../../Framework/ATTWorkFlowDriver.robot
30Resource ../../Framework/Kubernetes.robot
31Resource ../../Framework/ONU.robot
32Resource ../../Framework/DHCP.robot
33Variables ../../Properties/RestApiProperties.py
34
35*** Variables ***
36${number_of_onus} 16
37
38*** Test Cases ***
39Debug
40 [Tags] debug
41 Log debug
42
43Create Subscriber and Whitelist for ONUs
44 [Documentation] Creates whitelists in ATT-WF for each onu device
45 [Tags] play
46 ${att_workflow_service_id}= Get Service Owner Id ${ATT_SERVICE}
47 ${volt_service_id}= Get Service Owner Id ${VOLT_SERVICE}
48 ${rcord_service_id}= Get Service Owner Id /xosapi/v1/rcord/rcordservices
49 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': 'bbsim.voltha.svc:50060', 'volt_service_id': ${volt_service_id}}
50 @{subscribers}= Generate Subscribers ${number_of_onus} ${rcord_service_id}
51 : FOR ${subscriber} IN @{subscribers}
52 \ Log To Console ${subscriber}
53 \ CORD Post ${VOLT_SUBSCRIBER} ${subscriber}
54 @{whitelists}= Generate Whitelists ${number_of_onus} ${att_workflow_service_id}
55 : FOR ${whitelist} IN @{whitelists}
56 \ Log To Console ${whitelist}
57 \ CORD Post ${ATT_WHITELIST} ${whitelist}
58
59ONUs Discovered
60 [Documentation] Validates All ONU Devices are discovered and retrieve SNs
61 [Tags] onudiscovery
62 Wait Until Keyword Succeeds 120s 5s Validate Number of ONU Devices ${number_of_onus}
63
64Validate ONU States
65 [Documentation] Validates All ONU Device states are "enabled" and "active"
66 [Tags] onustates
67 : FOR ${onu} IN @{serial_numbers}
68 \ Wait Until Keyword Succeeds 120s 5s Validate ONU States ACTIVE ENABLED ${onu}
69
70Validate ATT WF Driver SIs
71 [Documentation] Validates all service instances per onu devices become "approved" and "dhcpdiscovered"
72 [Tags] serviceinstances
73 : FOR ${onu} IN @{serial_numbers}
74 \ Wait Until Keyword Succeeds 180s 2s Validate ATT Workflow Driver SI ENABLED APPROVED ${onu}
75 \ Wait Until Keyword Succeeds 240s 2s Validate ATT Workflow Driver SI DHCP State DHCPACK ${onu}
76
77*** Keywords ***
78Setup
79 ${server_ip}= Get Environment Variable SERVER_IP localhost
80 ${port}= Get Environment Variable SERVER_PORT 30001
81 ${auth} = Create List ${XOS_USER} ${XOS_PASSWD}
82 ${HEADERS} Create Dictionary Content-Type=application/json
83 Create Session ${server_ip} http://${server_ip}:${port} auth=${AUTH} headers=${HEADERS}
84 @{container_list}= Create List
85 Append To List ${container_list} att-workflow-att-workflow-driver
86 Append To List ${container_list} seba-services-volt
87 Append To List ${container_list} seba-services-rcord
88 Append To List ${container_list} seba-services-fabric-crossconnect
89 Append To List ${container_list} seba-services-onos-service
90 Append To List ${container_list} xos-core
91 Append To List ${container_list} vcore
92 Set Suite Variable ${container_list}
93
94Teardown
95 #Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${VOLT_SUBSCRIBER}
96 #Wait Until Keyword Succeeds 60s 2s Clean Up Objects ${ATT_WHITELIST}
97 Delete All Sessions
98 #Get Pod Logs
99
100Get Pod Logs
101 : FOR ${pod} IN @{container_list}
102 \ ${full_pod_name}= Run kubectl get pods --all-namespaces | grep '${pod}' | head -1 | awk '{print $2}'
103 \ ${namespace}= Run kubectl get pods --all-namespaces | grep ' ${pod}' | head -1 | awk '{print $1}'
104 \ ${output}= Run kubectl logs --timestamps -n ${namespace} ${full_pod_name}
105 \ Log ${output}
106
107Validate Number of ONU Devices
108 [Arguments] ${expected_onus}
109 ${resp}= CORD Get ${ONU_DEVICE}
110 ${jsondata}= To Json ${resp.content}
111 Log ${jsondata}
112 ${length}= Get Length ${jsondata['items']}
113 @{serial_numbers}= Create List
114 : FOR ${INDEX} IN RANGE 0 ${length}
115 \ ${value}= Get From List ${jsondata['items']} ${INDEX}
116 \ ${sn}= Get From Dictionary ${value} serial_number
117 \ ${contains}= Evaluate "BBSM" in """${sn}"""
118 \ Run Keyword if '${contains}' == 'True' Append To List ${serial_numbers} ${sn}
119 Set Suite Variable ${serial_numbers}
120 ${length_of_bbsim_onus}= Get Length ${serial_numbers}
121 Should Be Equal as Integers ${length_of_bbsim_onus} ${expected_onus}