blob: a493133f6021f74e538278dbf5ed12f8acc384f5 [file] [log] [blame]
TorstenThieme1619db22020-04-03 12:01:15 +00001*** Settings ***
TorstenThieme109683b2020-09-24 12:35:41 +00002Documentation Test states of ONU Go adapter with ATT workflows only (not for DT/TT workflow!)
TorstenThieme1619db22020-04-03 12:01:15 +00003Suite Setup Setup Suite
4Suite Teardown Teardown Suite
5Test Setup Setup
6Test Teardown Teardown
7Library Collections
8Library String
9Library OperatingSystem
10Library XML
11Library RequestsLibrary
12Library ../../libraries/DependencyLibrary.py
13Resource ../../libraries/onos.robot
14Resource ../../libraries/voltctl.robot
15Resource ../../libraries/voltha.robot
16Resource ../../libraries/utils.robot
17Resource ../../libraries/k8s.robot
18Resource ../../variables/variables.robot
19
20*** Variables ***
TorstenThieme94e4ae42020-05-18 13:01:42 +000021${timeout} 180s
TorstenThieme1619db22020-04-03 12:01:15 +000022${of_id} 0
23${logical_id} 0
24${has_dataplane} True
25${external_libs} True
26${teardown_device} True
27${scripts} ../../scripts
28# Per-test logging on failure is turned off by default; set this variable to enable
29${container_log_dir} ${None}
TorstenThiemee0e5bba2020-08-05 11:20:13 +000030# state to test variable, can be passed via the command line too, valid values: 1-6
31# 1 -> activating-onu
32# 2 -> starting-openomci
33# 3 -> discovery-mibsync-complete
34# 4 -> initial-mib-downloaded
35# 5 -> tech-profile-config-download-success
36# 6 -> omci-flows-pushed
TorstenThieme87cd6202020-09-09 10:01:28 +000037# example: -v state2test:5
TorstenThieme66c91a82020-10-19 13:37:53 +000038# example: -v state2test:omci-flows-pushed
TorstenThieme1619db22020-04-03 12:01:15 +000039${state2test} 6
TorstenThiemee0e5bba2020-08-05 11:20:13 +000040# test mode variable, can be passed via the command line too, valid values: SingleState, Up2State, SingleStateTime
TorstenThieme87cd6202020-09-09 10:01:28 +000041# example: -v testmode:SingleStateTime
TorstenThieme1619db22020-04-03 12:01:15 +000042${testmode} SingleState
TorstenThieme87cd6202020-09-09 10:01:28 +000043# used tech profile, can be passed via the command line too, valid values: default (=1T1GEM), 1T4GEM, 1T8GEM
44# example: -v techprofile:1T4GEM
TorstenThiemee0e5bba2020-08-05 11:20:13 +000045${techprofile} default
TorstenThiemee0e5bba2020-08-05 11:20:13 +000046# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000047# example: -v debugmode:True
TorstenThieme401af432020-06-11 15:53:53 +000048${debugmode} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000049# logging flag to enable Collect Logs, can be passed via the command line too
TorstenThieme87cd6202020-09-09 10:01:28 +000050# example: -v logging:True
TorstenThieme5e324e42020-07-27 09:36:16 +000051${logging} False
TorstenThieme66c91a82020-10-19 13:37:53 +000052# if True execution will be paused before clean up, only use in case of manual testing, do not use in ci pipeline!
TorstenThieme87cd6202020-09-09 10:01:28 +000053# example: -v pausebeforecleanup:True
TorstenThiemeb41007d2020-06-22 12:14:12 +000054${pausebeforecleanup} False
TorstenThiemee0e5bba2020-08-05 11:20:13 +000055${data_dir} ../data
56
TorstenThieme1619db22020-04-03 12:01:15 +000057
58*** Test Cases ***
59ONU State Test
60 [Documentation] Validates the ONU Go adapter states
TorstenThieme66c91a82020-10-19 13:37:53 +000061 [Tags] sanityOnuGo StateTestOnuGo
TorstenThieme1619db22020-04-03 12:01:15 +000062 [Setup] Run Keywords Start Logging ONUStateTest
63 ... AND Setup Test
64 Run Keyword If ${has_dataplane} Clean Up Linux
65 Enable Device ${olt_device_id}
TorstenThieme94e4ae42020-05-18 13:01:42 +000066 ${timeStart} = Get Current Date
67 Set Global Variable ${timeStart}
TorstenThieme1619db22020-04-03 12:01:15 +000068 Run Keyword If "${testmode}"=="SingleState" Do ONU Single State Test
69 ... ELSE IF "${testmode}"=="Up2State" Do ONU Up To State Test
TorstenThieme94e4ae42020-05-18 13:01:42 +000070 ... ELSE IF "${testmode}"=="SingleStateTime" Do ONU Single State Test Time
TorstenThieme1619db22020-04-03 12:01:15 +000071 ... ELSE Fail The testmode (${testmode}) is not valid!
TorstenThieme5e324e42020-07-27 09:36:16 +000072 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme1619db22020-04-03 12:01:15 +000073 ... AND Stop Logging ONUStateTest
74
TorstenThiemee0e5bba2020-08-05 11:20:13 +000075Check Loaded Tech Profile
76 [Documentation] Validates the loaded Tech Profile
77 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
78 ... Check will be executed only the reached ONU state is 5 (tech-profile-config-download-success) or higher
TorstenThieme66c91a82020-10-19 13:37:53 +000079 [Tags] functionalOnuGo CheckTechProfileOnuGo
TorstenThiemee0e5bba2020-08-05 11:20:13 +000080 [Setup] Start Logging ONUCheckTechProfile
TorstenThieme66c91a82020-10-19 13:37:53 +000081 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
82 ... Do Check Tech Profile
TorstenThieme5a205ba2020-09-29 08:08:29 +000083 ... ELSE Pass Execution ${skip_message} skipped
TorstenThiemee0e5bba2020-08-05 11:20:13 +000084 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
85 ... AND Stop Logging ONUCheckTechProfile
86
TorstenThieme401af432020-06-11 15:53:53 +000087Onu Port Check
TorstenThieme87cd6202020-09-09 10:01:28 +000088 [Documentation] Validates that all the UNI ports show up in ONOS
TorstenThieme00958682020-06-19 11:29:31 +000089 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +000090 [Tags] functionalOnuGo PortTestOnuGo
TorstenThieme401af432020-06-11 15:53:53 +000091 [Setup] Start Logging ONUPortTest
TorstenThieme66c91a82020-10-19 13:37:53 +000092 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
93 ... Do Onu Port Check
TorstenThieme5a205ba2020-09-29 08:08:29 +000094 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme5e324e42020-07-27 09:36:16 +000095 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme401af432020-06-11 15:53:53 +000096 ... AND Stop Logging ONUPortTest
97
TorstenThieme109683b2020-09-24 12:35:41 +000098Onu Flow Check
99 [Documentation] Validates the onu flows in ONOS and Voltha
100 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000101 [Tags] functionalOnuGo FlowTestOnuGo notreadyOnuGo
TorstenThieme109683b2020-09-24 12:35:41 +0000102 [Setup] Start Logging ONUFlowTest
TorstenThieme66c91a82020-10-19 13:37:53 +0000103 Run Keyword If '${onu_state}'=='omci-flows-pushed' Do Onu Flow Check
TorstenThieme5a205ba2020-09-29 08:08:29 +0000104 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme109683b2020-09-24 12:35:41 +0000105 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
106 ... AND Stop Logging ONUFlowTest
107
TorstenThiemee3841a02020-09-23 08:20:43 +0000108Disable Enable Onu Device
109 [Documentation] Disables/enables ONU Device and check states
110 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000111 [Tags] functionalOnuGo DisableEnableOnuGo
TorstenThiemee3841a02020-09-23 08:20:43 +0000112 [Setup] Start Logging DisableEnableONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000113 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
114 ... Do Disable Enable Onu Test
TorstenThieme5a205ba2020-09-29 08:08:29 +0000115 ... ELSE Pass Execution ${skip_message} skipped
TorstenThiemee3841a02020-09-23 08:20:43 +0000116 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
117 ... AND Stop Logging DisableEnableONUDevice
118
TorstenThieme015d5c02020-09-11 09:53:34 +0000119Reconcile Onu Device
120 [Documentation] Reconciles ONU Device and check state
121 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000122 [Tags] functionalOnuGo ReconcileOnuGo
TorstenThieme015d5c02020-09-11 09:53:34 +0000123 [Setup] Start Logging ReconcileONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000124 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
125 ... Do Reconcile Onu Device
TorstenThieme5a205ba2020-09-29 08:08:29 +0000126 ... ELSE Pass Execution ${skip_message} skipped
TorstenThieme015d5c02020-09-11 09:53:34 +0000127 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
128 ... AND Stop Logging ReconcileONUDevice
129
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000130Power Off Power On Onu Device
131 [Documentation] Power off and Power on of all ONU Devices and check state
132 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme66c91a82020-10-19 13:37:53 +0000133 [Tags] functionalOnuGo PowerOffPowerOnOnuGo
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000134 [Setup] Start Logging PowerOffPowerOnONUDevice
TorstenThieme66c91a82020-10-19 13:37:53 +0000135 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
136 ... Do Power Off Power On Onu Device
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000137 ... ELSE Pass Execution ${skip_message} skipped
138 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
139 ... AND Stop Logging PowerOffPowerOnONUDevice
140
TorstenThieme1fbe8082020-10-21 13:27:59 +0000141Soft Reboot Onu Device
142 [Documentation] Reboots softly all ONU Devices and check state
143 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
144 [Tags] functionalOnuGo SoftRebootOnuGo
145 [Setup] Start Logging SoftRebootONUDevice
146 Run Keyword If '${onu_state}'=='tech-profile-config-download-success' or '${onu_state}'=='omci-flows-pushed'
147 ... Do Soft Reboot Onu Device
148 ... ELSE Pass Execution ${skip_message} skipped
149 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
150 ... AND Stop Logging SoftRebootONUDevice
151
TorstenThieme1619db22020-04-03 12:01:15 +0000152*** Keywords ***
153Setup Suite
154 [Documentation] Set up the test suite
TorstenThieme87cd6202020-09-09 10:01:28 +0000155 ${LogInfo}= Catenate
156 ... \r\nPassed arguments:
TorstenThieme66c91a82020-10-19 13:37:53 +0000157 ... state2test:${state2test}, testmode:${testmode}, techprofile:${techprofile},
TorstenThieme015d5c02020-09-11 09:53:34 +0000158 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
TorstenThieme87cd6202020-09-09 10:01:28 +0000159 Log ${LogInfo} console=yes
TorstenThieme1619db22020-04-03 12:01:15 +0000160 Common Test Suite Setup
TorstenThieme5a205ba2020-09-29 08:08:29 +0000161 # prepare skip message in yellow for console log
162 ${skip}= Evaluate "\\033[33mSKIP\\033[0m"
163 ${skipped}= Evaluate "\\033[33m${SPACE*14} ===> Test case above was skipped! <=== ${SPACE*15}\\033[0m"
164 ${skip_message} Catenate ${skipped} | ${skip} |
165 Set Suite Variable ${skip_message}
TorstenThieme1619db22020-04-03 12:01:15 +0000166 Run Keyword If ${num_onus}>4 Calculate Timeout
TorstenThieme1488d772020-09-28 10:52:43 +0000167 ${techprofile}= Set Variable If "${techprofile}"=="1T1GEM" default ${techprofile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000168 Run Keyword If "${techprofile}"=="default" Log To Console \nTechProfile:default (1T1GEM)
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000169 ... ELSE IF "${techprofile}"=="1T4GEM" Set Tech Profile 1T4GEM
170 ... ELSE IF "${techprofile}"=="1T8GEM" Set Tech Profile 1T8GEM
171 ... ELSE Fail The TechProfile (${techprofile}) is not valid!
172 ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
173 Set Suite Variable ${onos_ssh_connection}
TorstenThieme66c91a82020-10-19 13:37:53 +0000174 # map the passed onu state to reached and make it visible for test suite
175 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}=
176 ... Map State ${state2test}
177 Set Suite Variable ${admin_state}
178 Set Suite Variable ${oper_status}
179 Set Suite Variable ${connect_status}
180 Set Suite Variable ${onu_state_nb}
181 Set Suite Variable ${onu_state}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000182 # delete etcd MIB Template Data
183 Delete MIB Template Data
TorstenThieme1619db22020-04-03 12:01:15 +0000184
TorstenThiemeb41007d2020-06-22 12:14:12 +0000185Teardown Suite
186 [Documentation] Replaces the Suite Teardown in utils.robot.
187 ... Cleans up and checks all ONU ports disabled in ONOS.
188 ... Furthermore gives the possibility to pause the execution.
189 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
190 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
TorstenThieme87cd6202020-09-09 10:01:28 +0000191 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
TorstenThiemeb41007d2020-06-22 12:14:12 +0000192 Run Keyword If ${teardown_device} Delete All Devices and Verify
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000193 # Wait for Ports in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM
194 Wait for Ports in ONOS ${onos_ssh_connection} 0 BBSM
195 Close ONOS SSH Connection ${onos_ssh_connection}
TorstenThieme87cd6202020-09-09 10:01:28 +0000196 Remove Tech Profile
TorstenThiemeb41007d2020-06-22 12:14:12 +0000197
TorstenThieme1619db22020-04-03 12:01:15 +0000198Setup Test
199 [Documentation] Pre-test Setup
200 #test for empty device list
201 Test Empty Device List
202 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
Suchitra Vemurib7253a52020-07-14 22:35:17 -0700203 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
TorstenThieme1619db22020-04-03 12:01:15 +0000204 Run Keyword If ${has_dataplane} Sleep 60s
205 #create/preprovision device
206 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
207 Set Suite Variable ${olt_device_id}
208 #validate olt states
209 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
210 ... ${olt_device_id}
211 Sleep 5s
212
213Calculate Timeout
214 [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus
215 ${timeout} Fetch From Left ${timeout} s
216 ${timeout}= evaluate ${timeout}+((${num_onus}-4)*30)
TorstenThieme401af432020-06-11 15:53:53 +0000217 ${timeout}= Set Variable If (not ${debugmode}) and (${timeout}>600) 600 ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000218 ${timeout}= Catenate SEPARATOR= ${timeout} s
219 Set Suite Variable ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000220
221Do ONU Up To State Test
222 [Documentation] This keyword performs Up2State Test
223 ... All states up to the passed have to be checked
224 FOR ${I} IN RANGE 0 ${num_onus}
225 ${src}= Set Variable ${hosts.src[${I}]}
226 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThieme66c91a82020-10-19 13:37:53 +0000227 Run Keyword If ${onu_state_nb}>=1
TorstenThieme1619db22020-04-03 12:01:15 +0000228 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
229 ... Validate Device ENABLED ACTIVATING REACHABLE
230 ... ${src['onu']} onu=True onu_reason=activating-onu
TorstenThieme66c91a82020-10-19 13:37:53 +0000231 Run Keyword If ${onu_state_nb}>=2
TorstenThieme1619db22020-04-03 12:01:15 +0000232 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
233 ... Validate Device ENABLED ACTIVATING REACHABLE
234 ... ${src['onu']} onu=True onu_reason=starting-openomci
TorstenThieme66c91a82020-10-19 13:37:53 +0000235 Run Keyword If ${onu_state_nb}>=3
TorstenThieme1619db22020-04-03 12:01:15 +0000236 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
237 ... Validate Device ENABLED ACTIVATING REACHABLE
238 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
TorstenThieme66c91a82020-10-19 13:37:53 +0000239 Run Keyword If ${onu_state_nb}>=4
TorstenThieme1619db22020-04-03 12:01:15 +0000240 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
241 ... Validate Device ENABLED ACTIVE REACHABLE
242 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
TorstenThieme66c91a82020-10-19 13:37:53 +0000243 Run Keyword If ${onu_state_nb}>=5
TorstenThieme1619db22020-04-03 12:01:15 +0000244 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
245 ... Validate Device ENABLED ACTIVE REACHABLE
246 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
TorstenThieme66c91a82020-10-19 13:37:53 +0000247 Run Keyword If ${onu_state_nb}>=6
TorstenThieme1619db22020-04-03 12:01:15 +0000248 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
249 ... Validate Device ENABLED ACTIVE REACHABLE
250 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
251 END
252
253Do ONU Single State Test
254 [Documentation] This keyword performs SingleState Test
255 ... Only the passed state has to be checked
256 FOR ${I} IN RANGE 0 ${num_onus}
257 ${src}= Set Variable ${hosts.src[${I}]}
258 ${dst}= Set Variable ${hosts.dst[${I}]}
TorstenThieme015d5c02020-09-11 09:53:34 +0000259 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
260 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
261 ... ${src['onu']} onu=True onu_reason=${onu_state}
TorstenThieme1619db22020-04-03 12:01:15 +0000262 END
263
TorstenThieme94e4ae42020-05-18 13:01:42 +0000264Do ONU Single State Test Time
265 [Documentation] This keyword performs SingleState Test with calculate running time
266 ... Only the passed state has to be checked and the duration each single onu adapter needed
267 ... will be calculated and printed out
TorstenThieme17becfc2020-10-08 09:46:27 +0000268 #${ListfinishedONUs} Create List
269 #Set Global Variable ${ListfinishedONUs}
TorstenThieme94e4ae42020-05-18 13:01:42 +0000270 Create File ONU_Startup_Time.txt This file contains the startup times of all ONUs.
271 ${list_onus} Create List
TorstenThieme401af432020-06-11 15:53:53 +0000272 Build ONU SN List ${list_onus}
TorstenThieme015d5c02020-09-11 09:53:34 +0000273 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000274 ... Validate ONU Devices MIB State With Duration
TorstenThieme015d5c02020-09-11 09:53:34 +0000275 ... ${onu_state} ${list_onus} ${timeStart} print2console=True
TorstenThieme401af432020-06-11 15:53:53 +0000276 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000277
TorstenThieme1619db22020-04-03 12:01:15 +0000278Do Onu Port Check
TorstenThieme00958682020-06-19 11:29:31 +0000279 [Documentation] Check that all the UNI ports show up in ONOS
TorstenThieme17becfc2020-10-08 09:46:27 +0000280 Wait for Ports in ONOS ${onos_ssh_connection} ${num_onus} BBSM
TorstenThieme9949b172020-06-16 10:00:15 +0000281
TorstenThieme109683b2020-09-24 12:35:41 +0000282Do Onu Flow Check
283 [Documentation] Check that all ONU flows show up in ONOS and Voltha
284 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
285 ${nni_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
286 ... Get NNI Port in ONOS ${of_id}
287 FOR ${I} IN RANGE 0 ${num_onus}
288 ${src}= Set Variable ${hosts.src[${I}]}
289 ${dst}= Set Variable ${hosts.dst[${I}]}
290 ${onu_device_id}= Get Device ID From SN ${src['onu']}
291 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
292 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
293 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2
294 ... Execute ONOS CLI Command ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
295 ... volt-add-subscriber-access ${of_id} ${onu_port}
296 # Verify subscriber access flows are added for the ONU port
297 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 5s
298 ... Verify Subscriber Access Flows Added For ONU ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${of_id}
299 ... ${onu_port} ${nni_port} ${src['c_tag']} ${src['s_tag']}
TorstenThieme109683b2020-09-24 12:35:41 +0000300 END
TorstenThieme66c91a82020-10-19 13:37:53 +0000301 #check for previous state is kept (normally omci-flows-pushed)
302 Do Current State Test All Onus ${state2test}
TorstenThieme109683b2020-09-24 12:35:41 +0000303
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000304Set Tech Profile
305 [Documentation] This keyword set the passed TechProfile for the test
306 [Arguments] ${TechProfile}
TorstenThieme87cd6202020-09-09 10:01:28 +0000307 Log To Console \nTechProfile:${TechProfile}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000308 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200309 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000310 ${src}= Set Variable ${data_dir}/TechProfile-${TechProfile}.json
311 ${dest}= Set Variable /tmp/flexpod.json
312 ${command} Catenate
313 ... /bin/sh -c 'cat ${dest} | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/64'
314 Copy File To Pod ${namespace} ${podname} ${src} ${dest}
315 Exec Pod ${namespace} ${podname} ${command}
316 ${commandget} Catenate
317 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
318 Exec Pod ${namespace} ${podname} ${commandget}
319
320Remove Tech Profile
321 [Documentation] This keyword removes TechProfile
TorstenThieme015d5c02020-09-11 09:53:34 +0000322 Log To Console \nTechProfile:${TechProfile}
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000323 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200324 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000325 ${command} Catenate
326 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/technology_profiles/XGS-PON/64'
327 Exec Pod ${namespace} ${podname} ${command}
328 ${commandget} Catenate
329 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
330 Exec Pod ${namespace} ${podname} ${commandget}
331
332Do Check Tech Profile
333 [Documentation] This keyword checks the loaded TechProfile
334 ${namespace}= Set Variable default
Andrea Campanella60dde302020-09-09 18:42:56 +0200335 ${podname}= Set Variable etcd
TorstenThiemee0e5bba2020-08-05 11:20:13 +0000336 ${commandget} Catenate
337 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/XGS-PON/64'
338 ${result}= Exec Pod ${namespace} ${podname} ${commandget}
339 ${num_gem_ports}= Set Variable 1
340 ${num_gem_ports}= Set Variable If
341 ... "${techprofile}"=="default" 1
342 ... "${techprofile}"=="1T4GEM" 4
343 ... "${techprofile}"=="1T8GEM" 8
344 @{resultList} Split String ${result} separator=,
345 ${num_of_count_matches}= Get Match Count ${resultList} "num_gem_ports": ${num_gem_ports}
346 ... whitespace_insensitive=True
347 ${num_of_expected_matches}= Run Keyword If "${techprofile}"=="default" Evaluate ${num_onus}
348 ... ELSE Evaluate ${num_onus}+1
349 Run Keyword If ${num_of_expected_matches}!=${num_of_count_matches} Log To Console
350 ... \nTechProfile (${TechProfile}) not loaded correctly:${num_of_count_matches} of ${num_of_expected_matches}
TorstenThieme015d5c02020-09-11 09:53:34 +0000351
352Do Disable Enable Onu Test
353 [Documentation] This keyword disables/enables all onus and checks the states.
TorstenThieme1fbe8082020-10-21 13:27:59 +0000354 [Arguments] ${state2check}=${state2test} ${checkstatebeforedisable}=True
355 Run Keyword If ${checkstatebeforedisable} Do Current State Test All Onus ${state2check}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000356 Do Disable Onu Device
TorstenThieme17becfc2020-10-08 09:46:27 +0000357 Do Current State Test All Onus omci-admin-lock
358 Log Ports
359 #check no port is enabled in ONOS
360 Wait for Ports in ONOS ${onos_ssh_connection} 0 BBSM
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000361 Do Enable Onu Device
TorstenThieme17becfc2020-10-08 09:46:27 +0000362 Do Current State Test All Onus ${state2check}
363 Log Ports onlyenabled=True
364 #check that all the UNI ports show up in ONOS again
365 Wait for Ports in ONOS ${onos_ssh_connection} ${num_onus} BBSM
TorstenThieme015d5c02020-09-11 09:53:34 +0000366
367Do Reconcile Onu Device
368 [Documentation] This keyword reconciles ONU device and check the state afterwards.
369 ... Following steps will be executed:
370 ... - restart openonu adaptor
371 ... - check openonu adaptor is ready again
372 ... - check previous state is kept
373 ... - ONU-Disable
374 ... - wait some seconds
375 ... - check for state omci-admin-lock
376 ... - ONU-Enable
377 ... - wait some seconds
378 ... - check for state onu-reenabled
379 ... - port check
TorstenThieme015d5c02020-09-11 09:53:34 +0000380 ${list_openonu_apps} Create List adapter-open-onu
381 ${namespace}= Set Variable voltha
382 ${adaptorname}= Set Variable open-onu
TorstenThieme015d5c02020-09-11 09:53:34 +0000383 Kill Adaptor ${namespace} ${adaptorname}
384 Sleep 5s
385 Wait For Pods Ready ${namespace} ${list_openonu_apps}
386 Do Disable Enable Onu Test
TorstenThieme66c91a82020-10-19 13:37:53 +0000387 Do Onu Port Check
TorstenThieme015d5c02020-09-11 09:53:34 +0000388
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000389Do Power Off Power On Onu Device
390 [Documentation] This keyword power off/on all onus and checks the states.
391 Do Power Off ONU Device
392 Sleep 5s
393 Do Current State Test All Onus stopping-openomci
394 Do Power On ONU Device
395 Do Current State Test All Onus ${state2test}
396
TorstenThieme1fbe8082020-10-21 13:27:59 +0000397Do Soft Reboot Onu Device
398 [Documentation] This keyword reboots softly all onus and checks the states.
399 ${namespace}= Set Variable voltha
400 FOR ${I} IN RANGE 0 ${num_onus}
401 ${src}= Set Variable ${hosts.src[${I}]}
402 ${onu_device_id}= Get Device ID From SN ${src['onu']}
403 Reboot ONU ${onu_device_id}
404 END
405 Run Keyword If ${has_dataplane} Sleep 30s
406 Do Disable Enable Onu Test checkstatebeforedisable=False
407 Do Onu Port Check
408
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000409Do Disable Onu Device
410 [Documentation] This keyword disables all onus.
TorstenThieme17becfc2020-10-08 09:46:27 +0000411 FOR ${I} IN RANGE 0 ${num_onus}
412 ${src}= Set Variable ${hosts.src[${I}]}
413 ${onu_device_id}= Get Device ID From SN ${src['onu']}
414 Disable Device ${onu_device_id}
415 Wait Until Keyword Succeeds 20s 2s Test Devices Disabled in VOLTHA Id=${onu_device_id}
416 END
417
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000418Do Enable Onu Device
419 [Documentation] This keyword enables all onus.
TorstenThieme17becfc2020-10-08 09:46:27 +0000420 FOR ${I} IN RANGE 0 ${num_onus}
421 ${src}= Set Variable ${hosts.src[${I}]}
422 ${onu_device_id}= Get Device ID From SN ${src['onu']}
423 Enable Device ${onu_device_id}
424 END
425
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000426Do Power Off ONU Device
427 [Documentation] This keyword power off all onus.
428 ${namespace}= Set Variable voltha
429 FOR ${I} IN RANGE 0 ${num_onus}
430 ${src}= Set Variable ${hosts.src[${I}]}
431 ${result}= Exec Pod ${namespace} bbsim bbsimctl onu shutdown ${src['onu']}
432 Should Contain ${result} successfully msg=Can not shutdown ${src['onu']} values=False
433 END
434
435Do Power On ONU Device
436 [Documentation] This keyword power on all onus.
437 ${namespace}= Set Variable voltha
438 FOR ${I} IN RANGE 0 ${num_onus}
439 ${src}= Set Variable ${hosts.src[${I}]}
440 ${result}= Exec Pod ${namespace} bbsim bbsimctl onu poweron ${src['onu']}
441 Should Contain ${result} successfully msg=Can not poweron ${src['onu']} values=False
442 END
443
TorstenThieme015d5c02020-09-11 09:53:34 +0000444Do Current State Test
445 [Documentation] This keyword checks the passed state of the given onu.
446 [Arguments] ${state} ${onu}
TorstenThieme66c91a82020-10-19 13:37:53 +0000447 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Map State ${state}
TorstenThieme015d5c02020-09-11 09:53:34 +0000448 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
449 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
450 ... ${onu} onu=True onu_reason=${onu_state}
451
TorstenThieme17becfc2020-10-08 09:46:27 +0000452Do Current State Test All Onus
453 [Documentation] This keyword checks the passed state of all onus.
454 ... Hint: ${timeStart} will be not evaluated here!
455 [Arguments] ${state}
456 ${list_onus} Create List
457 Build ONU SN List ${list_onus}
TorstenThieme66c91a82020-10-19 13:37:53 +0000458 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Map State ${state}
TorstenThieme17becfc2020-10-08 09:46:27 +0000459 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
460 ... Validate ONU Devices With Duration
461 ... ${admin_state} ${oper_status} ${connect_status}
462 ... ${onu_state} ${list_onus} ${timeStart}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000463
TorstenThieme17becfc2020-10-08 09:46:27 +0000464Log Ports
465 [Documentation] This keyword logs all port data available in ONOS of first port per ONU
466 [Arguments] ${onlyenabled}=False
467 ${cmd} Set Variable If ${onlyenabled} ports -e ports
468 ${onu_ports}= Execute ONOS CLI Command on open connection ${onos_ssh_connection} ${cmd}
469 ${lines} = Get Lines Matching Regexp ${onu_ports} .*portName=BBSM[0-9]{8}-1
470 Log ${lines}
471
TorstenThieme015d5c02020-09-11 09:53:34 +0000472Kill Adaptor
473 [Documentation] This keyword kills the passed adaptor.
474 [Arguments] ${namespace} ${name}
475 ${cmd} Catenate
476 ... kubectl exec -it -n voltha $(kubectl get pods -n ${namespace} | grep ${name} | awk 'NR==1{print $1}')
477 ... -- /bin/sh -c "kill 1"
478 ${rc} ${output}= Run and Return Rc and Output ${cmd}
479 Log ${output}
480
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000481Delete MIB Template Data
482 [Documentation] This keyword deletes MIB Template Data stored in etcd
483 ${namespace}= Set Variable default
484 ${podname}= Set Variable etcd
485 ${commanddel} Catenate
486 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/omci_mibs/go_templates/'
487 ${result}= Exec Pod ${namespace} ${podname} ${commanddel}
488 Sleep 3s
489 ${commandget} Catenate
490 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/omci_mibs/go_templates/'
491 ${result}= Exec Pod ${namespace} ${podname} ${commandget}
492 Should Be Empty ${result} Could not delete MIB Template Data stored in etcd!
493
TorstenThieme015d5c02020-09-11 09:53:34 +0000494Map State
495 [Documentation] This keyword converts the passed numeric value or name of a onu state to its state values.
496 [Arguments] ${state}
497 # create state lists with corresponding return values
TorstenThieme66c91a82020-10-19 13:37:53 +0000498 # ADMIN-STATE OPER-STATUS CONNECT-STATUS ONU-STATE (number/name)
499 ${state1} Create List ENABLED ACTIVATING REACHABLE 1 activating-onu
500 ${state2} Create List ENABLED ACTIVATING REACHABLE 2 starting-openomci
501 ${state3} Create List ENABLED ACTIVATING REACHABLE 3 discovery-mibsync-complete
502 ${state4} Create List ENABLED ACTIVE REACHABLE 4 initial-mib-downloaded
503 ${state5} Create List ENABLED ACTIVE REACHABLE 5 tech-profile-config-download-success
504 ${state6} Create List ENABLED ACTIVE REACHABLE 6 omci-flows-pushed
505 ${state7} Create List DISABLED UNKNOWN REACHABLE 7 omci-admin-lock
506 ${state8} Create List ENABLED ACTIVE REACHABLE 8 onu-reenabled
507 ${state9} Create List ENABLED DISCOVERED UNREACHABLE 9 stopping-openomci
508 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Set Variable If
TorstenThieme015d5c02020-09-11 09:53:34 +0000509 ... '${state}'=='1' or '${state}'=='activating-onu' ${state1}
510 ... '${state}'=='2' or '${state}'=='starting-openomci' ${state2}
511 ... '${state}'=='3' or '${state}'=='discovery-mibsync-complete' ${state3}
512 ... '${state}'=='4' or '${state}'=='initial-mib-downloaded' ${state4}
513 ... '${state}'=='5' or '${state}'=='tech-profile-config-download-success' ${state5}
514 ... '${state}'=='6' or '${state}'=='omci-flows-pushed' ${state6}
515 ... '${state}'=='7' or '${state}'=='omci-admin-lock' ${state7}
516 ... '${state}'=='8' or '${state}'=='onu-reenabled' ${state8}
TorstenThieme5ca1dd12020-10-16 08:42:16 +0000517 ... '${state}'=='9' or '${state}'=='stopping-openomci' ${state9}
TorstenThieme66c91a82020-10-19 13:37:53 +0000518 [Return] ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}