2 Documentation PCEP functional HA testing with one pcep peer.
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 distbmution,
8 ... and is available at http://www.eclipse.org/legal/epl-v10.html
10 ... This suite uses PCC mock. It is configured to have 3 peers (all 3 nodes of odl).
11 ... PCEP implemented with singleton accepts only one incomming conection. PCC 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 PCC 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/ClusterManagement.robot
25 Resource ../../../libraries/NexusKeywords.robot
26 Resource ../../../libraries/PcepOperations.robot
27 Resource ../../../libraries/SetupUtils.robot
28 Resource ../../../libraries/TemplatedRequests.robot
29 Resource ../../../variables/Variables.robot
33 ${DIR_WITH_TEMPLATES} ${CURDIR}/../../../variables/bgpclustering/
34 ${PCC_LOG_FILE} pccmock.restart.log
35 ${CONFIG_SESSION} session
36 ${OLD_ERROR_ARGS} \n"last-received-error": {},\n"last-sent-error": {},
37 ${NEW_ERROR_ARGS} ${EMPTY}
40 Get_Example_Pcep_Owner
41 [Documentation] Find an odl node which is able to accept incomming connection.
42 ${pcep_owner} ${pcep_candidates}= Wait_Until_Keyword_Succeeds 5x 2s ClusterManagement.Get_Owner_And_Successors_For_device pcep-topology
44 BuiltIn.Set Suite variable ${pcep_owner}
45 BuiltIn.Log ${pcep_owner}
46 BuiltIn.Set Suite variable ${pcep_candidates}
47 ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${pcep_owner}
48 BuiltIn.Set_Suite_Variable ${living_session} ${session}
49 BuiltIn.Log ${living_session}
50 BuiltIn.Set_Suite_Variable ${living_node} ${pcep_owner}
52 Verify_Data_Reported_1
53 [Documentation] Verifies if pcep-topology reported expected data
54 ... Expects pcep-topology not be empty/filled path-computation.
55 Pcep_Topology_Postcondition
57 Kill_Current_Owner_Member
58 [Documentation] Killing cluster node which is connected with pcc-mock.
59 ClusterManagement.Kill_Single_Member ${pcep_owner}
60 BuiltIn.Set Suite variable ${old_pcep_owner} ${pcep_owner}
61 BuiltIn.Set Suite variable ${old_pcep_candidates} ${pcep_candidates}
62 ${idx}= Collections.Get From List ${old_pcep_candidates} 0
63 ${session}= ClusterManagement.Resolve_Http_Session_For_Member member_index=${idx}
64 BuiltIn.Set_Suite_Variable ${living_session} ${session}
65 BuiltIn.Set_Suite_Variable ${living_node} ${idx}
68 [Documentation] Verifies if new owner of pcep-topology is elected.
69 BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s Verify_New_Pcep_Owner_Elected ${old_pcep_owner} ${living_node}
71 Verify_Data_Reported_2
72 [Documentation] Verifies if pcep-topology reports expected data
73 ... Expects pcep-topology not be empty/filled path-computation.
74 Pcep_Topology_Postcondition
77 [Documentation] Starting stopped node
78 ClusterManagement.Start_Single_Member ${old_pcep_owner}
81 [Documentation] Verifies started node become candidate for pcep_topology
82 BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s Verify_New_Pcep_Candidate_Present ${old_pcep_owner} ${living_node}
84 Verify_Data_Reported_3
85 [Documentation] Verifies if pcep-topology reported expected data
86 ... Expects pcep-topology not be empty/filled path-computation.
87 Pcep_Topology_Postcondition
90 [Documentation] Send ctrl+c to pcc-mock to stop it.
91 BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt
95 [Documentation] Initial setup
96 SetupUtils.Setup_Utils_For_Setup_And_Teardown
97 ClusterManagement.ClusterManagement_Setup
98 NexusKeywords.Initialize_Artifact_Deployment_And_Usage
99 RequestsLibrary.Create_Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
100 ${name}= NexusKeywords.Deploy_Test_Tool bgpcep pcep-pcc-mock
101 BuiltIn.Set_Suite_Variable ${filename} ${name}
102 #Setting Pcc Name and its code for mapping for templates
103 #TODO: Move variable definitions into PcepOperations setup after its update
104 BuiltIn.Set_Suite_Variable ${pcc_name} pcc_${TOOLS_SYSTEM_IP}_tunnel_1
105 ${code}= Evaluate binascii.b2a_base64('${pcc_name}')[:-1] modules=binascii
106 BuiltIn.Set_Suite_Variable ${pcc_name_code} ${code}
107 PcepOperations.Pcep_Topology_Precondition ${CONFIG_SESSION}
108 ${ERROR_ARGS} = CompareStream.Set_Variable_If_At_Least_Neon ${NEW_ERROR_ARGS} ${OLD_ERROR_ARGS}
109 BuiltIn.Set_Suite_Variable ${ERROR_ARGS}
113 [Documentation] Suite cleanup
114 BGPcliKeywords.Store_File_To_Workspace ${PCC_LOG_FILE} ${PCC_LOG_FILE}
115 RequestsLibrary.Delete_All_Sessions
116 SSHLibrary.Close_All_Connections
119 [Documentation] Starts pcc mock
120 ${command}= BuiltIn.Set_Variable -jar ${filename} --reconnect 1 --local-address ${TOOLS_SYSTEM_IP} --remote-address ${ODL_SYSTEM_1_IP}:4189,${ODL_SYSTEM_2_IP}:4189,${ODL_SYSTEM_3_IP}:4189 --log-level INFO 2>&1 | tee ${PCC_LOG_FILE}
121 BGPcliKeywords.Start_Java_Tool_And_Verify_Connection ${command} started
123 Pcep_Topology_Postcondition
124 [Documentation] Verifies if the tool reported expected data
125 &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} CODE=${pcc_name_code} NAME=${pcc_name} IP_ODL=${ODL_SYSTEM_${pcep_owner}_IP} ERRORS=${ERROR_ARGS}
126 BuiltIn.Wait_Until_Keyword_Succeeds 10x 5s TemplatedRequests.Get_As_Json_Templated ${DIR_WITH_TEMPLATES}${/}pcep_on_state ${mapping} ${living_session}
129 Verify_New_Pcep_Owner_Elected
130 [Arguments] ${old_owner} ${node_to_ask}
131 [Documentation] Verifies new owner was elected
132 ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device pcep-topology Bgpcep ${node_to_ask}
133 BuiltIn.Should_Not_Be_Equal ${old_owner} ${owner}
134 BuiltIn.Set_Suite_Variable ${pcep_owner} ${owner}
136 Verify_New_Pcep_Candidate_Present
137 [Arguments] ${candidate} ${node_to_ask}
138 [Documentation] Verifies candidate's presence.
139 ${owner} ${candidates}= ClusterManagement.Get_Owner_And_Successors_For_device pcep-topology Bgpcep ${node_to_ask}
140 Collections.Append_To_List ${candidates} ${owner}
141 BuiltIn.Should_Contain ${candidates} ${candidate}
142 BuiltIn.Set_Suite_Variable ${pcep_owner} ${owner}