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 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
21 Library OperatingSystem
22 Resource ../../../variables/Variables.robot
23 Resource ../../../libraries/SetupUtils.robot
24 Resource ../../../libraries/ClusterManagement.robot
25 Resource ../../../libraries/RemoteBash.robot
26 Resource ../../../libraries/TemplatedRequests.robot
27 Resource ../../../libraries/NexusKeywords.robot
30 ${BGP_VAR_FOLDER} ${CURDIR}/../../../variables/bgpclustering
32 ${BGP_BMP_DIR} ${CURDIR}/../../../variables/bgpfunctional/bmp_basic/filled_structure
33 ${BGP_BMP_FEAT_DIR} ${CURDIR}/../../../variables/bgpfunctional/bmp_basic/empty_structure
34 ${BMP_LOG_FILE} bmpmock.log
38 [Documentation] Find an odl node which is able to accept incomming connection. To this node netconf connector should be configured.
39 ${bm_owner} ${bm_candidates}= Wait_Until_Keyword_Succeeds 5x 2s ClusterManagement.Get_Owner_And_Successors_For_Device bmp-monitors
41 BuiltIn.Set Suite variable ${bm_owner}
42 BuiltIn.Log ${bm_owner}
43 BuiltIn.Log ${ODL_SYSTEM_${bm_owner}_IP}
44 BuiltIn.Set Suite variable ${bm_candidates}
45 ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${bm_owner}
46 BuiltIn.Set_Suite_Variable ${living_session} ${session}
47 BuiltIn.Log ${living_session}
48 BuiltIn.Set_Suite_Variable ${living_node} ${bm_owner}
51 [Documentation] Verify example-bmp-monitor presence in bmp-monitors
52 &{mapping} BuiltIn.Create_Dictionary TOOL_IP=${TOOLS_SYSTEM_IP}
53 BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s TemplatedRequests.Get_As_Json_Templated folder=${BGP_BMP_FEAT_DIR} mapping=${mapping} verify=True
54 ... session=${living_session}
57 [Documentation] Starts bmp mock
58 ${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}
59 BuiltIn.Log ${command}
60 SSHLibrary.Set_Client_Configuration timeout=30s
61 SSHLibrary.Write ${command}
62 ${output}= SSHLibrary.Read_Until successfully established.
65 Verify_Data_Reported_1
66 [Documentation] Verifies if example-bmp-monitor reported expected data
69 Kill_Current_Owner_Member
70 [Documentation] Killing cluster node which is connected with bmp mock.
71 ClusterManagement.Kill_Single_Member ${bm_owner}
72 BuiltIn.Set Suite variable ${old_bm_owner} ${bm_owner}
73 BuiltIn.Set Suite variable ${old_bm_candidates} ${bm_candidates}
74 ${idx}= Collections.Get From List ${old_bm_candidates} 0
75 ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${idx}
76 BuiltIn.Set_Suite_Variable ${living_session} ${session}
77 BuiltIn.Set_Suite_Variable ${living_node} ${idx}
80 [Documentation] Verifies if new owner of bmp-monitor is elected.
81 BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s Verify_New_Bm_Owner_Elected ${old_bm_owner} ${living_node}
83 Verify_Data_Reported_2
84 [Documentation] Verifies if example-bmp-monitor reported expected data
87 Start_Old_Owner_Member
88 [Documentation] Start killed node
89 ClusterManagement.Start_Single_Member ${old_bm_owner}
92 [Documentation] Verifies started node become candidate for bmp-monitor
93 BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s Verify_New_Bm_Candidate_Present ${old_bm_owner} ${living_node}
95 Verify_Data_Reported_3
96 [Documentation] Verifies if example-bmp-monitor reported expected data
100 [Documentation] Send ctrl+c to bmp-mock to stop it
101 RemoteBash.Write_Bare_Ctrl_C
102 ${output}= SSHLibrary.Read_Until_Prompt
103 BuiltIn.Log ${output}
107 [Documentation] Initial setup
108 SetupUtils.Setup_Utils_For_Setup_And_Teardown
109 ClusterManagement.ClusterManagement_Setup
110 NexusKeywords.Initialize_Artifact_Deployment_And_Usage
111 #ClusterManagement.Cluster_Setup_For_Artifact_Deployment_And_Usage
112 ${name}= NexusKeywords.Deploy_Test_Tool bgpcep bgp-bmp-mock
113 BuiltIn.Set_Suite_Variable ${filename} ${name}
116 [Documentation] Suite cleanup
117 SSHLibrary.Get_File ${BMP_LOG_FILE}
118 ${cnt}= OperatingSystem.Get_File ${BMP_LOG_FILE}
120 RequestsLibrary.Delete_All_Sessions
121 SSHLibrary.Close_All_Connections
124 [Arguments] ${ip}=${TOOLS_SYSTEM_IP}
125 [Documentation] Verifies if the tool reported expected data
126 &{mapping} BuiltIn.Create_Dictionary TOOL_IP=${ip}
127 ${output}= Wait Until Keyword Succeeds 10x 5s TemplatedRequests.Get_As_Json_Templated folder=${BGP_BMP_DIR} mapping=${mapping}
128 ... session=${living_session} verify=True
131 Verify_New_Bm_Owner_Elected
132 [Arguments] ${old_owner} ${node_to_ask}
133 [Documentation] Verifies new owner was elected
134 ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device bmp-monitors Bgpcep ${node_to_ask}
135 BuiltIn.Should_Not_Be_Equal ${old_owner} ${owner}
137 Verify_New_Bm_Candidate_Present
138 [Arguments] ${candidate} ${node_to_ask}
139 [Documentation] Verifies candidate's presence.
140 ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device bmp-monitors Bgpcep ${node_to_ask}
141 BuiltIn.Should_Contain ${candidates} ${candidate}