summaryrefslogtreecommitdiff
path: root/dts/framework/remote_session/testpmd_shell.py
AgeCommit message (Collapse)Author
2024-11-19dts: add checksum offload to testpmd shellDean Marx
Add csum_set_hw method to testpmd shell class. Signed-off-by: Dean Marx <[email protected]> Reviewed-by: Patrick Robb <[email protected]>
2024-11-19dts: add testpmd port queue modificationDean Marx
This patch adds methods for querying and modifying port queue state and configuration. In addition to this, it also adds the ability to capture the forwarding statistics that get outputted when you send the "stop" command in testpmd. Querying of port queue information is handled through a TextParser dataclass in case there is future need for using more of the output from the command used to query the information. Signed-off-by: Jeremy Spewock <[email protected]> Signed-off-by: Dean Marx <[email protected]>
2024-11-15dts: add capability check for multicast filteringNicholas Pratte
The multicast address filter component of the MAC filter test suite is not supported by all device drivers. So, a simple multicast filter capability check is added for the multicast filter testcase. Bugzilla ID: 1454 Signed-off-by: Nicholas Pratte <[email protected]>
2024-11-15dts: add setting MAC and multicast addressesNicholas Pratte
New methods have been added to TestPMDShell in order to support the MAC filter's individual test cases: - set_mac_addr - set_multicast_mac_addr set_mac_addr and set_multicast_addr were created for the MAC filter test suite, enabling users to both add or remove MAC and multicast addresses based on a boolean 'add or remove' parameter. Bugzilla ID: 1454 Signed-off-by: Nicholas Pratte <[email protected]>
2024-11-15dts: add blocked ports to EAL parametersLuca Vizzarro
Make the "ports" attribute of EalParams as it actually is to "allowed_ports", and add "blocked_ports". Signed-off-by: Luca Vizzarro <[email protected]> Reviewed-by: Paul Szczepanek <[email protected]> Reviewed-by: Nicholas Pratte <[email protected]>
2024-11-11dts: fix custom enum behaviour with docLuca Vizzarro
When building docs without any dependencies, autodoc will mock all the packages missing from the system. Because DTS makes use of a special enum library called aenum, autodoc fails to recognise enum inheriting it as such and raises exceptions as a consequence. This change extends the already in-place mechanism for type checking that pretends that aenums are builtin enums to the API doc building process. Fixes: 039256daa8bf ("dts: add topology capability") Fixes: c89d00380603 ("dts: add NIC capability support") Signed-off-by: Luca Vizzarro <[email protected]> Reviewed-by: Paul Szczepanek <[email protected]>
2024-11-06dts: fix verify argument in set forward modeDean Marx
Condition set_forward_mode verify code on the verify argument, which was originally omitted. Bugzilla ID: 1410 Fixes: fc0f7dc47ee3 ("dts: add testpmd shell params") Signed-off-by: Dean Marx <[email protected]> Reviewed-by: Patrick Robb <[email protected]> Reviewed-by: Nicholas Pratte <[email protected]>
2024-10-11dts: add VLAN methods to testpmd shellDean Marx
Added the following methods to testpmd shell class: set vlan filter on/off, rx vlan add/rm, set vlan strip on/off, tx vlan set/reset, set promisc/verbose. Fixed a bug in the VLAN regex used in testpmd shell flags. Fixes: 61d5bc9bf974 ("dts: add port info command to testpmd shell") Signed-off-by: Dean Marx <[email protected]>
2024-10-11dts: add NIC capabilities from port infoJuraj Linkeš
Add the capabilities advertised by the testpmd command "show port info" so that test cases may be marked as requiring those capabilities: RUNTIME_RX_QUEUE_SETUP RUNTIME_TX_QUEUE_SETUP RXQ_SHARE FLOW_RULE_KEEP FLOW_SHARED_OBJECT_KEEP These names are copy pasted from the existing DeviceCapabilitiesFlag class. Dynamic addition of Enum members runs into problems with typing (mypy doesn't know about the members) and documentation generation (Sphinx doesn't know about the members). Signed-off-by: Juraj Linkeš <[email protected]> Reviewed-by: Jeremy Spewock <[email protected]> Reviewed-by: Dean Marx <[email protected]> Reviewed-by: Luca Vizzarro <[email protected]>
2024-10-11dts: add Rx offload capabilitiesJuraj Linkeš
The scatter Rx offload capability is needed for the pmd_buffer_scatter test suite. The command that retrieves the capability is: show port <port_id> rx_offload capabilities The command also retrieves a lot of other capabilities (RX_OFFLOAD_*) which are all added into a Flag. The Flag members correspond to NIC capability names so a convenience function that looks for the supported Flags in a testpmd output is also added. The NIC capability names (mentioned above) are copy-pasted from the Flag. Dynamic addition of Enum members runs into problems with typing (mypy doesn't know about the members) and documentation generation (Sphinx doesn't know about the members). Signed-off-by: Juraj Linkeš <[email protected]> Reviewed-by: Dean Marx <[email protected]> Reviewed-by: Jeremy Spewock <[email protected]> Reviewed-by: Luca Vizzarro <[email protected]>
2024-10-11dts: add NIC capabilities from Rx queue infoJuraj Linkeš
Add parsing for the show rxq info <port_id> <queue_id> tespmd command and add support for the Scattered Rx capability. Signed-off-by: Juraj Linkeš <[email protected]> Reviewed-by: Dean Marx <[email protected]> Reviewed-by: Jeremy Spewock <[email protected]> Reviewed-by: Luca Vizzarro <[email protected]>
2024-10-11dts: add NIC capability supportJuraj Linkeš
Some test cases or suites may be testing a NIC feature that is not supported on all NICs, so add support for marking test cases or suites as requiring NIC capabilities. The marking is done with a decorator, which populates the internal required_capabilities attribute of TestProtocol. The NIC capability itself is a wrapper around the NicCapability defined in testpmd_shell. The reason is Enums cannot be extended and the class implements the methods of its abstract base superclass. The decorator API is designed to be simple to use. The arguments passed to it are all from the testpmd shell. Everything else (even the actual capability object creation) is done internally. Signed-off-by: Juraj Linkeš <[email protected]> Reviewed-by: Dean Marx <[email protected]> Reviewed-by: Jeremy Spewock <[email protected]> Reviewed-by: Luca Vizzarro <[email protected]>
2024-09-30dts: add text parser for testpmd verbose outputJeremy Spewock
Multiple test suites from the old DTS framework rely on being able to consume and interpret the verbose output of testpmd. The new framework doesn't have an elegant way for handling the verbose output, but test suites are starting to be written that rely on it. This patch creates a TextParser class that can be used to extract the verbose information from any testpmd output and also adjusts the `stop` method of the shell to return all output that it collected. Signed-off-by: Jeremy Spewock <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]> Reviewed-by: Luca Vizzarro <[email protected]>
2024-09-19dts: add MTU config methods to testpmd shellJeremy Spewock
There are methods within DTS currently that support updating the MTU of ports on a node, but the methods for doing this in a linux session rely on the ip command and the port being bound to the kernel driver. Since test suites are run while bound to the driver for DPDK, there needs to be a way to modify the value while bound to said driver as well. This is done by using testpmd to modify the MTU. Signed-off-by: Jeremy Spewock <[email protected]> Reviewed-by: Luca Vizzarro <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]>
2024-09-19dts: add testpmd port information cachingJuraj Linkeš
When using port information multiple times in a testpmd shell instance lifespan, it's desirable to not get the information each time, so caching is added. In case the information changes, there's a way to force the update with either TestPmdShell.show_port_info() or TestPmdShell.show_port_info_all(). Signed-off-by: Juraj Linkeš <[email protected]> Reviewed-by: Luca Vizzarro <[email protected]> Reviewed-by: Jeremy Spewock <[email protected]>
2024-09-09dts: fix testpmd port device error handling modeJuraj Linkeš
Make device_error_handling_mode of testpmd port optional as it may not be present, e.g. in VM ports. Fixes: 61d5bc9bf974 ("dts: add port info command to testpmd shell") Signed-off-by: Juraj Linkeš <[email protected]> Reviewed-by: Luca Vizzarro <[email protected]> Reviewed-by: Jeremy Spewock <[email protected]>
2024-09-09dts: add testpmd set ports queuesLuca Vizzarro
Add a facility to update the number of TX/RX queues during the runtime of testpmd. Signed-off-by: Luca Vizzarro <[email protected]> Reviewed-by: Paul Szczepanek <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]> Reviewed-by: Jeremy Spewock <[email protected]>
2024-09-09dts: add ability to start/stop testpmd portsLuca Vizzarro
Add testpmd commands to start and stop all the ports, so that they can be configured. Because there is a distinction of commands that require the ports to be stopped and started, also add decorators for commands that require a specific state, removing this logic from the test writer's duty. Signed-off-by: Luca Vizzarro <[email protected]> Reviewed-by: Paul Szczepanek <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]> Reviewed-by: Jeremy Spewock <[email protected]>
2024-07-29dts: improve logging for interactive shellsJeremy Spewock
The messages being logged by interactive shells currently are using the same logger as the node they were created from. Because of this, when sending interactive commands, the logs make no distinction between when you are sending a command directly to the host and when you are using an interactive shell on the host. This change adds names to interactive shells so that they are able to use their own loggers with distinct names. Signed-off-by: Jeremy Spewock <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]> Tested-by: Nicholas Pratte <[email protected]> Reviewed-by: Nicholas Pratte <[email protected]> Reviewed-by: Luca Vizzarro <[email protected]>
2024-07-23dts: improve starting and stopping interactive shellsJeremy Spewock
The InteractiveShell class currently relies on being cleaned up and shutdown at the time of garbage collection, but this cleanup of the class does no verification that the session is still running prior to cleanup. So, if a user were to call this method themselves prior to garbage collection, it would be called twice and throw an exception when the desired behavior is to do nothing since the session is already cleaned up. This is solved by using a weakref and a finalize class which achieves the same result of calling the method at garbage collection, but also ensures that it is called exactly once. Additionally, this fixes issues regarding starting a primary DPDK application while another is still cleaning up via a retry when starting interactive shells. It also adds catch for attempting to send a command to an interactive shell that is not running to create a more descriptive error message. Signed-off-by: Jeremy Spewock <[email protected]> Reviewed-by: Luca Vizzarro <[email protected]> Reviewed-by: Patrick Robb <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]> Tested-by: Dean Marx <[email protected]>
2024-07-23dts: add context manager for interactive shellsJeremy Spewock
Interactive shells are managed in a way currently where they are closed and cleaned up at the time of garbage collection. Due to there being no guarantee of when this garbage collection happens in Python, there is no way to consistently know when an application will be closed without manually closing the application yourself when you are done with it. This doesn't cause a problem in cases where you can start another instance of the same application multiple times on a server, but this isn't the case for primary applications in DPDK. The introduction of primary applications, such as testpmd, adds a need for knowing previous instances of the application have been stopped and cleaned up before starting a new one, which the garbage collector does not provide. To solve this problem, a new class is added which acts as a base class for interactive shells that enforces that instances of the application be managed using a context manager. Using a context manager guarantees that once you leave the scope of the block where the application is being used for any reason, the application will be closed immediately. This avoids the possibility of the shell not being closed due to an exception being raised or user error. The interactive shell class then becomes shells that can be started/stopped manually or at the time of garbage collection rather than through a context manager. Signed-off-by: Jeremy Spewock <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]> Reviewed-by: Patrick Robb <[email protected]> Reviewed-by: Luca Vizzarro <[email protected]>
2024-06-20dts: use Unpack for type checking and hintingLuca Vizzarro
Interactive shells that inherit DPDKShell initialise their params classes from a kwargs dict. Therefore, static type checking is disabled. This change uses the functionality of Unpack added in PEP 692 to re-enable it. The disadvantage is that this functionality has been implemented only with TypedDict, forcing the creation of TypedDict mirrors of the Params classes. Signed-off-by: Luca Vizzarro <[email protected]> Reviewed-by: Paul Szczepanek <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]> Reviewed-by: Jeremy Spewock <[email protected]> Reviewed-by: Nicholas Pratte <[email protected]>
2024-06-20dts: rework interactive shellsLuca Vizzarro
The way nodes and interactive shells interact makes it difficult to develop for static type checking and hinting. The current system relies on a top-down approach, attempting to give a generic interface to the test developer, hiding the interaction of concrete shell classes as much as possible. When working with strong typing this approach is not ideal, as Python's implementation of generics is still rudimentary. This rework reverses the tests interaction to a bottom-up approach, allowing the test developer to call concrete shell classes directly, and let them ingest nodes independently. While also re-enforcing type checking and making the code easier to read. Signed-off-by: Luca Vizzarro <[email protected]> Reviewed-by: Paul Szczepanek <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]>
2024-06-20dts: add testpmd shell paramsLuca Vizzarro
Implement all the testpmd shell parameters into a data structure. Signed-off-by: Luca Vizzarro <[email protected]> Reviewed-by: Paul Szczepanek <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]> Reviewed-by: Jeremy Spewock <[email protected]> Reviewed-by: Nicholas Pratte <[email protected]>
2024-06-20dts: refactor EAL parameters classLuca Vizzarro
Move EalParams to its own module to avoid circular dependencies. Also the majority of the attributes are now optional. Signed-off-by: Luca Vizzarro <[email protected]> Reviewed-by: Paul Szczepanek <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]> Reviewed-by: Jeremy Spewock <[email protected]> Reviewed-by: Nicholas Pratte <[email protected]>
2024-06-20dts: use params module for interactive shellsLuca Vizzarro
Make it so that interactive shells accept an implementation of `Params` for app arguments. Convert EalParameters to use `Params` instead. String command line parameters can still be supplied by using the `Params.from_str()` method. Signed-off-by: Luca Vizzarro <[email protected]> Reviewed-by: Paul Szczepanek <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]> Reviewed-by: Jeremy Spewock <[email protected]> Reviewed-by: Nicholas Pratte <[email protected]>
2024-06-20dts: add port stats command to testpmd shellLuca Vizzarro
Add a new TestPmdPortStats data structure to represent the output returned by `show port stats`, which is implemented as part of TestPmdShell. Bugzilla ID: 1407 Signed-off-by: Luca Vizzarro <[email protected]> Reviewed-by: Paul Szczepanek <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]> Reviewed-by: Jeremy Spewock <[email protected]> Reviewed-by: Nicholas Pratte <[email protected]> Tested-by: Nicholas Pratte <[email protected]>
2024-06-20dts: add port info command to testpmd shellLuca Vizzarro
Add a new TestPmdPort data structure to represent the output returned by `show port info`, which is implemented as part of TestPmdShell. The TestPmdPort data structure and its derived classes are modelled based on the relevant testpmd source code. This implementation makes extensive use of regular expressions, which all parse individually. The rationale behind this is to lower the risk of the testpmd output changing as part of development. Therefore minimising breakage. Bugzilla ID: 1407 Signed-off-by: Luca Vizzarro <[email protected]> Reviewed-by: Paul Szczepanek <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]> Reviewed-by: Jeremy Spewock <[email protected]> Reviewed-by: Nicholas Pratte <[email protected]> Tested-by: Nicholas Pratte <[email protected]>
2024-06-20dts: unify class inheritance from objectJuraj Linkeš
There are two ways we specify that a class inherits from object - implicitly and explicitly. There's no need to explicitly specify that a class inherits from object and is in fact mostly a remnant from Python2. Leaving it implicit is the standard in Python3 and offers a small bonus in cases where something would assign something else to the builtin object variable. Signed-off-by: Juraj Linkeš <[email protected]> Reviewed-by: Luca Vizzarro <[email protected]> Reviewed-by: Patrick Robb <[email protected]> Reviewed-by: Jeremy Spewock <[email protected]>
2024-03-15dts: extend application parametersJeremy Spewock
Changed the factory method for creating interactive apps in the SUT Node so that EAL parameters would only be passed into DPDK apps since non-DPDK apps wouldn't be able to process them. Also modified interactive apps to allow for the ability to pass parameters into the app on startup so that the applications can be started with certain configuration steps passed on the command line. Signed-off-by: Jeremy Spewock <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]> Tested-by: Patrick Robb <[email protected]>
2024-03-15dts: add start/stop/mode to testpmd shellJeremy Spewock
Added commonly used methods in testpmd such as starting and stopping packet forwarding, changing forward modes, and verifying link status of ports so that developers can configure testpmd and start forwarding through the provided class rather than sending commands to the testpmd session directly. Signed-off-by: Jeremy Spewock <[email protected]> Reviewed-by: Juraj Linkeš <[email protected]> Tested-by: Patrick Robb <[email protected]>
2023-12-21dts: update docstringsJuraj Linkeš
Format according to the Google format and PEP257, with slight deviations. Signed-off-by: Juraj Linkeš <[email protected]>
2023-12-21dts: adjust code for doc generationJuraj Linkeš
The standard Python tool for generating API documentation, Sphinx, imports modules one-by-one when generating the documentation. This requires code changes: * properly guarding argument parsing in the if __name__ == '__main__' block, * the logger used by DTS runner underwent the same treatment so that it doesn't create log files outside of a DTS run, * however, DTS uses the arguments to construct an object holding global variables. The defaults for the global variables needed to be moved from argument parsing elsewhere, * importing the remote_session module from framework resulted in circular imports because of one module trying to import another module. This is fixed by reorganizing the code, * some code reorganization was done because the resulting structure makes more sense, improving documentation clarity. The are some other changes which are documentation related: * added missing type annotation so they appear in the generated docs, * reordered arguments in some methods, * removed superfluous arguments and attributes, * change private functions/methods/attributes to private and vice-versa. The above all appear in the generated documentation and the with them, the documentation is improved. Signed-off-by: Juraj Linkeš <[email protected]>