aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/PapiExecutor.py
AgeCommit message (Collapse)AuthorFilesLines
2024-01-22feat(papi): Tolerate behavior after 39871Vratko Polak1-14/+31
Even when VPP switches back to (or adds support for) the old behavior, this enables bisect to work for all VPP commits in 2402 cycle. Change-Id: Ic2b71bee1db723d9d13229d9f4288d1699d246c6 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2023-08-17feat(swasync): switch to polling modeVratko Polak1-0/+1
Performance of adaptive mode is bad (different bug), keep continuity of ipsec swasync tests (when VPP allows). As 23.06-release does not have the new API message, the new CSIT code needs to be more careful around CRC checking. + Add new crc collection with the new API call used. + Also keep the old collection so older VPP does not fail. + Document how papi executor works with VPP without a message. + Prevent CRC checker from raising bodus errors with old VPP. Change-Id: I9ff933a8a9558289d22d55526905d63e7894378c Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2023-01-16feat(papi): add async mode, use it in scale callsVratko Polak1-136/+377
+ Introduce two explicit handling modes to save memory in scale test. + Connect in async mode for both handling modes (to avoid reconnects). + Support both pre- and post-37758 VPP PAPI async behavior. + Use control-ping in dumps to emulate sync mode. + Do not use it for single reply to avoid VPP-2033. + Fix call sites to get their replies with correct handling mode. + Drain enqueued replies to avoid subsequent errors. + Retry if read returns None too early. + Update docstrings. - Complexity issues reported by pylint postponed, needs larger refactor. - Explicit replace of VAT is done in subsequent changes. Ticket: CSIT-1547 CSIT-1671 Change-Id: I3c63fa5c578975cc4dd7fce0babe3ab04ec15ed3 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2023-01-16style(papi): reformat code before real changesVratko Polak1-111/+144
Used black (with line length overridden to 80). Also manually removed u from inside f strigs. Change-Id: I5be354e744a697ac68f781b08159de6d1fbdc07e Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2021-11-25PAPI: Include more details in PAPI fail messageVratko Polak1-3/+4
This helps to distinguish different symptoms for PAL failure alerting. Change-Id: Idd8e8f4b427641fa055516bdf17715f6b967ca72 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2021-05-12PAPI stats: Use single dumpVratko Polak1-0/+2
There is only one call site (VppCounters.vpp_show_runtime) which uses a single path ("^/sys/node"), so we do not need to split the replies anymore. This simplifies investigating bugs related to VPP stats. Change-Id: Idfc029c795cd78cf6d41c2f461f7844aed53410d Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2021-02-17PAPI: Python 3.8 compatibilitypmikus1-5/+7
Signed-off-by: pmikus <pmikus@cisco.com> Change-Id: I33fefddda9055524c1817b13b5c99bb1b97ebff4
2020-12-17PAPI: Cache connected client instancesVratko Polak1-77/+353
Disconnect+connect cycle is expensive and slow. This change tracks connected client instances so later "connect" to the same target uses it. Explicit disconnects are allowed (and executed before VPP ends), but once again disconnected instances are cached and reused, as creating a new instance is more expensive than just connect. + Add missing checks on interfaces being up to appropriate keyword. + Use appropriate keywords. + Add a comment explaining why a simpler keyword is not appropriate. + Improve VPP checks in containers. + Fix the vppctl check to actually work. + Add PAPI check to ensure VPP is really ready. + Delay/reorder checks to make them faster with multiple containers. + Leave some TODOs to improve various lifecycles later. + As we do not stop VPP in test/suite teardown: + One final disconnect is needed, added to __init__.robot teardowns. - Import of the final disconnect keyword is ugly, but it works. - We could use a hashable class for distinguishing node+socket pairs. - Are we connecting to VPP inside VMs? Change-Id: I49cd726740c3e8cae1591c7c84b85a447241228f Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2020-07-23FIX: Log required cli_cmd not "cli_inband"Jan Gelety1-2/+2
Change-Id: If0975b1d54882390c5be418927e2961d0f4c8429 Signed-off-by: Jan Gelety <jgelety@cisco.com> Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-12-17Telemetry: Add more operational dataPeter Mikus1-9/+7
+ Add both NDR and PDR telemetry capture + Speedup sockets + Adjust privileges Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: Ia6fd5d405e6fb410651d8b705c921653753aea10
2019-12-05FIX: Deal with some "pylint: disable=" commentsPeter Mikus1-6/+3
Same rules for all Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: Iaf6b6313750d19132e2f2886e676100878719690
2019-12-05Deal with some "pylint: disable=" commentsVratko Polak1-0/+5
+ When possible, fix the violation. + Else, add a comment: + An explanation (if not already present) and keep disable. + A TODO (if not already present) and remove the disable. - This makes tox job report more pylint violations, but any such violation is fixable and should be fixed. - Although some need to be fixed in VPP, such as enum item long names. Change-Id: I48604b5eda070083d79dff1439620dbd9e798e1f Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-11-28Python3: resources and librariesJan Gelety1-126/+152
Change-Id: I1392c06b1d64f62b141d24c0d42a8e36913b15e2 Signed-off-by: Jan Gelety <jgelety@cisco.com>
2019-10-19Tests: Introduce driver layerPeter Mikus1-1/+1
+ Small bugfixes in various suites Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: I051af0a6da7340fe3f617400370c3846ca5241ab
2019-09-26CSIT-1471: Policer - VAT API to PAPIpremkumarv1-1/+1
Change-Id: I6c7eff8d9cbb196ccb684a45579ac59942351cfe Signed-off-by: premkumarv <preym17@gmail.com>
2019-09-17Update CRC list and support 21997/7Vratko Polak1-15/+18
- Attempt to repair IPsec LispGpe perf suite. + Collection name to reflect the current stable vpp. + Add messages found in CSIT L1 keywords. - Uncommented (instead of deleted) untestable messages. Reasons: - Honeycomb. - Messages used by unused keywords. + Listed reasons. Honeycomb not mentioned if both reasons apply. + Delete CRC items for commands not found in keywords anymore. + Add CRCs from .json.api files (as teardown is hard to execute). + Define and restore alphabetical order. + Add hints to find used API commands (not entirely reliable). + Move used commands to "cmd = " form so hints find them. + Argument to run_cli_command changed from "cmd" to "cli_cmd". + Except also struct.error where IOError is excepted. Change-Id: I61058dbe1e33296908aabd0c13433bb16cfa6adf Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-09-10Refactor getting telemetryPeter Mikus1-13/+39
+ Ability to get stats from CNF via SocketPAPI - Remove obsolete functions Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: I4d1b32a7279244592be96644e4f8a530c4f29a15
2019-09-06Read environment variables in Constants.pyVratko Polak1-14/+1
Instead of using EnsureGlobalVariable, which is clunky to use from Python. As a consequence, all caps variables from Constants.py are used directly and tests/__init__.robot and robot_enhancements.robot are deleted. + Rename the CRC global kill switch based on ci-man review. Change-Id: I10723792475bc83352bf8c3b7f7946ecf885a194 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-09-05Allow CRC checking to be controlled via env varVratko Polak1-2/+15
The plan is to override the default in some (but not all) jobs. The csit-vpp jobs shall do the checking, but vpp-csit jobs shall not (except api-crc job of course) in order to confirm benign changes. Change-Id: If59d17991de3fb0e847113a87e0533a8ee62af7f Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-08-15Reduce disabled pylint to address them not hidePeter Mikus1-1/+1
+ Fixed Qemu - Broad Exception should be addressed - Policer is about to be refactored - Drop search to be refactored Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: I97eb992497ff6334057bf82a0f413387706e17fd
2019-08-14DO_NOT_MERGE CSIT-1194 - Framework easy pylint improvementsMiroslav Los1-1/+2
- force a python2 environment in tox for pylint - let pylint load some compiled modules for member checking - allow locally enabled pylint rules - ignore bad enum names - ignore complexity for code to be refactored by other tickets - broad excepts are acceptable sometimes Signed-off-by: Miroslav Los <miroslav.los@pantheon.tech> Change-Id: If4c3a1b85e8609f074e1de8ce91fc9c4fedbeb38
2019-08-14Revert "Disable CRC checking at runtime"Vratko Polak1-40/+24
Needed to verify CSIT expects the correct CRCs. This reverts commit d541b2b7d99651b53bd21ff75cd5fdacf8472a98. This reverts commit 2dd27f5a638b5231c0f074ca61e6b67fed9d1faf. + Some pylint related improvements since then. + Less and better documented caching to class fields. + Global kill switch in Constants. Change-Id: Id459800744cd93c578eab9c2e84cb9528235b064 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-08-09Bump VPP stable version: socksvrVratko Polak1-1/+1
VPP changed the default socket path in: https://gerrit.fd.io/r/c/vpp/+/21100 Instead of "default", explicit value is used now. It coincides with VPP default one, and is stored in Constants.py (except documentation). The file name for robot side forwarded socket remains, as the path leading to is is different anyway. Change-Id: I0058d16794a3cd04411640c2c8d5fd4ee8cb997d Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-08-08Fix: Deep-copy arguments in papi executorsVratko Polak1-4/+9
Without this, it is not safe to re-use the original argument dicts with additional edits for subsequent commands. Change-Id: Ib4f67d09e6bf7438dfdf7669263957a42c8d4dbe Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-08-07FIX: PylintPeter Mikus1-3/+2
- my bad Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: I8c1f57f6b648b99338f3f6a6ff9ec943082e9bc4
2019-08-02FIX: Disable API checker during runtimePeter Mikus1-3/+0
Change-Id: Id530710aaedc30472d8bcd33d24b7fbcaa7c011b Signed-off-by: Peter Mikus <pmikus@cisco.com>
2019-07-31Add VPP API CRC checkingVratko Polak1-1/+35
+ Include both checking at runtime and standalone static quick check. + Runtime checking does not look for missing messages, as messages belonging to disabled plugins are not visible. + Standalone check script has nice loud output. Change-Id: I1dfc3846d1bcdad0b09017d4ce8edd5028e17e0c Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-07-233n-tsh timeout, testbed tags and ansible updatejuraj.linkes1-1/+1
* disable AVF tests which don't work with x520 * increase VPPApiClient timeout to 14s, as x520 show hardware is slower on Taishan * re-enable vhost and memif tests * remove tx2 mrr daily tag list; no tx2 is used for perf testing * remove taishan workaround * add scipy arm prerequisites and scipy workaround * rework inventories/lf_inventory/hosts; move cpu_microarchitecture to host files Change-Id: I5f10bd07b8146ac3b8be8c54fbb4d924a9373813 Signed-off-by: juraj.linkes <juraj.linkes@pantheon.tech>
2019-07-18Papi socket: except more errors to insert err_msgVratko Polak1-10/+14
Change-Id: Ided91ee2b47dafb6aad83091126294d79f67aeac Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-07-17Use PapiSocketProvider for most PAPI callsVratko Polak1-238/+436
Ticket: CSIT-1541 Ticket: VPP-1722 Ticket: CSIT-1546 + Increase timeout to hide x520 slownes of show hardware detail. - Install sshpass and update ssh client in virl bootstrap. + Added TODOs to remove when CSIT-1546 is fixed. + Enable default socksvr on any startup conf. + Improve OptionString init and repr. - The non-socket executor still kept for stats. + Remove everything unrelated to stats from non-socket executor. - Remove some debug-loooking calls to avoid failures. TODO: Introduce proper parsing to the affected keywords. + Reduce logging from PAPI code to level INFO. - Needs https://gerrit.fd.io/r/20660 to fully work. + Change default values for LocalExecution.run() + Return code check enabled by default. Code is more readable when rc!=0 is allowed explicitly, and the test code will now detect unexpected failures. + Logging disabled by default. Output XML is large already. Important logging can be enabled explicitly. + Restore alphabetical order in common.sh functions. Change-Id: I05882cb6b620ad14638f7404b5ad38c7a5de9e6c Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-07-12PapiExecutor always verifiesVratko Polak1-309/+131
Do not support returning unverified replies anymore. Basically, ".get_replies().verify_replies()" is now just ".get_replies()". This allows fairly large simplifications both at call sites and in PapiExecutor.py + Rename get_dumps to get_details. + Introduce get_reply and get_sw_if_index. + Rename variables holding get_*() value, + e.g. get_stats() value is stored to variable named "stats". + Rename "item" of subsequent loop to hint the type instead. + Rename "details" function argument to "verbose". + Process reply details in place, instead of building new list. - Except hybrid blocks which can return both list or single item. - Except human readable text building blocks. + Rename most similar names to sw_if_index. - Except "vpp_sw_index" and some function names. + Use single run_cli_cmd from PapiExecutor. + Do not chain methods over multiple lines. + Small space gain is not worth readability loss. + Include minor code and docstrings improvement. + Add some TODOs. Change-Id: Ib2110a3d2101a74d5837baab3a58dc46aafc6ce3 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-06-16FIX: IPUtil after vpp api changesJan Gelety1-7/+34
+ do not log all ip_route_add_del api calls to PAPI history in case of scale tests + fix for SRv6 proxy tests + support of more complex structures in api calls/replies in PapiExecutor + update of vpp stable build to version 19.08-rc0~487-gb98dbb1 Change-Id: I9972e126b68ce1cb57f781e3d90ea9b3914de69e Signed-off-by: Jan Gelety <jgelety@cisco.com>
2019-06-19VAT-to-PAPI: VPPCountersTibor Frank1-1/+21
Change-Id: I5954fdd61ead9b4143f8cc4e20294cf8e199e0af Signed-off-by: Tibor Frank <tifrank@cisco.com>
2019-06-19VAT-to-PAPI: NATUtilTibor Frank1-0/+17
Change-Id: Id64bbf899e78c7c55410a8ce608393c22fa596ab Signed-off-by: Tibor Frank <tifrank@cisco.com>
2019-06-19VAT-to-PAPI: VPPUtilsTibor Frank1-0/+28
Change-Id: If4eb592e2718c4564f1f7929ca6ff91c02f074a6 Signed-off-by: Tibor Frank <tifrank@cisco.com>
2019-06-18PAPI: Reduce the amount of logged informationTibor Frank1-1/+1
Change-Id: I5cfd19a9ecca6891232d92d232a159422c0a835e Signed-off-by: Tibor Frank <tifrank@cisco.com>
2019-05-31CSIT-1468: InterfaceUtil migration from VAT to PAPIJan Gelety1-2/+17
Change-Id: I0062710d58996be767a852dc00545fedd60a5c72 Signed-off-by: Jan Gelety <jgelety@cisco.com>
2019-04-15Fix pylint error in PapiExecutorVratko Polak1-52/+26
+ Remove ret_val as it cannot be nonzero outside _execute_papi. + Change indentation to save vertical space. + Return computed values without storing them to variable. + Add TODO to remove duplicated method. + Add missing fields to docstring. + Minor formatting changes. Change-Id: I8e8f41d139de8aff3b76a7fe27ee450e89e8d1de Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-04-01CSIT-1337: Migrate L2Util library from VAT to PAPIJan Gelety1-1/+5
Change-Id: I22879c7bdd100d00216b9528663bf17406169826 Signed-off-by: Jan Gelety <jgelety@cisco.com>
2019-03-27CSIT-1460: Add VPP-stats to PAPI ProviderTibor Frank1-108/+225
Change-Id: I2665700a4948c481585d66c987f94af748f102c3 Signed-off-by: Tibor Frank <tifrank@cisco.com>
2019-03-18PAPI Executor: Add more desciptive error messageTibor Frank1-1/+6
- Add more desciptive error message to the processing of replies. Change-Id: Ie43651370d5754aedf2515438c02ff4aa21bdc46 Signed-off-by: Tibor Frank <tifrank@cisco.com>
2019-03-15PAPI: Add verification of the responseTibor Frank1-32/+137
Change-Id: I86afcaeae865f0af076b8dd974386a83de07bf44 Signed-off-by: Tibor Frank <tifrank@cisco.com>
2019-03-13PAPI: Use Python3 for PapiProviderTibor Frank1-1/+1
Change-Id: I39e237db5cba8311ae11fd709b10a17297f3a729 Signed-off-by: Tibor Frank <tifrank@cisco.com>
2019-03-07Papi: Rename methods argumentTibor Frank1-5/+9
The argument name 'csit_papi_command' must be unique enough as it cannot be repeated in kwargs. - PapiExecutor.add(self, csit_papi_command, **kwargs) - PapiHistory.add_to_papi_history(node, csit_papi_command, papi=True, **kwargs) Change-Id: I243a20d6f03befb149891c37a88e0e6359ea2940 Signed-off-by: Tibor Frank <tifrank@cisco.com>
2019-03-06CSIT-1451: PapiHistoryTibor Frank1-3/+2
Change-Id: Idb51f377fe0c196fbe24aab21c294dad595adcd2 Signed-off-by: Tibor Frank <tifrank@cisco.com>
2019-03-06CSIT-1450: PAPI executorVratko Polak1-111/+245
Change-Id: I4c756cc4b29901184594a728f6184c30cadd9c1a Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-03-04Rename to Constants.pyVratko Polak1-1/+1
Motivation: Make the constants available also for Robot. Restraint: Robotframework user guide says: Because variable files are always imported using a file system path, creating them as classes has some restrictions: Python classes must have the same name as the module they are located. Change-Id: I638ef3fe045db132e366de2e2699638b8637e45e Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2018-12-17FIX: Update PAPI to work with string changes in Python APIJan Gelety1-3/+4
Change-Id: I3b5f0568b5928cf12aaf2a555f52dd9809348579 Signed-off-by: Jan Gelety <jgelety@cisco.com>
2018-11-27CSIT python API introductionJan Gelety1-0/+223
Jira: CSIT-1336 Change-Id: I96d2b0221c5a7466484a82339fc132c5921532d1 Signed-off-by: Jan Gelety <jgelety@cisco.com>