2 Documentation Test Suite for BFD tunnel monitoring
4 Library OperatingSystem
6 Library RequestsLibrary
9 Resource ../../libraries/DataModels.robot
10 Resource ../../libraries/Genius.robot
11 Resource ../../libraries/KarafKeywords.robot
12 Resource ../../libraries/OVSDB.robot
13 Resource ../../libraries/ToolsSystem.robot
14 Resource ../../libraries/Utils.robot
15 Resource ../../libraries/VpnOperations.robot
16 Resource ../../variables/netvirt/Variables.robot
17 Resource ../../variables/Variables.robot
18 Resource ../../libraries/CompareStream.robot
19 Variables ../../variables/genius/Modules.py
21 Suite Setup Genius Suite Setup
22 Suite Teardown BFD Suite Teardown
23 Test Setup Genius Test Setup
24 Test Teardown Genius Test Teardown ${data_models}
28 ${TUNNEL_MONITOR_ON} Tunnel Monitoring (for VXLAN tunnels): On
29 ${DEFAULT_MONITORING_INTERVAL} Tunnel Monitoring Interval (for VXLAN tunnels): 1000
30 ${TUNNEL_MONITOR_OFF} Tunnel Monitoring (for VXLAN tunnels): Off
31 ${INTERVAL_5000} {"tunnel-monitor-interval":{"interval":5000}}
33 ... {"tunnel-monitor-params":{"enabled":true,"monitor-protocol":"odl-interface:tunnel-monitoring-type-bfd"}}
35 ... {"tunnel-monitor-params":{"enabled":"false","monitor-protocol":"odl-interface:tunnel-monitoring-type-bfd"}}
36 ${TUNNEL_MONI_PARAMS_TRUE} true
37 ${TUNNEL_MONI_PARAMS_FALSE} false
38 ${INTERFACE_DS_MONI_FALSE} "odl-interface:monitor-enabled": false
39 ${INTERFACE_DS_MONI_TRUE} "odl-interface:monitor-enabled": true
40 ${INTERFACE_DS_MONI_INT_1000} "odl-interface:monitor-interval": 1000
41 ${INTERFACE_DS_MONI_INT_5000} "odl-interface:monitor-interval": 5000
42 ${TUNNEL_MONI_PROTO} tunnel-monitoring-type-bfd
46 BFD_TC00 Create ITM between DPNs
47 [Documentation] Create ITM between DPNs
48 Genius.Create Vteps ${NO_VLAN} ${gateway_ip}
49 BuiltIn.Wait Until Keyword Succeeds 30s 5s Genius.Verify Tunnel Status As Up
51 BFD_TC01 Verify default BFD monitoring status on Controller
52 [Documentation] Verify the default value of BFD monitoring \ on the Controller
53 CompareStream.Run_Keyword_If_At_Least_Neon
54 ... BuiltIn.Wait Until Keyword Succeeds
57 ... Genius.Verify Tunnel Monitoring Status
58 ... ${TUNNEL_MONITOR_OFF}
59 CompareStream.Run_Keyword_If_Less_Than_Neon
60 ... BuiltIn.Wait Until Keyword Succeeds
63 ... Genius.Verify Tunnel Monitoring Status
64 ... ${TUNNEL_MONITOR_ON}
65 CompareStream.Run_Keyword_If_At_Least_Neon
66 ... BuiltIn.Wait Until Keyword Succeeds
69 ... Verify Config Ietf Interface Output
70 ... ${INTERFACE_DS_MONI_FALSE}
71 ... ${INTERFACE_DS_MONI_INT_1000}
72 ... ${TUNNEL_MONI_PROTO}
73 CompareStream.Run_Keyword_If_Less_Than_Neon
74 ... BuiltIn.Wait Until Keyword Succeeds
77 ... Verify Config Ietf Interface Output
78 ... ${INTERFACE_DS_MONI_TRUE}
79 ... ${INTERFACE_DS_MONI_INT_1000}
80 ... ${TUNNEL_MONI_PROTO}
82 BFD_TC02 Enable BFD Monitoring And Verify On Controller
83 [Documentation] Enable BFD monitoring in branches greater than neon and verify that BFD is enabled in the controller.
84 CompareStream.Run_Keyword_If_Less_Than_Neon
85 ... BuiltIn.Pass Execution
86 ... Test case valid only for versions Neon and above
87 Enable BFD And Verify ${INTERFACE_DS_MONI_INT_1000}
89 BFD_TC03 Verify that BFD tunnel monitoring interval is set with appropriate default value i.e.,1000
90 [Documentation] This will verify BFD tunnel monitoring default interval
91 ${output} = KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW}
92 ${tunnel_monitoring} = String.Get Lines Containing String ${output} Tunnel Monitoring Interval
93 BuiltIn.Should Be Equal ${tunnel_monitoring} ${DEFAULT_MONITORING_INTERVAL}
94 BuiltIn.Wait Until Keyword Succeeds
97 ... Verify Config Ietf Interface Output
98 ... ${INTERFACE_DS_MONI_TRUE}
99 ... ${INTERFACE_DS_MONI_INT_1000}
100 ... ${TUNNEL_MONI_PROTO}
102 BFD_TC04 Verify that in controller tunnel status is up when ITM tunnel interface is brought up.
103 [Documentation] Verify that in controller tunnel status is up when ITM tunnel interface is brought up.
104 BuiltIn.Wait Until Keyword Succeeds 10s 2s Genius.Verify Tunnel Monitoring Status ${TUNNEL_MONITOR_ON}
105 BuiltIn.Wait Until Keyword Succeeds 10s 1s Genius.Verify Tunnel Status As Up
106 BuiltIn.Wait Until Keyword Succeeds
109 ... Verify Config Ietf Interface Output
110 ... ${INTERFACE_DS_MONI_TRUE}
111 ... ${INTERFACE_DS_MONI_INT_1000}
112 ... ${TUNNEL_MONI_PROTO}
114 BFD_TC05 Verify BFD tunnel monitoring interval can be changed.
115 [Documentation] Verify BFD tunnel monitoring interval can be changed.
116 ${oper_int} = RequestsLibrary.Put Request
118 ... ${CONFIG_API}/itm-config:tunnel-monitor-interval/
119 ... data=${INTERVAL_5000}
120 ${Bfd_updated_value} = BuiltIn.Create List 5000
121 Wait Until Keyword Succeeds
124 ... Utils.Check For Elements At URI
125 ... ${OPERATIONAL_API}/itm-config:tunnel-monitor-interval/
126 ... ${Bfd_updated_value}
127 Wait Until Keyword Succeeds
130 ... Utils.Check For Elements At URI
131 ... ${CONFIG_API}/itm-config:tunnel-monitor-interval/
132 ... ${Bfd_updated_value}
133 Wait Until Keyword Succeeds
136 ... Verify Config Ietf Interface Output
137 ... ${INTERFACE_DS_MONI_TRUE}
138 ... ${INTERFACE_DS_MONI_INT_5000}
139 ... ${TUNNEL_MONI_PROTO}
140 FOR ${tool_system_index} IN RANGE ${NUM_TOOLS_SYSTEM}
141 ${tun_names} = Genius.Get Tunnels On OVS ${TOOLS_SYSTEM_ALL_CONN_IDS[${tool_system_index}]}
142 Verify ovs-vsctl Output For Each Tunnel ${tun_names} ${tool_system_index}
145 BFD_TC06 Verify that the tunnel state goes to UNKNOWN when DPN is disconnected
146 [Documentation] Verify that the tunnel state goes to UNKNOWN when DPN is disconnected
147 ToolsSystem.Run Command On All Tools Systems sudo ovs-vsctl del-controller ${Bridge}
148 BuiltIn.Wait Until Keyword Succeeds 10s 1s VpnOperations.Verify Tunnel Status as UNKNOWN
149 BuiltIn.Wait Until Keyword Succeeds
152 ... Verify Config Ietf Interface Output
153 ... ${INTERFACE_DS_MONI_TRUE}
154 ... ${INTERFACE_DS_MONI_INT_5000}
155 ... ${TUNNEL_MONI_PROTO}
156 ToolsSystem.Run Command On All Tools Systems
157 ... sudo ovs-vsctl set-controller ${Bridge} tcp:${ODL_SYSTEM_IP}:${ODL_OF_PORT}
158 BuiltIn.Wait Until Keyword Succeeds 10s 1s Genius.Verify Tunnel Status As Up
159 BuiltIn.Wait Until Keyword Succeeds
162 ... Verify Config Ietf Interface Output
163 ... ${INTERFACE_DS_MONI_TRUE}
164 ... ${INTERFACE_DS_MONI_INT_5000}
165 ... ${TUNNEL_MONI_PROTO}
167 BFD_TC07 Set BFD monitoring To Default Value
168 [Documentation] Disable BFD monitoring(setting it to default value) and verify that BFD is disabled on the controller.
169 CompareStream.Run_Keyword_If_At_Least_Neon Disable BFD And Verify
170 CompareStream.Run_Keyword_If_Less_Than_Neon Enable BFD And Verify ${INTERFACE_DS_MONI_INT_5000}
174 Verify Config Ietf Interface Output
175 [Documentation] This keyword will get request from config ietf interface and verifies state, interval and proto are present
176 [Arguments] ${state} ${interval} ${proto}
177 ${int_resp} = RequestsLibrary.Get Request session ${CONFIG_API}/ietf-interfaces:interfaces/
178 ${respjson} = RequestsLibrary.To Json ${int_resp.content} pretty_print=True
179 BuiltIn.Should Contain ${respjson} ${state}
180 BuiltIn.Should Contain ${respjson} ${interval}
181 BuiltIn.Should Contain ${respjson} ${proto}
184 [Documentation] This keyword will return the tunnel name on OVS
185 [Arguments] ${tools_ip}
186 ${list_interface} = Utils.Run Command On Remote System ${tools_ip} sudo ovs-vsctl list interface
187 ${tun_line} = ${tun_name} = BuiltIn.Should Match Regexp ${list_interface} name\\s+: "(tun.*)"
188 BuiltIn.Log ${tun_name}
189 BuiltIn.Should Not Be Empty ${tun_name}
192 Verify Tunnel Monitoring Params
193 [Documentation] This keyword will verify the tunnel monitoring is true or false
195 @{checklist} = BuiltIn.Create List ${flag}
196 Utils.Check For Elements At URI ${OPERATIONAL_API}/itm-config:tunnel-monitor-params/ ${checklist}
198 Enable BFD And Verify
199 [Documentation] Enable BFD Monitoring And Verify On Controller.
200 [Arguments] ${interface_ds_moni_int}
201 ${resp} = RequestsLibrary.Put Request
203 ... ${CONFIG_API}/itm-config:tunnel-monitor-params/
204 ... data=${ENABLE_MONITORING}
205 BuiltIn.Should Be Equal As Strings ${resp.status_code} 201
206 BuiltIn.Wait Until Keyword Succeeds 10s 2s Verify Tunnel Monitoring Params ${TUNNEL_MONI_PARAMS_TRUE}
207 BuiltIn.Wait Until Keyword Succeeds 10s 2s Genius.Verify Tunnel Monitoring Status ${TUNNEL_MONITOR_ON}
208 BuiltIn.Wait Until Keyword Succeeds
211 ... Verify Config Ietf Interface Output
212 ... ${INTERFACE_DS_MONI_TRUE}
213 ... ${interface_ds_moni_int}
214 ... ${TUNNEL_MONI_PROTO}
215 BuiltIn.Wait Until Keyword Succeeds 10s 1s Genius.Verify Tunnel Status As Up
217 Disable BFD And Verify
218 [Documentation] Disable BFD Monitoring And Verify On Controller.
219 ${resp} = RequestsLibrary.Put Request
221 ... ${CONFIG_API}/itm-config:tunnel-monitor-params/
222 ... data=${DISABLE_MONITORING}
223 BuiltIn.Should Be Equal As Strings ${resp.status_code} 200
224 BuiltIn.Wait Until Keyword Succeeds 10s 2s Verify Tunnel Monitoring Params ${TUNNEL_MONI_PARAMS_FALSE}
225 BuiltIn.Wait Until Keyword Succeeds 10s 2s Genius.Verify Tunnel Monitoring Status ${TUNNEL_MONITOR_OFF}
226 BuiltIn.Wait Until Keyword Succeeds
229 ... Verify Config Ietf Interface Output
230 ... ${INTERFACE_DS_MONI_FALSE}
231 ... ${INTERFACE_DS_MONI_INT_5000}
232 ... ${TUNNEL_MONI_PROTO}
233 BuiltIn.Wait Until Keyword Succeeds 10s 1s Genius.Verify Tunnel Status As Up
235 Verify ovs-vsctl Output For Each Tunnel
236 [Arguments] ${tun_names} ${tool_system_index}
237 ${no of tunnels} = BuiltIn.Get Length ${tun_names}
238 FOR ${each_tun} IN RANGE ${no of tunnels}
239 ${tun} = Collections.Get From List ${tun_names} ${each_tun}
240 BuiltIn.Wait Until Keyword Succeeds
243 ... OVSDB.Verify Ovs-vsctl Output
244 ... list interface ${tun}
246 ... ovs_system=${TOOLS_SYSTEM_ALL_IPS}[${tool_system_index}]