Closed leonardhyu closed 1 year ago
I have success run the config on my side, but it need some steps to make it happen on client side.
Here is my folder structure and main.py for reference of problem 4.
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())
@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.
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
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