blob: 0386b27885279412d1c79da38cd4da1cdc563f31 [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
TorstenThiemefd7e7ba2020-11-06 13:57:57 +000021Resource Voltha_ONUUtilities.robot
TorstenThieme840380b2020-10-02 09:31:56 +000022
23*** Variables ***
24${NAMESPACE} voltha
25${timeout} 180s
26${of_id} 0
27${logical_id} 0
28${has_dataplane} True
29${external_libs} True
30${teardown_device} True
31${scripts} ../../scripts
32# Per-test logging on failure is turned off by default; set this variable to enable
33${container_log_dir} ${None}
34
35# flag debugmode is used, if true timeout calculation various, can be passed via the command line too
36# example: -v debugmode:True
37${debugmode} False
38# logging flag to enable Collect Logs, can be passed via the command line too
39# example: -v logging:True
40${logging} False
41# if True execution will be paused before clean up
42# example: -v pausebeforecleanup:True
43${pausebeforecleanup} False
44${data_dir} ../data
45
46
47*** Test Cases ***
48ONU MIB Template Data Test
49 [Documentation] Validates ONU Go adapter storage of MIB Template Data in etcd and checks the usage
50 ... - setup one ONU
51 ... - request MIB-Upload-Data by ONU via OMCI
52 ... - storage MIB-Upload-Data in etcd
53 ... - store setup duration of ONU
54 ... - check Template-Data in etcd stored (service/voltha/omci_mibs/go_templates/)
55 ... - setup second ONU
56 ... - collect setup durationof second ONU
57 ... - compare both duration
58 ... - duration of second ONU should be at least 10 times faster than the first one
59 ... - MIB-Upload-Data should not requested via OMCI by second ONU
60 ... - MIB-Upload-Data should read from etcd
TorstenThieme66c91a82020-10-19 13:37:53 +000061 [Tags] functionalOnuGo MibTemplateOnuGo
TorstenThieme840380b2020-10-02 09:31:56 +000062 [Setup] Run Keywords Start Logging ONUMibTemplateTest
63 ... AND Setup
64 Perform ONU MIB Template Data Test
65 [Teardown] Run Keywords Run Keyword If ${logging} Collect Logs
66 ... AND Stop Logging ONUMibTemplateTest
67
68
69*** Keywords ***
70Setup Suite
71 [Documentation] Set up the test suite
72 ${LogInfo}= Catenate
73 ... \r\nPassed arguments:
74 ... debugmode:${debugmode}, logging:${logging}, pausebeforecleanup:${pausebeforecleanup},
75 Log ${LogInfo} console=yes
76 Common Test Suite Setup
77 ${onos_ssh_connection} Open ONOS SSH Connection ${ONOS_SSH_IP} ${ONOS_SSH_PORT}
78 Set Suite Variable ${onos_ssh_connection}
79 # delete etcd MIB Template Data
80 Delete MIB Template Data
81
82Teardown Suite
83 [Documentation] Replaces the Suite Teardown in utils.robot.
84 ... Cleans up and checks all ONU ports disabled in ONOS.
85 ... Furthermore gives the possibility to pause the execution.
86 Run Keyword If ${pausebeforecleanup} Import Library Dialogs
87 Run Keyword If ${pausebeforecleanup} Pause Execution Press OK to continue with clean up!
88 Run Keyword If ${pausebeforecleanup} Log Teardown will be continued... console=yes
89 Run Keyword If ${teardown_device} Delete All Devices and Verify
Matteo Scandolo786aba42020-12-07 10:00:03 -080090 FOR ${I} IN RANGE 0 ${num_olts}
91 ${olt_serial_number}= Set Variable ${list_olts}[${I}][sn]
Matteo Scandolob9953232020-12-07 14:24:47 -080092 ${of_id}= Wait Until Keyword Succeeds 60s 5s Validate OLT Device in ONOS ${olt_serial_number}
93 Wait for Ports in ONOS ${onos_ssh_connection} 0 ${of_id} BBSM
Matteo Scandolo786aba42020-12-07 10:00:03 -080094 END
TorstenThieme840380b2020-10-02 09:31:56 +000095 # delete etcd MIB Template Data (for repeating test)
96 Delete MIB Template Data
97 Close ONOS SSH Connection ${onos_ssh_connection}
98
99Perform ONU MIB Template Data Test
100 [Documentation] This keyword performs ONU MIB Template Data Test
TorstenThieme66c91a82020-10-19 13:37:53 +0000101 ${firstonu}= Set Variable 0
102 ${secondonu}= Set Variable 1
103 ${state2test}= Set Variable omci-flows-pushed
TorstenThieme840380b2020-10-02 09:31:56 +0000104 Set Global Variable ${state2test}
105 Run Keyword If ${has_dataplane} Clean Up Linux
106 # Start first Onu
TorstenThieme66c91a82020-10-19 13:37:53 +0000107 ${src}= Set Variable ${hosts.src[${0}]}
108 Log \r\nONU ${src['onu']}: startup with MIB upload cycle and storage of template data to etcd. console=yes
Holger Hildebrandt23147742020-11-16 10:13:21 +0000109 ${result}= Exec Pod In Kube ${NAMESPACE} bbsim bbsimctl onu poweron ${src['onu']}
TorstenThieme66c91a82020-10-19 13:37:53 +0000110 Should Contain ${result} successfully msg=Can not poweron ${src['onu']} values=False
TorstenThieme840380b2020-10-02 09:31:56 +0000111 ${timeStart}= Get Current Date
112 ${firstonustartup}= Get ONU Startup Duration ${firstonu} ${timeStart}
113 # check MIB Template data stored in etcd
114 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 3s
115 ... Verify MIB Template Data Available
116 # Start second Onu
TorstenThieme66c91a82020-10-19 13:37:53 +0000117 ${src}= Set Variable ${hosts.src[${1}]}
118 Log ONU ${src['onu']}: startup without MIB upload cycle by using of template data of etcd. console=yes
Holger Hildebrandt23147742020-11-16 10:13:21 +0000119 ${result}= Exec Pod In Kube ${NAMESPACE} bbsim bbsimctl onu poweron ${src['onu']}
TorstenThieme66c91a82020-10-19 13:37:53 +0000120 Should Contain ${result} successfully msg=Can not poweron ${src['onu']} values=False
TorstenThieme840380b2020-10-02 09:31:56 +0000121 ${timeStart}= Get Current Date
122 ${secondonustartup}= Get ONU Startup Duration ${secondonu} ${timeStart}
123 # compare both durations, second onu should be at least 3 times faster
124 ${status} Evaluate ${firstonustartup}>=${secondonustartup}*3
125 Should Be True ${status}
126 ... Startup durations (${firstonustartup} and ${secondonustartup}) do not full fill the requirements of 1/10.
127
128Get ONU Startup Duration
129 [Documentation] This keyword delivers startup duration of onu
130 [Arguments] ${onu} ${starttime}
131 ${src}= Set Variable ${hosts.src[${onu}]}
TorstenThieme66c91a82020-10-19 13:37:53 +0000132 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}=
133 ... Map State ${state2test}
TorstenThieme840380b2020-10-02 09:31:56 +0000134 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
135 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
136 ... ${src['onu']} onu=True onu_reason=${onu_state}
137 ${timeCurrent} = Get Current Date
138 ${timeTotalMs} = Subtract Date From Date ${timeCurrent} ${startTime} result_format=number
139 Log ONU ${src['onu']}: reached the state ${onu_state} after ${timeTotalMs} sec. console=yes
140 [Return] ${timeTotalMs}