blob: dedf443fb375b04569869a838ffe3978738f64fe [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
60 [Tags] onutest
61 [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
96 ${firstonu}= Set Variable 0
97 ${secondonu}= Set Variable 1
98 ${state2test}= Set Variable 6
99 Set Global Variable ${state2test}
100 Run Keyword If ${has_dataplane} Clean Up Linux
101 # Start first Onu
102 Log \r\nONU BBSM00000001: startup with MIB upload cycle and storage of template data to etcd. console=yes
103 ${result}= Exec Pod ${NAMESPACE} bbsim bbsimctl onu poweron BBSM00000001
104 Should Contain ${result} successfully msg=Can not poweron BBSM00000001 values=False
105 ${timeStart}= Get Current Date
106 ${firstonustartup}= Get ONU Startup Duration ${firstonu} ${timeStart}
107 # check MIB Template data stored in etcd
108 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 3s
109 ... Verify MIB Template Data Available
110 # Start second Onu
111 Log ONU BBSM00000002: startup without MIB upload cycle by using of template data of etcd. console=yes
112 ${result}= Exec Pod ${NAMESPACE} bbsim bbsimctl onu poweron BBSM00000002
113 Should Contain ${result} successfully msg=Can not poweron BBSM00000002 values=False
114 ${timeStart}= Get Current Date
115 ${secondonustartup}= Get ONU Startup Duration ${secondonu} ${timeStart}
116 # compare both durations, second onu should be at least 3 times faster
117 ${status} Evaluate ${firstonustartup}>=${secondonustartup}*3
118 Should Be True ${status}
119 ... Startup durations (${firstonustartup} and ${secondonustartup}) do not full fill the requirements of 1/10.
120
121Get ONU Startup Duration
122 [Documentation] This keyword delivers startup duration of onu
123 [Arguments] ${onu} ${starttime}
124 ${src}= Set Variable ${hosts.src[${onu}]}
125 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Map State ${state2test}
126 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
127 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
128 ... ${src['onu']} onu=True onu_reason=${onu_state}
129 ${timeCurrent} = Get Current Date
130 ${timeTotalMs} = Subtract Date From Date ${timeCurrent} ${startTime} result_format=number
131 Log ONU ${src['onu']}: reached the state ${onu_state} after ${timeTotalMs} sec. console=yes
132 [Return] ${timeTotalMs}
133
134Verify MIB Template Data Available
135 [Documentation] This keyword verifies MIB Template Data stored in etcd
136 ${namespace}= Set Variable default
137 ${podname}= Set Variable etcd
138 ${commandget} Catenate
139 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/omci_mibs/go_templates/'
140 ${result}= Exec Pod ${namespace} ${podname} ${commandget}
141 Should Not Be Empty ${result} No MIB Template Data stored in etcd!
142
143Delete MIB Template Data
144 [Documentation] This keyword deletes MIB Template Data stored in etcd
145 ${namespace}= Set Variable default
146 ${podname}= Set Variable etcd
147 ${commanddel} Catenate
148 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl del --prefix service/voltha/omci_mibs/go_templates/'
149 ${result}= Exec Pod ${namespace} ${podname} ${commanddel}
150 Sleep 3s
151 ${commandget} Catenate
152 ... /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/omci_mibs/go_templates/'
153 ${result}= Exec Pod ${namespace} ${podname} ${commandget}
154 Should Be Empty ${result} Could not delete MIB Template Data stored in etcd!
155
156Map State
157 [Documentation] This keyword converts the passed numeric value or name of a onu state to its state values.
158 [Arguments] ${state}
159 # create state lists with corresponding return values
160 # ADMIN-STATE OPER-STATUS CONNECT-STATUS ONU-STATE
161 ${state1} Create List ENABLED ACTIVATING REACHABLE activating-onu
162 ${state2} Create List ENABLED ACTIVATING REACHABLE starting-openomci
163 ${state3} Create List ENABLED ACTIVATING REACHABLE discovery-mibsync-complete
164 ${state4} Create List ENABLED ACTIVE REACHABLE initial-mib-downloaded
165 ${state5} Create List ENABLED ACTIVE REACHABLE tech-profile-config-download-success
166 ${state6} Create List ENABLED ACTIVE REACHABLE omci-flows-pushed
167 ${state7} Create List DISABLED UNKNOWN REACHABLE omci-admin-lock
168 ${state8} Create List ENABLED ACTIVE REACHABLE onu-reenabled
169 ${admin_state} ${oper_status} ${connect_status} ${onu_state}= Set Variable If
170 ... '${state}'=='1' or '${state}'=='activating-onu' ${state1}
171 ... '${state}'=='2' or '${state}'=='starting-openomci' ${state2}
172 ... '${state}'=='3' or '${state}'=='discovery-mibsync-complete' ${state3}
173 ... '${state}'=='4' or '${state}'=='initial-mib-downloaded' ${state4}
174 ... '${state}'=='5' or '${state}'=='tech-profile-config-download-success' ${state5}
175 ... '${state}'=='6' or '${state}'=='omci-flows-pushed' ${state6}
176 ... '${state}'=='7' or '${state}'=='omci-admin-lock' ${state7}
177 ... '${state}'=='8' or '${state}'=='onu-reenabled' ${state8}
178 [Return] ${admin_state} ${oper_status} ${connect_status} ${onu_state}