blob: 929f81574a95767697b1861b2562ad306a250a0a [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
TorstenThiemeb41007d2020-06-22 12:14:12 +000046${pausebeforecleanup} False
TorstenThieme1619db22020-04-03 12:01:15 +000047
48*** Test Cases ***
49ONU State Test
50 [Documentation] Validates the ONU Go adapter states
TorstenThieme401af432020-06-11 15:53:53 +000051 [Tags] statetest onutest
TorstenThieme1619db22020-04-03 12:01:15 +000052 [Setup] Run Keywords Start Logging ONUStateTest
53 ... AND Setup Test
54 Run Keyword If ${has_dataplane} Clean Up Linux
55 Enable Device ${olt_device_id}
TorstenThieme94e4ae42020-05-18 13:01:42 +000056 ${timeStart} = Get Current Date
57 Set Global Variable ${timeStart}
TorstenThieme1619db22020-04-03 12:01:15 +000058 Run Keyword If "${testmode}"=="SingleState" Do ONU Single State Test
59 ... ELSE IF "${testmode}"=="Up2State" Do ONU Up To State Test
TorstenThieme94e4ae42020-05-18 13:01:42 +000060 ... ELSE IF "${testmode}"=="SingleStateTime" Do ONU Single State Test Time
TorstenThieme1619db22020-04-03 12:01:15 +000061 ... ELSE Fail The testmode (${testmode}) is not valid!
TorstenThieme1619db22020-04-03 12:01:15 +000062 [Teardown] Run Keywords Collect Logs
63 ... AND Stop Logging ONUStateTest
64
TorstenThieme401af432020-06-11 15:53:53 +000065Onu Port Check
66 [Documentation] Validates the ONU Go adapter states
TorstenThieme00958682020-06-19 11:29:31 +000067 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme401af432020-06-11 15:53:53 +000068 [Tags] onutest
69 [Setup] Start Logging ONUPortTest
70 Run Keyword If ${porttest} Do Onu Port Check
71 [Teardown] Run Keywords Collect Logs
72 ... AND Stop Logging ONUPortTest
73
TorstenThieme1619db22020-04-03 12:01:15 +000074*** Keywords ***
75Setup Suite
76 [Documentation] Set up the test suite
77 Common Test Suite Setup
78 Run Keyword If ${num_onus}>4 Calculate Timeout
79
TorstenThiemeb41007d2020-06-22 12:14:12 +000080Teardown Suite
81 [Documentation] Replaces the Suite Teardown in utils.robot.
82 ... Cleans up and checks all ONU ports disabled in ONOS.
83 ... Furthermore gives the possibility to pause the execution.
84 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
85 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
86 Run Keyword If ${teardown_device} Delete All Devices and Verify
87 Wait for Ports in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM
88
TorstenThieme1619db22020-04-03 12:01:15 +000089Setup Test
90 [Documentation] Pre-test Setup
91 #test for empty device list
92 Test Empty Device List
93 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
Suchitra Vemurib7253a52020-07-14 22:35:17 -070094 ... ${olt_ssh_ip} ${olt_user} ${olt_pass}
TorstenThieme1619db22020-04-03 12:01:15 +000095 Run Keyword If ${has_dataplane} Sleep 60s
96 #create/preprovision device
97 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
98 Set Suite Variable ${olt_device_id}
99 #validate olt states
100 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
101 ... ${olt_device_id}
102 Sleep 5s
103
104Calculate Timeout
105 [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus
106 ${timeout} Fetch From Left ${timeout} s
107 ${timeout}= evaluate ${timeout}+((${num_onus}-4)*30)
TorstenThieme401af432020-06-11 15:53:53 +0000108 ${timeout}= Set Variable If (not ${debugmode}) and (${timeout}>600) 600 ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +0000109 ${timeout}= Catenate SEPARATOR= ${timeout} s
110 Set Suite Variable ${timeout}
111 #Log \r\nTimeout: ${timeout} INFO console=True
112
113Do ONU Up To State Test
114 [Documentation] This keyword performs Up2State Test
115 ... All states up to the passed have to be checked
116 FOR ${I} IN RANGE 0 ${num_onus}
117 ${src}= Set Variable ${hosts.src[${I}]}
118 ${dst}= Set Variable ${hosts.dst[${I}]}
119 Run Keyword If ${state2test}>=1
120 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
121 ... Validate Device ENABLED ACTIVATING REACHABLE
122 ... ${src['onu']} onu=True onu_reason=activating-onu
123 Run Keyword If ${state2test}>=2
124 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
125 ... Validate Device ENABLED ACTIVATING REACHABLE
126 ... ${src['onu']} onu=True onu_reason=starting-openomci
127 Run Keyword If ${state2test}>=3
128 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
129 ... Validate Device ENABLED ACTIVATING REACHABLE
130 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
131 Run Keyword If ${state2test}>=4
132 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
133 ... Validate Device ENABLED ACTIVE REACHABLE
134 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
135 Run Keyword If ${state2test}>=5
136 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
137 ... Validate Device ENABLED ACTIVE REACHABLE
138 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
139 Run Keyword If ${state2test}>=6
140 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
141 ... Validate Device ENABLED ACTIVE REACHABLE
142 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
143 END
144
145Do ONU Single State Test
146 [Documentation] This keyword performs SingleState Test
147 ... Only the passed state has to be checked
148 FOR ${I} IN RANGE 0 ${num_onus}
149 ${src}= Set Variable ${hosts.src[${I}]}
150 ${dst}= Set Variable ${hosts.dst[${I}]}
151 Run Keyword If ${state2test}==1
152 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
153 ... Validate Device ENABLED ACTIVATING REACHABLE
154 ... ${src['onu']} onu=True onu_reason=activating-onu
155 ... ELSE IF ${state2test}==2
156 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
157 ... Validate Device ENABLED ACTIVATING REACHABLE
158 ... ${src['onu']} onu=True onu_reason=starting-openomci
159 ... ELSE IF ${state2test}==3
160 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
161 ... Validate Device ENABLED ACTIVATING REACHABLE
162 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
163 ... ELSE IF ${state2test}==4
164 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
165 ... Validate Device ENABLED ACTIVE REACHABLE
166 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
167 ... ELSE IF ${state2test}==5
168 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
169 ... Validate Device ENABLED ACTIVE REACHABLE
170 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
171 ... ELSE IF ${state2test}==6
172 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
173 ... Validate Device ENABLED ACTIVE REACHABLE
174 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
175 ... ELSE Fail The state to test (${state2test}) is not valid!
176 END
177
TorstenThieme94e4ae42020-05-18 13:01:42 +0000178Do ONU Single State Test Time
179 [Documentation] This keyword performs SingleState Test with calculate running time
180 ... Only the passed state has to be checked and the duration each single onu adapter needed
181 ... will be calculated and printed out
182 ${ListfinishedONUs} Create List
183 Set Global Variable ${ListfinishedONUs}
184 Create File ONU_Startup_Time.txt This file contains the startup times of all ONUs.
185 ${list_onus} Create List
TorstenThieme401af432020-06-11 15:53:53 +0000186 Build ONU SN List ${list_onus}
TorstenThieme94e4ae42020-05-18 13:01:42 +0000187 Run Keyword If ${state2test}==1
188 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000189 ... Validate ONU Devices MIB State With Duration
TorstenThieme401af432020-06-11 15:53:53 +0000190 ... activating-onu ${list_onus} ${timeStart} print2console=True
191 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000192 ... ELSE IF ${state2test}==2
193 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000194 ... Validate ONU Devices MIB State With Duration
TorstenThieme401af432020-06-11 15:53:53 +0000195 ... starting-openomci ${list_onus} ${timeStart} print2console=True
196 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000197 ... ELSE IF ${state2test}==3
198 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000199 ... Validate ONU Devices MIB State With Duration
TorstenThieme401af432020-06-11 15:53:53 +0000200 ... discovery-mibsync-complete ${list_onus} ${timeStart} print2console=True
201 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000202 ... ELSE IF ${state2test}==4
203 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000204 ... Validate ONU Devices MIB State With Duration
TorstenThieme401af432020-06-11 15:53:53 +0000205 ... initial-mib-downloaded ${list_onus} ${timeStart} print2console=True
206 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000207 ... ELSE IF ${state2test}==5
208 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000209 ... Validate ONU Devices MIB State With Duration
TorstenThieme401af432020-06-11 15:53:53 +0000210 ... tech-profile-config-download-success ${list_onus} ${timeStart} print2console=True
211 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000212 ... ELSE IF ${state2test}==6
213 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000214 ... Validate ONU Devices MIB State With Duration
TorstenThieme401af432020-06-11 15:53:53 +0000215 ... omci-flows-pushed ${list_onus} ${timeStart} print2console=True
216 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000217 ... ELSE Fail The state to test (${state2test}) is not valid!
218
TorstenThieme1619db22020-04-03 12:01:15 +0000219Do Onu Port Check
TorstenThieme00958682020-06-19 11:29:31 +0000220 [Documentation] Check that all the UNI ports show up in ONOS
221 Wait for Ports in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${num_onus} BBSM
TorstenThieme9949b172020-06-16 10:00:15 +0000222