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 BuiltIn.Wait Until Keyword Succeeds
56 ... Genius.Verify Tunnel Monitoring Status
57 ... ${TUNNEL_MONITOR_OFF}
58 BuiltIn.Wait Until Keyword Succeeds
61 ... Verify Config Ietf Interface Output
62 ... ${INTERFACE_DS_MONI_FALSE}
63 ... ${INTERFACE_DS_MONI_INT_1000}
64 ... ${TUNNEL_MONI_PROTO}
66 BFD_TC02 Enable BFD Monitoring And Verify On Controller
67 [Documentation] Enable BFD monitoring in branches greater than neon and verify that BFD is enabled in the controller.
68 Enable BFD And Verify ${INTERFACE_DS_MONI_INT_1000}
70 BFD_TC03 Verify that BFD tunnel monitoring interval is set with appropriate default value i.e.,1000
71 [Documentation] This will verify BFD tunnel monitoring default interval
72 ${output} = KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW}
73 ${tunnel_monitoring} = String.Get Lines Containing String ${output} Tunnel Monitoring Interval
74 BuiltIn.Should Be Equal ${tunnel_monitoring} ${DEFAULT_MONITORING_INTERVAL}
75 BuiltIn.Wait Until Keyword Succeeds
78 ... Verify Config Ietf Interface Output
79 ... ${INTERFACE_DS_MONI_TRUE}
80 ... ${INTERFACE_DS_MONI_INT_1000}
81 ... ${TUNNEL_MONI_PROTO}
83 BFD_TC04 Verify that in controller tunnel status is up when ITM tunnel interface is brought up.
84 [Documentation] Verify that in controller tunnel status is up when ITM tunnel interface is brought up.
85 BuiltIn.Wait Until Keyword Succeeds 10s 2s Genius.Verify Tunnel Monitoring Status ${TUNNEL_MONITOR_ON}
86 BuiltIn.Wait Until Keyword Succeeds 10s 1s Genius.Verify Tunnel Status As Up
87 BuiltIn.Wait Until Keyword Succeeds
90 ... Verify Config Ietf Interface Output
91 ... ${INTERFACE_DS_MONI_TRUE}
92 ... ${INTERFACE_DS_MONI_INT_1000}
93 ... ${TUNNEL_MONI_PROTO}
95 BFD_TC05 Verify BFD tunnel monitoring interval can be changed.
96 [Documentation] Verify BFD tunnel monitoring interval can be changed.
97 ${oper_int} = RequestsLibrary.Put Request
99 ... ${CONFIG_API}/itm-config:tunnel-monitor-interval/
100 ... data=${INTERVAL_5000}
101 ${Bfd_updated_value} = BuiltIn.Create List 5000
102 Wait Until Keyword Succeeds
105 ... Utils.Check For Elements At URI
106 ... ${OPERATIONAL_API}/itm-config:tunnel-monitor-interval/
107 ... ${Bfd_updated_value}
108 Wait Until Keyword Succeeds
111 ... Utils.Check For Elements At URI
112 ... ${CONFIG_API}/itm-config:tunnel-monitor-interval/
113 ... ${Bfd_updated_value}
114 Wait Until Keyword Succeeds
117 ... Verify Config Ietf Interface Output
118 ... ${INTERFACE_DS_MONI_TRUE}
119 ... ${INTERFACE_DS_MONI_INT_5000}
120 ... ${TUNNEL_MONI_PROTO}
121 FOR ${tool_system_index} IN RANGE ${NUM_TOOLS_SYSTEM}
122 ${tun_names} = Genius.Get Tunnels On OVS ${TOOLS_SYSTEM_ALL_CONN_IDS[${tool_system_index}]}
123 Verify ovs-vsctl Output For Each Tunnel ${tun_names} ${tool_system_index}
126 BFD_TC06 Verify that the tunnel state goes to UNKNOWN when DPN is disconnected
127 [Documentation] Verify that the tunnel state goes to UNKNOWN when DPN is disconnected
128 ToolsSystem.Run Command On All Tools Systems sudo ovs-vsctl del-controller ${Bridge}
129 BuiltIn.Wait Until Keyword Succeeds 10s 1s VpnOperations.Verify Tunnel Status as UNKNOWN
130 BuiltIn.Wait Until Keyword Succeeds
133 ... Verify Config Ietf Interface Output
134 ... ${INTERFACE_DS_MONI_TRUE}
135 ... ${INTERFACE_DS_MONI_INT_5000}
136 ... ${TUNNEL_MONI_PROTO}
137 ToolsSystem.Run Command On All Tools Systems
138 ... sudo ovs-vsctl set-controller ${Bridge} tcp:${ODL_SYSTEM_IP}:${ODL_OF_PORT}
139 BuiltIn.Wait Until Keyword Succeeds 10s 1s Genius.Verify Tunnel Status As Up
140 BuiltIn.Wait Until Keyword Succeeds
143 ... Verify Config Ietf Interface Output
144 ... ${INTERFACE_DS_MONI_TRUE}
145 ... ${INTERFACE_DS_MONI_INT_5000}
146 ... ${TUNNEL_MONI_PROTO}
148 BFD_TC07 Set BFD monitoring To Default Value
149 [Documentation] Disable BFD monitoring(setting it to default value) and verify that BFD is disabled on the controller.
150 Disable BFD And Verify
154 Verify Config Ietf Interface Output
155 [Documentation] This keyword will get request from config ietf interface and verifies state, interval and proto are present
156 [Arguments] ${state} ${interval} ${proto}
157 ${int_resp} = RequestsLibrary.Get Request session ${CONFIG_API}/ietf-interfaces:interfaces/
158 ${respjson} = RequestsLibrary.To Json ${int_resp.content} pretty_print=True
159 BuiltIn.Should Contain ${respjson} ${state}
160 BuiltIn.Should Contain ${respjson} ${interval}
161 BuiltIn.Should Contain ${respjson} ${proto}
164 [Documentation] This keyword will return the tunnel name on OVS
165 [Arguments] ${tools_ip}
166 ${list_interface} = Utils.Run Command On Remote System ${tools_ip} sudo ovs-vsctl list interface
167 ${tun_line} = ${tun_name} = BuiltIn.Should Match Regexp ${list_interface} name\\s+: "(tun.*)"
168 BuiltIn.Log ${tun_name}
169 BuiltIn.Should Not Be Empty ${tun_name}
172 Verify Tunnel Monitoring Params
173 [Documentation] This keyword will verify the tunnel monitoring is true or false
175 @{checklist} = BuiltIn.Create List ${flag}
176 Utils.Check For Elements At URI ${OPERATIONAL_API}/itm-config:tunnel-monitor-params/ ${checklist}
178 Enable BFD And Verify
179 [Documentation] Enable BFD Monitoring And Verify On Controller.
180 [Arguments] ${interface_ds_moni_int}
181 ${resp} = RequestsLibrary.Put Request
183 ... ${CONFIG_API}/itm-config:tunnel-monitor-params/
184 ... data=${ENABLE_MONITORING}
185 BuiltIn.Should Be Equal As Strings ${resp.status_code} 201
186 BuiltIn.Wait Until Keyword Succeeds 10s 2s Verify Tunnel Monitoring Params ${TUNNEL_MONI_PARAMS_TRUE}
187 BuiltIn.Wait Until Keyword Succeeds 10s 2s Genius.Verify Tunnel Monitoring Status ${TUNNEL_MONITOR_ON}
188 BuiltIn.Wait Until Keyword Succeeds
191 ... Verify Config Ietf Interface Output
192 ... ${INTERFACE_DS_MONI_TRUE}
193 ... ${interface_ds_moni_int}
194 ... ${TUNNEL_MONI_PROTO}
195 BuiltIn.Wait Until Keyword Succeeds 10s 1s Genius.Verify Tunnel Status As Up
197 Disable BFD And Verify
198 [Documentation] Disable BFD Monitoring And Verify On Controller.
199 ${resp} = RequestsLibrary.Put Request
201 ... ${CONFIG_API}/itm-config:tunnel-monitor-params/
202 ... data=${DISABLE_MONITORING}
203 BuiltIn.Should Be Equal As Strings ${resp.status_code} 200
204 BuiltIn.Wait Until Keyword Succeeds 10s 2s Verify Tunnel Monitoring Params ${TUNNEL_MONI_PARAMS_FALSE}
205 BuiltIn.Wait Until Keyword Succeeds 10s 2s Genius.Verify Tunnel Monitoring Status ${TUNNEL_MONITOR_OFF}
206 BuiltIn.Wait Until Keyword Succeeds
209 ... Verify Config Ietf Interface Output
210 ... ${INTERFACE_DS_MONI_FALSE}
211 ... ${INTERFACE_DS_MONI_INT_5000}
212 ... ${TUNNEL_MONI_PROTO}
213 BuiltIn.Wait Until Keyword Succeeds 10s 1s Genius.Verify Tunnel Status As Up
215 Verify ovs-vsctl Output For Each Tunnel
216 [Arguments] ${tun_names} ${tool_system_index}
217 ${no of tunnels} = BuiltIn.Get Length ${tun_names}
218 FOR ${each_tun} IN RANGE ${no of tunnels}
219 ${tun} = Collections.Get From List ${tun_names} ${each_tun}
220 BuiltIn.Wait Until Keyword Succeeds
223 ... OVSDB.Verify Ovs-vsctl Output
224 ... list interface ${tun}
226 ... ovs_system=${TOOLS_SYSTEM_ALL_IPS}[${tool_system_index}]