2 Documentation BMP functional HA testing with 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 killing 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
16 Suite Setup Setup_Everything
17 Suite Teardown Teardown_Everything
18 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
19 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
20 Library SSHLibrary timeout=10s
22 Library OperatingSystem
23 Resource ../../../libraries/BGPcliKeywords.robot
24 Resource ../../../libraries/BgpOperations.robot
25 Resource ../../../libraries/ClusterManagement.robot
26 Resource ../../../libraries/NexusKeywords.robot
27 Resource ../../../libraries/SetupUtils.robot
28 Resource ../../../variables/Variables.robot
32 ${BMP_LOG_FILE} bmpmock.restart.log
33 ${CONFIG_SESSION} session
37 [Documentation] Find an odl node which is able to accept incomming connection.
38 ${bm_owner} ${bm_candidates}= Wait_Until_Keyword_Succeeds 5x 2s ClusterManagement.Get_Owner_And_Successors_For_Device bmp-monitors
40 BuiltIn.Set Suite variable ${bm_owner}
41 BuiltIn.Log ${bm_owner}
42 BuiltIn.Log ${ODL_SYSTEM_${bm_owner}_IP}
43 BuiltIn.Set Suite variable ${bm_candidates}
44 ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${bm_owner}
45 BuiltIn.Set_Suite_Variable ${living_session} ${session}
46 BuiltIn.Log ${living_session}
47 BuiltIn.Set_Suite_Variable ${living_node} ${bm_owner}
49 Verify_Data_Reported_1
50 [Documentation] Verifies if example-bmp-monitor reported expected data
51 BgpOperations.Bmp_Monitor_Postcondition ${living_session}
53 Kill_Current_Owner_Member
54 [Documentation] Killing cluster node which is connected with bmp mock.
55 ClusterManagement.Kill_Single_Member ${bm_owner}
56 BuiltIn.Set Suite variable ${old_bm_owner} ${bm_owner}
57 BuiltIn.Set Suite variable ${old_bm_candidates} ${bm_candidates}
58 ${idx}= Collections.Get From List ${old_bm_candidates} 0
59 ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${idx}
60 BuiltIn.Set_Suite_Variable ${living_session} ${session}
61 BuiltIn.Set_Suite_Variable ${living_node} ${idx}
64 [Documentation] Verifies if new owner of bmp-monitor is elected.
65 BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s Verify_New_Bm_Owner_Elected ${old_bm_owner} ${living_node}
67 Verify_Data_Reported_2
68 [Documentation] Verifies if example-bmp-monitor reported expected data
69 BgpOperations.Bmp_Monitor_Postcondition ${living_session}
71 Start_Old_Owner_Member
72 [Documentation] Start killed node
73 ClusterManagement.Start_Single_Member ${old_bm_owner}
76 [Documentation] Verifies started node become candidate for bmp-monitor
77 BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s Verify_New_Bm_Candidate_Present ${old_bm_owner} ${living_node}
79 Verify_Data_Reported_3
80 [Documentation] Verifies if example-bmp-monitor reported expected data
81 BgpOperations.Bmp_Monitor_Postcondition ${living_session}
84 [Documentation] Send ctrl+c to bmp-mock to stop it
85 BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt
89 [Documentation] Initial setup
90 SetupUtils.Setup_Utils_For_Setup_And_Teardown
91 ClusterManagement.ClusterManagement_Setup
92 NexusKeywords.Initialize_Artifact_Deployment_And_Usage
93 RequestsLibrary.Create_Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
94 ${name}= NexusKeywords.Deploy_Test_Tool bgpcep bgp-bmp-mock
95 BuiltIn.Set_Suite_Variable ${filename} ${name}
96 BgpOperations.Bmp_Monitor_Precondition ${CONFIG_SESSION}
100 [Documentation] Suite cleanup
101 BGPcliKeywords.Store_File_To_Workspace ${BMP_LOG_FILE} ${BMP_LOG_FILE}
102 RequestsLibrary.Delete_All_Sessions
103 SSHLibrary.Close_All_Connections
106 [Documentation] Starts bmp mock
107 ${command}= BuiltIn.Set_Variable -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}
108 BGPcliKeywords.Start_Java_Tool_And_Verify_Connection ${command} successfully established.
110 Verify_New_Bm_Owner_Elected
111 [Arguments] ${old_owner} ${node_to_ask}
112 [Documentation] Verifies new owner was elected
113 ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device bmp-monitors Bgpcep ${node_to_ask}
115 BuiltIn.Should_Not_Be_Equal ${old_owner} ${owner}
117 Verify_New_Bm_Candidate_Present
118 [Arguments] ${candidate} ${node_to_ask}
119 [Documentation] Verifies candidate's presence.
120 ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device bmp-monitors Bgpcep ${node_to_ask}
122 BuiltIn.Should_Contain ${candidates} ${candidate}