📞📱☎️📡🌐 Cloud Native Telecom Initiative (CNTI) Test Catalog is a tool to check for and provide feedback on the use of K8s + cloud native best practices in networking applications and platforms
To speed up the development of the #2120 epic we are currently experimenting with a different approach to pull requests. This pull request has been created anew from a different branch, if you want to check the already existing discussion around it, view the old #2133.
Description
The transformer transforms the old config according to the structure proposed in #2129.
Notes
To allow for some input validation, the v1 config was reimplemented as class in config_v1.cr.
Certain arguments are found in cnf-testsuite.yml files spread across the samples and examples that are unused anywhere in the code, these are still parsed but ignored to avoid too much manual intervention in later stages.
A new task has been added to allow for transformation, users can execute it by calling this command:
The ConfigTransformer class found in config_transformer.cr automatically detects the version of the old config and transforms it to the latest version (currently only v1 -> v2), but allows for future extendibility.
Upon determining the version of the old config, the main transform function is called which does the actual transformation in code (through use of Hashes and YAML::Any).
The transform function uses the appropriate transformation rules (V1ToV2Transformation class in v1_to_v2_transformation.cr file)
To make future extension of transformation rules easier, the function process_data has been added (TransformationBase class in transformation.cr file), this function converts the underlying hashes and arrays to the YAML::Any type and removes any nil branches so they don't clutter the final output.
After the transformation is done the result can be printed to either String or dumped to a file through the serialize_to_string and serialize_to_file functions.
Most edge cases have been resolved through the use of exceptions and their catching, giving users a readable output in case of any errors.
Issues:
Refs: #2130
How has this been tested:
[ ] Covered by existing integration testing
[ ] Added integration testing to cover
[x] Verified all A/C passes
[ ] develop
[ ] master
[ ] tag/other branch
[ ] Test environment
[ ] Shared Packet K8s cluster
[ ] New Packet K8s cluster
[x] Kind cluster
[ ] Have not tested
Types of changes:
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] Documentation update
Checklist:
Documentation
[x] My change requires a change to the documentation.
[ ] I have updated the documentation accordingly.
[ ] No updates required.
Code Review
[x] Does the test handle fatal exceptions, ie. rescue block
IMPORTANT
To speed up the development of the #2120 epic we are currently experimenting with a different approach to pull requests. This pull request has been created anew from a different branch, if you want to check the already existing discussion around it, view the old #2133.
Description
The transformer transforms the old config according to the structure proposed in #2129.
Notes
config_v1.cr
../cnf-testsuite transform_config OLD_FILE_PATH NEW_FILE_PATH
ConfigTransformer
class found inconfig_transformer.cr
automatically detects the version of the old config and transforms it to the latest version (currently only v1 -> v2), but allows for future extendibility.transform
function is called which does the actual transformation in code (through use of Hashes and YAML::Any).transform
function uses the appropriate transformation rules (V1ToV2Transformation class
inv1_to_v2_transformation.cr
file)process_data
has been added (TransformationBase class
intransformation.cr
file), this function converts the underlying hashes and arrays to theYAML::Any
type and removes any nil branches so they don't clutter the final output.serialize_to_string
andserialize_to_file
functions.Issues:
Refs: #2130
How has this been tested:
Types of changes:
Checklist:
Documentation
Code Review
Issue