2 Documentation PCEP performance suite, uses restconf with configurable authentication.
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
13 ... This is a suite which has both scale and performance aspects.
14 ... Given scale target, suite reports failures if functional error
15 ... is detected, or if various time limits expire.
16 ... For passing test cases, their duration is the performance metric.
18 ... ODL acts as a translation layer between PCEP capable devices
19 ... and users employing RESTCONF.
20 ... Performance measurement focuses on two different workflows.
22 ... The first workflow is initial synchronization, when ODL learns
23 ... the state of PCEP topology as devices connect to it,
24 ... while restconf user reads the state repeatedly.
25 ... The second workflow is mass update, when restconf users issue RPCs
26 ... to updale Layer Switched Paths on Path Computation Clients.
28 ... This suite uses pcc-mock (downloaded from Nexus) to simulate PCCs.
29 ... It needs segment of bindable IP addresses,
30 ... one for each simulated PCC; so running pcc-mock from remote machine
31 ... is only viable when just single PCC is simulated.
32 ... Testing with multiple PCCs works best when pcc-mock
33 ... runs on the same VM as ODL, so 127.0.0.0/8 subnet can be used.
35 ... Library AuthStandalone is used directly for restconf reads
36 ... in the first workflow. That library transparently handles several
37 ... http authentication methods, based on credentials and pybot arguments.
39 ... In the second workflow, updater.py utility is used for issuing
40 ... rapid restconf requests. It can use multiple worker threads,
41 ... as http requests are blocking.
42 ... Due to CPython interpreter itself being single threaded,
43 ... amounts of threads above 8-16 are actually slightly slower
44 ... (which may roughly correspond to network traffic
45 ... being more limiting factor than CPU).
46 ... This suite starts updater utility bound to single CPU,
47 ... as this setup was the most performant in other tests.
49 ... In case of failed test case, other tests are skipped (unless
50 ... this is overriden by [Setup]) to finish test run sooner.
52 ... Variables and test case names refer to Controller(ODL_SYSTEM) and Mininet
53 ... (TOOLS_SYSTEM), those are assumed to be separate remote VMs, one to host ODL,
54 ... other to host tools.
55 ... In case updater and pcc-mock are desired to run
56 ... from separate machines, their parameters use Mininet(TOOLS_SYSTEM)
57 ... values as default.
58 ... If both updater VM and pcc-mock VM parameters are specified,
59 ... Mininet(TOOLS_SYSTEM) parameters may be skipped.
60 ... Variable ${USE_TOOLS_SYSTEM} decides the pcc-mock running machine.
62 ... Some launch scripts put restrictions on how pybot options
63 ... can be specified, so there are utility variables to help with
64 ... copying Controller related value to apply fo updater of pccmock.
65 ... Having a tool co-located with ODL reduces network latency,
66 ... but puts more pressure on CPU and memory on Controller VM.
68 ... In some environments, issues with TIME-WAIT prevent high restconf rates,
69 ... so TCP reuse is temporarily allowed during the suite run, if possible
70 ... (and if not disabled by UPDATERVM_ENABLE_TCP_RW_REUSE option value).
71 ... See http://vincent.bernat.im/en/blog/2014-tcp-time-wait-state-linux.html
72 ... This suite ignores possible failures when changing reuse.
74 ... Similarly, in some environments, handling of requests.Session object matters
75 ... try changing RESTCONF_REUSE value to see if it helps.
77 ... Variables to override (only if needed) in pybot command:
78 ... (Look into Variables table to see the default values.)
80 ... FIRST_PCC_IP: Set in case bind address is different from public pcc-mock VM address.
81 ... LOG_NAME: Filename (without path) to save pcc-mock output into.
82 ... LOG_PATH: Override if not the same as pccmock VM workspace.
83 ... LSPS: Number of LSPs per PCC to simulate and test.
84 ... MOCK_FILE: Filename to use for mock-pcc executable instead of the timestamped one.
85 ... ODL_SYSTEM_IP: Numeric IP address of VM where ODL runs.
86 ... ODL_SYSTEM_USER: Username for ssh login to ODL VM.
87 ... ODL_SYSTEM_PASSWORD: Ssh password, empty means public keys are used instead.
88 ... ODL_SYSTEM_PROMPT: Substring to identify Linux prompt on ODL VM.
89 ... ODL_SYSTEM_WORKSPACE: Path to where files can be written on ODL VM.
90 ... PCCDOWNLOAD_HOSTHEADER: Download server may check checks this header before showing content.
91 ... PCCDOWNLOAD_URLBASE: URL to pcep-pcc-mock folder in Nexus (use numberic IP if DNS has problems).
92 ... PCCMOCK_COLOCATED: If True, set PCCMOCKVM* to mirror ODL_SYSTEM*
93 ... PCCMOCKVM_IP: Override TOOLS_SYSTEM for pcc-mock usage.
94 ... PCCMOCKVM_*: Override corresponding TOOLS_SYSTEM_* for pcc-mock usage.
95 ... PCCS: Number of PCCs to simulate and test.
96 ... PCEP_READY_VERIFY_TIMEOUT: Grace period for pcep-topology to appear. Lower if ODL is ready.
97 ... RESTCONF_*: USER, PASSWORD and SCOPE to authenticate with, REUSE session.
98 ... (Note: If SCOPE is not empty, token-based authentication is used.)
99 ... TOOLS_SYSTEM_IP: Numeric IP address of VM to run pcc-mock and updater from by default.
100 ... TOOLS_SYSTEM_PASSWORD: Linux password to go with the username (empty means keys).
101 ... TOOLS_SYSTEM_PROMPT: Substring to identify Linux prompt on TOOLS_SYSTEM VM.
102 ... TOOLS_SYSTEM_USER: Linux username to SSH to on TOOLS_SYSTEM VM.
103 ... TOOLS_SYSTEM_WORKSPACE: Path to where files may be created on TOOLS_SYSTEM VM.
104 ... UPDATER_COLOCATED: If True, overrides UPDATERVM_* parameters to point at ODL_SYSTEM
105 ... (The purpose is to provide an option without ability to unpack ODL_SYSTEM value.)
106 ... UPDATER_ODLADDRESS: Override if public ODL_SYSTEM address is not best fit.
107 ... UPDATER_REFRESH: Main updater thread may sleep this long. Balance precision with overhead.
108 ... UPDATER_TIMEOUT: If updater stops itself if running more than this time.
109 ... (Set this limit according to your performance target.)
110 ... UPDATERVM_ENABLE_TCP_RW_REUSE: Set to false if changing Linux configuration is not desired.
111 ... UPDATERVM_IP: Override TOOLS_SYSTEM for updater.py usage.
112 ... UPDATERVM_*: Override corresponding TOOLS_SYSTEM_* for updater.py usage.
114 Library SSHLibrary timeout=10s
115 Library RequestsLibrary
116 Library ${CURDIR}/../../../libraries/AuthStandalone.py
117 Resource ${CURDIR}/../../../variables/Variables.robot
118 Resource ${CURDIR}/../../../libraries/BGPcliKeywords.robot
119 Resource ${CURDIR}/../../../libraries/FailFast.robot
120 Resource ${CURDIR}/../../../libraries/NexusKeywords.robot # for Deploy_Artifact
121 Resource ${CURDIR}/../../../libraries/SSHKeywords.robot # for Require_* and Assure_*, Flexible_SSH_Login
123 Suite Setup Initial Setup
124 Suite Teardown Disconnect
125 Test Setup FailFast.Fail_This_Fast_On_Previous_Error
126 Test Teardown FailFast.Start_Failing_Fast_If_This_Failed
130 # This Variable decides the pcc mock to run in ODL system or tools system.
131 ${USE_TOOLS_SYSTEM} False
132 # This table acts as an exhaustive list of variables users can modify on pybot invocation.
133 # It also contains commented-out lines for variables defined elswhere.
134 # Keep this list in alphabetical order.
137 ${FIRST_PCC_IP} ${PCCMOCKVM_IP}
138 # ${LOG_FILE} is reserved for location of pybot-created log.html
139 ${INIT_PCC_DEVICE_COUNT} ${100}
140 ${LOG_NAME} throughpcep.log
141 ${LOG_PATH} ${PCCMOCKVM_WORKSPACE}
143 #Reduced max pcc device count to 100 for BGPCEP-901
144 ${MAX_PCC_DEVICE_COUNT} ${100}
145 ${ODL_SYSTEM_WORKSPACE} /tmp
146 ${PARALLEL_ITERATION} 10
147 ${PCC_DEVICE_INCREMENT} ${50}
148 ${PCCDOWNLOAD_HOSTHEADER} nexus.opendaylight.org
149 ${PCCDOWNLOAD_URLBASE}
150 ... http://${PCCDOWNLOAD_HOSTHEADER}/content/repositories/opendaylight.snapshot/org/opendaylight/bgpcep/pcep-pcc-mock/
151 ${PCCMOCK_COLOCATED} False
152 ${PCCMOCKVM_IP} ${TOOLS_SYSTEM_IP}
153 ${PCCMOCKVM_PASSWORD} ${TOOLS_SYSTEM_PASSWORD}
154 ${PCCMOCKVM_PROMPT} ${TOOLS_SYSTEM_PROMPT}
155 ${PCCMOCKVM_USER} ${TOOLS_SYSTEM_USER}
156 ${PCCMOCKVM_WORKSPACE} ${TOOLS_SYSTEM_WORKSPACE}
158 ${PCEP_READY_VERIFY_TIMEOUT} 300s
159 # Yes, the default timeout is 5 minutes, as this suite might be started eagerly just after ODL starts booting up.
160 ${RESTCONF_PASSWORD} ${PWD} # from Variables.robot
161 ${RESTCONF_REUSE} True
162 ${RESTCONF_SCOPE} ${EMPTY}
163 ${RESTCONF_USER} ${USER} # from Variables.robot
164 ${SEQUENTIAL_ITERATION} 15
165 ${TOOLS_SYSTEM_WORKSPACE} /tmp
166 ${UPDATER_COLOCATED} False
167 ${UPDATER_ODLADDRESS} ${ODL_SYSTEM_IP}
168 ${UPDATER_REFRESH} 0.1
169 # Updater timeout is overwritten in releng/builder
170 ${UPDATER_TIMEOUT} 300
171 ${UPDATERVM_ENABLE_TCP_RW_REUSE} True
172 ${UPDATERVM_IP} ${TOOLS_SYSTEM_IP}
173 ${UPDATERVM_PASSWORD} ${TOOLS_SYSTEM_PASSWORD}
174 ${UPDATERVM_PROMPT} ${TOOLS_SYSTEM_PROMPT}
175 ${UPDATERVM_USER} ${TOOLS_SYSTEM_USER}
176 ${UPDATERVM_WORKSPACE} ${TOOLS_SYSTEM_WORKSPACE}
181 [Documentation] Open SSH session to updater VM, copy the utility there, including dependencies, also prepare direct http session.
182 IF ${UPDATER_COLOCATED} Updater_From_Controller
183 SSHLibrary.Open_Connection ${UPDATERVM_IP} alias=updater
184 SSHLibrary.Set_Client_Configuration timeout=20s
185 SSHLibrary.Set_Client_Configuration prompt=${UPDATERVM_PROMPT}
186 SSHKeywords.Flexible_SSH_Login ${UPDATERVM_USER} ${UPDATERVM_PASSWORD} delay=4s
187 SSHKeywords.Require_Python
188 SSHLibrary.Put_File ${CURDIR}/../../../../tools/pcep_updater/updater.py ${UPDATERVM_WORKSPACE}/
189 SSHLibrary.Put_File ${CURDIR}/../../../libraries/AuthStandalone.py ${UPDATERVM_WORKSPACE}/
190 SSHKeywords.Assure_Library_Counter target_dir=${UPDATERVM_WORKSPACE}
191 SSHKeywords.Assure_Library_Ipaddr target_dir=${UPDATERVM_WORKSPACE}
192 # Done preparation of Updater VM, now use AuthStandalone to create session from robot VM too.
193 BuiltIn.Log_Many ${RESTCONF_USER} ${RESTCONF_PASSWORD} ${RESTCONF_SCOPE} ${ODL_SYSTEM_IP}
194 ${session} = AuthStandalone.Init_Session
197 ... ${RESTCONF_PASSWORD}
198 ... ${RESTCONF_SCOPE}
199 BuiltIn.Set_Suite_Variable ${rest_session} ${session}
200 # TODO: Define http timeouts.
202 Save_And_Enable_Tcp_Rw_Reuse
203 [Documentation] If requested, temporarily enable TCP port reuse on Updater VM to allow for high rate of TCP connections. Do not start failing fast.
204 BuiltIn.Pass_Execution_If not ${UPDATERVM_ENABLE_TCP_RW_REUSE} Manipulation of tcp_rw_reuse is not requested.
205 ${old_value} = SSHLibrary.Execute_Command cat /proc/sys/net/ipv4/tcp_tw_reuse
206 # The next line may be skipped if the previous line failed.
207 BuiltIn.Set_Suite_Variable ${tcp_rw_reuse} ${old_value}
208 ${out} ${rc} = SSHLibrary.Execute_Command
209 ... sudo bash -c "echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse"
211 BuiltIn.Should_Be_Equal ${rc} ${0}
212 # Lack of sudo access should not prevent the rest of suite from trying without TCP reuse.
213 [Teardown] Do_Not_Start_Failing_If_This_Failed
215 Topology_Precondition
216 [Documentation] Verify that within timeout, PCEP topology is present, with no PCC connected.
219 Builtin.Wait_Until_Keyword_Succeeds ${PCEP_READY_VERIFY_TIMEOUT} 1s Pcep_Off
220 # Yes, timeout is 5 minutes, as this suite might be started eagerly just after ODL starts booting up.
222 Topology_Intercondition
223 [Documentation] Verify that within timeout, PCEP topology contains correct numbers of LSPs.
225 [Setup] Start_Pcc_Mock
226 ${localsize} = Evaluate int(${PCCS})*int(${LSPS})
227 Builtin.Set_Suite_Variable ${size} ${localsize}
229 Builtin.Wait_Until_Keyword_Succeeds 120s 1s Pcep_On
230 # TODO: Make timeout value scale with ${size}?
233 [Documentation] Run updater tool to change hops, using 1 blocking http thread.
236 [Teardown] Do_Not_Start_Failing_If_This_Failed
239 [Documentation] Verify that within timeout, the correct number of new hops is in PCEP topology.
244 [Documentation] Run updater tool to change hops again, using 2 blocking http threads.
247 [Teardown] Do_Not_Start_Failing_If_This_Failed
250 [Documentation] Verify that within timeout, the correct number of new hops is in PCEP topology.
255 [Documentation] Run updater tool to change hops again, using 4 blocking http threads.
258 [Teardown] Do_Not_Start_Failing_If_This_Failed
261 [Documentation] Verify that within timeout, the correct number of new hops is in PCEP topology.
266 [Documentation] Run updater tool to change hops again, using 8 blocking http threads.
269 [Teardown] Do_Not_Start_Failing_If_This_Failed
272 [Documentation] Verify that within timeout, the correct number of new hops is in PCEP topology.
277 [Documentation] Run updater tool to change hops again, using 16 blocking http threads.
280 [Teardown] Do_Not_Start_Failing_If_This_Failed
283 [Documentation] Verify that within timeout, the correct number of new hops is in PCEP topology.
288 [Documentation] Run updater tool to change hops again, using 32 blocking http threads.
291 [Teardown] Do_Not_Start_Failing_If_This_Failed
294 [Documentation] Verify that within timeout, the correct number of new hops is in PCEP topology.
299 [Documentation] Run updater tool to change hops again, using 64 blocking http threads.
302 [Teardown] Do_Not_Start_Failing_If_This_Failed
305 [Documentation] Verify that within timeout, the correct number of new hops is in PCEP topology.
310 [Documentation] Run updater tool to change hops again, using 128 blocking http threads.
313 [Teardown] Do_Not_Start_Failing_If_This_Failed
316 [Documentation] Verify that within timeout, the correct number of new hops is in PCEP topology.
321 [Documentation] Run updater tool to change hops again, using 256 blocking http threads.
324 [Teardown] Do_Not_Start_Failing_If_This_Failed
327 [Documentation] Verify that within timeout, the correct number of new hops is in PCEP topology.
332 [Documentation] Run updater tool to change hops again, using 512 blocking http threads.
335 [Teardown] Do_Not_Start_Failing_If_This_Failed
338 [Documentation] Verify that within timeout, the correct number of new hops is in PCEP topology.
342 Updater_with delegate
343 [Documentation] Run updater tool to revoke the delegate for the given hop, using 1 blocking http thread.
345 Updater 10 1 127.1.0.0 ${PCCS} ${LSPS} True false 127.1.0.1 2
347 [Teardown] Do_Not_Start_Failing_If_This_Failed
349 PCEP_sessions_from_multiple_machines
350 [Documentation] Download and start PCC Mock in tools vm and do updation
352 ... ${TOOLS_SYSTEM_IP}
353 ... ${TOOLS_SYSTEM_USER}
354 ... ${TOOLS_SYSTEM_PASSWORD}
355 ... ${TOOLS_SYSTEM_PROMPT}
358 Start_Pcc_Mock pccmock_toolsvm ${TOOLS_SYSTEM_IP} ${PCCS} ${LSPS} throughpcep_tools.log
359 ${total_size} = BuiltIn.Evaluate int(${size})+int(${LSPS})
360 Builtin.Set_Suite_Variable ${size} ${total_size}
362 Builtin.Wait_Until_Keyword_Succeeds 120s 1s Pcep_On
363 ${second_pcc_lsp_size} = BuiltIn.Evaluate int(${LSPS})
364 Builtin.Set_Suite_Variable ${size} ${second_pcc_lsp_size}
365 Updater 10 1 ${TOOLS_SYSTEM_IP}
366 Builtin.Set_Suite_Variable ${size} ${total_size}
368 SSHLibrary.Switch_Connection pccmock_toolsvm
369 SSHLibrary.Get_File ${LOG_PATH}/throughpcep_tools.log throughpcep_tools.log
370 BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt
371 Kill all pcc mock simulator processes pccmock_toolsvm
372 [Teardown] Run Keywords BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt AND Kill all pcc mock simulator processes
375 [Documentation] Send ctrl+c to pcc-mock, see prompt again within timeout.
376 [Setup] Run_Even_When_Failing_Fast
377 SSHLibrary.Switch_Connection pccmock
378 BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt
379 [Teardown] Run Keywords Kill all pcc mock simulator processes AND Builtin.Wait_Until_Keyword_Succeeds ${PCEP_READY_VERIFY_TIMEOUT} 5s Pcep_Off
381 PCEP Sessions Flapped with LSP updates
382 [Documentation] Flapping PCEP sessions and perform LSP updates within flapping
383 IF '${USE_TOOLS_SYSTEM}' == 'True'
384 BuiltIn.Pass Execution Pcc Mock should not run in ODL System
386 FOR ${devices} IN RANGE ${INIT_PCC_DEVICE_COUNT} ${MAX_PCC_DEVICE_COUNT+1} ${PCC_DEVICE_INCREMENT}
387 Flap Pcc Mock sessions continuously with LSP updates 127.1.0.0 ${devices} 150
389 [Teardown] Run Keywords Kill all pcc mock simulator processes AND BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt
391 PCEP Sessions Flapped alongside LSP updates
392 [Documentation] Flapping PCEP sessions and perform LSP updates alongside flapping
393 IF '${USE_TOOLS_SYSTEM}' == 'True'
394 BuiltIn.Pass Execution Pcc Mock should not run in ODL System
396 FOR ${devices} IN RANGE ${INIT_PCC_DEVICE_COUNT} ${MAX_PCC_DEVICE_COUNT+1} ${PCC_DEVICE_INCREMENT}
397 Flap Pcc Mock sessions parallelly with LSP updates 127.1.0.0 ${devices} 150
398 BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt
400 [Teardown] Run Keywords Kill all pcc mock simulator processes AND BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt
403 [Documentation] Transfer pcc-mock output from pcc-mock VM to robot VM.
404 [Setup] Run_Even_When_Failing_Fast
405 SSHLibrary.Get_File ${LOG_PATH}/${LOG_NAME} ${LOG_NAME}
406 SSHLibrary.Get_File ${LOG_PATH}/serial_execution.log serial_execution.log
407 SSHLibrary.Get_File ${LOG_PATH}/throughpcep_parallel_Execution.log
409 Topology_Postcondition
410 [Documentation] Verify that within timeout, PCEP topology contains no PCCs again.
412 [Setup] Run_Even_When_Failing_Fast
413 Builtin.Wait_Until_Keyword_Succeeds 90s 5s Pcep_Off_Again
416 [Documentation] If requested, restore the old value if enabling TCP reuse was successful on Updater VM.
417 [Setup] Run_Even_When_Failing_Fast
418 BuiltIn.Pass_Execution_If not ${UPDATERVM_ENABLE_TCP_RW_REUSE} Manipulation of tcp_rw_reuse is not requested.
419 SSHLibrary.Switch_Connection updater
420 BuiltIn.Variable_Should_Exist ${tcp_rw_reuse}
421 ${out} ${rc} = SSHLibrary.Execute_Command
422 ... sudo bash -c "echo ${tcp_rw_reuse} > /proc/sys/net/ipv4/tcp_tw_reuse"
424 BuiltIn.Should_Be_Equal ${rc} ${0}
429 FailFast.Do_Not_Fail_Fast_From_Now_On
430 Select_mock_machine_and_Download_PCC_Mock
432 Select_mock_machine_and_Download_PCC_Mock
437 [Documentation] Check the tools system variable and assigns the PCC Mock
438 IF '${USE_TOOLS_SYSTEM}' == 'False'
439 Pccmock_From_Odl_System
440 Updater_From_Odl_System
442 BuiltIn.Set_Suite_Variable ${FIRST_PCC_IP} ${PCCMOCKVM_IP}
445 [Documentation] SSH login to pcc-mock VM, download latest pcc-mock executable from Nexus.
446 [Arguments] ${pcc_ip}=${PCCMOCKVM_IP} ${pcc_user}=${PCCMOCKVM_USER} ${pcc_password}=${PCCMOCKVM_PASSWORD} ${pcc_prompt}=${PCCMOCKVM_PROMPT} ${ssh_alias}=pccmock
447 IF ${PCCMOCK_COLOCATED} Pccmock_From_Controller
448 NexusKeywords.Initialize_Artifact_Deployment_And_Usage tools_system_connect=False
449 SSHLibrary.Open_Connection ${pcc_ip} alias=${ssh_alias}
450 SSHLibrary.Set_Client_Configuration timeout=10s
451 SSHLibrary.Set_Client_Configuration prompt=${pcc_prompt}
452 SSHKeywords.Flexible_SSH_Login ${pcc_user} ${pcc_password} delay=4s
453 ${file_name} = NexusKeywords.Deploy_Test_Tool bgpcep pcep-pcc-mock
454 BuiltIn.Set_Suite_Variable ${mock_location} ${file_name}
457 [Documentation] Launch pcc-mock on background so simulated PCCs start connecting to controller.
458 [Arguments] ${ssh_alias}=pccmock ${mock-ip}=${FIRST_PCC_IP} ${pccs}=${PCCS} ${lsps}=${LSPS} ${log_name}=${LOG_NAME}
459 SSHLibrary.Switch_Connection ${ssh_alias}
460 ${command} = NexusKeywords.Compose_Full_Java_Command
461 ... -jar ${mock_location} --local-address ${mock-ip} --remote-address ${ODL_SYSTEM_IP} --pcc ${pccs} --lsp ${lsps} &> ${LOG_PATH}/${log_name}
462 BuiltIn.Log ${command}
463 SSHLibrary.Write ${command}
464 # The pccmock SSH session is left alive, but no data will be exchanged for a while.
465 # We need this connection to stay alive to send ctrl+c later.
466 # SSHLibrary.Start_Command would not do that for us.
468 Pccmock_From_Odl_System
469 [Documentation] Copy Odl_System values to Pccmock VM variables.
470 BuiltIn.Set_Suite_Variable ${PCCMOCKVM_IP} ${ODL_SYSTEM_IP}
471 BuiltIn.Set_Suite_Variable ${PCCMOCKVM_PASSWORD} ${ODL_SYSTEM_PASSWORD}
472 BuiltIn.Set_Suite_Variable ${PCCMOCKVM_PROMPT} ${ODL_SYSTEM_PROMPT}
473 BuiltIn.Set_Suite_Variable ${PCCMOCKVM_WORKSPACE} ${ODL_SYSTEM_WORKSPACE}
474 BuiltIn.Set_Suite_Variable ${LOG_PATH} ${ODL_SYSTEM_WORKSPACE}
476 Updater_From_Odl_System
477 [Documentation] Copy Odl_System values to Uprater VM variables.
478 BuiltIn.Set_Suite_Variable ${UPDATERVM_IP} ${ODL_SYSTEM_IP}
479 BuiltIn.Set_Suite_Variable ${UPDATERVM_PASSWORD} ${ODL_SYSTEM_PASSWORD}
480 BuiltIn.Set_Suite_Variable ${UPDATERVM_PROMPT} ${ODL_SYSTEM_PROMPT}
481 BuiltIn.Set_Suite_Variable ${UPDATERVM_WORKSPACE} ${ODL_SYSTEM_WORKSPACE}
484 [Documentation] Explicitly close all SSH connections.
485 SSHLibrary.Close_All_Connections
486 # TODO: Make AuthStandalone session object closable?
488 Get_Pcep_Topology_Data
489 [Documentation] Use session object to download PCEP topology JSON. Check status and return Response object.
490 ${resp} = AuthStandalone.Get_Using_Session
492 ... data/${TOPOLOGY_URL}\=pcep-topology?content\=nonconfig
493 # Not Logging content, as it may be huge.
494 BuiltIn.Should_Be_Equal ${resp.status_code} ${200}
497 Get_Pcep_Topology_Count
498 [Documentation] Get topology data, return number of pattern matches.
499 [Arguments] ${pattern}
500 ${resp} = Get_Pcep_Topology_Data
501 # BuiltIn.Log ${resp.text}
502 ${count} = BuiltIn.Evaluate len(re.findall('${pattern}', '''${resp.text}''')) modules=re
507 [Documentation] Get topology data, Log content and assert the exact JSON of empty topology.
508 ${resp} = Get_Pcep_Topology_Data
509 # Used before topology had chance to grow huge. Be aware when creating a longevity suite from this.
510 BuiltIn.Log ${resp.text}
511 BuiltIn.Should_Be_Equal
513 ... {"network-topology:topology":[{"topology-id":"pcep-topology","topology-types":{"network-topology-pcep:topology-pcep":{}}}]}
516 [Documentation] Get topology count of current hop, assert the number of matches.
517 # Suite variables ${size} and ${hop} are set elsewhere.
518 ${resp} = Get_Pcep_Topology_Count ${hop}
519 BuiltIn.Should_Be_Equal ${resp} ${size}
522 [Documentation] Get topology count of final hop, assert there is none.
523 ... This is more log friendly than Pcep_Off keyword, as it does not Log possibly large content.
525 ${resp} = Get_Pcep_Topology_Count ${hop}
526 BuiltIn.Should_Be_Equal ${resp} ${0}
529 [Documentation] Set pattern to match the currently expected hop.
530 [Arguments] ${iteration}
531 ${i} = BuiltIn.Evaluate str(1 + int(${iteration}))
532 # Regular Expressions need a dot to be escaped to represent a dot.
533 BuiltIn.Set_Suite_Variable ${hop} ${i}\.${i}\.${i}\.${i}/32
537 [Documentation] Compute number of workers, call updater.py, assert its response.
538 [Arguments] ${iteration} ${workers} ${mock-ip}=${FIRST_PCC_IP} ${pccs}=${PCCS} ${lsps}=${LSPS} ${parallel}=False ${delegate}=true ${pccip}=${none} ${tunnel_no}=${none}
539 SSHLibrary.Switch_Connection pccmock
540 # In some systems, inactive SSH sessions get severed.
541 ${command} = BuiltIn.Set_Variable echo "still alive"
542 ${output} = SSHLibrary.Execute_Command bash -c '${command}'
543 # The previous line relies on a fact that Execute_Command spawns separate shels, so running pcc-mock is not affected.
545 SSHLibrary.Switch_Connection updater
546 ${response} = SSHLibrary.Execute_Command
547 ... bash -c "cd ${UPDATERVM_WORKSPACE}; taskset 0x00000001 python3 updater.py --workers '${workers}' --odladdress '${UPDATER_ODLADDRESS}' --user '${RESTCONF_USER}' --password '${RESTCONF_PASSWORD}' --scope '${RESTCONF_SCOPE}' --pccaddress '${mock-ip}' --pccs '${pccs}' --lsps '${lsps}' --hop '${hop}' --timeout '${UPDATER_TIMEOUT}' --refresh '${UPDATER_REFRESH}' --reuse '${RESTCONF_REUSE}' --delegate '${delegate}' --pccip '${pccip}' --tunnelnumber '${tunnel_no}' 2>&1"
548 Check Updater response ${response} ${parallel}
550 Check Updater response
551 [Arguments] ${response} ${parallel}
552 BuiltIn.Log ${response}
553 ${expected_value_continuous_execution} = BuiltIn.Set_Variable Counter({'pass': ${size}})
554 ${not_expected_value_for_parallel_execution} = BuiltIn.Set_Variable Counter({'pass': 0})
555 BuiltIn.Log ${expected_value_continuous_execution}
556 IF '${parallel}' == 'False'
557 BuiltIn.Should_Contain ${response} ${expected_value_continuous_execution}
559 BuiltIn.Should_Not_Contain ${response} ${not_expected_value_for_parallel_execution}
563 [Documentation] Set hop and verify that within timeout, all LSPs in topology are updated.
564 [Arguments] ${iteration}
566 Builtin.Wait_Until_Keyword_Succeeds 30s 1s Pcep_On
568 Flap Pcc Mock sessions continuously with LSP updates
569 [Arguments] ${mock-ip}=${FIRST_PCC_IP} ${pccs}=${PCCS} ${lsps}=${LSPS}
570 ${localsize} = Evaluate int(${pccs})*int(${lsps})
571 Builtin.Set_Suite_Variable ${size} ${localsize}
572 ${workers} = Set Variable ${BLOCKING-THREAD}
573 FOR ${i} IN RANGE ${SEQUENTIAL_ITERATION}
574 ${workers} = Evaluate ${workers}*${workers}
576 Builtin.Wait_Until_Keyword_Succeeds ${PCEP_READY_VERIFY_TIMEOUT} 5s Pcep_Off
577 Start_Pcc_Mock pccmock ${mock-ip} ${pccs} ${lsps} serial_execution.log
578 Builtin.Wait_Until_Keyword_Succeeds 60s 5s Pcep_On
579 ${i} = Evaluate ${i}+1
580 Updater ${i} ${workers} 127.1.0.0 ${pccs} ${lsps}
582 SSHLibrary.Switch_Connection pccmock
583 BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt
587 Flap Pcc Mock sessions parallelly with LSP updates
588 [Arguments] ${mock-ip}=${FIRST_PCC_IP} ${pccs}=${PCCS} ${lsps}=${LSPS}
589 SSHLibrary.Switch_Connection pccmock
590 SSHLibrary.Put File ${CURDIR}/../../../../tools/pcep_updater/mock.sh /tmp/mock.sh
592 Builtin.Wait_Until_Keyword_Succeeds ${PCEP_READY_VERIFY_TIMEOUT} 5s Pcep_Off
593 SSHLibrary.Start Command
594 ... sh /tmp/mock.sh ${mock_location} ${mock-ip} ${ODL_SYSTEM_IP} ${pccs} ${lsps} parallel_Execution ${DELAY_TIME} &>1
595 FOR ${i} IN RANGE ${PARALLEL_ITERATION}
596 ${pid} = SSHLibrary.Execute Command
597 ... ps -fu ${ODL_SYSTEM_USER} | grep "/home/${ODL_SYSTEM_USER}/${mock_location}" | grep -v "grep" | awk '{print $2}'
598 IF '${pid}'!= "" Log ${pid}
599 ${i} = Evaluate ${i}+1
601 Updater ${i} 1 127.1.0.0 ${pccs} ${lsps} True
604 BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt
605 Kill all pcc mock simulator processes
609 [Documentation] Check PCEP topology with default pcc and lsp values
610 ${localsize} = Evaluate int(${PCCS})*int(${LSPS})
611 Builtin.Set_Suite_Variable ${size} ${localsize}
612 Builtin.Wait_Until_Keyword_Succeeds 90s 5s Pcep_Off_Again
614 Builtin.Wait_Until_Keyword_Succeeds 60s 5s Pcep_On
617 SSHLibrary.Switch_Connection pccmock
618 BGPcliKeywords.Stop_Console_Tool_And_Wait_Until_Prompt
620 Kill all pcc mock simulator processes
621 [Arguments] ${ssh_alias}=pccmock
622 SSHLibrary.Switch_Connection ${ssh_alias}
623 ${mock_pid} = Get pid /home/${ODL_SYSTEM_USER}/${mock_location}
624 SSHLibrary.Execute_Command kill -9 ${mock_pid}
625 ${script_pid_1} = Get pid bash -c sh /tmp/mock.sh
626 SSHLibrary.Execute_Command kill -9 ${script_pid_1}
627 ${script_pid_2} = Get pid sh /tmp/mock.sh
628 SSHLibrary.Execute_Command kill -9 ${script_pid_2}
631 [Arguments] ${process_name}
632 ${pid} = SSHLibrary.Execute Command
633 ... ps -fu ${ODL_SYSTEM_USER} | grep "${process_name}" | grep -v "grep" | awk '{print $2}'