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 Suite Setup Setup_Everything
16 Suite Teardown Teardown_Everything
17 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
18 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
19 Library SSHLibrary timeout=10s
20 Library RequestsLibrary
22 Library OperatingSystem
23 Resource ../../../variables/Variables.robot
24 Resource ../../../libraries/SetupUtils.robot
25 Resource ../../../libraries/ClusterManagement.robot
26 Resource ../../../libraries/RemoteBash.robot
27 Resource ../../../libraries/SSHKeywords.robot
28 Resource ../../../libraries/TemplatedRequests.robot
29 Resource ../../../libraries/NexusKeywords.robot
32 ${BGP_VAR_FOLDER} ${CURDIR}/../../../variables/bgpclustering
34 ${BGP_BMP_DIR} ${CURDIR}/../../../variables/bgpfunctional/bmp_basic/filled_structure
35 ${BGP_BMP_FEAT_DIR} ${CURDIR}/../../../variables/bgpfunctional/bmp_basic/empty_structure
36 ${BMP_LOG_FILE} bmpmock.log
40 [Documentation] Find an odl node which is able to accept incomming connection. To this node netconf connector should be configured.
41 ${bm_owner} ${bm_candidates}= Wait_Until_Keyword_Succeeds 5x 2s ClusterManagement.Get_Owner_And_Successors_For_Device bmp-monitors
43 BuiltIn.Set Suite variable ${bm_owner}
44 BuiltIn.Log ${bm_owner}
45 BuiltIn.Log ${ODL_SYSTEM_${bm_owner}_IP}
46 BuiltIn.Set Suite variable ${bm_candidates}
47 ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${bm_owner}
48 BuiltIn.Set_Suite_Variable ${living_session} ${session}
49 BuiltIn.Log ${living_session}
50 BuiltIn.Set_Suite_Variable ${living_node} ${bm_owner}
53 [Documentation] Verify example-bmp-monitor presence in bmp-monitors
54 &{mapping} BuiltIn.Create_Dictionary TOOL_IP=${TOOLS_SYSTEM_IP}
55 BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s TemplatedRequests.Get_As_Json_Templated folder=${BGP_BMP_FEAT_DIR} mapping=${mapping} verify=True
56 ... session=${living_session}
59 [Documentation] Starts bmp mock
60 ${command}= NexusKeywords.Compose_Full_Java_Command -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 TRACE 2>&1 | tee ${BMP_LOG_FILE}
61 BuiltIn.Log ${command}
62 SSHLibrary.Set_Client_Configuration timeout=30s
63 SSHLibrary.Write ${command}
64 ${output}= SSHLibrary.Read_Until successfully established.
67 Verify_Data_Reported_1
68 [Documentation] Verifies if example-bmp-monitor reported expected data
71 Stop_Current_Owner_Member
72 [Documentation] Stop cluster node which is connected with bmp mock.
73 ClusterManagement.Stop_Single_Member ${bm_owner}
74 BuiltIn.Set Suite variable ${old_bm_owner} ${bm_owner}
75 BuiltIn.Set Suite variable ${old_bm_candidates} ${bm_candidates}
76 ${idx}= Collections.Get From List ${old_bm_candidates} 0
77 ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${idx}
78 BuiltIn.Set_Suite_Variable ${living_session} ${session}
79 BuiltIn.Set_Suite_Variable ${living_node} ${idx}
82 [Documentation] Verifies if new owner of bmp-monitor is elected.
83 BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s Verify_New_Bm_Owner_Elected ${old_bm_owner} ${living_node}
85 Verify_Data_Reported_2
86 [Documentation] Verifies if example-bmp-monitor reported expected data
89 Start_Old_Owner_Member
90 [Documentation] Restart old owner node with bin/start
91 ClusterManagement.Start_Single_Member ${old_bm_owner}
94 [Documentation] Verifies started node become candidate for bmp-monitor
95 BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s Verify_New_Bm_Candidate_Present ${old_bm_owner} ${living_node}
97 Verify_Data_Reported_3
98 [Documentation] Verifies if example-bmp-monitor reported expected data
102 [Documentation] Send ctrl+c to bmp-mock to stop it
103 RemoteBash.Write_Bare_Ctrl_C
104 ${output}= SSHLibrary.Read_Until_Prompt
105 BuiltIn.Log ${output}
109 [Documentation] Initial setup
110 SetupUtils.Setup_Utils_For_Setup_And_Teardown
111 ${odl1} = SSHKeywords.Open_Connection_To_ODL_System ip_address=${ODL_SYSTEM_1_IP}
112 SSHLibrary.Put_File ${CURDIR}/../../../../tools/deployment/search.sh
113 SSHLibrary.Close_Connection
114 ${odl2} = SSHKeywords.Open_Connection_To_ODL_System ip_address=${ODL_SYSTEM_2_IP}
115 SSHLibrary.Put_File ${CURDIR}/../../../../tools/deployment/search.sh
116 SSHLibrary.Close_Connection
117 ${odl3} = SSHKeywords.Open_Connection_To_ODL_System ip_address=${ODL_SYSTEM_3_IP}
118 SSHLibrary.Put_File ${CURDIR}/../../../../tools/deployment/search.sh
119 SSHLibrary.Close_Connection
120 ClusterManagement.ClusterManagement_Setup
121 SSHKeywords.Open_Connection_To_Tools_System
122 ${name}= NexusKeywords.Deploy_Test_Tool bgpcep bgp-bmp-mock
123 BuiltIn.Set_Suite_Variable ${filename} ${name}
126 [Documentation] Suite cleanup
127 SSHLibrary.Get_File ${BMP_LOG_FILE}
128 ${cnt}= OperatingSystem.Get_File ${BMP_LOG_FILE}
130 RequestsLibrary.Delete_All_Sessions
131 SSHLibrary.Close_All_Connections
134 [Arguments] ${ip}=${TOOLS_SYSTEM_IP}
135 [Documentation] Verifies if the tool reported expected data
136 &{mapping} BuiltIn.Create_Dictionary TOOL_IP=${ip}
137 ${output}= Wait Until Keyword Succeeds 10x 5s TemplatedRequests.Get_As_Json_Templated folder=${BGP_BMP_DIR} mapping=${mapping}
138 ... session=${living_session} verify=True
141 Verify_New_Bm_Owner_Elected
142 [Arguments] ${old_owner} ${node_to_ask}
143 [Documentation] Verifies new owner was elected
144 ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device bmp-monitors Bgpcep ${node_to_ask}
145 BuiltIn.Should_Not_Be_Equal ${old_owner} ${owner}
147 Verify_New_Bm_Candidate_Present
148 [Arguments] ${candidate} ${node_to_ask}
149 [Documentation] Verifies candidate's presence.
150 ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device bmp-monitors Bgpcep ${node_to_ask}
151 BuiltIn.Should_Contain ${candidates} ${candidate}