2 Documentation BGP functional HA testing with one exabgp peer.
4 ... Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
6 ... This program and the accompanying materials are made available under the
7 ... terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ... and is available at http://www.eclipse.org/legal/epl-v10.html
10 ... This suite uses exabgp. It is configured to have 3 peers (all 3 nodes of odl).
11 ... Bgp implemented with singleton accepts only one incomming conection. Exabgp
12 ... logs will show that one peer will be connected and two will fail.
13 ... After isolating karaf which owned connection, new owner should be elected and
14 ... this new owner should accept incomming bgp connection.
15 ... TODO: Add similar keywords from all bgpclustering-ha tests into same libraries
17 Library SSHLibrary timeout=10s
18 Library RequestsLibrary
19 Resource ../../../libraries/BGPcliKeywords.robot
20 Resource ../../../libraries/ClusterManagement.robot
21 Resource ../../../libraries/ExaBgpLib.robot
22 Resource ../../../libraries/SetupUtils.robot
23 Resource ../../../libraries/SSHKeywords.robot
24 Resource ../../../libraries/TemplatedRequests.robot
25 Resource ../../../variables/Variables.robot
27 Suite Setup Setup_Everything
28 Suite Teardown Teardown_Everything
29 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
30 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
34 ${BGP_VAR_FOLDER} ${CURDIR}/../../../variables/bgpclustering
35 ${BGP_PEER_FOLDER} ${CURDIR}/../../../variables/bgpclustering/bgp_peer_openconf
36 ${DEFAULT_EXA_CFG} exa.cfg
37 ${EXA_CMD} env exabgp.tcp.port=1790 exabgp
39 ${RIB_INSTANCE} example-bgp-rib
43 Get_Example_Bgp_Rib_Owner
44 [Documentation] Find an odl node which is able to accept incomming connection.
45 ${rib_owner} ${rib_candidates}= BuiltIn.Wait_Until_Keyword_Succeeds
48 ... ClusterManagement.Get_Owner_And_Successors_For_Device
52 BuiltIn.Set Suite variable ${rib_owner}
53 BuiltIn.Log ${ODL_SYSTEM_${rib_owner}_IP}
54 BuiltIn.Set Suite variable ${rib_candidates}
55 ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${rib_owner}
56 BuiltIn.Set_Suite_Variable ${living_session} ${session}
57 BuiltIn.Set_Suite_Variable ${living_node} ${rib_owner}
59 Reconfigure_ODL_To_Accept_Connection
60 [Documentation] Configure BGP peer module with initiate-connection set to false.
61 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
62 &{mapping}= Create Dictionary
63 ... IP=${TOOLS_SYSTEM_IP}
64 ... HOLDTIME=${HOLDTIME}
65 ... PEER_PORT=${BGP_TOOL_PORT}
67 ... BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
68 TemplatedRequests.Put_As_Xml_Templated
69 ... ${BGP_PEER_FOLDER}
70 ... mapping=${mapping}
71 ... session=${living_session}
73 [Teardown] SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
76 [Documentation] Starts exabgp
77 SSHKeywords.Virtual_Env_Activate_On_Current_Session log_output=${True}
78 BGPcliKeywords.Start_Console_Tool ${EXA_CMD} ${DEFAULT_EXA_CFG} > exa_ha_isolation.log 2>&1
80 Verify_ExaBgp_Connected
81 [Documentation] Verifies exabgp's presence in operational ds.
82 BuiltIn.Wait_Until_Keyword_Succeeds 5x 5s ExaBgpLib.Verify_ExaBgps_Connection ${living_session}
84 Isolate_Current_Owner_Member
85 [Documentation] Isolating cluster node which is connected with exabgp.
86 ClusterManagement.Isolate_Member_From_List_Or_All ${rib_owner}
87 BuiltIn.Set Suite variable ${old_rib_owner} ${rib_owner}
88 BuiltIn.Set Suite variable ${old_rib_candidates} ${rib_candidates}
89 ${idx}= Collections.Get From List ${old_rib_candidates} 0
90 ${session}= Resolve_Http_Session_For_Member member_index=${idx}
91 BuiltIn.Set_Suite_Variable ${living_session} ${session}
92 BuiltIn.Set_Suite_Variable ${living_node} ${idx}
95 [Documentation] Verifies if new owner of example-bgp-rib is elected.
96 BuiltIn.Wait_Until_Keyword_Succeeds
99 ... Verify_New_Rib_Owner_Elected
103 Verify_ExaBgp_Reconnected
104 [Documentation] Verifies exabgp's presence in operational ds.
105 BuiltIn.Wait_Until_Keyword_Succeeds 5x 5s ExaBgpLib.Verify_ExaBgps_Connection ${living_session}
107 Rejoin_Isolated_Member
108 [Documentation] Rejoin isolated node
109 ClusterManagement.Rejoin_Member_From_List_Or_All ${old_rib_owner}
112 [Documentation] Verifies started node become candidate for example-bgp-rib
113 BuiltIn.Wait_Until_Keyword_Succeeds
116 ... Verify_New_Rib_Candidate_Present
120 Verify_ExaBgp_Still_Connected
121 [Documentation] Verifies exabgp's presence in operational ds
122 BuiltIn.Wait_Until_Keyword_Succeeds 5x 5s ExaBgpLib.Verify_ExaBgps_Connection ${living_session}
125 [Documentation] Stops exabgp tool by sending ctrl+c
126 BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt
127 BGPcliKeywords.Store_File_To_Workspace exa_ha_isolation.log exa_ha_isolation.log
128 SSHKeywords.Virtual_Env_Deactivate_On_Current_Session log_output=${True}
130 Delete_Bgp_Peer_Configuration
131 [Documentation] Revert the BGP configuration to the original state: without any configured peers
132 &{mapping}= Create Dictionary BGP_RIB_OPENCONFIG=${RIB_INSTANCE} IP=${TOOLS_SYSTEM_IP}
133 TemplatedRequests.Delete_Templated
134 ... ${BGP_PEER_FOLDER}
135 ... mapping=${mapping}
136 ... session=${living_session}
142 [Documentation] Initial setup
143 SetupUtils.Setup_Utils_For_Setup_And_Teardown
144 ClusterManagement.ClusterManagement_Setup
145 ${tools_system_conn_id}= SSHLibrary.Open_Connection
146 ... ${TOOLS_SYSTEM_IP}
147 ... prompt=${DEFAULT_LINUX_PROMPT}
149 Builtin.Set_Suite_Variable ${tools_system_conn_id}
150 SSHKeywords.Flexible_Mininet_Login ${TOOLS_SYSTEM_USER}
151 SSHKeywords.Virtual_Env_Create
152 SSHKeywords.Virtual_Env_Install_Package exabgp==3.4.16
153 ExaBgpLib.Upload_ExaBgp_Cluster_Config_Files ${BGP_VAR_FOLDER} ${DEFAULT_EXA_CFG}
156 [Documentation] Suite cleanup
157 SSHKeywords.Virtual_Env_Delete
158 RequestsLibrary.Delete_All_Sessions
159 SSHLibrary.Close_All_Connections
161 Verify_New_Rib_Owner_Elected
162 [Documentation] Verifies new owner was elected
163 [Arguments] ${old_owner} ${node_to_ask}
164 ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device
168 BuiltIn.Should_Not_Be_Equal ${old_owner} ${owner}
170 Verify_New_Rib_Candidate_Present
171 [Documentation] Verifies candidate's presence.
172 [Arguments] ${candidate} ${node_to_ask}
173 ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device
177 BuiltIn.Should_Contain ${candidates} ${candidate}