2 Documentation Test Suite for BFD tunnel monitoring
3 Suite Setup Genius Suite Setup
4 Suite Teardown BFD Suite Teardown
5 Test Setup Genius Test Setup
6 Test Teardown Genius Test Teardown ${data_models}
7 Library OperatingSystem
9 Library RequestsLibrary
12 Resource ../../libraries/DataModels.robot
13 Resource ../../libraries/Genius.robot
14 Resource ../../libraries/KarafKeywords.robot
15 Resource ../../libraries/OVSDB.robot
16 Resource ../../libraries/ToolsSystem.robot
17 Resource ../../libraries/Utils.robot
18 Resource ../../libraries/VpnOperations.robot
19 Resource ../../variables/netvirt/Variables.robot
20 Resource ../../variables/Variables.robot
21 Resource ../../libraries/CompareStream.robot
22 Variables ../../variables/genius/Modules.py
25 ${TUNNEL_MONITOR_ON} Tunnel Monitoring (for VXLAN tunnels): On
26 ${DEFAULT_MONITORING_INTERVAL} Tunnel Monitoring Interval (for VXLAN tunnels): 1000
27 ${TUNNEL_MONITOR_OFF} Tunnel Monitoring (for VXLAN tunnels): Off
28 ${INTERVAL_5000} {"tunnel-monitor-interval":{"interval":5000}}
29 ${ENABLE_MONITORING} {"tunnel-monitor-params":{"enabled":true,"monitor-protocol":"odl-interface:tunnel-monitoring-type-bfd"}}
30 ${DISABLE_MONITORING} {"tunnel-monitor-params":{"enabled":"false","monitor-protocol":"odl-interface:tunnel-monitoring-type-bfd"}}
31 ${TUNNEL_MONI_PARAMS_TRUE} true
32 ${TUNNEL_MONI_PARAMS_FALSE} false
33 ${INTERFACE_DS_MONI_FALSE} "odl-interface:monitor-enabled": false
34 ${INTERFACE_DS_MONI_TRUE} "odl-interface:monitor-enabled": true
35 ${INTERFACE_DS_MONI_INT_1000} "odl-interface:monitor-interval": 1000
36 ${INTERFACE_DS_MONI_INT_5000} "odl-interface:monitor-interval": 5000
37 ${TUNNEL_MONI_PROTO} tunnel-monitoring-type-bfd
40 BFD_TC00 Create ITM between DPNs
41 [Documentation] Create ITM between DPNs
42 Genius.Create Vteps ${NO_VLAN} ${gateway_ip}
43 BuiltIn.Wait Until Keyword Succeeds 30s 5s Genius.Verify Tunnel Status As Up
45 BFD_TC01 Verify default BFD monitoring status on Controller
46 [Documentation] Verify the default value of BFD monitoring \ on the Controller
47 CompareStream.Run_Keyword_If_At_Least_Neon BuiltIn.Wait Until Keyword Succeeds 10s 2s Genius.Verify Tunnel Monitoring Status ${TUNNEL_MONITOR_OFF}
48 CompareStream.Run_Keyword_If_Less_Than_Neon BuiltIn.Wait Until Keyword Succeeds 10s 2s Genius.Verify Tunnel Monitoring Status ${TUNNEL_MONITOR_ON}
49 CompareStream.Run_Keyword_If_At_Least_Neon BuiltIn.Wait Until Keyword Succeeds 10s 2s Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_FALSE} ${INTERFACE_DS_MONI_INT_1000}
50 ... ${TUNNEL_MONI_PROTO}
51 CompareStream.Run_Keyword_If_Less_Than_Neon BuiltIn.Wait Until Keyword Succeeds 10s 2s Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_TRUE} ${INTERFACE_DS_MONI_INT_1000}
52 ... ${TUNNEL_MONI_PROTO}
54 BFD_TC02 Enable BFD Monitoring And Verify On Controller
55 [Documentation] Enable BFD monitoring in branches greater than neon and verify that BFD is enabled in the controller.
56 CompareStream.Run_Keyword_If_Less_Than_Neon BuiltIn.Pass Execution Test case valid only for versions Neon and above
57 Enable BFD And Verify ${INTERFACE_DS_MONI_INT_1000}
59 BFD_TC03 Verify that BFD tunnel monitoring interval is set with appropriate default value i.e.,1000
60 [Documentation] This will verify BFD tunnel monitoring default interval
61 ${output} = KarafKeywords.Issue Command On Karaf Console ${TEP_SHOW}
62 ${tunnel_monitoring} = String.Get Lines Containing String ${output} Tunnel Monitoring Interval
63 BuiltIn.Should Be Equal ${tunnel_monitoring} ${DEFAULT_MONITORING_INTERVAL}
64 BuiltIn.Wait Until Keyword Succeeds 10s 2s Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_TRUE} ${INTERFACE_DS_MONI_INT_1000} ${TUNNEL_MONI_PROTO}
66 BFD_TC04 Verify that in controller tunnel status is up when ITM tunnel interface is brought up.
67 [Documentation] Verify that in controller tunnel status is up when ITM tunnel interface is brought up.
68 BuiltIn.Wait Until Keyword Succeeds 10s 2s Genius.Verify Tunnel Monitoring Status ${TUNNEL_MONITOR_ON}
69 BuiltIn.Wait Until Keyword Succeeds 10s 1s Genius.Verify Tunnel Status As Up
70 BuiltIn.Wait Until Keyword Succeeds 10s 2s Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_TRUE} ${INTERFACE_DS_MONI_INT_1000} ${TUNNEL_MONI_PROTO}
72 BFD_TC05 Verify BFD tunnel monitoring interval can be changed.
73 [Documentation] Verify BFD tunnel monitoring interval can be changed.
74 ${oper_int} = RequestsLibrary.Put Request session ${CONFIG_API}/itm-config:tunnel-monitor-interval/ data=${INTERVAL_5000}
75 ${Bfd_updated_value}= BuiltIn.Create List 5000
76 Wait Until Keyword Succeeds 30s 10s Utils.Check For Elements At URI ${OPERATIONAL_API}/itm-config:tunnel-monitor-interval/ ${Bfd_updated_value}
77 Wait Until Keyword Succeeds 30s 10s Utils.Check For Elements At URI ${CONFIG_API}/itm-config:tunnel-monitor-interval/ ${Bfd_updated_value}
78 Wait Until Keyword Succeeds 10s 2s Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_TRUE} ${INTERFACE_DS_MONI_INT_5000} ${TUNNEL_MONI_PROTO}
79 : FOR ${tool_system_index} IN RANGE ${NUM_TOOLS_SYSTEM}
80 \ ${tun_names} Genius.Get Tunnels On OVS ${TOOLS_SYSTEM_ALL_CONN_IDS[${tool_system_index}]}
81 \ Verify ovs-vsctl Output For Each Tunnel ${tun_names} ${tool_system_index}
83 BFD_TC06 Verify that the tunnel state goes to UNKNOWN when DPN is disconnected
84 [Documentation] Verify that the tunnel state goes to UNKNOWN when DPN is disconnected
85 ToolsSystem.Run Command On All Tools Systems sudo ovs-vsctl del-controller ${Bridge}
86 BuiltIn.Wait Until Keyword Succeeds 10s 1s VpnOperations.Verify Tunnel Status as UNKNOWN
87 BuiltIn.Wait Until Keyword Succeeds 10s 2s Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_TRUE} ${INTERFACE_DS_MONI_INT_5000} ${TUNNEL_MONI_PROTO}
88 ToolsSystem.Run Command On All Tools Systems sudo ovs-vsctl set-controller ${Bridge} tcp:${ODL_SYSTEM_IP}:${ODL_OF_PORT}
89 BuiltIn.Wait Until Keyword Succeeds 10s 1s Genius.Verify Tunnel Status As Up
90 BuiltIn.Wait Until Keyword Succeeds 10s 2s Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_TRUE} ${INTERFACE_DS_MONI_INT_5000} ${TUNNEL_MONI_PROTO}
92 BFD_TC07 Set BFD monitoring To Default Value
93 [Documentation] Disable BFD monitoring(setting it to default value) and verify that BFD is disabled on the controller.
94 CompareStream.Run_Keyword_If_At_Least_Neon Disable BFD And Verify
95 CompareStream.Run_Keyword_If_Less_Than_Neon Enable BFD And Verify ${INTERFACE_DS_MONI_INT_5000}
98 Verify Config Ietf Interface Output
99 [Arguments] ${state} ${interval} ${proto}
100 [Documentation] This keyword will get request from config ietf interface and verifies state, interval and proto are present
101 ${int_resp} = RequestsLibrary.Get Request session ${CONFIG_API}/ietf-interfaces:interfaces/
102 ${respjson} = RequestsLibrary.To Json ${int_resp.content} pretty_print=True
103 BuiltIn.Should Contain ${respjson} ${state}
104 BuiltIn.Should Contain ${respjson} ${interval}
105 BuiltIn.Should Contain ${respjson} ${proto}
108 [Arguments] ${tools_ip}
109 [Documentation] This keyword will return the tunnel name on OVS
110 ${list_interface} = Utils.Run Command On Remote System ${tools_ip} sudo ovs-vsctl list interface
111 ${tun_line} = ${tun_name} BuiltIn.Should Match Regexp ${list_interface} name\\s+: "(tun.*)"
112 BuiltIn.Log ${tun_name}
113 BuiltIn.Should Not Be Empty ${tun_name}
116 Verify Tunnel Monitoring Params
118 [Documentation] This keyword will verify the tunnel monitoring is true or false
119 @{checklist} BuiltIn.Create List ${flag}
120 Utils.Check For Elements At URI ${OPERATIONAL_API}/itm-config:tunnel-monitor-params/ ${checklist}
122 Enable BFD And Verify
123 [Arguments] ${interface_ds_moni_int}
124 [Documentation] Enable BFD Monitoring And Verify On Controller.
125 ${resp} = RequestsLibrary.Put Request session ${CONFIG_API}/itm-config:tunnel-monitor-params/ data=${ENABLE_MONITORING}
126 BuiltIn.Should Be Equal As Strings ${resp.status_code} 201
127 BuiltIn.Wait Until Keyword Succeeds 10s 2s Verify Tunnel Monitoring Params ${TUNNEL_MONI_PARAMS_TRUE}
128 BuiltIn.Wait Until Keyword Succeeds 10s 2s Genius.Verify Tunnel Monitoring Status ${TUNNEL_MONITOR_ON}
129 BuiltIn.Wait Until Keyword Succeeds 10s 2s Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_TRUE} ${interface_ds_moni_int} ${TUNNEL_MONI_PROTO}
130 BuiltIn.Wait Until Keyword Succeeds 10s 1s Genius.Verify Tunnel Status As Up
132 Disable BFD And Verify
133 [Documentation] Disable BFD Monitoring And Verify On Controller.
134 ${resp} = RequestsLibrary.Put Request session ${CONFIG_API}/itm-config:tunnel-monitor-params/ data=${DISABLE_MONITORING}
135 BuiltIn.Should Be Equal As Strings ${resp.status_code} 200
136 BuiltIn.Wait Until Keyword Succeeds 10s 2s Verify Tunnel Monitoring Params ${TUNNEL_MONI_PARAMS_FALSE}
137 BuiltIn.Wait Until Keyword Succeeds 10s 2s Genius.Verify Tunnel Monitoring Status ${TUNNEL_MONITOR_OFF}
138 BuiltIn.Wait Until Keyword Succeeds 10s 2s Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_FALSE} ${INTERFACE_DS_MONI_INT_5000} ${TUNNEL_MONI_PROTO}
139 BuiltIn.Wait Until Keyword Succeeds 10s 1s Genius.Verify Tunnel Status As Up
141 Verify ovs-vsctl Output For Each Tunnel
142 [Arguments] ${tun_names} ${tool_system_index}
143 ${no of tunnels} = BuiltIn.Get Length ${tun_names}
144 : FOR ${each_tun} IN RANGE ${no of tunnels}
145 \ ${tun} Collections.Get From List ${tun_names} ${each_tun}
146 \ BuiltIn.Wait Until Keyword Succeeds 20 5 OVSDB.Verify Ovs-vsctl Output list interface ${tun} 5000
147 \ ... ovs_system=@{TOOLS_SYSTEM_ALL_IPS}[${tool_system_index}]