blob: f583a7eba322ca41e1c48592b644ace12cfc1857 [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
32${timeout} 120s
33${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
45
46*** Test Cases ***
47ONU State Test
48 [Documentation] Validates the ONU Go adapter states
49 [Tags] statetest
50 [Setup] Run Keywords Start Logging ONUStateTest
51 ... AND Setup Test
52 Run Keyword If ${has_dataplane} Clean Up Linux
53 Enable Device ${olt_device_id}
54 Run Keyword If "${testmode}"=="SingleState" Do ONU Single State Test
55 ... ELSE IF "${testmode}"=="Up2State" Do ONU Up To State Test
56 ... ELSE Fail The testmode (${testmode}) is not valid!
57 Run Keyword If ${porttest} Do Onu Port Check
58 [Teardown] Run Keywords Collect Logs
59 ... AND Stop Logging ONUStateTest
60
61*** Keywords ***
62Setup Suite
63 [Documentation] Set up the test suite
64 Common Test Suite Setup
65 Run Keyword If ${num_onus}>4 Calculate Timeout
66
67Setup Test
68 [Documentation] Pre-test Setup
69 #test for empty device list
70 Test Empty Device List
71 Run Keyword If ${has_dataplane} Wait Until Keyword Succeeds 120s 10s Openolt is Up
72 ... ${olt_ip} ${olt_user} ${olt_pass}
73 Run Keyword If ${has_dataplane} Sleep 60s
74 #create/preprovision device
75 ${olt_device_id}= Create Device ${olt_ip} ${OLT_PORT}
76 Set Suite Variable ${olt_device_id}
77 #validate olt states
78 Wait Until Keyword Succeeds ${timeout} 5s Validate OLT Device PREPROVISIONED UNKNOWN UNKNOWN
79 ... ${olt_device_id}
80 Sleep 5s
81
82Calculate Timeout
83 [Documentation] Calculates the timeout regarding num-onus in case of more than 4 onus
84 ${timeout} Fetch From Left ${timeout} s
85 ${timeout}= evaluate ${timeout}+((${num_onus}-4)*30)
86 ${timeout}= Catenate SEPARATOR= ${timeout} s
87 Set Suite Variable ${timeout}
88 #Log \r\nTimeout: ${timeout} INFO console=True
89
90Do ONU Up To State Test
91 [Documentation] This keyword performs Up2State Test
92 ... All states up to the passed have to be checked
93 FOR ${I} IN RANGE 0 ${num_onus}
94 ${src}= Set Variable ${hosts.src[${I}]}
95 ${dst}= Set Variable ${hosts.dst[${I}]}
96 Run Keyword If ${state2test}>=1
97 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
98 ... Validate Device ENABLED ACTIVATING REACHABLE
99 ... ${src['onu']} onu=True onu_reason=activating-onu
100 Run Keyword If ${state2test}>=2
101 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
102 ... Validate Device ENABLED ACTIVATING REACHABLE
103 ... ${src['onu']} onu=True onu_reason=starting-openomci
104 Run Keyword If ${state2test}>=3
105 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
106 ... Validate Device ENABLED ACTIVATING REACHABLE
107 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
108 Run Keyword If ${state2test}>=4
109 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
110 ... Validate Device ENABLED ACTIVE REACHABLE
111 ... ${src['onu']} onu=True onu_reason=initial-mib-downloaded
112 Run Keyword If ${state2test}>=5
113 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
114 ... Validate Device ENABLED ACTIVE REACHABLE
115 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
116 Run Keyword If ${state2test}>=6
117 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
118 ... Validate Device ENABLED ACTIVE REACHABLE
119 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
120 END
121
122Do ONU Single State Test
123 [Documentation] This keyword performs SingleState Test
124 ... Only the passed state has to be checked
125 FOR ${I} IN RANGE 0 ${num_onus}
126 ${src}= Set Variable ${hosts.src[${I}]}
127 ${dst}= Set Variable ${hosts.dst[${I}]}
128 Run Keyword If ${state2test}==1
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=activating-onu
132 ... ELSE IF ${state2test}==2
133 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
134 ... Validate Device ENABLED ACTIVATING REACHABLE
135 ... ${src['onu']} onu=True onu_reason=starting-openomci
136 ... ELSE IF ${state2test}==3
137 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
138 ... Validate Device ENABLED ACTIVATING REACHABLE
139 ... ${src['onu']} onu=True onu_reason=discovery-mibsync-complete
140 ... ELSE IF ${state2test}==4
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=initial-mib-downloaded
144 ... ELSE IF ${state2test}==5
145 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
146 ... Validate Device ENABLED ACTIVE REACHABLE
147 ... ${src['onu']} onu=True onu_reason=tech-profile-config-download-success
148 ... ELSE IF ${state2test}==6
149 ... Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
150 ... Validate Device ENABLED ACTIVE REACHABLE
151 ... ${src['onu']} onu=True onu_reason=omci-flows-pushed
152 ... ELSE Fail The state to test (${state2test}) is not valid!
153 END
154
155Do Onu Port Check
156 [Documentation] This keyword performs Onu Port Check
157 ${of_id}= Wait Until Keyword Succeeds ${timeout} 15s Validate OLT Device in ONOS ${olt_serial_number}
158 Set Global Variable ${of_id}
159 FOR ${I} IN RANGE 0 ${num_onus}
160 ${src}= Set Variable ${hosts.src[${I}]}
161 ${dst}= Set Variable ${hosts.dst[${I}]}
162 ${onu_device_id}= Get Device ID From SN ${src['onu']}
163 ${onu_port}= Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 2s
164 ... Get ONU Port in ONOS ${src['onu']} ${of_id}
165 Run Keyword And Continue On Failure Wait Until Keyword Succeeds 120s 2s
166 ... Verify ONU Port Is Enabled ${ONOS_SSH_IP} ${ONOS_SSH_PORT} ${onu_port}
167 END