2 Documentation BMP functional HA testing with one BMP mock.
4 ... Copyright (c) 2017 AT&T Intellectual Property. 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 BMP mock. It is configured to have 3 peers (all 3 nodes of odl).
11 ... BMP implemented with singleton accepts only one incomming conection. BMP mock
12 ... logs will show that one peer will be connected and two will fail.
13 ... After stopping karaf which owned connection new owner should be elected and
14 ... this new owner should accept incomming BMP connection.
15 ... TODO: Add similar keywords from all bgpclustering-ha tests into same libraries
17 Library SSHLibrary timeout=10s
19 Library OperatingSystem
20 Resource ../../../libraries/BGPcliKeywords.robot
21 Resource ../../../libraries/BgpOperations.robot
22 Resource ../../../libraries/ClusterManagement.robot
23 Resource ../../../libraries/NexusKeywords.robot
24 Resource ../../../libraries/SetupUtils.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
35 ${BMP_LOG_FILE} bmpmock.stop.log
36 ${CONFIG_SESSION} session
41 [Documentation] Find an odl node which is able to accept incomming connection.
42 ${bm_owner} ${bm_candidates}= Wait_Until_Keyword_Succeeds
45 ... ClusterManagement.Get_Owner_And_Successors_For_Device
49 BuiltIn.Set Suite variable ${bm_owner}
50 BuiltIn.Log ${bm_owner}
51 BuiltIn.Log ${ODL_SYSTEM_${bm_owner}_IP}
52 BuiltIn.Set Suite variable ${bm_candidates}
53 ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${bm_owner}
54 BuiltIn.Set_Suite_Variable ${living_session} ${session}
55 BuiltIn.Log ${living_session}
56 BuiltIn.Set_Suite_Variable ${living_node} ${bm_owner}
58 Verify_Data_Reported_1
59 [Documentation] Verifies if example-bmp-monitor reported expected data
60 BgpOperations.Bmp_Monitor_Postcondition ${living_session}
62 Stop_Current_Owner_Member
63 [Documentation] Stop cluster node which is connected with bmp mock.
64 ClusterManagement.Stop_Single_Member ${bm_owner}
65 BuiltIn.Set Suite variable ${old_bm_owner} ${bm_owner}
66 BuiltIn.Set Suite variable ${old_bm_candidates} ${bm_candidates}
67 ${idx}= Collections.Get From List ${old_bm_candidates} 0
68 ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${idx}
69 BuiltIn.Set_Suite_Variable ${living_session} ${session}
70 BuiltIn.Set_Suite_Variable ${living_node} ${idx}
73 [Documentation] Verifies if new owner of bmp-monitor is elected.
74 BuiltIn.Wait_Until_Keyword_Succeeds
77 ... Verify_New_Bm_Owner_Elected
81 Verify_Data_Reported_2
82 [Documentation] Verifies if example-bmp-monitor reported expected data
83 BgpOperations.Bmp_Monitor_Postcondition ${living_session}
85 Start_Old_Owner_Member
86 [Documentation] Restart old owner node with bin/start
87 ClusterManagement.Start_Single_Member ${old_bm_owner}
90 [Documentation] Verifies started node become candidate for bmp-monitor
91 BuiltIn.Wait_Until_Keyword_Succeeds
94 ... Verify_New_Bm_Candidate_Present
98 Verify_Data_Reported_3
99 [Documentation] Verifies if example-bmp-monitor reported expected data
100 BgpOperations.Bmp_Monitor_Postcondition ${living_session}
103 [Documentation] Send ctrl+c to bmp-mock to stop it
104 BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt
109 [Documentation] Initial setup
110 SetupUtils.Setup_Utils_For_Setup_And_Teardown
111 ClusterManagement.ClusterManagement_Setup
112 NexusKeywords.Initialize_Artifact_Deployment_And_Usage
113 RequestsLibrary.Create_Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
114 ${name}= NexusKeywords.Deploy_Test_Tool bgpcep bgp-bmp-mock
115 BuiltIn.Set_Suite_Variable ${filename} ${name}
116 BgpOperations.Bmp_Monitor_Precondition ${CONFIG_SESSION}
120 [Documentation] Suite cleanup
121 BGPcliKeywords.Store_File_To_Workspace ${BMP_LOG_FILE} ${BMP_LOG_FILE}
122 RequestsLibrary.Delete_All_Sessions
123 SSHLibrary.Close_All_Connections
126 [Documentation] Starts bmp mock
127 ${command}= BuiltIn.Set_Variable
128 ... -jar ${filename} --local_address ${TOOLS_SYSTEM_IP} --remote_address ${ODL_SYSTEM_1_IP}:12345,${ODL_SYSTEM_2_IP}:12345,${ODL_SYSTEM_3_IP}:12345 --routers_count 1 --peers_count 1 --log_level INFO 2>&1 | tee ${BMP_LOG_FILE}
129 BGPcliKeywords.Start_Java_Tool_And_Verify_Connection ${command} successfully established.
131 Verify_New_Bm_Owner_Elected
132 [Documentation] Verifies new owner was elected
133 [Arguments] ${old_owner} ${node_to_ask}
134 ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device
139 BuiltIn.Should_Not_Be_Equal ${old_owner} ${owner}
141 Verify_New_Bm_Candidate_Present
142 [Documentation] Verifies candidate's presence.
143 [Arguments] ${candidate} ${node_to_ask}
144 ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device
149 BuiltIn.Should_Contain ${candidates} ${candidate}