Package: xoa-core
Xena OpenAutomation CoreXena OpenAutomation Core (XOA Core) is an open-source test suite framework for network automation and testing. It is designed to host variousXOA Test Suitesas plugins, allowing users to create, manage, and run test cases for different network scenarios. The XOA Core framework serves as the foundation for building and executing test suites in the XOA ecosystem.Key features of XOA Core include:Modular architecture: The test suite framework employs a modular architecture, enabling users to develop and run different test suites as plugins.Test Suite execution: XOA Core supports both local and remote test suite execution. Users can execute test suites on their local machines or on remote testbeds through the XOA CLI or Web GUI.Test Case management: XOA Core provides tools for managing test cases, including creating, updating, and deleting them. Users can also organize test cases using tags and execute them in parallel or sequentially.Extensibility: The framework is designed to be extensible, allowing users to develop custom test suites and plugins to address specific testing requirements.Logging and reporting: XOA Core offers built-in logging and reporting functionality, generating detailed test reports to help users analyze test results and identify issues.
Xena OpenAutomation (XOA) Core is the framework that provides a standardized way for developers and test specialists to execute, develop, and integrate test suites, as well as managing Xena's physical and virtual Traffic Generation and Analysis (TGA) testers.DocumentationThe user documentation is hosted:Xena OpenAutomation Core DocumentationInstallationInstall UsingpipMake sure Pythonpipis installed on you system. If you are using virtualenv, then pip is already installed into environments created by virtualenv, and using sudo is not needed. If you do not have pip installed, download this file:https://bootstrap.pypa.io/get-pip.pyand runpython get-pip.py.To install the latest, use pip to install from pypi:~/>pipinstallxoa-coreTo upgrade to the latest, use pip to upgrade from pypi:~/>pipinstallxoa-core--upgradeNote:
If you install XOA Core usingpip, XOA Python API (PyPi package namexoa_driver) will be automatically installed.Install From Source CodeMake sure these packages are installedwheel,setuptoolson your system.Installsetuptoolsusing pip:~/>pipinstallwheelsetuptoolsTo install source of python packages:/xoa_core>pythonsetup.pyinstallTo build.whlfile for distribution:/xoa_core>pythonsetup.pybdist_wheelNote:
If you install XOA Core from the source code, you need to install XOA Python API (PyPi package namexoa_driver) separately. This is because XOA Python API is treated as a 3rd-party dependency of XOA Core. You can go toXOA Python APIrepository to learn how to install.Understanding XOA CoreThe XOA Core is an asynchronous Python framework that can be represented by four subparts:Resources Management SystemTest Suite Plugin SystemTest Execution SystemData IO SystemResources Management SystemThe key functionality is represented in managing and monitoring the state of known test resources.Under the hood, it uses the instance ofxoa_driverlibrary as a representation of the resource.Note:XOA Python API(PyPi package namexoa_driver) is treated as a 3rd-party dependency, thus its source code is not included in XOA Core.Available operations for users:Add testersRemove testersConnect to testersDisconnect from testersGet the list of available testersTest Suite Plugin SystemXOA Core dynamically loads test suites that are organized in a common structure, and exposes information of those test suites to the user.Available operations for users:Register plugins libraryGet the list of available test suite namesGet test suite info by its nameUsers can register one or multiple test suite lookup folders in a test script by calling the methodregister_lib(<lookup_path: str>).A test suite plugin must have the structure below:./my_test_suite
    |
    |- meta.yml
    |- __init__.py
    |- <any other modules defined by user>meta.ymlhas a fixed structure as shown below, and is used as the entry point for the plugin loading system. If the test suite folder doesn't contain this file, it will not be loaded by XOA Core.name: "RFC-2544[Frame Loss]" # Plugin name
version: "1.0" # Plugin curren version
core_version: ">=1.0.0" # compatible to xoa-core version
author: # Optional list of authors
  - "ACO"
entry_object: "FrameLossTest" # class name of script entry point
data_model: "FrameLossModel"  # class name of test suite data modelTheentry_objectmust be inherited from an abstract class:types.PluginAbstractThedata_modelmust be a class ofPydanticmodel inherited frompydantic.BaseModelYou can find the source code of a test suite plugin example./examples/billet_plugin_example/FrameLoss/.Note:
Be aware of imports during implementation of your plugin. It is recommended to use relative import in your plugin because the library paths in different user environments can be different, which makes it impossible for the plugin code to run.Performance Notice:
Test suites are treated as anasyncio.Task. It means all heavy computational operations must be implemented with subprocess workers or threadings.Test Execution SystemXOA Core provides the following controlling methods of test suite execution:Start test suitePause/continue test suite: User should useawait self.state_conditions.wait_if_paused(), where the test suite should be paused/continued.Stop test suite: User should useawait self.state_conditions.stop_if_stopped(), where the test suite should be stopped.Start Test SuiteMethod:execution_id = c.start_test_suite(<plugin_name>, <suite_config_dict>)<plugin_name>- must match the name from pluginsmeta.yml.<suite_config_dict>- must be a dictionary matching to the following structure:{"username":"JonDoe","port_identities":{"p0":{"tester_id":"2906f8d041e9fd07191d6a37ef5785b2","tester_index":0,"module_index":1,"port_index":4},...},"config":TestSuiteModel<asdict>}Iftest_suiteis successfully started, the function will return anexecution_id, which can be used to control the test suite executions, or to subscribe to the outgoing messages from the test suite.Note:
A test suite will not start if its test resources are not registered inResource Manager, or if one of its test resources is unavailable/disconnected.Pause/Continue Test SuiteMethod:await my_core_controller.running_test_toggle_pause(<execution_id>)Note:
To apply pause/continue action, a validexecution_idmust be passed into the method.Stop Test SuiteMethod:await c.running_test_stop(<execution_id>).If the execution ofexecution_idexists, the test suite will be terminated.Data IO SystemXOA Core allows users to subscribe to different messages generated by different subsystems (ResourcesManager, ExecutorManager) and test suites.Code example of message subscription:asyncformsginc.listen_changes(execution_id,_filter={types.EMsgType.STATISTICS}):print(msg.dict())In the snippet above, we subscribe only to the statistics messages from the test suite that is currently in execution.The_filterargument is an set of filter types.The first parameter of_filterargument is a mandatory identifier of the subsystem or the test suite execution.Subsystem types:types.PIPE_EXECUTORtypes.PIPE_RESOURCESAvailable filters types:classEMsgType(Enum):STATE="STATE"DATA="DATA"STATISTICS="STATISTICS"PROGRESS="PROGRESS"WARNING="WARNING"ERROR="ERROR"Note:_filterargument is optional. If it is not provided, all message types will be returned from this test suite execution.FOR TESTING BEYOND THE STANDARD.