Support parameterization of hard-coded SIMS attributes
Description
Activity

Gilles THOUENON June 16, 2022 at 12:47 PM
The idea is good.
To prevent from having to modify simulators.py file each time you have to use specific real equipment, it would be worth configuring once the simulators.py file with a python function (os.getenv) that will read environment variables as for example XPDRA_USER, XPDRA_PASSWORD, XPDRA_HOST..., and test_utils.mount_device with the reading of the simulators dictionary.
If the env variable is not set, the corresponding key will not exist in the dictionary and the test_utils.start_sims() will start the sims.
On the other hand, if the env variable is set, the key will exist, the corresponding sims will not start, and the mount_device function could use the dict.get(key, default) to either use the value setted in the env variable, or the default value to be used for the sims.
Details
Details
Assignee

Reporter

Certain node attributes are hard-coded into test_utils.py and test_utils_rfc8040.py, including username (openroadm), password (openroadm), and host (127.0.0.1). To facilitate using the existing tox testing framework for physical devices, we propose to add support for username, password, and host as additional optional key-value pairs in the simulators.py file.
If the new key-value pairs are not present in simulators.py, the normal defaults will apply. In order to take advantage of this new feature, the person doing the testing of physical devices would need to edit the simulators.py file by hand.
E.g.:
SIMS = { ('xpdra', '1.2.1'): {'port': '17830', 'configfile': 'oper-XPDRA.xml', 'logfile': 'xpdra-121.log', 'username': 'person123', 'password': 'MyPassword', 'host': '192.168.5.55'},
Additionally, if the start_sims function sees that a particular node has a host override specified in the SIM dictionary, it will skip starting a Honeynode instance for it. This would potentially allow for mixed physical/honeynode test environments.