blob: 09db958df708ed1961b6c35ee23e93ad3eaebc4d [file] [log] [blame]
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +00001# 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# FIXME Can we use the same test against BBSim and Hardware?
15
16*** Settings ***
17Documentation Test various end-to-end scenarios
18Suite Setup Common Test Suite Setup
19Test Setup Setup
20Test Teardown Teardown
21#Suite Teardown Teardown Suite
22Library Collections
23Library String
24Library OperatingSystem
25Library XML
26Library RequestsLibrary
27Library ../../libraries/DependencyLibrary.py
28Resource ../../libraries/onos.robot
29Resource ../../libraries/voltctl.robot
30Resource ../../libraries/voltha.robot
31Resource ../../libraries/utils.robot
32Resource ../../libraries/k8s.robot
33Resource ../../variables/variables.robot
34
35*** Variables ***
36${POD_NAME} flex-ocp-cord
37${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
38${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
39#${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
40${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
41${HELM_CHARTS_DIR} ~/helm-charts
42${VOLTHA_POD_NUM} 8
43${NAMESPACE} voltha
44# For below variable value, using deployment name as using grep for
45# parsing radius pod name, we can also use full radius pod name
46${RESTART_POD_NAME} radius
Suchitra Vemuribc5e3162020-01-23 11:21:10 -080047${timeout} 90s
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000048${of_id} 0
49${logical_id} 0
Suchitra Vemuri2fa9bba2020-01-22 17:38:48 -080050${has_dataplane} True
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000051${external_libs} True
52${teardown_device} False
53${scripts} ../../scripts
54
55*** Test Cases ***
56Adding the same OLT before and after enabling the device
57 [Documentation] Create OLT, Create the same OLT again and Check for the Error message
Suchitra Vemuri2fa9bba2020-01-22 17:38:48 -080058 [Tags] VOL-2405 VOL-2406 AddSameOLT functional
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000059 [Setup] None
60 [Teardown] None
Suchitra Vemuribd7fcd22020-01-22 19:08:32 -080061 Run Keyword If ${has_dataplane} Delete Device and Verify
Gayathri.Selvanee4a91b2020-01-17 06:49:53 +000062 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
63 Set Suite Variable ${olt_device_id}
64 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
65 ... ${EMPTY} ${olt_device_id}
66 ${rc} ${output}= Run and Return Rc and Output
67 ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT}
68 Should Not Be Equal As Integers ${rc} 0
69 Should Contain ${output} Device is already pre-provisioned
70 #Enable the created OLT device
71 Enable Device ${olt_device_id}
72 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
73 ... ${olt_serial_number}
74 ${rc} ${output}= Run and Return Rc and Output
75 ... ${VOLTCTL_CONFIG}; voltctl device create -t openolt -H ${olt_ip}:${OLT_PORT}
76 Should Not Be Equal As Integers ${rc} 0
77 Log ${output}
78 Should Contain ${output} Device is already pre-provisioned
79 Log "This OLT is added already and enabled"
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +000080
81Test Disable different device id which is not in the device list
82 [Documentation] Disable a device id which is not listed in the voltctl device list
83 ... command and ensure that error message is shown.
Suchitra Vemuri925db9d2020-01-27 15:41:26 -080084 [Tags] functional DisableInvalidDevice VOL-2412
Gayathri.Selvan3dfe6c22020-01-27 13:08:55 +000085 [Setup] None
86 [Teardown] None
87 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device list -o json
88 Should Be Equal As Integers ${rc} 0
89 ${jsondata}= To Json ${output}
90 Log ${jsondata}
91 ${length}= Get Length ${jsondata}
92 @{ids}= Create List
93 FOR ${INDEX} IN RANGE 0 ${length}
94 ${value}= Get From List ${jsondata} ${INDEX}
95 ${device_id}= Get From Dictionary ${value} id
96 Append To List ${ids} ${device_id}
97 END
98 #Create a new fake device id
99 ${fakeDeviceId} Replace String Using Regexp ${device_id} \\d\\d xx count=1
100 Log ${fakeDeviceId}
101 #Ensure that the new id created is not in the device id list
102 List Should Not Contain Value ${ids} ${fakeDeviceId}
103 #Disable fake device id
104 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${fakeDeviceId}
Suchitra Vemuri925db9d2020-01-27 15:41:26 -0800105 Should Contain ${output} Error while disabling '${fakeDeviceId}': rpc error: code = NotFound desc
suraj gourbaee2c62020-02-03 10:21:32 +0000106
107Check deletion of OLT/ONU before disabling
108 [Documentation] Try deleting OL/ONU before disabling and check error message
109 ... Assuming devices are already created, up and running fine; test1 or sanity was
110 ... executed where all the ONUs are authenticated/DHCP/pingable
111 [Tags] VOL-2411 DeleteBeforeDisableCheck notready
112 [Setup] None
113 [Teardown] None
114 #validate olt states
115 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
116 ... ${olt_serial_number}
117 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${olt_device_id}
118 Log ${output}
119 Should Contain ${output} expected-admin-state:DISABLED
120 Wait Until Keyword Succeeds ${timeout} 5s
121 ... Validate OLT Device ENABLED ACTIVE REACHABLE ${olt_serial_number}
122 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
123 Set Global Variable ${of_id}
124 FOR ${I} IN RANGE 0 ${num_onus}
125 ${src}= Set Variable ${hosts.src[${I}]}
126 ${dst}= Set Variable ${hosts.dst[${I}]}
127 ${onu_device_id}= Get Device ID From SN ${src['onu']}
128 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
129 ... ENABLED ACTIVE REACHABLE
130 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
131 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device delete ${onu_device_id}
132 Log ${output}
133 Should Contain ${output} expected-admin-state:DISABLED
134 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
135 ... ENABLED ACTIVE REACHABLE
136 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
137 END
138 Run Keyword and Ignore Error Collect Logs
suraj gourb3160412020-02-04 06:11:31 +0000139
140Check disabling of pre-provisioned OLT before enabling
141 [Documentation] Create OLT, disable same OLT, check error message and validates ONU
142 [Tags] VOL-2414 DisablePreprovisionedOLTCheck notready
143 [Setup] Delete Device and Verify
144 [Teardown] None
145 Run Keyword If ${has_dataplane} Sleep 180s
146 #create/preprovision device
147 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
148 Set Suite Variable ${olt_device_id}
149 #validate olt states
150 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
151 ... ${EMPTY} ${olt_device_id}
152 #Try disabling pre-provisioned OLT
153 ${rc} ${output}= Run and Return Rc and Output ${VOLTCTL_CONFIG}; voltctl device disable ${olt_device_id}
154 Should Be Equal As Integers ${rc} 0
155 Log ${output}
156 Should Contain ${output} invalid-admin-state:PREPROVISIONED
157 #Enable OLT
158 Enable Device ${olt_device_id}
159 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device ENABLED ACTIVE REACHABLE
160 ... ${olt_serial_number}
161 ${logical_id}= Get Logical Device ID From SN ${olt_serial_number}
162 Set Suite Variable ${logical_id}
163 FOR ${I} IN RANGE 0 ${num_onus}
164 ${src}= Set Variable ${hosts.src[${I}]}
165 ${dst}= Set Variable ${hosts.dst[${I}]}
166 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s Validate Device
167 ... ENABLED ACTIVE REACHABLE
168 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
169 END
170 Run Keyword and Ignore Error Collect Logs