2 Documentation TCPMD5 user-facing feature system tests, using PCEP.
4 ... Copyright (c) 2015 Cisco Systems, Inc. and others. 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 ... Test suite performs basic pcep md5 password authorization test cases:
11 ... (Run entire basic PCEP suite without passwords.)
12 ... Start pcc-mock (reconnecting mode): 1 pcc, 1 lsp, password set, check pcep-topology stays empty.
13 ... Use restconf to change PCEP configuration to use a wrong password, check pcep-topology stays empty.
14 ... Change ODL PCEP configuration to use the correct password, check pcep-topology shows the lsp.
15 ... Stop pcc-mock, check pcep-topology stays empty.
16 ... Start pcc-mock with new password, check pcep-topology stays empty.
17 ... Change ODL PCEP configuration to use the correct password, check pcep-topology shows the lsp.
18 ... Update the lsp, check a change in pcep-topology.
19 ... Change ODL PCEP configuration to not use password, pcep-topology empties, kill pcep-pcc-mock.
21 ... Test cases no longer need netconf-connector-ssh, and they include comparison of
22 ... pcep-session-state.
24 Library OperatingSystem
25 Library RequestsLibrary
26 Library SSHLibrary prompt=]>
27 Resource ../../../libraries/FailFast.robot
28 Resource ../../../libraries/KarafKeywords.robot
29 Resource ../../../libraries/NexusKeywords.robot
30 Resource ../../../libraries/TemplatedRequests.robot
31 Resource ../../../libraries/RemoteBash.robot
32 Resource ../../../libraries/WaitForFailure.robot
33 Resource ../../../variables/Variables.robot
34 Variables ../../../variables/tcpmd5user/${ODL_STREAM}/variables.py ${TOOLS_SYSTEM_IP}
37 Suite Teardown Tear_It_Down
38 Test Setup FailFast.Fail_This_Fast_On_Previous_Error
39 Test Teardown FailFast.Start_Failing_Fast_If_This_Failed
43 ${DIR_WITH_TEMPLATES} ${CURDIR}/../../../variables/tcpmd5user/${ODL_STREAM}
44 ${CONFIG_SESSION} session
45 ${ERROR_ARGS} ${EMPTY}
50 [Documentation] Compare current pcep-topology to empty one.
51 ... Timeout is long enough to see that pcep is ready, with no PCC connected.
53 BuiltIn.Wait_Until_Keyword_Succeeds
56 ... TemplatedRequests.Get_As_Json_Templated
57 ... ${DIR_WITH_TEMPLATES}${/}default_off
58 ... session=${CONFIG_SESSION}
62 [Documentation] Execute pcc-mock on Mininet with password set, fail if pcc-mock promptly exits. Keep pcc-mock running for next test cases.
63 Start_Pcc_Mock_Tool_With_Password password=topsecret
65 Topology_Unauthorized_1
66 [Documentation] Try to catch a glimpse of pcc-mock in pcep-topology. Pass if no change from Precondition is detected over 10 seconds.
68 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout 10s 1s Test_Unauthorized
71 [Documentation] Configure password in pcep dispatcher for client with Mininet IP address.
72 ... This password does not match what pcc-mock uses.
73 Replace_Password_On_Pcep_Node password=changeme
75 Topology_Unauthorized_2
76 [Documentation] The same logic as Topology_Unauthorized_1 as incorrect password was provided to ODL.
78 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout 10s 1s Test_Unauthorized
81 [Documentation] Configure password in pcep dispatcher for client with Mininet IP address.
82 ... This password finally matches what pcc-mock uses.
83 Replace_Password_On_Pcep_Node password=topsecret
85 Topology_Intercondition
86 [Documentation] Compare pcep-topology/path-computation-client to filled one, which includes a tunnel from pcc-mock.
87 &{mapping} BuiltIn.Create_Dictionary
88 ... IP=${TOOLS_SYSTEM_IP}
89 ... CODE=${pcc_name_code}
91 ... IP_ODL=${ODL_SYSTEM_IP}
92 ... ERRORS=${ERROR_ARGS}
93 BuiltIn.Wait_Until_Keyword_Succeeds
96 ... TemplatedRequests.Get_As_Json_Templated
97 ... ${DIR_WITH_TEMPLATES}${/}default_on_state
103 [Documentation] Stops First instance of pcc-mock.
104 [Setup] FailFast.Run_Even_When_Failing_Fast
106 FailFast.Do_Not_Fail_Fast_From_Now_On
107 # NOTE: It is still possible to remain failing, if both previous and this test failed.
108 [Teardown] FailFast.Do_Not_Start_Failing_If_This_Failed
110 Topology_Unauthorized_3
111 [Documentation] The same logic as Topology_Unauthorized_1, with no pcc-mock running.
113 BuiltIn.Wait_Until_Keyword_Succeeds 10s 1s Test_Unauthorized
115 Start_Secure_Pcc_Mock_2
116 [Documentation] Execute pcc-mock on Mininet with new password set, fail if pcc-mock promptly exits. Keep pcc-mock running for next test cases.
117 Start_Pcc_Mock_Tool_With_Password password=newtopsecret
119 Topology_Unauthorized_4
120 [Documentation] The same logic as Topology_Unauthorized_1, but ODL password became incorrect with new pcc-mock running.
122 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout 10s 1s Test_Unauthorized
124 Set_Correct_Password_2
125 [Documentation] Configure password in pcep dispatcher for client with Mininet IP address.
126 ... This password again matches what second pcc-mock instance uses.
127 Replace_Password_On_Pcep_Node password=newtopsecret
129 Topology_Intercondition_2
130 [Documentation] Compare pcep-topology/path-computation-client to filled one, which includes a tunnel from pcc-mock.
131 &{mapping} BuiltIn.Create_Dictionary
132 ... IP=${TOOLS_SYSTEM_IP}
133 ... CODE=${pcc_name_code}
135 ... IP_ODL=${ODL_SYSTEM_IP}
136 ... ERRORS=${ERROR_ARGS}
137 BuiltIn.Wait_Until_Keyword_Succeeds
140 ... TemplatedRequests.Get_As_Json_Templated
141 ... ${DIR_WITH_TEMPLATES}${/}default_on_state
143 ... ${CONFIG_SESSION}
147 [Documentation] Perform update-lsp on the mocked tunnel, check response is success.
148 &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} NAME=${pcc_name}
149 ${response} TemplatedRequests.Post_As_Xml_Templated
150 ... ${DIR_WITH_TEMPLATES}${/}update_delegated
152 ... ${CONFIG_SESSION}
157 [Documentation] Compare pcep-topology/path-computation-client to default_on_updated, which includes the updated tunnel.
159 &{mapping} BuiltIn.Create_Dictionary
160 ... IP=${TOOLS_SYSTEM_IP}
161 ... CODE=${pcc_name_code}
163 ... IP_ODL=${ODL_SYSTEM_IP}
164 ... ERRORS=${ERROR_ARGS}
165 BuiltIn.Wait_Until_Keyword_Succeeds
168 ... TemplatedRequests.Get_As_Json_Templated
169 ... ${DIR_WITH_TEMPLATES}${/}default_on_updated_state
171 ... ${CONFIG_SESSION}
175 [Documentation] De-configure password for pcep dispatcher for client with Mininet IP address.
176 [Setup] FailFast.Run_Even_When_Failing_Fast
177 Unset_Password_On_Pcep_Node
178 FailFast.Do_Not_Fail_Fast_From_Now_On
179 # NOTE: It is still possible to remain failing, if both previous and this test failed.
180 [Teardown] FailFast.Do_Not_Start_Failing_If_This_Failed
182 Topology_Unauthorized_5
183 [Documentation] Wait for pcep-topology to become empty again.
185 BuiltIn.Wait_Until_Keyword_Succeeds 10s 1s Test_Unauthorized
188 [Documentation] Stops second instance of pcc-mock
189 [Setup] FailFast.Run_Even_When_Failing_Fast
191 FailFast.Do_Not_Fail_Fast_From_Now_On
192 # NOTE: It is still possible to remain failing, if both previous and this test failed.
193 [Teardown] FailFast.Do_Not_Start_Failing_If_This_Failed
195 Topology_Postcondition
196 [Documentation] Verify that pcep-topology stays empty.
198 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout 10s 1s Test_Unauthorized
200 Delete_Pcep_Client_Module
201 [Documentation] Delete Pcep client module.
202 &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP}
203 TemplatedRequests.Delete_Templated ${DIR_WITH_TEMPLATES}${/}pcep_topology_node ${mapping}
208 [Documentation] Create SSH session to Mininet machine, prepare HTTP client session to Controller.
209 ... Figure out latest pcc-mock version and download it from Nexus to Mininet.
210 ... Also, delete and create directories for json diff handling.
211 KarafKeywords.Setup_Karaf_Keywords
212 TemplatedRequests.Create_Default_Session
213 NexusKeywords.Initialize_Artifact_Deployment_And_Usage
214 ${current_connection} SSHLibrary.Get_Connection
215 ${current_prompt} BuiltIn.Set_Variable ${current_connection.prompt}
216 BuiltIn.Log ${current_prompt}
217 BuiltIn.Set_Suite_Variable ${prompt} ${current_prompt}
218 RequestsLibrary.Create_Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
219 ${name} NexusKeywords.Deploy_Test_Tool bgpcep pcep-pcc-mock
220 BuiltIn.Set_Suite_Variable ${filename} ${name}
221 #Setting Pcc Name and its code for mapping for templates
222 FailFast.Do_Not_Fail_Fast_From_Now_On
225 [Documentation] Download pccmock.log and Log its contents.
226 ... Compute and Log the diff between expected and actual normalized responses.
227 ... Close both HTTP client session and SSH connection to Mininet.
228 SSHLibrary.Get_File pccmock.log
229 ${pccmocklog} OperatingSystem.Run cat pccmock.log
230 BuiltIn.Log ${pccmocklog}
231 RequestsLibrary.Delete_All_Sessions
232 SSHLibrary.Close_All_Connections
235 [Documentation] Try to access pcep topology with wrong password, should get empty topology
236 TemplatedRequests.Get_As_Json_Templated
237 ... ${DIR_WITH_TEMPLATES}${/}default_off
238 ... session=${CONFIG_SESSION}
241 Read_Text_Before_Prompt
242 [Documentation] Log text gathered by SSHLibrary.Read_Until_Prompt.
243 ... This needs to be a separate keyword just because how Read_And_Fail_If_Prompt_Is_Seen is implemented.
244 ${text} SSHLibrary.Read_Until_Prompt
247 Replace_Password_On_Pcep_Node
248 [Documentation] Send restconf PUT to replace the config module specifying PCEP password element.
249 [Arguments] ${password}
250 &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} PASSWD=${password}
251 TemplatedRequests.Put_As_Xml_Templated ${DIR_WITH_TEMPLATES}${/}pcep_topology_node mapping=${mapping}
253 Unset_Password_On_Pcep_Node
254 [Documentation] Send restconf PUT to unset the config module.
255 &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP}
256 TemplatedRequests.Put_As_Xml_Templated ${DIR_WITH_TEMPLATES}${/}pcep_topology_node_empty mapping=${mapping}
259 [Documentation] Send ctrl+c to pcc-mock, fails if no prompt is seen
260 ... after 3 seconds (the default for SSHLibrary)
261 RemoteBash.Write_Bare_Ctrl_C
262 ${output} SSHLibrary.Read_Until_Prompt
263 BuiltIn.Log ${output}
265 Start_Pcc_Mock_Tool_With_Password
266 [Documentation] Starts pcc-mock with password argument.
267 [Arguments] ${password}
268 ${command} NexusKeywords.Compose_Full_Java_Command
269 ... -jar ${filename} --password ${password} --reconnect 1 --local-address ${TOOLS_SYSTEM_IP} --remote-address ${ODL_SYSTEM_IP} 2>&1 | tee pccmock.log
270 BuiltIn.Log ${command}
271 SSHLibrary.Write ${command}