blob: ce1fcf7004fa2e79bf8749fd4e471ddf2b754aae [file] [log] [blame]
TorstenThieme1619db22020-04-03 12:01:15 +00001*** Settings ***
2Documentation Test states of ONU Go adapter
3Suite 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 ***
21${POD_NAME} flex-ocp-cord
22${KUBERNETES_CONF} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
23${KUBERNETES_CONFIGS_DIR} ~/pod-configs/kubernetes-configs
24#${KUBERNETES_CONFIGS_DIR} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.conf
25${KUBERNETES_YAML} ${KUBERNETES_CONFIGS_DIR}/${POD_NAME}.yml
26${HELM_CHARTS_DIR} ~/helm-charts
27${VOLTHA_POD_NUM} 8
28${NAMESPACE} voltha
29# For below variable value, using deployment name as using grep for
30# parsing radius pod name, we can also use full radius pod name
31${RESTART_POD_NAME} radius
TorstenThieme94e4ae42020-05-18 13:01:42 +000032${timeout} 180s
TorstenThieme1619db22020-04-03 12:01:15 +000033${of_id} 0
34${logical_id} 0
35${has_dataplane} True
36${external_libs} True
37${teardown_device} True
38${scripts} ../../scripts
39# Per-test logging on failure is turned off by default; set this variable to enable
40${container_log_dir} ${None}
41# state to test variable, can be passed via the command line too
42${state2test} 6
43${testmode} SingleState
44${porttest} True
TorstenThieme401af432020-06-11 15:53:53 +000045${debugmode} False
TorstenThieme5e324e42020-07-27 09:36:16 +000046${logging} False
TorstenThiemeb41007d2020-06-22 12:14:12 +000047${pausebeforecleanup} False
TorstenThieme1619db22020-04-03 12:01:15 +000048
49*** Test Cases ***
50ONU State Test
51 [Documentation] Validates the ONU Go adapter states
TorstenThieme401af432020-06-11 15:53:53 +000052 [Tags] statetest onutest
TorstenThieme1619db22020-04-03 12:01:15 +000053 [Setup] Run Keywords Start Logging ONUStateTest
54 ... AND Setup Test
55 Run Keyword If ${has_dataplane} Clean Up Linux
56 Enable Device ${olt_device_id}
TorstenThieme94e4ae42020-05-18 13:01:42 +000057 ${timeStart} = Get Current Date
58 Set Global Variable ${timeStart}
TorstenThieme1619db22020-04-03 12:01:15 +000059 Run Keyword If "${testmode}"=="SingleState" Do ONU Single State Test
60 ... ELSE IF "${testmode}"=="Up2State" Do ONU Up To State Test
TorstenThieme94e4ae42020-05-18 13:01:42 +000061 ... ELSE IF "${testmode}"=="SingleStateTime" Do ONU Single State Test Time
TorstenThieme1619db22020-04-03 12:01:15 +000062 ... ELSE Fail The testmode (${testmode}) is not valid!
TorstenThieme5e324e42020-07-27 09:36:16 +000063 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme1619db22020-04-03 12:01:15 +000064 ... AND Stop Logging ONUStateTest
65
TorstenThieme401af432020-06-11 15:53:53 +000066Onu Port Check
67 [Documentation] Validates the ONU Go adapter states
TorstenThieme00958682020-06-19 11:29:31 +000068 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme401af432020-06-11 15:53:53 +000069 [Tags] onutest
70 [Setup] Start Logging ONUPortTest
71 Run Keyword If ${porttest} Do Onu Port Check
TorstenThieme5e324e42020-07-27 09:36:16 +000072 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
TorstenThieme401af432020-06-11 15:53:53 +000073 ... AND Stop Logging ONUPortTest
74
TorstenThieme1619db22020-04-03 12:01:15 +000075*** Keywords ***
76Setup Suite
77 [Documentation] Set up the test suite
78 Common Test Suite Setup
79 Run Keyword If ${num_onus}>4 Calculate Timeout
80
TorstenThiemeb41007d2020-06-22 12:14:12 +000081Teardown Suite
82 [Documentation] Replaces the Suite Teardown in utils.robot.
83 ... Cleans up and checks all ONU ports disabled in ONOS.
84 ... Furthermore gives the possibility to pause the execution.
85 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
86 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
87 Run Keyword If ${teardown_device} Delete All Devices and Verify
88 Wait for Ports in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM
89
TorstenThieme1619db22020-04-03 12:01:15 +000090Setup Test
91 [Documentation] Pre-test Setup
92 #test for empty device list
93 Test Empty Device List
94 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
Suchitra Vemurib7253a52020-07-14 22:35:17 -070095 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
TorstenThieme1619db22020-04-03 12:01:15 +000096 Run Keyword If ${has_dataplane} Sleep 60s
97 #create/preprovision device
98 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
99 Set Suite Variable ${olt_device_id}
100 #validate olt states
101 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
102 ... ${olt_device_id}
103 Sleep 5s
104
105Calculate Timeout
106 [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus
107 ${timeout} Fetch From Left ${timeout} s
108 ${timeout}= evaluate ${timeout}+((${num_onus}-4)*30)
TorstenThieme401af432020-06-11 15:53:53 +0000109 ${timeout}= Set Variable If (not ${debugmode}) and (${timeout}>600) 600 ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000110 ${timeout}= Catenate SEPARATOR= ${timeout} s
111 Set Suite Variable ${timeout}
112 #Log \r\nTimeout: ${timeout} INFO console=True
113
114Do ONU Up To State Test
115 [Documentation] This keyword performs Up2State Test
116 ... All states up to the passed have to be checked
117 FOR ${I} IN RANGE 0 ${num_onus}
118 ${src}= Set Variable ${hosts.src[${I}]}
119 ${dst}= Set Variable ${hosts.dst[${I}]}
120 Run Keyword If ${state2test}>=1
121 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
122 ... Validate Device ENABLED ACTIVATING REACHABLE
123 ... ${src['onu']} onu=True onu_reason=activating-onu
124 Run Keyword If ${state2test}>=2
125 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
126 ... Validate Device ENABLED ACTIVATING REACHABLE
127 ... ${src['onu']} onu=True onu_reason=starting-openomci
128 Run Keyword If ${state2test}>=3
129 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
130 ... Validate Device ENABLED ACTIVATING REACHABLE
131 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
132 Run Keyword If ${state2test}>=4
133 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
134 ... Validate Device ENABLED ACTIVE REACHABLE
135 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
136 Run Keyword If ${state2test}>=5
137 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
138 ... Validate Device ENABLED ACTIVE REACHABLE
139 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
140 Run Keyword If ${state2test}>=6
141 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
142 ... Validate Device ENABLED ACTIVE REACHABLE
143 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
144 END
145
146Do ONU Single State Test
147 [Documentation] This keyword performs SingleState Test
148 ... Only the passed state has to be checked
149 FOR ${I} IN RANGE 0 ${num_onus}
150 ${src}= Set Variable ${hosts.src[${I}]}
151 ${dst}= Set Variable ${hosts.dst[${I}]}
152 Run Keyword If ${state2test}==1
153 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
154 ... Validate Device ENABLED ACTIVATING REACHABLE
155 ... ${src['onu']} onu=True onu_reason=activating-onu
156 ... ELSE IF ${state2test}==2
157 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
158 ... Validate Device ENABLED ACTIVATING REACHABLE
159 ... ${src['onu']} onu=True onu_reason=starting-openomci
160 ... ELSE IF ${state2test}==3
161 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
162 ... Validate Device ENABLED ACTIVATING REACHABLE
163 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
164 ... ELSE IF ${state2test}==4
165 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
166 ... Validate Device ENABLED ACTIVE REACHABLE
167 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
168 ... ELSE IF ${state2test}==5
169 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
170 ... Validate Device ENABLED ACTIVE REACHABLE
171 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
172 ... ELSE IF ${state2test}==6
173 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
174 ... Validate Device ENABLED ACTIVE REACHABLE
175 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
176 ... ELSE Fail The state to test (${state2test}) is not valid!
177 END
178
TorstenThieme94e4ae42020-05-18 13:01:42 +0000179Do ONU Single State Test Time
180 [Documentation] This keyword performs SingleState Test with calculate running time
181 ... Only the passed state has to be checked and the duration each single onu adapter needed
182 ... will be calculated and printed out
183 ${ListfinishedONUs} Create List
184 Set Global Variable ${ListfinishedONUs}
185 Create File ONU_Startup_Time.txt This file contains the startup times of all ONUs.
186 ${list_onus} Create List
TorstenThieme401af432020-06-11 15:53:53 +0000187 Build ONU SN List ${list_onus}
TorstenThieme94e4ae42020-05-18 13:01:42 +0000188 Run Keyword If ${state2test}==1
189 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000190 ... Validate ONU Devices MIB State With Duration
TorstenThieme401af432020-06-11 15:53:53 +0000191 ... activating-onu ${list_onus} ${timeStart} print2console=True
192 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000193 ... ELSE IF ${state2test}==2
194 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000195 ... Validate ONU Devices MIB State With Duration
TorstenThieme401af432020-06-11 15:53:53 +0000196 ... starting-openomci ${list_onus} ${timeStart} print2console=True
197 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000198 ... ELSE IF ${state2test}==3
199 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000200 ... Validate ONU Devices MIB State With Duration
TorstenThieme401af432020-06-11 15:53:53 +0000201 ... discovery-mibsync-complete ${list_onus} ${timeStart} print2console=True
202 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000203 ... ELSE IF ${state2test}==4
204 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000205 ... Validate ONU Devices MIB State With Duration
TorstenThieme401af432020-06-11 15:53:53 +0000206 ... initial-mib-downloaded ${list_onus} ${timeStart} print2console=True
207 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000208 ... ELSE IF ${state2test}==5
209 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000210 ... Validate ONU Devices MIB State With Duration
TorstenThieme401af432020-06-11 15:53:53 +0000211 ... tech-profile-config-download-success ${list_onus} ${timeStart} print2console=True
212 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000213 ... ELSE IF ${state2test}==6
214 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000215 ... Validate ONU Devices MIB State With Duration
TorstenThieme401af432020-06-11 15:53:53 +0000216 ... omci-flows-pushed ${list_onus} ${timeStart} print2console=True
217 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000218 ... ELSE Fail The state to test (${state2test}) is not valid!
219
TorstenThieme1619db22020-04-03 12:01:15 +0000220Do Onu Port Check
TorstenThieme00958682020-06-19 11:29:31 +0000221 [Documentation] Check that all the UNI ports show up in ONOS
222 Wait for Ports in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${num_onus} BBSM
TorstenThieme9949b172020-06-16 10:00:15 +0000223