blob: ca476db05302ef05e7d7876db92b38df7f4c0fa9 [file] [log] [blame]
TorstenThiemed4f48962020-12-08 12:17:19 +00001# Copyright 2020 - present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
TorstenThieme840380b2020-10-02 09:31:56 +000015*** Settings ***
16Documentation Test Template handling of ONU Go adapter with BBSIM controlledActivation: only-onu only!
17... Values.yaml must contain 'onu: 2' and 'controlledActivation: only-onu' under BBSIM!
18... Run robot with bbsim-kind-2x2.yaml
19Suite Setup Setup Suite
20Suite Teardown Teardown Suite
21Test Setup Setup
22Test Teardown Teardown
23Library Collections
24Library String
25Library OperatingSystem
26Library XML
27Library RequestsLibrary
28Library ../../libraries/DependencyLibrary.py
29Resource ../../libraries/onos.robot
30Resource ../../libraries/voltctl.robot
31Resource ../../libraries/voltha.robot
32Resource ../../libraries/utils.robot
33Resource ../../libraries/k8s.robot
TorstenThieme440b7c02020-12-18 15:42:57 +000034Resource ../../libraries/onu_utilities.robot
TorstenThiemefe7099e2021-01-29 08:41:04 +000035Resource ../../libraries/bbsim.robot
TorstenThieme840380b2020-10-02 09:31:56 +000036Resource ../../variables/variables.robot
37
38*** Variables ***
Hardik Windlass4288c6a2021-09-28 07:22:06 +000039${NAMESPACE} voltha
40${INFRA_NAMESPACE} default
TorstenThiemed4f48962020-12-08 12:17:19 +000041${timeout} 60s
TorstenThieme840380b2020-10-02 09:31:56 +000042${of_id} 0
43${logical_id} 0
44${has_dataplane} True
45${external_libs} True
46${teardown_device} True
47${scripts} ../../scripts
48# Per-test logging on failure is turned off by default; set this variable to enable
49${container_log_dir} ${None}
50
51# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
52# example: -v debugmode:True
53${debugmode} False
54# logging flag to enable Collect Logs, can be passed via the command line too
55# example: -v logging:True
56${logging} False
57# if True execution will be paused before clean up
58# example: -v pausebeforecleanup:True
59${pausebeforecleanup} False
60${data_dir} ../data
61
62
63*** Test Cases ***
64ONU MIB Template Data Test
65 [Documentation] Validates ONU Go adapter storage of MIB Template Data in etcd and checks the usage
66 ... - setup one ONU
67 ... - request MIB-Upload-Data by ONU via OMCI
68 ... - storage MIB-Upload-Data in etcd
69 ... - store setup duration of ONU
TorstenThiemed4f48962020-12-08 12:17:19 +000070 ... - check Template-Data in etcd stored (service/%{NAME}/omci_mibs/go_templates/)
TorstenThieme840380b2020-10-02 09:31:56 +000071 ... - setup second ONU
72 ... - collect setup durationof second ONU
73 ... - compare both duration
74 ... - duration of second ONU should be at least 10 times faster than the first one
75 ... - MIB-Upload-Data should not requested via OMCI by second ONU
76 ... - MIB-Upload-Data should read from etcd
TorstenThieme66c91a82020-10-19 13:37:53 +000077 [Tags] functionalOnuGo MibTemplateOnuGo
TorstenThieme840380b2020-10-02 09:31:56 +000078 [Setup] Run Keywords Start Logging ONUMibTemplateTest
79 ... AND Setup
80 Perform ONU MIB Template Data Test
81 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
82 ... AND Stop Logging ONUMibTemplateTest
83
84
85*** Keywords ***
86Setup Suite
87 [Documentation] Set up the test suite
Andrea Campanella82add372021-11-05 12:01:15 +010088 Start Logging Setup or Teardown Setup-${SUITE NAME}
TorstenThieme840380b2020-10-02 09:31:56 +000089 ${LogInfo}= Catenate
90 ... \r\nPassed arguments:
91 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
92 Log ${LogInfo} console=yes
93 Common Test Suite Setup
TorstenThieme840380b2020-10-02 09:31:56 +000094 # delete etcd MIB Template Data
Hardik Windlass4288c6a2021-09-28 07:22:06 +000095 Delete MIB Template Data ${INFRA_NAMESPACE}
Andrea Campanella82add372021-11-05 12:01:15 +010096 Run Keyword If ${logging} Collect Logs
97 Stop Logging Setup or Teardown Setup-${SUITE NAME}
TorstenThieme840380b2020-10-02 09:31:56 +000098
99Teardown Suite
100 [Documentation] Replaces the Suite Teardown in utils.robot.
101 ... Cleans up and checks all ONU ports disabled in ONOS.
102 ... Furthermore gives the possibility to pause the execution.
Andrea Campanella82add372021-11-05 12:01:15 +0100103 Start Logging Setup or Teardown Teardown-${SUITE NAME}
TorstenThieme840380b2020-10-02 09:31:56 +0000104 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
105 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
106 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
107 Run Keyword If ${teardown_device} Delete All Devices and Verify
TorstenThieme731a7592021-07-01 14:26:54 +0000108 Wait for Ports in ONOS for all OLTs ${ONOS_SSH_IP} ${ONOS_SSH_PORT} 0 BBSM
TorstenThieme840380b2020-10-02 09:31:56 +0000109 # delete etcd MIB Template Data (for repeating test)
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000110 Delete MIB Template Data ${INFRA_NAMESPACE}
Andrea Campanella82add372021-11-05 12:01:15 +0100111 Run Keyword If ${logging} Collect Logs
112 Stop Logging Setup or Teardown Teardown-${SUITE NAME}
TorstenThieme440b7c02020-12-18 15:42:57 +0000113 Close All ONOS SSH Connections
TorstenThieme840380b2020-10-02 09:31:56 +0000114
115Perform ONU MIB Template Data Test
116 [Documentation] This keyword performs ONU MIB Template Data Test
TorstenThieme66c91a82020-10-19 13:37:53 +0000117 ${firstonu}= Set Variable 0
118 ${secondonu}= Set Variable 1
119 ${state2test}= Set Variable omci-flows-pushed
TorstenThieme840380b2020-10-02 09:31:56 +0000120 Set Global Variable ${state2test}
121 Run Keyword If ${has_dataplane} Clean Up Linux
122 # Start first Onu
TorstenThieme66c91a82020-10-19 13:37:53 +0000123 ${src}= Set Variable ${hosts.src[${0}]}
124 Log \r\nONU ${src['onu']}: startup with MIB upload cycle and storage of template data to etcd. console=yes
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000125 ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release bbsim0
126 Power On ONU ${NAMESPACE} ${bbsim_pod} ${src['onu']}
TorstenThieme840380b2020-10-02 09:31:56 +0000127 ${timeStart}= Get Current Date
128 ${firstonustartup}= Get ONU Startup Duration ${firstonu} ${timeStart}
129 # check MIB Template data stored in etcd
130 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 3s
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000131 ... Verify MIB Template Data Available ${INFRA_NAMESPACE}
TorstenThieme840380b2020-10-02 09:31:56 +0000132 # Start second Onu
TorstenThieme66c91a82020-10-19 13:37:53 +0000133 ${src}= Set Variable ${hosts.src[${1}]}
134 Log ONU ${src['onu']}: startup without MIB upload cycle by using of template data of etcd. console=yes
Hardik Windlass4288c6a2021-09-28 07:22:06 +0000135 ${bbsim_pod}= Get Pod Name By Label ${NAMESPACE} release bbsim0
136 Power On ONU ${NAMESPACE} ${bbsim_pod} ${src['onu']}
TorstenThieme840380b2020-10-02 09:31:56 +0000137 ${timeStart}= Get Current Date
138 ${secondonustartup}= Get ONU Startup Duration ${secondonu} ${timeStart}
139 # compare both durations, second onu should be at least 3 times faster
140 ${status} Evaluate ${firstonustartup}>=${secondonustartup}*3
141 Should Be True ${status}
142 ... Startup durations (${firstonustartup} and ${secondonustartup}) do not full fill the requirements of 1/10.
143
144Get ONU Startup Duration
145 [Documentation] This keyword delivers startup duration of onu
146 [Arguments] ${onu} ${starttime}
147 ${src}= Set Variable ${hosts.src[${onu}]}
TorstenThieme66c91a82020-10-19 13:37:53 +0000148 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}=
149 ... Map State ${state2test}
TorstenThieme840380b2020-10-02 09:31:56 +0000150 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
151 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
152 ... ${src['onu']} onu=True onu_reason=${onu_state}
153 ${timeCurrent} = Get Current Date
154 ${timeTotalMs} = Subtract Date From Date ${timeCurrent} ${startTime} result_format=number
155 Log ONU ${src['onu']}: reached the state ${onu_state} after ${timeTotalMs} sec. console=yes
156 [Return] ${timeTotalMs}