blob: 7e788ff12828ffc022f36ae82d0ed1b4d9846d58 [file] [log] [blame]
TorstenThieme840380b2020-10-02 09:31:56 +00001*** Settings ***
2Documentation Test Template handling of ONU Go adapter with BBSIM controlledActivation: only-onu only!
3... Values.yaml must contain 'onu: 2' and 'controlledActivation: only-onu' under BBSIM!
4... Run robot with bbsim-kind-2x2.yaml
5Suite Setup Setup Suite
6Suite Teardown Teardown Suite
7Test Setup Setup
8Test Teardown Teardown
9Library Collections
10Library String
11Library OperatingSystem
12Library XML
13Library RequestsLibrary
14Library ../../libraries/DependencyLibrary.py
15Resource ../../libraries/onos.robot
16Resource ../../libraries/voltctl.robot
17Resource ../../libraries/voltha.robot
18Resource ../../libraries/utils.robot
19Resource ../../libraries/k8s.robot
20Resource ../../variables/variables.robot
21
22*** Variables ***
23${NAMESPACE} voltha
24${timeout} 180s
25${of_id} 0
26${logical_id} 0
27${has_dataplane} True
28${external_libs} True
29${teardown_device} True
30${scripts} ../../scripts
31# Per-test logging on failure is turned off by default; set this variable to enable
32${container_log_dir} ${None}
33
34# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
35# example: -v debugmode:True
36${debugmode} False
37# logging flag to enable Collect Logs, can be passed via the command line too
38# example: -v logging:True
39${logging} False
40# if True execution will be paused before clean up
41# example: -v pausebeforecleanup:True
42${pausebeforecleanup} False
43${data_dir} ../data
44
45
46*** Test Cases ***
47ONU MIB Template Data Test
48 [Documentation] Validates ONU Go adapter storage of MIB Template Data in etcd and checks the usage
49 ... - setup one ONU
50 ... - request MIB-Upload-Data by ONU via OMCI
51 ... - storage MIB-Upload-Data in etcd
52 ... - store setup duration of ONU
53 ... - check Template-Data in etcd stored (service/voltha/omci_mibs/go_templates/)
54 ... - setup second ONU
55 ... - collect setup durationof second ONU
56 ... - compare both duration
57 ... - duration of second ONU should be at least 10 times faster than the first one
58 ... - MIB-Upload-Data should not requested via OMCI by second ONU
59 ... - MIB-Upload-Data should read from etcd
TorstenThieme66c91a82020-10-19 13:37:53 +000060 [Tags] functionalOnuGo MibTemplateOnuGo
TorstenThieme840380b2020-10-02 09:31:56 +000061 [Setup] Run Keywords Start Logging ONUMibTemplateTest
62 ... AND Setup
63 Perform ONU MIB Template Data Test
64 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
65 ... AND Stop Logging ONUMibTemplateTest
66
67
68*** Keywords ***
69Setup Suite
70 [Documentation] Set up the test suite
71 ${LogInfo}= Catenate
72 ... \r\nPassed arguments:
73 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
74 Log ${LogInfo} console=yes
75 Common Test Suite Setup
76 ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
77 Set Suite Variable ${onos_ssh_connection}
78 # delete etcd MIB Template Data
79 Delete MIB Template Data
80
81Teardown 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 ${pausebeforecleanup} Log Teardown will be continued... console=yes
88 Run Keyword If ${teardown_device} Delete All Devices and Verify
89 Wait for Ports in ONOS ${onos_ssh_connection} 0 BBSM
90 # delete etcd MIB Template Data (for repeating test)
91 Delete MIB Template Data
92 Close ONOS SSH Connection ${onos_ssh_connection}
93
94Perform ONU MIB Template Data Test
95 [Documentation] This keyword performs ONU MIB Template Data Test
TorstenThieme66c91a82020-10-19 13:37:53 +000096 ${firstonu}= Set Variable 0
97 ${secondonu}= Set Variable 1
98 ${state2test}= Set Variable omci-flows-pushed
TorstenThieme840380b2020-10-02 09:31:56 +000099 Set Global Variable ${state2test}
100 Run Keyword If ${has_dataplane} Clean Up Linux
101 # Start first Onu
TorstenThieme66c91a82020-10-19 13:37:53 +0000102 ${src}= Set Variable ${hosts.src[${0}]}
103 Log \r\nONU ${src['onu']}: startup with MIB upload cycle and storage of template data to etcd. console=yes
104 ${result}= Exec Pod ${NAMESPACE} bbsim bbsimctl onu poweron ${src['onu']}
105 Should Contain ${result} successfully msg=Can not poweron ${src['onu']} values=False
TorstenThieme840380b2020-10-02 09:31:56 +0000106 ${timeStart}= Get Current Date
107 ${firstonustartup}= Get ONU Startup Duration ${firstonu} ${timeStart}
108 # check MIB Template data stored in etcd
109 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 3s
110 ... Verify MIB Template Data Available
111 # Start second Onu
TorstenThieme66c91a82020-10-19 13:37:53 +0000112 ${src}= Set Variable ${hosts.src[${1}]}
113 Log ONU ${src['onu']}: startup without MIB upload cycle by using of template data of etcd. console=yes
114 ${result}= Exec Pod ${NAMESPACE} bbsim bbsimctl onu poweron ${src['onu']}
115 Should Contain ${result} successfully msg=Can not poweron ${src['onu']} values=False
TorstenThieme840380b2020-10-02 09:31:56 +0000116 ${timeStart}= Get Current Date
117 ${secondonustartup}= Get ONU Startup Duration ${secondonu} ${timeStart}
118 # compare both durations, second onu should be at least 3 times faster
119 ${status} Evaluate ${firstonustartup}>=${secondonustartup}*3
120 Should Be True ${status}
121 ... Startup durations (${firstonustartup} and ${secondonustartup}) do not full fill the requirements of 1/10.
122
123Get ONU Startup Duration
124 [Documentation] This keyword delivers startup duration of onu
125 [Arguments] ${onu} ${starttime}
126 ${src}= Set Variable ${hosts.src[${onu}]}
TorstenThieme66c91a82020-10-19 13:37:53 +0000127 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}=
128 ... Map State ${state2test}
TorstenThieme840380b2020-10-02 09:31:56 +0000129 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
130 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
131 ... ${src['onu']} onu=True onu_reason=${onu_state}
132 ${timeCurrent} = Get Current Date
133 ${timeTotalMs} = Subtract Date From Date ${timeCurrent} ${startTime} result_format=number
134 Log ONU ${src['onu']}: reached the state ${onu_state} after ${timeTotalMs} sec. console=yes
135 [Return] ${timeTotalMs}
136
137Verify MIB Template Data Available
138 [Documentation] This keyword verifies MIB Template Data stored in etcd
139 ${namespace}= Set Variable default
140 ${podname}= Set Variable etcd
141 ${commandget} Catenate
142 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/omci_mibs/go_templates/'
143 ${result}= Exec Pod ${namespace} ${podname} ${commandget}
144 Should Not Be Empty ${result} No MIB Template Data stored in etcd!
145
146Delete MIB Template Data
147 [Documentation] This keyword deletes MIB Template Data stored in etcd
148 ${namespace}= Set Variable default
149 ${podname}= Set Variable etcd
150 ${commanddel} Catenate
151 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/omci_mibs/go_templates/'
152 ${result}= Exec Pod ${namespace} ${podname} ${commanddel}
153 Sleep 3s
154 ${commandget} Catenate
155 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/omci_mibs/go_templates/'
156 ${result}= Exec Pod ${namespace} ${podname} ${commandget}
157 Should Be Empty ${result} Could not delete MIB Template Data stored in etcd!
158
159Map State
160 [Documentation] This keyword converts the passed numeric value or name of a onu state to its state values.
161 [Arguments] ${state}
162 # create state lists with corresponding return values
TorstenThieme66c91a82020-10-19 13:37:53 +0000163 # ADMIN-STATE OPER-STATUS CONNECT-STATUS ONU-STATE (number/name)
164 ${state1} Create List ENABLED ACTIVATING REACHABLE 1 activating-onu
165 ${state2} Create List ENABLED ACTIVATING REACHABLE 2 starting-openomci
166 ${state3} Create List ENABLED ACTIVATING REACHABLE 3 discovery-mibsync-complete
167 ${state4} Create List ENABLED ACTIVE REACHABLE 4 initial-mib-downloaded
168 ${state5} Create List ENABLED ACTIVE REACHABLE 5 tech-profile-config-download-success
169 ${state6} Create List ENABLED ACTIVE REACHABLE 6 omci-flows-pushed
170 ${state7} Create List DISABLED UNKNOWN REACHABLE 7 omci-admin-lock
171 ${state8} Create List ENABLED ACTIVE REACHABLE 8 onu-reenabled
172 ${state9} Create List ENABLED DISCOVERED UNREACHABLE 9 stopping-openomci
173 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}= Set Variable If
TorstenThieme840380b2020-10-02 09:31:56 +0000174 ... '${state}'=='1' or '${state}'=='activating-onu' ${state1}
175 ... '${state}'=='2' or '${state}'=='starting-openomci' ${state2}
176 ... '${state}'=='3' or '${state}'=='discovery-mibsync-complete' ${state3}
177 ... '${state}'=='4' or '${state}'=='initial-mib-downloaded' ${state4}
178 ... '${state}'=='5' or '${state}'=='tech-profile-config-download-success' ${state5}
179 ... '${state}'=='6' or '${state}'=='omci-flows-pushed' ${state6}
180 ... '${state}'=='7' or '${state}'=='omci-admin-lock' ${state7}
181 ... '${state}'=='8' or '${state}'=='onu-reenabled' ${state8}
TorstenThieme66c91a82020-10-19 13:37:53 +0000182 ... '${state}'=='9' or '${state}'=='stopping-openomci' ${state9}
183 [Return] ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}