blob: 9dc0c55a3a13f4cb101258ca3d5a91d91867cc89 [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
90 Wait for Ports in ONOS ${onos_ssh_connection} 0 BBSM
91 # delete etcd MIB Template Data (for repeating test)
92 Delete MIB Template Data
93 Close ONOS SSH Connection ${onos_ssh_connection}
94
95Perform ONU MIB Template Data Test
96 [Documentation] This keyword performs ONU MIB Template Data Test
TorstenThieme66c91a82020-10-19 13:37:53 +000097 ${firstonu}= Set Variable 0
98 ${secondonu}= Set Variable 1
99 ${state2test}= Set Variable omci-flows-pushed
TorstenThieme840380b2020-10-02 09:31:56 +0000100 Set Global Variable ${state2test}
101 Run Keyword If ${has_dataplane} Clean Up Linux
102 # Start first Onu
TorstenThieme66c91a82020-10-19 13:37:53 +0000103 ${src}= Set Variable ${hosts.src[${0}]}
104 Log \r\nONU ${src['onu']}: startup with MIB upload cycle and storage of template data to etcd. console=yes
105 ${result}= Exec Pod ${NAMESPACE} bbsim bbsimctl onu poweron ${src['onu']}
106 Should Contain ${result} successfully msg=Can not poweron ${src['onu']} values=False
TorstenThieme840380b2020-10-02 09:31:56 +0000107 ${timeStart}= Get Current Date
108 ${firstonustartup}= Get ONU Startup Duration ${firstonu} ${timeStart}
109 # check MIB Template data stored in etcd
110 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 3s
111 ... Verify MIB Template Data Available
112 # Start second Onu
TorstenThieme66c91a82020-10-19 13:37:53 +0000113 ${src}= Set Variable ${hosts.src[${1}]}
114 Log ONU ${src['onu']}: startup without MIB upload cycle by using of template data of etcd. console=yes
115 ${result}= Exec Pod ${NAMESPACE} bbsim bbsimctl onu poweron ${src['onu']}
116 Should Contain ${result} successfully msg=Can not poweron ${src['onu']} values=False
TorstenThieme840380b2020-10-02 09:31:56 +0000117 ${timeStart}= Get Current Date
118 ${secondonustartup}= Get ONU Startup Duration ${secondonu} ${timeStart}
119 # compare both durations, second onu should be at least 3 times faster
120 ${status} Evaluate ${firstonustartup}>=${secondonustartup}*3
121 Should Be True ${status}
122 ... Startup durations (${firstonustartup} and ${secondonustartup}) do not full fill the requirements of 1/10.
123
124Get ONU Startup Duration
125 [Documentation] This keyword delivers startup duration of onu
126 [Arguments] ${onu} ${starttime}
127 ${src}= Set Variable ${hosts.src[${onu}]}
TorstenThieme66c91a82020-10-19 13:37:53 +0000128 ${admin_state} ${oper_status} ${connect_status} ${onu_state_nb} ${onu_state}=
129 ... Map State ${state2test}
TorstenThieme840380b2020-10-02 09:31:56 +0000130 Run Keyword And Continue On Failure Wait Until Keyword Succeeds ${timeout} 50ms
131 ... Validate Device ${admin_state} ${oper_status} ${connect_status}
132 ... ${src['onu']} onu=True onu_reason=${onu_state}
133 ${timeCurrent} = Get Current Date
134 ${timeTotalMs} = Subtract Date From Date ${timeCurrent} ${startTime} result_format=number
135 Log ONU ${src['onu']}: reached the state ${onu_state} after ${timeTotalMs} sec. console=yes
136 [Return] ${timeTotalMs}