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/CompareStream.robot
28 Resource ../../../libraries/FailFast.robot
29 Resource ../../../libraries/KarafKeywords.robot
30 Resource ../../../libraries/NexusKeywords.robot
31 Resource ../../../libraries/TemplatedRequests.robot
32 Resource ../../../libraries/RemoteBash.robot
33 Resource ../../../libraries/WaitForFailure.robot
34 Resource ../../../variables/Variables.robot
35 Variables ../../../variables/tcpmd5user/${ODL_STREAM}/variables.py ${TOOLS_SYSTEM_IP}
38 Suite Teardown Tear_It_Down
39 Test Setup FailFast.Fail_This_Fast_On_Previous_Error
40 Test Teardown FailFast.Start_Failing_Fast_If_This_Failed
44 ${DIR_WITH_TEMPLATES} ${CURDIR}/../../../variables/tcpmd5user/${ODL_STREAM}
45 ${CONFIG_SESSION} session
46 ${OLD_ERROR_ARGS} \n"last-received-error": {},\n"last-sent-error": {},
47 ${NEW_ERROR_ARGS} ${EMPTY}
52 [Documentation] Compare current pcep-topology to empty one.
53 ... Timeout is long enough to see that pcep is ready, with no PCC connected.
55 BuiltIn.Wait_Until_Keyword_Succeeds
58 ... TemplatedRequests.Get_As_Json_Templated
59 ... ${DIR_WITH_TEMPLATES}${/}default_off
60 ... session=${CONFIG_SESSION}
64 [Documentation] Execute pcc-mock on Mininet with password set, fail if pcc-mock promptly exits. Keep pcc-mock running for next test cases.
65 Start_Pcc_Mock_Tool_With_Password password=topsecret
67 Topology_Unauthorized_1
68 [Documentation] Try to catch a glimpse of pcc-mock in pcep-topology. Pass if no change from Precondition is detected over 10 seconds.
70 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout 10s 1s Test_Unauthorized
73 [Documentation] Configure password in pcep dispatcher for client with Mininet IP address.
74 ... This password does not match what pcc-mock uses.
75 Replace_Password_On_Pcep_Node password=changeme
77 Topology_Unauthorized_2
78 [Documentation] The same logic as Topology_Unauthorized_1 as incorrect password was provided to ODL.
80 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout 10s 1s Test_Unauthorized
83 [Documentation] Configure password in pcep dispatcher for client with Mininet IP address.
84 ... This password finally matches what pcc-mock uses.
85 Replace_Password_On_Pcep_Node password=topsecret
87 Topology_Intercondition
88 [Documentation] Compare pcep-topology/path-computation-client to filled one, which includes a tunnel from pcc-mock.
89 &{mapping} BuiltIn.Create_Dictionary
90 ... IP=${TOOLS_SYSTEM_IP}
91 ... CODE=${pcc_name_code}
93 ... IP_ODL=${ODL_SYSTEM_IP}
94 ... ERRORS=${ERROR_ARGS}
95 BuiltIn.Wait_Until_Keyword_Succeeds
98 ... TemplatedRequests.Get_As_Json_Templated
99 ... ${DIR_WITH_TEMPLATES}${/}default_on_state
101 ... ${CONFIG_SESSION}
105 [Documentation] Stops First instance of pcc-mock.
106 [Setup] FailFast.Run_Even_When_Failing_Fast
108 FailFast.Do_Not_Fail_Fast_From_Now_On
109 # NOTE: It is still possible to remain failing, if both previous and this test failed.
110 [Teardown] FailFast.Do_Not_Start_Failing_If_This_Failed
112 Topology_Unauthorized_3
113 [Documentation] The same logic as Topology_Unauthorized_1, with no pcc-mock running.
115 BuiltIn.Wait_Until_Keyword_Succeeds 10s 1s Test_Unauthorized
117 Start_Secure_Pcc_Mock_2
118 [Documentation] Execute pcc-mock on Mininet with new password set, fail if pcc-mock promptly exits. Keep pcc-mock running for next test cases.
119 Start_Pcc_Mock_Tool_With_Password password=newtopsecret
121 Topology_Unauthorized_4
122 [Documentation] The same logic as Topology_Unauthorized_1, but ODL password became incorrect with new pcc-mock running.
124 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout 10s 1s Test_Unauthorized
126 Set_Correct_Password_2
127 [Documentation] Configure password in pcep dispatcher for client with Mininet IP address.
128 ... This password again matches what second pcc-mock instance uses.
129 Replace_Password_On_Pcep_Node password=newtopsecret
131 Topology_Intercondition_2
132 [Documentation] Compare pcep-topology/path-computation-client to filled one, which includes a tunnel from pcc-mock.
133 &{mapping} BuiltIn.Create_Dictionary
134 ... IP=${TOOLS_SYSTEM_IP}
135 ... CODE=${pcc_name_code}
137 ... IP_ODL=${ODL_SYSTEM_IP}
138 ... ERRORS=${ERROR_ARGS}
139 BuiltIn.Wait_Until_Keyword_Succeeds
142 ... TemplatedRequests.Get_As_Json_Templated
143 ... ${DIR_WITH_TEMPLATES}${/}default_on_state
145 ... ${CONFIG_SESSION}
149 [Documentation] Perform update-lsp on the mocked tunnel, check response is success.
150 &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} NAME=${pcc_name}
151 ${response} TemplatedRequests.Post_As_Xml_Templated
152 ... ${DIR_WITH_TEMPLATES}${/}update_delegated
154 ... ${CONFIG_SESSION}
159 [Documentation] Compare pcep-topology/path-computation-client to default_on_updated, which includes the updated tunnel.
161 &{mapping} BuiltIn.Create_Dictionary
162 ... IP=${TOOLS_SYSTEM_IP}
163 ... CODE=${pcc_name_code}
165 ... IP_ODL=${ODL_SYSTEM_IP}
166 ... ERRORS=${ERROR_ARGS}
167 BuiltIn.Wait_Until_Keyword_Succeeds
170 ... TemplatedRequests.Get_As_Json_Templated
171 ... ${DIR_WITH_TEMPLATES}${/}default_on_updated_state
173 ... ${CONFIG_SESSION}
177 [Documentation] De-configure password for pcep dispatcher for client with Mininet IP address.
178 [Setup] FailFast.Run_Even_When_Failing_Fast
179 Unset_Password_On_Pcep_Node
180 FailFast.Do_Not_Fail_Fast_From_Now_On
181 # NOTE: It is still possible to remain failing, if both previous and this test failed.
182 [Teardown] FailFast.Do_Not_Start_Failing_If_This_Failed
184 Topology_Unauthorized_5
185 [Documentation] Wait for pcep-topology to become empty again.
187 BuiltIn.Wait_Until_Keyword_Succeeds 10s 1s Test_Unauthorized
190 [Documentation] Stops second instance of pcc-mock
191 [Setup] FailFast.Run_Even_When_Failing_Fast
193 FailFast.Do_Not_Fail_Fast_From_Now_On
194 # NOTE: It is still possible to remain failing, if both previous and this test failed.
195 [Teardown] FailFast.Do_Not_Start_Failing_If_This_Failed
197 Topology_Postcondition
198 [Documentation] Verify that pcep-topology stays empty.
200 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout 10s 1s Test_Unauthorized
202 Delete_Pcep_Client_Module
203 [Documentation] Delete Pcep client module.
204 &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP}
205 TemplatedRequests.Delete_Templated ${DIR_WITH_TEMPLATES}${/}pcep_topology_node ${mapping}
210 [Documentation] Create SSH session to Mininet machine, prepare HTTP client session to Controller.
211 ... Figure out latest pcc-mock version and download it from Nexus to Mininet.
212 ... Also, delete and create directories for json diff handling.
213 KarafKeywords.Setup_Karaf_Keywords
214 TemplatedRequests.Create_Default_Session
215 NexusKeywords.Initialize_Artifact_Deployment_And_Usage
216 ${current_connection} SSHLibrary.Get_Connection
217 ${current_prompt} BuiltIn.Set_Variable ${current_connection.prompt}
218 BuiltIn.Log ${current_prompt}
219 BuiltIn.Set_Suite_Variable ${prompt} ${current_prompt}
220 RequestsLibrary.Create_Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
221 ${name} NexusKeywords.Deploy_Test_Tool bgpcep pcep-pcc-mock
222 BuiltIn.Set_Suite_Variable ${filename} ${name}
223 #Setting Pcc Name and its code for mapping for templates
224 FailFast.Do_Not_Fail_Fast_From_Now_On
225 ${ERROR_ARGS} CompareStream.Set_Variable_If_At_Least_Neon ${NEW_ERROR_ARGS} ${OLD_ERROR_ARGS}
226 BuiltIn.Set_Suite_Variable ${ERROR_ARGS}
229 [Documentation] Download pccmock.log and Log its contents.
230 ... Compute and Log the diff between expected and actual normalized responses.
231 ... Close both HTTP client session and SSH connection to Mininet.
232 SSHLibrary.Get_File pccmock.log
233 ${pccmocklog} OperatingSystem.Run cat pccmock.log
234 BuiltIn.Log ${pccmocklog}
235 RequestsLibrary.Delete_All_Sessions
236 SSHLibrary.Close_All_Connections
239 [Documentation] Try to access pcep topology with wrong password, should get empty topology
240 TemplatedRequests.Get_As_Json_Templated
241 ... ${DIR_WITH_TEMPLATES}${/}default_off
242 ... session=${CONFIG_SESSION}
245 Read_Text_Before_Prompt
246 [Documentation] Log text gathered by SSHLibrary.Read_Until_Prompt.
247 ... This needs to be a separate keyword just because how Read_And_Fail_If_Prompt_Is_Seen is implemented.
248 ${text} SSHLibrary.Read_Until_Prompt
251 Replace_Password_On_Pcep_Node
252 [Documentation] Send restconf PUT to replace the config module specifying PCEP password element.
253 [Arguments] ${password}
254 &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} PASSWD=${password}
255 TemplatedRequests.Put_As_Xml_Templated ${DIR_WITH_TEMPLATES}${/}pcep_topology_node mapping=${mapping}
257 Unset_Password_On_Pcep_Node
258 [Documentation] Send restconf PUT to unset the config module.
259 &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP}
260 TemplatedRequests.Put_As_Xml_Templated ${DIR_WITH_TEMPLATES}${/}pcep_topology_node_empty mapping=${mapping}
263 [Documentation] Send ctrl+c to pcc-mock, fails if no prompt is seen
264 ... after 3 seconds (the default for SSHLibrary)
265 RemoteBash.Write_Bare_Ctrl_C
266 ${output} SSHLibrary.Read_Until_Prompt
267 BuiltIn.Log ${output}
269 Start_Pcc_Mock_Tool_With_Password
270 [Documentation] Starts pcc-mock with password argument.
271 [Arguments] ${password}
272 ${command} NexusKeywords.Compose_Full_Java_Command
273 ... -jar ${filename} --password ${password} --reconnect 1 --local-address ${TOOLS_SYSTEM_IP} --remote-address ${ODL_SYSTEM_IP} 2>&1 | tee pccmock.log
274 BuiltIn.Log ${command}
275 SSHLibrary.Write ${command}