blob: 384180759dd073f3dcafe4072d4ded8d13d81304 [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
TorstenThieme1619db22020-04-03 12:01:15 +000046
47*** Test Cases ***
48ONU State Test
49 [Documentation] Validates the ONU Go adapter states
TorstenThieme401af432020-06-11 15:53:53 +000050 [Tags] statetest onutest
TorstenThieme1619db22020-04-03 12:01:15 +000051 [Setup] Run Keywords Start Logging ONUStateTest
52 ... AND Setup Test
53 Run Keyword If ${has_dataplane} Clean Up Linux
54 Enable Device ${olt_device_id}
TorstenThieme94e4ae42020-05-18 13:01:42 +000055 ${timeStart} = Get Current Date
56 Set Global Variable ${timeStart}
TorstenThieme1619db22020-04-03 12:01:15 +000057 Run Keyword If "${testmode}"=="SingleState" Do ONU Single State Test
58 ... ELSE IF "${testmode}"=="Up2State" Do ONU Up To State Test
TorstenThieme94e4ae42020-05-18 13:01:42 +000059 ... ELSE IF "${testmode}"=="SingleStateTime" Do ONU Single State Test Time
TorstenThieme1619db22020-04-03 12:01:15 +000060 ... ELSE Fail The testmode (${testmode}) is not valid!
TorstenThieme1619db22020-04-03 12:01:15 +000061 [Teardown] Run Keywords Collect Logs
62 ... AND Stop Logging ONUStateTest
63
TorstenThieme401af432020-06-11 15:53:53 +000064Onu Port Check
65 [Documentation] Validates the ONU Go adapter states
TorstenThieme00958682020-06-19 11:29:31 +000066 ... Assuming that ONU State Test was executed where all the ONUs are reached the expected state!
TorstenThieme401af432020-06-11 15:53:53 +000067 [Tags] onutest
68 [Setup] Start Logging ONUPortTest
69 Run Keyword If ${porttest} Do Onu Port Check
70 [Teardown] Run Keywords Collect Logs
71 ... AND Stop Logging ONUPortTest
72
TorstenThieme1619db22020-04-03 12:01:15 +000073*** Keywords ***
74Setup Suite
75 [Documentation] Set up the test suite
76 Common Test Suite Setup
77 Run Keyword If ${num_onus}>4 Calculate Timeout
78
79Setup Test
80 [Documentation] Pre-test Setup
81 #test for empty device list
82 Test Empty Device List
83 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
84 ... ${olt_ip} ${olt_user} ${olt_pass}
85 Run Keyword If ${has_dataplane} Sleep 60s
86 #create/preprovision device
87 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
88 Set Suite Variable ${olt_device_id}
89 #validate olt states
90 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
91 ... ${olt_device_id}
92 Sleep 5s
93
94Calculate Timeout
95 [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus
96 ${timeout} Fetch From Left ${timeout} s
97 ${timeout}= evaluate ${timeout}+((${num_onus}-4)*30)
TorstenThieme401af432020-06-11 15:53:53 +000098 ${timeout}= Set Variable If (not ${debugmode}) and (${timeout}>600) 600 ${timeout}
TorstenThieme1619db22020-04-03 12:01:15 +000099 ${timeout}= Catenate SEPARATOR= ${timeout} s
100 Set Suite Variable ${timeout}
101 #Log \r\nTimeout: ${timeout} INFO console=True
102
103Do ONU Up To State Test
104 [Documentation] This keyword performs Up2State Test
105 ... All states up to the passed have to be checked
106 FOR ${I} IN RANGE 0 ${num_onus}
107 ${src}= Set Variable ${hosts.src[${I}]}
108 ${dst}= Set Variable ${hosts.dst[${I}]}
109 Run Keyword If ${state2test}>=1
110 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
111 ... Validate Device ENABLED ACTIVATING REACHABLE
112 ... ${src['onu']} onu=True onu_reason=activating-onu
113 Run Keyword If ${state2test}>=2
114 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
115 ... Validate Device ENABLED ACTIVATING REACHABLE
116 ... ${src['onu']} onu=True onu_reason=starting-openomci
117 Run Keyword If ${state2test}>=3
118 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
119 ... Validate Device ENABLED ACTIVATING REACHABLE
120 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
121 Run Keyword If ${state2test}>=4
122 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
123 ... Validate Device ENABLED ACTIVE REACHABLE
124 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
125 Run Keyword If ${state2test}>=5
126 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
127 ... Validate Device ENABLED ACTIVE REACHABLE
128 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
129 Run Keyword If ${state2test}>=6
130 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
131 ... Validate Device ENABLED ACTIVE REACHABLE
132 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
133 END
134
135Do ONU Single State Test
136 [Documentation] This keyword performs SingleState Test
137 ... Only the passed state has to be checked
138 FOR ${I} IN RANGE 0 ${num_onus}
139 ${src}= Set Variable ${hosts.src[${I}]}
140 ${dst}= Set Variable ${hosts.dst[${I}]}
141 Run Keyword If ${state2test}==1
142 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
143 ... Validate Device ENABLED ACTIVATING REACHABLE
144 ... ${src['onu']} onu=True onu_reason=activating-onu
145 ... ELSE IF ${state2test}==2
146 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
147 ... Validate Device ENABLED ACTIVATING REACHABLE
148 ... ${src['onu']} onu=True onu_reason=starting-openomci
149 ... ELSE IF ${state2test}==3
150 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
151 ... Validate Device ENABLED ACTIVATING REACHABLE
152 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
153 ... ELSE IF ${state2test}==4
154 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
155 ... Validate Device ENABLED ACTIVE REACHABLE
156 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
157 ... ELSE IF ${state2test}==5
158 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
159 ... Validate Device ENABLED ACTIVE REACHABLE
160 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
161 ... ELSE IF ${state2test}==6
162 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
163 ... Validate Device ENABLED ACTIVE REACHABLE
164 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
165 ... ELSE Fail The state to test (${state2test}) is not valid!
166 END
167
TorstenThieme94e4ae42020-05-18 13:01:42 +0000168Do ONU Single State Test Time
169 [Documentation] This keyword performs SingleState Test with calculate running time
170 ... Only the passed state has to be checked and the duration each single onu adapter needed
171 ... will be calculated and printed out
172 ${ListfinishedONUs} Create List
173 Set Global Variable ${ListfinishedONUs}
174 Create File ONU_Startup_Time.txt This file contains the startup times of all ONUs.
175 ${list_onus} Create List
TorstenThieme401af432020-06-11 15:53:53 +0000176 Build ONU SN List ${list_onus}
TorstenThieme94e4ae42020-05-18 13:01:42 +0000177 Run Keyword If ${state2test}==1
178 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000179 ... Validate ONU Devices MIB State With Duration
TorstenThieme401af432020-06-11 15:53:53 +0000180 ... activating-onu ${list_onus} ${timeStart} print2console=True
181 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000182 ... ELSE IF ${state2test}==2
183 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
TorstenThieme9949b172020-06-16 10:00:15 +0000184 ... Validate ONU Devices MIB State With Duration
TorstenThieme401af432020-06-11 15:53:53 +0000185 ... starting-openomci ${list_onus} ${timeStart} print2console=True
186 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000187 ... ELSE IF ${state2test}==3
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 ... discovery-mibsync-complete ${list_onus} ${timeStart} print2console=True
191 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000192 ... ELSE IF ${state2test}==4
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 ... initial-mib-downloaded ${list_onus} ${timeStart} print2console=True
196 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000197 ... ELSE IF ${state2test}==5
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 ... tech-profile-config-download-success ${list_onus} ${timeStart} print2console=True
201 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000202 ... ELSE IF ${state2test}==6
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 ... omci-flows-pushed ${list_onus} ${timeStart} print2console=True
206 ... output_file=ONU_Startup_Time.txt
TorstenThieme94e4ae42020-05-18 13:01:42 +0000207 ... ELSE Fail The state to test (${state2test}) is not valid!
208
TorstenThieme1619db22020-04-03 12:01:15 +0000209Do Onu Port Check
TorstenThieme00958682020-06-19 11:29:31 +0000210 [Documentation] Check that all the UNI ports show up in ONOS
211 Wait for Ports in ONOS ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${num_onus} BBSM
TorstenThieme9949b172020-06-16 10:00:15 +0000212