xenanetworks / open-automation-rfc-test-suites

🚀 XOA test suite library for network performance benchmarking and more.
https://docs.xenanetworks.com/projects/xoa-core
Apache License 2.0
2 stars 1 forks source link

Failed to run v2889 using xoa-core #9

Closed leonardhyu closed 1 year ago

leonardhyu commented 1 year ago

Description:

RFC-2889 test suite - Not able to execute RFC2889 test suite same way i did for RFC-2544. I've copied required plugin from Xena git hub but getting the below circular error

 File "/home/ravindra/xena_automation/pluginlib/plugin2889/test_manager.py", line 7, in <module>
    from plugin2889.resource.manager import ResourcesManager
ImportError: cannot import name 'ResourcesManager' from partially initialized module 'plugin2889.resource.manager' (most likely due to a circular import) (/home/ravindra/xena_automation/pluginlib/plugin2889/resource/manager.py)

User environment:

Python version: Python 3.8.10 xoa_converter version: 1.0.3 xoa_core version: 1.0.5 xoa_driver version: 1.0.14

plugin2544 and plugin2889 downloaded from https://github.com/XenaNetworks/open-automation-test-suites

Config file:

rfc2889_ipv4_udp_1.v2889.zip

fpfeng commented 1 year ago

I have success run the config on my side, but it need some steps to make it happen on client side.

  1. Merge #11 becuase client using custom port rate cap.
  2. Merge https://github.com/xenanetworks/open-automation-config-converter/pull/11 and make new version release because current pip package do not include 2889 converter.
  3. Merge https://github.com/xenanetworks/open-automation-core/pull/29
  4. Fix document: https://github.com/xenanetworks/open-automation-core/issues/28

Here is my folder structure and main.py for reference of problem 4. 1674196052750

from __future__ import annotations
from xoa_core import (
    controller,
    types,
)
from pathlib import Path
import asyncio
import json
from xoa_converter.entry import converter
from xoa_converter.types import TestSuiteType

BASE_PATH = Path.cwd()
PLUGINS_PATH = "plugin2889"
TEST_CONFIG_PATH = BASE_PATH / "my2889_data.json"
OLD_CONFIG_FILE = BASE_PATH / "old_config.v2889"

async def do_test(tester: types.Credentials, suite_name: str, config):
    # Create a default instance of the controller class.
    ctrl = await controller.MainController()

    # Register the plugins folder.
    ctrl.register_lib(PLUGINS_PATH)

    # Add tester credentials into teh controller. If already added, it will be ignored.
    # If you want to add a list of testers, you need to iterate through the list.
    await ctrl.add_tester(tester)

    # get rfc2544 test suite information from the core's registration
    info = ctrl.get_test_suite_info("RFC-2889")
    if not info:
        print("Test suite is not recognized.")
        return None

    # convert the old config file into new config file
    new_data = converter(TestSuiteType.RFC2889, config, info["schema"])

    # you can use the config file below to start the test
    new_config = json.loads(new_data)

    # Test suite name: "RFC-2544" is received from call of c.get_available_test_suites()
    execution_id = ctrl.start_test_suite(suite_name, new_config)

    async for msg in ctrl.listen_changes(execution_id, _filter={types.EMsgType.STATISTICS}):
        print(msg)

async def main() -> None:
    # Define your tester login credentials
    my_tester_credential = types.Credentials(
        product=types.EProductType.VALKYRIE,
        host="192.168.1.197"
    )
    # Convert Valkyrie test config into XOA test config and run.
    with open(OLD_CONFIG_FILE, "r") as f:
        await do_test(my_tester_credential, "RFC-2889", f.read())

if __name__ == "__main__":
    asyncio.run(main())
fpfeng commented 1 year ago

@leonardhyu I forgot to write down @ArtemConstantinov have mention xoa-core need to rebase release for using "schema_json" function to export schema while keep port identies as dictionary for working compatible with converter. Maybe you guys should talk about it in person.