2 Documentation Test Suite for BFD tunnel monitoring
3 Suite Setup Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
4 Suite Teardown Genius.Delete All Sessions
5 Test Teardown Get Model Dump ${ODL_SYSTEM_IP} ${data_models}
6 Library OperatingSystem
8 Library RequestsLibrary
12 Resource ../../variables/Variables.robot
13 Variables ../../variables/genius/Modules.py
14 Resource ../../libraries/Genius.robot
15 Resource ../../libraries/DataModels.robot
16 Resource ../../libraries/Utils.robot
17 Resource ../../libraries/VpnOperations.robot
18 Resource ../../libraries/KarafKeywords.robot
19 Resource ../../libraries/OVSDB.robot
23 ${genius_config_dir} ${CURDIR}/../../variables/genius
27 ${TEP_SHOW_STATE} tep:show-state
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 ${ENABLE_MONITORING} {"tunnel-monitor-params":{"enabled":true,"monitor-protocol":"odl-interface:tunnel-monitoring-type-bfd"}}
34 ${DISABLE_MONITORING} {"tunnel-monitor-params":{"enabled":"false","monitor-protocol":"odl-interface:tunnel-monitoring-type-bfd"}}
35 ${INTERFACE_DS_MONI_FALSE} "odl-interface:monitor-enabled": false
36 ${INTERFACE_DS_MONI_TRUE} "odl-interface:monitor-enabled": true
37 ${INTERFACE_DS_MONI_INT_1000} "odl-interface:monitor-interval": 1000
38 ${INTERFACE_DS_MONI_INT_5000} "odl-interface:monitor-interval": 5000
39 ${TUNNEL_MONI_PROTO} tunnel-monitoring-type-bfd
42 BFD_TC00 Create ITM between DPNs Verify_BFD_Enablement
43 [Documentation] Create ITM between DPNs Verify_BFD_Enablement
44 ${Dpn_id_1} Get Dpn Ids ${conn_id_1}
45 ${Dpn_id_2} Get Dpn Ids ${conn_id_2}
46 Set Global Variable ${Dpn_id_1}
47 Set Global Variable ${Dpn_id_2}
48 ${vlan}= Set Variable 0
49 ${gateway-ip}= Set Variable 0.0.0.0
50 Create Vteps ${TOOLS_SYSTEM_IP} ${TOOLS_SYSTEM_2_IP} ${vlan} ${gateway-ip}
51 Wait Until Keyword Succeeds 10s 2s Verify Tunnel Status as UP
53 BFD_TC01 Verify by default BFD monitoring is enabled on Controller
54 [Documentation] Verify by default BFD monitoring is enabled on Controller
55 Verify Tunnel Monitoring Is On
56 Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_TRUE} ${INTERFACE_DS_MONI_INT_1000} ${TUNNEL_MONI_PROTO}
58 BFD_TC02 Verify that BFD tunnel monitoring interval is set with appropriate default value i.e.,1000
59 [Documentation] This will verify BFD tunnel monitoring default interval
60 ${output}= Issue Command On Karaf Console ${TEP_SHOW}
62 Should Contain ${output} ${DEFAULT_MONITORING_INTERVAL}
63 Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_TRUE} ${INTERFACE_DS_MONI_INT_1000} ${TUNNEL_MONI_PROTO}
65 BFD_TC04 Verify that in controller tunnel status is up when ITM tunnel interface is brought up.
66 [Documentation] Verify that in controller tunnel status is up when ITM tunnel interface is brought up.
67 Verify Tunnel Monitoring Is On
68 Wait Until Keyword Succeeds 10s 1s Verify Tunnel Status as UP
69 Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_TRUE} ${INTERFACE_DS_MONI_INT_1000} ${TUNNEL_MONI_PROTO}
71 BFD_TC05 Verify BFD tunnel monitoring interval can be changed.
72 [Documentation] Verify BFD tunnel monitoring interval can be changed.
73 Log "Value of BFD monitoring interval before updating with new value"
74 ${oper_int} RequestsLibrary.Get Request session ${OPERATIONAL_API}/itm-config:tunnel-monitor-interval/
75 ${respjson} RequestsLibrary.To Json ${oper_int.content} pretty_print=True
77 Log "Value of BFD monitoring interval is getting updated"
78 ${oper_int} RequestsLibrary.Put Request session ${CONFIG_API}/itm-config:tunnel-monitor-interval/ data=${INTERVAL_5000}
79 ${Bfd_updated_value}= Create List 5000
80 Wait Until Keyword Succeeds 30s 10s Check For Elements At Uri ${OPERATIONAL_API}/itm-config:tunnel-monitor-interval/ ${Bfd_updated_value}
81 Wait Until Keyword Succeeds 30s 10s Check For Elements At Uri ${CONFIG_API}/itm-config:tunnel-monitor-interval/ ${Bfd_updated_value}
82 Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_TRUE} ${INTERFACE_DS_MONI_INT_5000} ${TUNNEL_MONI_PROTO}
83 SSHLibrary.Switch Connection ${conn_id_1}
84 Execute Command sudo ovs-vsctl del-port ${Bridge-1} tap8ed70586-6c
85 ${ovs_1} Execute Command sudo ovs-vsctl show
87 ${tun_name} Wait Until Keyword Succeeds 20 5 Ovs Tunnel Get ${Bridge-1}
88 Wait Until Keyword Succeeds 20s 5 OVSDB.Verify Ovs-vsctl Output list interface ${tun_name} 5000 ovs_system=${TOOLS_SYSTEM_IP}
89 SSHLibrary.Switch Connection ${conn_id_2}
90 ${ovs_2} Execute Command sudo ovs-vsctl show
91 ${tun_name} Wait Until Keyword Succeeds 20 5 Ovs Tunnel Get ${Bridge-2}
92 Wait Until Keyword Succeeds 20s 5 OVSDB.Verify Ovs-vsctl Output list interface ${tun_name} 5000 ovs_system=${TOOLS_SYSTEM_2_IP}
94 BFD_TC06 Verify that the tunnel state goes to UNKNOWN when DPN is disconnected
95 [Documentation] Verify that the tunnel state goes to UNKNOWN when DPN is disconnected
96 ${output}= Issue Command On Karaf Console ${TEP_SHOW}
98 ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE}
100 SSHLibrary.Switch Connection ${conn_id_1}
101 Execute Command sudo ovs-vsctl del-controller BR1
102 SSHLibrary.Switch Connection ${conn_id_2}
103 Execute Command sudo ovs-vsctl del-controller BR2
104 ${output}= Issue Command On Karaf Console ${TEP_SHOW}
106 ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE}
108 Wait Until Keyword Succeeds 10s 1s Verify Tunnel Status as UNKNOWN
109 Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_TRUE} ${INTERFACE_DS_MONI_INT_5000} ${TUNNEL_MONI_PROTO}
110 SSHLibrary.Switch Connection ${conn_id_1}
111 Execute Command sudo ovs-vsctl set-controller BR1 tcp:${ODL_SYSTEM_IP}:${ODL_OF_PORT}
112 SSHLibrary.Switch Connection ${conn_id_2}
113 Execute Command sudo ovs-vsctl set-controller BR2 tcp:${ODL_SYSTEM_IP}:${ODL_OF_PORT}
114 Log "After connecting CSS with controller"
115 ${output}= Issue Command On Karaf Console ${TEP_SHOW}
117 ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE}
119 Wait Until Keyword Succeeds 10s 1s Verify Tunnel Status as UP
120 Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_TRUE} ${INTERFACE_DS_MONI_INT_5000} ${TUNNEL_MONI_PROTO}
122 BFD_TC07 Verify that BFD monitoring is disabled on Controller
123 [Documentation] Verify that BFD monitoring is disabled on Controller
124 ${resp} RequestsLibrary.Put Request session ${CONFIG_API}/itm-config:tunnel-monitor-params/ data=${DISABLE_MONITORING}
125 Should Be Equal As Strings ${resp.status_code} 201
126 ${oper} RequestsLibrary.Get Request session ${OPERATIONAL_API}/itm-config:tunnel-monitor-params/
128 ${respjson} RequestsLibrary.To Json ${oper.content} pretty_print=True
130 Should Contain ${respjson} false
131 ${output}= Issue Command On Karaf Console ${TEP_SHOW}
133 Should Contain ${output} ${TUNNEL_MONITOR_OFF}
134 Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_FALSE} ${INTERFACE_DS_MONI_INT_5000} ${TUNNEL_MONI_PROTO}
135 Log "Verifying tunnel is UP after BFD is disabled"
136 Wait Until Keyword Succeeds 10s 1s Verify Tunnel Status as UP
137 Log "Enabling tunnel monitoring once again"
138 ${resp} RequestsLibrary.Put Request session ${CONFIG_API}/itm-config:tunnel-monitor-params/ data=${ENABLE_MONITORING}
139 Should Be Equal As Strings ${resp.status_code} 200
140 ${oper} RequestsLibrary.Get Request session ${OPERATIONAL_API}/itm-config:tunnel-monitor-params/
142 ${respjson} RequestsLibrary.To Json ${oper.content} pretty_print=True
144 Should Contain ${respjson} true
145 Verify Tunnel Monitoring Is On
146 Verify Config Ietf Interface Output ${INTERFACE_DS_MONI_TRUE} ${INTERFACE_DS_MONI_INT_5000} ${TUNNEL_MONI_PROTO}
149 Verify Config Ietf Interface Output
150 [Arguments] ${state} ${interval} ${proto}
151 ${int_resp} RequestsLibrary.Get Request session ${CONFIG_API}/ietf-interfaces:interfaces/
152 ${respjson} RequestsLibrary.To Json ${int_resp.content} pretty_print=True
154 Should Contain ${respjson} ${state}
155 Should Contain ${respjson} ${interval}
156 Should Contain ${respjson} ${proto}
158 Verify Tunnel Monitoring Is On
159 [Documentation] This keyword will get tep:show output and verify tunnel monitoring status
160 ${output}= Issue Command On Karaf Console ${TEP_SHOW}
162 Should Contain ${output} ${TUNNEL_MONITOR_ON}
165 [Arguments] ${bridge}
166 log sudo ovs-vsctl list-ports ${bridge}
167 ${tun_name} Execute Command sudo ovs-vsctl list-ports ${bridge}
169 Should Not Be Empty ${tun_name}