The MiCADO component responsible for parsing and validating ADTs
Historically part of the MiCADO TOSCASubmitter, now a standalone library and command-line tool used inside MiCADO and on its own for validating single-file (YAML) and multi-file (CSAR) ADTs.
The MiCADO Parser uses the following packages:
Install the latest version of the MiCADO Parser from PyPI.
pip install micado-parseror from GitHub.
git clone https://github.com/micado-scale/micado-parser
pip install micado-parser/.For some helpful tips, use the --help option
micadoparser --helpTo validate an ADT, simply point at an ADT.
micadoparser /home/ubuntu/adts/nginx.yamlMulti-file ADTs in .csar format are also supported
micadoparser /home/ubuntu/adts/wordpress.csarThe tool can handle multiple files.
micadoparser ~/adts/nginx.yaml ~/adts/wordpress.csarOr an entire directory.
micadoparser ~/adts/*For verbose output use the -v option (for even more verbosity use -vv or -vvv).
micadoparser -v ~/adts/nginx.yamlThe primary function of the MiCADO Parser is to return a validated ToscaTemplate object.
To use it in your own project, simply import the set_template function and pass it the path to your ADT. You can optionally pass a dictionary of TOSCA inputs, if inputs are defined in your ADT.
from micadoparser import set_template
tpl = set_template("/home/ubuntu/adts/nginx.yaml")
tpl_with_params = set_template(
"home/ubuntu/adts/wordpress.csar",
{"username": "jay", "token": "ABD992LOKAL"}
)To use the package for validation only, use the set_template function and catch the MultiError exception.
from micadoparser import set_template, MultiError
try:
set_template("/home/ubuntu/adts/nginx.yaml")
except MultiError as e:
print(e)The MiCADO Parser adds a few features compared to the upstream TOSCA Parser.
- MiCADO-specific validations
- MiCADO-specific CSAR handling
- Input resolution
- Support for some TOSCA v1.3 features