Scripts

The scripts folder, in the root of the project directory, houses scripts that are relative to the ODA but are not appropriate for the src/ directory.

test_data_generation.py

This script can be used to generate syntactically valid SBDefinitions (SBDs) that can potentially be used for testing purposes. The script creates a specified number of SBDs and saves them in JSON format, either by creating a timestamped folder outside of the project folder or into a specified location.

before running the script, first run

$ poetry install
$ poetry shell

Followed by

$ python3 scripts/test_data_generation.py --n N --location /path/to/directory

both the command line inputs are optional e.g.

$ python3 scripts/test_data_generation.py

Will generate 10 test json files in a folder outside the ODA project folder with name e.g. YYYYMMDDhhmmss_TZ where TZ is the system timezone e.g. CET.

$ python3 scripts/test_data_generation.py --n 100

Will generate 100 test json files in a folder outside the ODA project folder with name e.g. YYYYMMDDhhmmss_TZ.

$ python3 scripts/test_data_generation.py --n 100 --location 'repo'

Will generate 100 test json files in a folder in the root of the directory with name repo. If the folder already exists then the files will be put into the existing folder. Nothing in the folder will be overwritten.

It is possible to create ska_oso_pdm.PdmObjects from these json files in python. Simply open a python terminal and enter:

$ python3
>>> from ska_oso_pdm import SBDefinition
>>> from ska_oso_pdm.openapi import CODEC
>>> CODEC.load_from_file(SBDefinition,'path/to/file.json')