././@PaxHeader0000000000000000000000000000003100000000000010207 xustar0025 mtime=1788873902.5294 tosca_parser-2.15.0/0000775000175000017500000000000015250006257013110 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7813091 tosca_parser-2.15.0/.coveragerc0000664000175000017500000000014715250006202015221 0ustar00zuulzuul[run] branch = True source = toscaparser omit = toscaparser/openstack/* [report] ignore_errors = True ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7823093 tosca_parser-2.15.0/.mailmap0000664000175000017500000000013015250006202014511 0ustar00zuulzuul# Format is: # # ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7823093 tosca_parser-2.15.0/.stestr.conf0000664000175000017500000000006515250006202015350 0ustar00zuulzuul[DEFAULT] test_path=./toscaparser/tests/ top_dir=./ ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7823093 tosca_parser-2.15.0/.zuul.yaml0000664000175000017500000000022415250006202015035 0ustar00zuulzuul- project: templates: - check-requirements - openstack-cover-jobs - openstack-python3-jobs - publish-openstack-docs-pti ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4113812 tosca_parser-2.15.0/AUTHORS0000664000175000017500000001030015250006256014151 0ustar00zuulzuulAldinson Esto Andreas Jaeger Andrew F. Ly Anjali Antonio Di Tommaso Anusree Atsushi SAKAI Ayumu Ueha Ben Martin Bharath Thiruveedula Bill Huber Bob HADDLETON Bob Haddleton Bob.Haddleton Bob.Haddleton Brad Topol Brendan Shephard Cao Xuan Hoang Christian Berendt Corey Bryant Csaba Fülöp Denis Makogon Dharmesh Bhakta Dimitri Mazmanov Doug Hellmann FeihuJiang Flavio Percoco Ghanshyam Mann Haejin Choe Haiyang DING Hervé Beraud Idan Moyal Janonymous Jeff Feng Jeremy Stanley Kanagaraj Manickam Keiko Kuriu Lakshmi Larry GUO LinusRamuk Longgeek Madhurya Manas Mal Manpreet Kaur Mathieu Velten Matt Rutkowski Meena Michael Brewer Michael Sambol Miguel Caballer Monty Taylor Nandini Nguyen Hai Oleksii Chuprykov OpenStack Release Bot Rohan Shah Roman Stolyarov Sahdev Zala Saju Madhavan Santhosh64 Serg Melikyan Sergey Lukjanov Simeon Monov Steve Martinelli Swapnil Kulkarni (coolsvap) Tim Rozet Ton Ngo Tony Breeds Toshiaki Takahashi Tung Doan Vahid Hashemian Valeriya Shvetcova Victor HU Wataru Juso XiaojueGuan Yaoguo Jiang Yasufumi Ogawa Yoshiro Watanabe Zach Sais Zachary Sais Zahra ZhijunWei caoyuan ddaskal doantungbk gecong1973 gengchc2 gujin hoangphuocbk huang.zhiping huruifeng jacky06 jiangyaoguo jinyuanliu madhavi melissaml micafer narengan niraj singh nirajsingh pangliye pengyuesheng ricolin sahdev zala sairamvengala007@gmail.com shangxdy shizhihui spzala sreelakshmi-penta srinivas_tadepalli surbhi sarda tonanhngo versus_vv wangjiaqi07 zahra zhangboye zhangyanxian ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7823093 tosca_parser-2.15.0/CONTRIBUTING.rst0000664000175000017500000000116015250006202015535 0ustar00zuulzuulThe source repository for this project can be found at: https://opendev.org/openstack/tosca-parser Pull requests submitted through GitHub are not monitored. To start contributing to OpenStack, follow the steps in the contribution guide to set up and use Gerrit: https://docs.openstack.org/contributors/code-and-documentation/quick-start.html Bugs should be filed on Launchpad,: https://bugs.launchpad.net/tosca-parser For more specific information about contributing to this repository, see the tosca-parser contributor guide: https://docs.openstack.org/tosca-parser/latest/contributor/contributing.html ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.3673742 tosca_parser-2.15.0/ChangeLog0000664000175000017500000006054415250006256014672 0ustar00zuulzuulCHANGES ======= 2.15.0 ------ * Validate occurrences in relationships * Fixes validation of input name in functions. Closes-Bug: 2104016 * Update versions in requirements files 2.12.0 ------ * Updated TOSCA1.3 support in tosca-parser * Fix to not run unnecessary tests 2.11.0 ------ * Support for updating tosca-parser with TOSCA1.3 * Move test samples to reduce setuptools warnings * Mock replacement for unit tests with external URL * Add TOSCA v1.3 to valid template version 2.10.0 ------ * Update metadata in setup.cfg 2.9.0 ----- * Support importing def from local instead of url * Interface outputs * Fix passenv for tox4 2.8.0 ----- * Update python classifier for python 3.10 2.7.0 ----- * Switch to 2023.1 Python3 UT and generic template * Fix dash-separated attributes in setup.cfg * Use py3 as the default runtime for tox * Add Python3 antelope unit tests * Support primary and dependencies definition 2.6.0 ----- * Drop lower-constraints.txt and its testing * Fix KeyError in get\_attribute function * Fix InvalidTypeError in get\_attribute function * Add Python3 zed unit tests 2.5.1 ----- * Update python testing classifier 2.5.0 ----- * Clean up extra spaces 2.4.1 ----- * Fix old link in Installation guide * Replace assertItemsEqual with assertCountEqual * import "collections.abc" explicitly * [ussuri][goal] Update contributor documentation * Fix parent types if relationships 2.4.0 ----- * Add Python3 xena unit tests * Simplify log translations 2.3.0 ----- * Remove depreciated file babel.cfg * Dropping explicit unicode literal * Update TOX\_CONSTRAINTS\_FILE * Update validation of function \`get\_operation\_output\` * Move tosca-parser to new hacking 4.0.0 * Support "Implementation" definition as Artifact Name * Drop Python 2 support * Add Python3 wallaby unit tests * Add validation for required property of policies * Fix error parsing scalar unit contraints 2.2.0 ----- * Enable \_get\_explicit\_relationship to maintain original relationship type name * Enable store multi flavour in nested topo template * Add "state" to condition keyname * Fix deprecated yaml loader usage 2.1.1 ----- * Add parent interfaces to the list of NodeType interfaces * Make custom definitions biggest priority * drop mock from lower-constraints * Fix ResourceWarning for unclosed file 2.1.0 ----- * Switch to newer openstackdocstheme version * Fix hacking min version to 3.0.1 * Update hacking for Python3 * Enable max\_length and min\_length constraints in lists 2.0.0 ----- * [ussuri][goal] Drop python 2.7 support and testing * Switch to official Ussuri jobs * Fail to parse if relationship is not defined in requirements 1.7.0 ----- * Initialize CSAR main\_template\_file\_name 1.6.0 ----- * Add support for tosca definition version 1.2 * Fail to parse properties in substitution\_mappings * Bump the openstackdocstheme extension to 1.20 * Blacklist sphinx 2.1.0 (autodoc bug) * Fail to parse capabilities without properties 1.5.0 ----- * Checks the type of the TopologyTemplate fields * Add Python 3 Train unit tests * Replace git.openstack.org URLs with opendev.org URLs * Sync Sphinx requirement * OpenDev Migration Patch * Dropping the py35 testing * Update the bugs link to storyboard * Remove support for py34 1.4.0 ----- * Change openstack-dev to openstack-discuss * Add reservation policy support 1.3.0 ----- * Move extension tests to where stestr can find them * Add py36 to tox.ini and setup.cfg 1.2.0 ----- * Use templates for cover and lower-constraints * Update the outdated URL * add python 3.6 unit test job * switch documentation job to new PTI * import zuul job settings from project-config * Fix error using get\_attribute with HOST in case of setting host relationship in "long" format * Use stestr instead of testr 1.1.0 ----- * fix tox python3 overrides * Use stevedore Extensions for TOSCA definitions * Handle deriving from custom policy definitions * Add EXPERIMENTAL support for MEC * Follow the new PTI for document build * Switch from oslosphinx to openstackdocstheme 1.0.0 ----- * Trivial: Update pypi url to new url * add lower-constraints job * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements * Updated from global requirements * Closes-Bug: #1746532 0.9.0 ----- * Closes-Bug: #1746441 * Add resource\_type in trigger policy * Closes-Bug: #1740063 Add default value None to \_\_new\_\_ method, this avoid exception when \_\_deepcopy\_\_ method used * Avoid tox\_install.sh for constraints support * Updated from global requirements * Updated from global requirements * Support yaml file with suffix of yml * Adding custom datatypes support in properties of capabilities * Updated from global requirements * Updated from global requirements * Add exception info about get\_explicit\_relationship * fix nested import list bug * Updated from global requirements * Fix error getting a boolean capability property with value false * Updated from global requirements * Updated from global requirements * Updated from global requirements * Fix error getting relationshps in case of custom\_def capability * Updated from global requirements 0.8.1 ----- * Add more properties to trigger policy * Updated from global requirements 0.8.0 ----- * Updated from global requirements * Fix \_find\_host\_containing\_property function to search for properties in capabilities * Fix error not considering inheritance in valid\_target\_types checking in functions * fix gate-tosca-parser-python35 issue * Add FloatingIP Node * Updated from global requirements * Changed the derived type of "tosca.nodes.SomeApp" * [Fix gate]Update test requirement * Updated from global requirements * Add monitoring node in tosca-parser * remove key from \_get\_node\_type\_by\_cap * Updated from global requirements * Updated from global requirements * Fix typo in compute\_with\_nested\_atributes.yaml * Remove white space between print () * Provide parsing support for multiple policies * Fix validation for invalid type * Fix few keywords on TOSCA policy 0.7.0 ----- * Bugfix in InterfacesDef \_\_init\_\_ function * Template to demonstrate properties override * Log the required inputs, instead of raising exceptions * Delete unnecessary utf-8 coding * Add Constraints support * Add output validation for substitution mappings * Add input validation in substitution\_mapping class * Updated from global requirements * Using assertIsNone() instead of assertEqual(None, ...) * Fix TOSCA type for Docker container * Organize containers and other tests * Show team and repo badges on README * custom interfaces can be used in node\_templates * Updated from global requirements * Validate template requirements as list * Add validation for implicit attribute reference * use passenv in tox.ini to forward http proxy settings to unit tests * Updated from global requirements * Enable DeprecationWarning in test environments * Updated from global requirements * Fixes Incorrect error in get\_attribute with unknown node template * Update the installation guide * Use argparse in shell * Updated from global requirements * Do not ignore E123, E125 per PEP 8-Style Guide for Python Code * Change assertTrue(isinstance()) by optimal assert * Updated from global requirements * Updated from global requirements * Add new dsl\_definitions test template * Rename nfv extensions files to support adding versions * Add missing entry\_schema field in parameters * Add url in setup.cfg * Delete the files in MANIFEST.IN * Fix paypalpizzastore\_nodejs\_app required property * Implementing get\_operation\_output function * Provided support for TOSCA qualified name * Add validation for parameters * Add docstring for the usage of unsupported type * Add missing default * Remove openstack common file * Use full name for consistency in main definition * Clean up oslo-incubator related stuff * Add endpoint capability to Compute (cf spec) * Remove H803 of flake8 ignore list in tox * Updeate the home-page in setup.cfg * Implement substitution mappings * Delete unused directory--openstack/common * Imported templates are not fully validated 0.6.0 ----- * urllib doesn't work with https under proxy * Modify the definition file for reuse * Remove discover from test-requirements * Add Python 3.5 classifier and venv * incorrect parent\_type definition in policy,artifacts, group and policy * Correct the node\_with\_cap.yaml file * Fixes error in UrlUtils validating urls with file scheme * Added Support for UnsupportedTypes * Add Token class to manage token function * Add test using container node types * Allow optimized compiled file in extensions * Add missing fields in inputs * PEP8 tests failing with E211 error * Updated from global requirements * Updated from global requirements * Add 'requests' lib to requirements.txt * EntityTemplate has no property of parent\_type * Bugfix for the non managed exception produced when a non defined capability is used in a node template * Updated from global requirements * Updated from global requirements * Updated from global requirements * Fixes NFV VNFFG and groups * Added logic to validate the default values from the templates * Added support for Repositories * Remove unused env value * Remove white space from the definition file * Change tosca.nodes.Container to tosca.nodes.Container.Runtime as host node in tosca.nodes.Container.Application * Bugfix the error in DataEntity.validate\_datatype with functions * Create new example templates for TOSCA Credential Data Type * The code in function of get\_all\_requirements is duplicated * Updated from global requirements * tosca.nodes.nfv.CP definition is error 0.5.0 ----- * Bugfix to show correct error message show in case of unknown field in a datatype * Add Support of the optional requirement or capability name get\_attribute function * Implement PortSpec datatype and all spec. requirements * Correct the specification of the datatype tosca.datatypes.Credential * The code in nodetype is reduplicated * Updated from global requirements * Updated from global requirements * Fix TypeError * Added support for range type * Set property required flag to true as default * Create concat function and provide validation * Fix the incorrect use of attribute * Add support for SOURCE and TARGET in get\_property and get\_attribute functions * Bugfix for RelationshipTemplate.\_create\_relationship\_properties method to get the properties of the "explicit relationships" * Enable to reference a repository in an import * Add support for using index and attribute names in the get\_attribute function * Solves an error in the \_create\_interfaces function in case of custom relationships defined in TOSCA document * Updated from global requirements * Implementation of triggers in policies * Change the result function of the GetAttribute class to return self * Add Docker related node types to TOSCA definition * Bugfix to enable CapabilityTypeDef to consider custom definitions * Solves the incorrect inheritance of properties in capability objects * Implement LoadBalancer node type per TOSCA v1.0 spec * Add repositories section to ToscaTemplate * Add OSX specific file extensions to gitignore * Updated from global requirements 0.4.0 ----- * Changed datatype\_definitions tag to data\_types to match spec * Fix CSAR usage in README * Update documentation for NFV profile support * Add the node type tosca.relationships.RoutesTo to TOSCA spec * Add undefined properties to Network and Database node types * Solves the incorrect inheritance of attributes in NodeType * Add new attributes to Compute node * Solves the incorrect inheritance of attributes and requirements of tosca.nodes.Root * Bugfix for incorrect definition of capabilities element in tosca.nodes.Root * Fixes for using the NFV Profile and Imports in the Tacker server * Fixed typo in statefulentity.py variable * Remove undesired message on CLI * Add test for relationship * \_get\_explicit\_relationship() only looks at the first relationship * Fix typo in definition file * Handle custom relationship types properly * Added support for TOSCA group and group types * Update the TOSCA NFV definitions with corrected capablity derivations * Updates to TOSCA NFV Profile * Validation of imported templates * Add support to node\_filter in requirements section * Solves the error using a map type with a max\_length contraint * Return type value along with parent hierarchy * Corrections to the TOSCA NFV definitions file * Implementation of policies in topology template * Add support for Simple NFV Profile * User assert in test * Correct an inline import * Updated from global requirements * Incorrect inheritance of properties in capability objects * Support of nested properties and indexes in get\_property function * Fix Tosca Parser returns an exception in the output when run on a node type template * Add support for HOST as first argument in get\_property function * Add support for using ToscaTemplate with a parsed template string * Remove duplicate test * Put py34 first in the env order of tox * Solves the error using a map type wuth a min\_length contraint * Solves the "TypeError: 'NoneType' object is not iterable" when getting nodetemplate relationships. Closes-Bug: #1527214 * Use six compatibility library to load yaml files * Add consistency and validation to required attribute * Included namespace\_prefix logic in toscaparser * Updated from global requirements 0.3.0 ----- * Add checks in shell for optional keynames in the template * Add full stack trace for parser errors * Update documentation * Fix issues with CSAR error handling * Fix an incorrect template * Fix a broken test * Add expected path for built in template * Update definition for public endpoint * Update PortSpec definition per latest spec * Fix more unhandled errors for full validation * Update requirements * Fix missing import with new test * Fix an error message format * Update error message to a uniform format * Fix an issue with handling invalid section names * Create an initial test coverage for shell entry point * Modify test case for broader coverage * Full validation of TOSCA templates * Create shell entry point * Update trove classifier * Support .zip and .csar extension for CSAR files * Update the endpoint admin capability definition * Fix and test the validation of template file * Fix a bug where the temp folder is not always removed * Fix error message for invalid CSAR URLs * Remove one line subject at top of file since its not necessary and update formatting for consistency * Support nested type definitions using imports 0.2.0 ----- * Fix backward compatibility issue * Add validation of external resources for CSAR archives * Update CSAR url to its github url * Create CLI test utility * Add CSAR processing support * Allow special keywords in TOSCA template * Add documentation for parser architecture * Add CSAR decompression support * Fix translation issue with interface inputs and functions * TOSCA imports implementation single-line and multi-line grammar * Support extracting the main template from a CSAR archive * Restructured node template testcases in file test\_toscatplvalidation.py * Change ignore-errors to ignore\_errors * Update links for URL referenced templates * Added PolicyType definitions for TOSCA * Remove unused yaml files * Change the entity type module name for consistency * Extract CSAR description metadata from the main template * Handle URLs for input templates and imports * Add CSAR validation and metadata extraction * Added occurrences of requirements validation * Fix property inheritance for node templates 0.1.0 ----- * Change i18n references * Update TOX * Update setup config file * Fix coverage file with new repo * Create README * Add init file for toscaparser * Update documentation * Redefine respository structure * Remove translator specific code * Update gitreview file * MemoryUnit Incorrectly normalizes to uppercase * Implement SoftwareComponent and WebApplication normative types * Validation of TOSCA version * scalar-unit data type support as template input parameters * Corrected checking required properties of OS capabilities in UT * Validation for TOSCA second to below levels in template * Fix two typos on heat-translator documentation * Modified to get closest flavor based on minimal/no inputs * Set property to be required by default * Update TOSCA artifacts type * Separate implementation of custom types and base types * supporting short versions of requirements * Add full support for PortDef data type * Update network examples to the spec (1) * Update TOSCA wordpress custom definition * Update the 4th and 5th block storage examples (1) * Add missing storage examples from the spec * Update the 6th block storage example from the spec (1) * Remove the circular dependency in network examples * Update the first block storage example to the spec (1) * Update object store definition and example * Sync single server example with latest spec * Sync network examples with the spec * Remove py26 env * Fix translation of block storage * Updated from global requirements * Add a unit test for nodejs-mongodb template translation * Update TOSCA version per spec * Prepare ELK TOSCA Template for Translation into HOT (6) * Add app in the nodejs mongodb template * Update TOSCA credential datatype * Update TOSCA relationship inheritance * Update TOSCA translator installation doc * Update TOSCA relationship valid targets * Document usage of translator with OSC * Added directory structure in README.rst * Add a unit test for ELK translation * Annotate TOSCA scripts * Prepare ELK TOSCA Template for Translation into HOT (5) * Updated from global requirements * Implement tosca.scalar-unit * Update TOSCA base type definition file with version * Prepare ELK TOSCA Template for Translation into HOT (4) * Added translation to the tosca network module * Added translation in dataentity module * Fix typos in ELK CSAR readme file * Updated from global requirements * Adding unit test coverage for the validate method * Implement artifact type definition * Add support for parameters to translate template * Added the missing testcases for Tosca translator * Add handler for ConnectsTo relationship * Prepare ELK TOSCA Template for Translation into HOT (3) * Update TOSCA ELK scripts * Adding an empty template test for simple\_parse() * Add unit testcases for toscalib\_elements\_constraints.py * Fixed spelling mistake * Fixing an error message which was not translated * Add the ability to set output file * Create an OSC plugin for heat-translator * Resolve interfaces by symbolic name not by type * TOSCA: Database and DBMS node properties update * TOSCA: fix indentation in elk CSAR * TOSCA: create csar for monitoring use case * Installer scripts should not run simultaneously on the same server * Prepare ELK TOSCA Template for Translation into HOT (2) * TOSCA: Update memory size per spec changes * Adding test coverage for HotParameter * Fix host server assignment for resources with multi-node dependency * Heat-Translator: Update README with new IRC Channel * Added a unit test to cover diff\_dicts in utils.py * Fix installation package name * Prepare ELK TOSCA Template for Translation into HOT * TOSCA: interfaces for relationship templates * TOSCA: fix Python34 UnicodeDecodeError * Pick up new plugins for ELK * Heat translator plugins for new TOSCA custom types * TOSCA: keep the license formatting consistent * TOSCA: Create a test CLI program * Fix typos in tosca\_elk.yaml file * TOSCA: use the artifacts directory for scripts * TOSCA: Correct duplicate Block Storage description * Implement tosca.capabilities.Container * TOSCA: minor updates in TOSCA def file per spec * TOSCA: rename sample template file * Create a unit test for wordpress specification in TOSCA * Update the TOSCA monitoring use case * Update TOSCA requirements for template and type * Apply topology\_template to tosca\_template * Inital Implementation of topology template * Add test templates for topology template * Update code base to be hacking compatible * Update requirements and test-requirements * Update README.rst to point to correct urls * Update heat-translator's documentation theme * Added unit test to verify num vals in str\_to\_num * Implementation of tosca.node.ObjectStorage * Implementation of CompareUtils class * Added a unit test for convert\_unit\_size\_to\_num * Added unit test to cover ValueError in str\_to\_num * Update definition of tosca.nodes.WebServer * TOSCA: organize test templates * Fixes few nits in the network features code * Create dictionary returning methods for certain class properties * The output template is close to HOT template * Rename TOSCA AttachTo relationship * Fix coverage so that it works for this repo * TOSCA: Handle memory units * TOSCA: Create new utils module with memory units * Add TOSCA networking features * TOSCA: Update README source code link * Follow the hosting chain to find the host server * Add scripts for logstash, elasticsearch, kibana * Add scripts to set up monitoring * Update set of scripts for mongodb and nodejs * tosca data type validation for float and timestamp * TOSCA: Handle custom capability type definition * Return input default value on get\_input evaluation * Replace ip\_address attribute with public\_address and private\_address * checking input parameter not None before accessing * TOSCA: Add missing artifacts references * Change name-value pairs to name-object pairs in the dictoinary * validating reference properties in translate\_input.py * Add support for properties\_def as a dictionary * added \_validate\_capabilities\_properties function & UT * Adding tosca.capabilities.Scalable in TOSCA\_definitions.yaml * Apply TOSCA OS capability to compute node * TOSCA: consider nodejs as web server only * TOSCA: remove misleading key Entry-Definitions * Use TOSCA properties from capabilities definition * Remove Stackforge from README * New custom type, unit test and template for use case * Add TOSCA networking definiton * Update TOSCA interfaces naming * Separate TOSCA capabilities definition from assignment * Remove unused TOSCA type variables * TOSCA: Do not import individual exception classes * Add missing TOSCA type keywords * Update TOSCA compute requirement * Validate TOSCA template version * Update TOSCA version * Add scalar unit type * Handle TOSCA relationship with 'type' keyword * Handle custom datatypes in current template * Change definition for tosca.capabilities.Endpoint * Remove Tosca.capabilities.feature per specs changes * add blockstorage attachment notation * Remove redundant TOSCA nodejs requirement * Change TOSCA interfaces keyword 'input' to 'inputs' * Add TOSCA service template for monitoring * Minor tweaks * Main translation code to handle parameters * Add new support for get\_attribute * Add support for datatypes * Rename TOSCA node property relationship to relationships * Add a debug env for tox * Sort TOSCA relation output for a match to expected test result * Create relationship between TOSCA nodes per updated specs * Fix .gitreview after rename/transfer * Fix errors in templates and base types * Workflow documentation is now in infra-manual * get\_attribute HOST keyword * Handle get\_attribute in Tosca outputs * Add support for list and map types * Check for tosca keyword in the TOSCA type * Create a TOSCA CSAR for Wordpress template * Represent memory unit in string * Remove extraneous vim editor configuration comments * Provide implementation to parse monitoring template in TOSCA library * Allow Tosca templates with no inputs/outputs * Extended intrinsic functions support * Remove README.md as duplicate for .rst one * Work toward Python 3.4 support and testing * Add missing TOSCA template keynames * Update README and other doc files * Clean up heat-translator documentation * Revert use of olsosphinx library * add docs job to tox.ini * Check tosca node requirements * Add Schema parent class for Property, Input, Output * Implement TOSCA Block Storage * Allow use of TOSCA types by short name in the TOSCA template * Add type attributes * Enhance the validation of tosca * Enhanced tosca validation * Added a module for intrinsic function * Support importing TOSCA custom node types * Update the Babel module version * TOSCA generator top level code * TOSCA generator translation for individual TOSCA type * TOSCA generator template syntax * Remove tosca node template inheritance from node type * Add missing parameter for the tosca property * TOSCA parser * TOSCA definition types for TOSCA library * Add .gitreview file and apply cookiecutter template * Delete testattrs.pyc * Delete test4.pyc * Delete test3.pyc * Delete test2.pyc * Delete squaretest.pyc * First code drop on data modeling * Initial commit ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7823093 tosca_parser-2.15.0/HACKING.rst0000664000175000017500000000022215250006202014670 0ustar00zuulzuultosca-parser Style Commandments =============================== Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest/ ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7823093 tosca_parser-2.15.0/LICENSE0000664000175000017500000002363615250006202014115 0ustar00zuulzuul Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. ././@PaxHeader0000000000000000000000000000003100000000000010207 xustar0025 mtime=1788873902.5294 tosca_parser-2.15.0/PKG-INFO0000644000175000017500000000653015250006257014207 0ustar00zuulzuulMetadata-Version: 2.4 Name: tosca-parser Version: 2.15.0 Summary: Parser for TOSCA Simple Profile in YAML. Home-page: https://docs.openstack.org/tosca-parser/latest/ Author: OpenStack Author-email: openstack-discuss@lists.openstack.org Classifier: Environment :: OpenStack Classifier: Intended Audience :: Information Technology Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Requires-Python: >=3.6 License-File: LICENSE Requires-Dist: pbr>=6.0.0 Requires-Dist: cliff>=4.9.1 Requires-Dist: PyYAML>=3.12 Requires-Dist: python-dateutil>=2.9.0 Requires-Dist: stevedore>=2.0.1 Requires-Dist: requests>=2.32.3 Dynamic: author Dynamic: author-email Dynamic: license-file Dynamic: requires-dist Dynamic: requires-python Dynamic: summary ======================== Team and repository tags ======================== .. image:: http://governance.openstack.org/badges/tosca-parser.svg :target: http://governance.openstack.org/reference/tags/index.html .. Change things from this point on =============== TOSCA Parser =============== Overview -------- The TOSCA Parser is an OpenStack project and licensed under Apache 2. It is developed to parse TOSCA Simple Profile in YAML. It reads the TOSCA templates and creates an in-memory graph of TOSCA nodes and their relationship. Architecture ------------ The TOSCA Parser takes TOSCA YAML template or TOSCA Cloud Service Archive (CSAR) file as an input, with optional input of dictionary of needed parameters with their values, and produces in-memory objects of different TOSCA elements with their relationship to each other. It also creates a graph of TOSCA node templates and their relationship. The ToscaTemplate class located in the toscaparser/tosca_template.py is an entry class of the parser and various functionality of parser can be used by initiating this class. In order to see an example usage of TOSCA Parser from a separate tool, refer to the OpenStack heat-translator class TranslateTemplate located in the translator/osc/v1/translate.py module. The toscaparser/shell.py module of tosca-parser also provides a good reference on how to invoke TOSCA Parser from Command Line Interface. The toscaparser/elements sub-directory contains various modules to handle various TOSCA type elements like node type, relationship type etc. The entity_type.py module is a parent of all type elements. The toscaparser directory contains various python module to handle service template including topology template, node templates, relationship templates etc. The entity_template.py is a parent of all template elements. How To Use ---------- Please refer to `doc/source/usage.rst `_ Project Info ------------ * License: Apache License, Version 2.0 * Source: https://opendev.org/openstack/tosca-parser/ ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7823093 tosca_parser-2.15.0/README.rst0000664000175000017500000000406115250006202014566 0ustar00zuulzuul======================== Team and repository tags ======================== .. image:: http://governance.openstack.org/badges/tosca-parser.svg :target: http://governance.openstack.org/reference/tags/index.html .. Change things from this point on =============== TOSCA Parser =============== Overview -------- The TOSCA Parser is an OpenStack project and licensed under Apache 2. It is developed to parse TOSCA Simple Profile in YAML. It reads the TOSCA templates and creates an in-memory graph of TOSCA nodes and their relationship. Architecture ------------ The TOSCA Parser takes TOSCA YAML template or TOSCA Cloud Service Archive (CSAR) file as an input, with optional input of dictionary of needed parameters with their values, and produces in-memory objects of different TOSCA elements with their relationship to each other. It also creates a graph of TOSCA node templates and their relationship. The ToscaTemplate class located in the toscaparser/tosca_template.py is an entry class of the parser and various functionality of parser can be used by initiating this class. In order to see an example usage of TOSCA Parser from a separate tool, refer to the OpenStack heat-translator class TranslateTemplate located in the translator/osc/v1/translate.py module. The toscaparser/shell.py module of tosca-parser also provides a good reference on how to invoke TOSCA Parser from Command Line Interface. The toscaparser/elements sub-directory contains various modules to handle various TOSCA type elements like node type, relationship type etc. The entity_type.py module is a parent of all type elements. The toscaparser directory contains various python module to handle service template including topology template, node templates, relationship templates etc. The entity_template.py is a parent of all template elements. How To Use ---------- Please refer to `doc/source/usage.rst `_ Project Info ------------ * License: Apache License, Version 2.0 * Source: https://opendev.org/openstack/tosca-parser/ ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4863932 tosca_parser-2.15.0/doc/0000775000175000017500000000000015250006256013654 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7833092 tosca_parser-2.15.0/doc/requirements.txt0000664000175000017500000000042515250006202017130 0ustar00zuulzuul# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. openstackdocstheme>=2.2.1 # Apache-2.0 sphinx>=2.0.0,!=2.1.0 # BSD ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4863932 tosca_parser-2.15.0/doc/source/0000775000175000017500000000000015250006256015154 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7833092 tosca_parser-2.15.0/doc/source/conf.py0000775000175000017500000000456715250006202016461 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import os import sys sys.path.insert(0, os.path.abspath('../..')) # -- General configuration ---------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', 'openstackdocstheme' ] # autodoc generation is a bit aggressive and a nuisance when doing heavy # text edit cycles. # execute "export SPHINX_DEBUG=1" in your terminal to disable # The suffix of source filenames. source_suffix = '.rst' # The master toctree document. master_doc = 'index' # General information about the project. project = 'tosca-parser' copyright = '2013, OpenStack Foundation' # openstackdocstheme options openstackdocs_repo_name = 'openstack/tosca-parser' openstackdocs_use_storyboard = True # If true, '()' will be appended to :func: etc. cross-reference text. add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). add_module_names = True # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'native' # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with html_theme = 'openstackdocs' # Output file base name for HTML help builder. htmlhelp_basename = '%sdoc' % project # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ ('index', '%s.tex' % project, '%s Documentation' % project, 'OpenStack Foundation', 'manual'), ] # Example configuration for intersphinx: refer to the Python standard library. #intersphinx_mapping = {'http://docs.python.org/': None} ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7833092 tosca_parser-2.15.0/doc/source/contributing.rst0000664000175000017500000000011415250006202020400 0ustar00zuulzuul============ Contributing ============ .. include:: ../../CONTRIBUTING.rst ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4873934 tosca_parser-2.15.0/doc/source/contributor/0000775000175000017500000000000015250006256017526 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7833092 tosca_parser-2.15.0/doc/source/contributor/contributing.rst0000664000175000017500000000353615250006202022765 0ustar00zuulzuul============================ So You Want to Contribute... ============================ For general information on contributing to OpenStack, please check out the `contributor guide `_ to get started. It covers all the basics that are common to all OpenStack projects: the accounts you need, the basics of interacting with our Gerrit review system, how we communicate as a community, etc. Below will cover the more project specific information you need to get started with tosca-parser. Communication ~~~~~~~~~~~~~ * IRC channel #heat at `OFTC ` * Mailing list (prefix subjects with ``[heat]`` for faster responses) http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-discuss Contacting the Core Team ~~~~~~~~~~~~~~~~~~~~~~~~ Please refer the `tosca-parser Core Team `_ contacts. New Feature Planning ~~~~~~~~~~~~~~~~~~~~ tosca-parser features are tracked on `Launchpad `_. Task Tracking ~~~~~~~~~~~~~ We track our tasks in `Launchpad `_. If you're looking for some smaller, easier work item to pick up and get started on, search for the 'low-hanging-fruit' tag. Reporting a Bug ~~~~~~~~~~~~~~~ You found an issue and want to make sure we are aware of it? You can do so on `Launchpad `_. Getting Your Patch Merged ~~~~~~~~~~~~~~~~~~~~~~~~~ All changes proposed to the tosca-parser project require one or two +2 votes from tosca-parser core reviewers before one of the core reviewers can approve patch by giving ``Workflow +1`` vote. Project Team Lead Duties ~~~~~~~~~~~~~~~~~~~~~~~~ All common PTL duties are enumerated in the `PTL guide `_. ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7833092 tosca_parser-2.15.0/doc/source/index.rst0000664000175000017500000000263415250006202017011 0ustar00zuulzuul.. tosca-parser documentation master file, created by sphinx-quickstart on Tue Jul 9 22:26:36 2013. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Welcome to tosca-parser's documentation! ======================================== The TOSCA Parser is developed to parse TOSCA Simple Profile in YAML. It reads the TOSCA templates and creates an in-memory graph of TOSCA nodes and their relationship. The TOSCA Parser can also be used for parsing TOSCA Simple Profile for Network Functions Virtualization (NFV). The work to provide such a support was started with the release of TOSCA Parser 0.4.0 PyPI release and it is ongoing. The TOSCA Simple Profile for NFV can be accessed by using TOSCA version "tosca_simple_profile_for_nfv_1_0_0" in the template. The TOSCA Parser now supports profile definition extensions that can be accessed via a custom tosca_definitions_version. Extensions can be added by creating a module in the "toscaparser/extensions" directory. See the "nfv" module for an example. Contents: --------- .. toctree:: :maxdepth: 2 installation usage contributing For Contributors ================ * If you are a new contributor to tosca-parser please refer: :doc:`contributor/contributing` .. toctree:: :hidden: contributor/contributing Indices and tables ------------------ * :ref:`genindex` * :ref:`search` ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7833092 tosca_parser-2.15.0/doc/source/installation.rst0000664000175000017500000000110215250006202020370 0ustar00zuulzuul============ Installation ============ PyPI Installation ----------------- Tosca-Parser can be installed via a PyPI package. Refer to https://pypi.org/project/tosca-parser for available packages. The latest release can be simply installed by running the following command:: sudo pip install tosca-parser Manual Installation ------------------- You can manually install the latest code available at the TOSCA-Parser github repository by following these steps:: git clone https://opendev.org/openstack/tosca-parser cd tosca-parser sudo python setup.py install ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7833092 tosca_parser-2.15.0/doc/source/usage.rst0000664000175000017500000000173115250006202017003 0ustar00zuulzuul===== Usage ===== The TOSCA Parser can be used as a library by any client program, for example, OpenStack heat-translator uses it to translate TOSCA to Heat Orchestration Template (HOT). For an easy reference on how TOSCA Parser can be used programmatically or to test that the a TOSCA template passes validation, refer to the tosca_parser.py test program which is located at the root level of the project. Alternatively, you can install 0.3.0 or higher PyPI release of TOSCA-Parser as available at the https://pypi.python.org/project/tosca-parser and test use the parser via CLI entry point as:: tosca-parser --template-file=samples/tests/data/tosca_helloworld.yaml The value to the --template-file is required to be a relative or an absolute path. Custom template versions can be created and supported outside of TOSCA Parser using the toscaparser.extensions namespace. See the NFV and MEC extensions for examples of how to define custom template definitions and versions. ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7843091 tosca_parser-2.15.0/requirements.txt0000664000175000017500000000112215250006202016356 0ustar00zuulzuul# Requirements lower bounds listed here are our best effort to keep them up to # date but we do not test them so no guarantee of having them all correct. If # you find any incorrect lower bounds, let us know or propose a fix. # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. pbr>=6.0.0 # Apache-2.0 cliff>=4.9.1 # Apache-2.0 PyYAML>=3.12 # MIT python-dateutil>=2.9.0 # BSD stevedore>=2.0.1 # Apache-2.0 requests>=2.32.3 # Apache-2.0 ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873902.478392 tosca_parser-2.15.0/samples/0000775000175000017500000000000015250006256014553 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873902.478392 tosca_parser-2.15.0/samples/tests/0000775000175000017500000000000015250006256015715 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4923942 tosca_parser-2.15.0/samples/tests/data/0000775000175000017500000000000015250006256016626 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873902.497395 tosca_parser-2.15.0/samples/tests/data/CSAR/0000775000175000017500000000000015250006256017356 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7843091 tosca_parser-2.15.0/samples/tests/data/CSAR/csar_elk.csar0000664000175000017500000004212215250006202022003 0ustar00zuulzuulPK ¬7G+UÍè8f README.txtUT Ú|V:Vux èèmTÍnÛ0 ¾ç)xë%Éî»mw+´yZ¢#­²äI´¿ý>É΂$²Åï�dÞ_O/o¯?w»³ó…ο?žOTü0¡1§ÞãÛÊÒR(&+Êž†/Év{’ÀE½)ÂÙ¸=…t)ÊÅGKŸ¾ãÈ$l¥HLEFά‚y–LW¯®ByMÙÇ Iä.ˆ¥>å�éÿM'Y*7YÛKÇà «:”ç)FÀéì@±ˆi:L AŒZb`ø�¡²4I4ÇÝî5j^p †¸ŠA FJ©Õå4]ªAJ°,EáWÀoRTöÐe5¶–åáM”-+ÿhÇã€cÕˆŠv à³·RÈù‹;™%<(òãBϧw‚ÊR‚ÑdiÌ©‡(i¯�ôkÊ8ä!eÙ“×;ø˜|T“¦v]šQäY;2E‹˜ŸšýËôMOy¢OYÖD¿Tx-zx¹àHQªÈ*¤ÙÄCÇÚZ0D„+¶Òl!QÇEH—²§ˆëå&ÝR·c³ó#⽊Dš9û4ÝvúÁW+µ‰Žç*·Ç¢E#­‡·rÎê{6Š“¿“ÏÛŠ® °š„›å»S6&e ½a9îþPK ¬7GTOSCA-Metadata/UT Ú|Vu´ Vux èèPK ¬7G®‚AcwTOSCA-Metadata/TOSCA.metaUT Ú|V:Vux èè ñvvÔõM-IÔuËÌIÕ K-*ÎÌϳR0Ô3àrv B1är.JM,IMÑuª´Rðw ö V âÌåšWRT©ë’š–™—YÔPl¥€ÄÑ/É/NNŒOÍÉÖ«LÌÍPK ¬7GPython/UT Ú|Vu´ Vux èèPK ¬7GPython/logstash/UT Ú|Vu´ Vux èèPK ¬7G•�Eu‰$Python/logstash/configure_rsyslog.pyUT Ú|V:Vux èèeRßkÛ0~÷_qS^Èì­l/xmÆÌ‚3ât¥Œ=(òÙ8’&ÉuCéÿ¾“•”– ƒ¹_ß}÷ÝÍÞdƒ³Ù^ªÌ}§U’Ì€ÞZ TkT�|‡�.èwŠ,áZ'µ‚‹ôÌC;…Øâõ~Œ`J{ŠtÐÈR�ÐÓK®Â(}7u:á¤pQ@ï=—*‚q*1äj^¦÷É,Ƨ×yo.³lÇ”O´SmÛ¬�É.[W«²Z½%êç²Õ£s`ñï -ͽ?7ÄLð=ñíùÚo-RÌëÀ|´ÒKÕ.ÁéÆ�Übª¥óVîÿJ¼3OàeÉǰ¼‚¢bð5¯Šj ·Åîûæfánóí6/wŪ‚Í®6åu±+6%Yß /ïàGQ^/I:ê„Ɔ)ˆª ²b�B…Ax|µVht¤å ÙHAªvà-B«ïÑ*š ÚƒtaÅŽHÖÐ˃ôÜ;‚ý7]Žg–ì„•´_¡U#Û�8Mi½n�ç®#õÌN"´ �íjýŒÕ^ Ý“(c´õpññýˆˆáS©å¤¿E�ò>BBcõ¬;:²&ƒê¹:Òb+0™îJTs–¡Ù™Fè¥uvªLƒÉ–ÀF¶N¨ÝeÆlº4¬猱ÉÙ?&ñÔ,öæÙ€Èûó—‰ú³ÓsbIÎß,ôfN�§éÿD¸‹äPK ¬7GßnšÑ2è*Python/logstash/configure_elasticsearch.pyUT Ú|V:Vux èèeRÑjÛ@|×Wl‚mp¥ÒÇ”Ü$¥¢Á†Èi(¥”ói--Èw×»USòïÝ“lj·÷"iw573;¯ò.ø|C&w{n¬I’ �sGMÀ :S¡nNiy:søŠ>�5ð6{Ó8�Zéììm;µÁŒeè ØR‹€ÏÐvçZRF#ôÄÍpÓ'ƒo# Ø +2#˜’_œ”¶§£ 8¹ûÃi˜ÝUž÷}Ÿ©�vf}�·ãpÈïŠëÛeyûZ¨{0-†uäE÷fÊ 3­6·U=Xªö(=¶‘yï‰ÉÔsv˽ò8UØÓ¦ã3óŽ<Å€Ó±OH%e eQÎá±X^=¬G¸ÇÅýýb¹.nKXÝÃõjyS¬‹ÕR¾>Ábù ¾Ë›9 X'7á³óQ…P¥h+V”�dzµÂÖŽ´‚CM[Ò"ÐÔ�ªjû„Þˆ.pèw⊃�¬ ¥±âø=‚ý§.‹áYÇ%íIö«­ÙRÝ §a¬µu`°»Ž£�BD¬,ÅV&PyÝ @’óDÞš†'åiXÆÙàOrÑTQŽšÇÝlDJâ\"&XÏ`C2dË:4Ó4GÖù‘J)fU~†™Åb:‡I?™�’È6WI¼m²¸tœ¦išŒA;(ù�“wtR—àêè¼ÿ á©ðù¤ÓØÀ±ž^†ô¤ì¼e«m;´b¢ÿ6_o/Â.ajCv°êûä_{&?f³äPK ¬7G/^»U-:uÒ’îõ¸!f‚¯‰oË{Ðxm‘r^潕^ªz NW¾ç#P)�·rÝù#óFždÀaÙǰyyÁàӼȋ)Üå«/ËÛU„»›ßÜÌ«üª€å \,—ù*_.(ú óÅ=|Í—S@²Ž:ᣱAQ•ÁV,S(0�Gc…JGZΠ�•$PÕ¯jý€V‘.0h7Ò…;"YB+7Òsâö�º4,Ï* Ù +i¾B«JÖqÊZ];Ï]Cî™.¬Dh]iÀXíµÐ-yB(F[³³w³·)DÈð*�Ôs€E�ò¡äžCeõ†šµ- _Apµ¥ÑtV`2l–6¨NX†^d#‘,LËl¼š†˜M�õì8íjsž¥U“†iã c,w,ŠxÚÇ0È8Œ!Êøð1*ÙŸNv±Œ¶”Xñ®õÃPF&G(뮪Ðþtò7°×oÎfÊðó¿ B—(Âõ½OOð|TáyíBÁw¶AÚPáØ�ãüÖ ýÙˆÀÒ¡žÉ¤ÓäPK ¬7GPython/collectd/UT Ú|Vu´ Vux èèPK ¬7GÓëOt:àPython/collectd/config.pyUT Ú|V:Vux èèeRakÛ0ýî_qS)M ³G cte�µ3 ɨӕ2FQä³-êHš$ÇÍ¿ßÉJÚ†é‹-ÝÝ»wïÞÉ»¬s6[K•™�o´J’ 3—•Ã:U¢ß Ì ôÙG&ð ­“ZÁ4ý£�Àö!6þ ;ÝÁ†ï"˜Ò:‡„"T²EÀg�ƃT ôÆ´’+�ÐKß �ö8)Ït?�𸵬 ëUo4¿±G_u½™Ç?Ô|PK ¬7G?Ý«�×sDefinitions/elasticsearch.yamlUT Ú|V:Vux èè}P1nÃ0 Üõ > 1ÚÕC�¢ÈÖ­h‰nȤ ÒIýûÚŽ´Ko"ŽwÇ]-aÌ4²°³ŠÅ+5[‡|_OµP\p*ñ%>‡�ÉRãê»æ5œ šs2–.À( •äd:·Dp,H¾X†™‹ƒÊ_AGx«˜.s"¡'@çRNNß~O‡±ðа-]¢™¢/•¬_Ïï5»�³îSG¿a£w�ª ‰wÊmr€L�¯”ãØtêÿ·ïú„.ë{î7Üó"I®ÊâzÅÖë‘úÛÙ�møPK ¬7Gì®êç§Definitions/rsyslog.yamlUT Ú|V:Vux èè…�±NÄ0D{ÅþÀYЦ 9!š“�’k¨,co’‰×x—Cù{œ@P*peÏΛYYY‚w{J¤ÄIÜ ‹ÔKº�„æ<¡[ü<¹{wgLD …²nžÐv/Ýåù H@G„–Ãê©÷¢P'Š3ô\`uäÂE( Ö˜Ä�.¥©![™]5±÷úé žyΜ0©me‘‰‡Õ±Ð £ë ÏÍßàæ/øþAçú–ï€Ô8‡)f¦¤»ºžà³¥‰tÙ³ª�?È�X»ÿÙÃ^xõ2°‚“ß~|¤¼ãGMì™S reóPK ¬7GÞ‚·7Definitions/kibana.yamlUT Ú|V:Vux èè…Q½RÃ0 ÞózÈÁÚ�¥×‰&Ÿj+T‡cKi.<=vÚeM–>}?¶MÔ£ 4pbcIêŽT´6`+¤<æHnÁ1º{w×u�Ôζîa7U—æ›Õ�“QAo'‰€† &…ò[±KÈÙ’I7U~½kßfÚ?É`3Úʘ%Q²þdÚö æ-|¤à†"ãæoÞº_è}âBcíõ¤ÐêößQ Yjðo¨•ÇŒ{ŽlËÅâkÂÕiw&]qZˆõW�pÅ.×�Ñç‹ÊÏ™ö[I‰¼é³t]÷ PKË’&I íPÂÁ,Definitions/paypalpizzastore_nodejs_app.yamlUT ÎkÏWÎkÏWux èè}R=�Û0 Ýý+tèÒ8íê¡ÀázC‡As@Gƒ¶è˜…,©"�Ö÷ë+ÙÇ‚„'’ïƒV/-Ö†:v¬ì�ÔgŠ’.èü$<Kõ„ƒ­¿ÔŸ‹Â�´‘ƒÎ5_ €¿½!ˆúH€!€ö¨€Öú¿“Ó Áægí :B# „èÏlÈ@3Á§Ú�?_ޝðtø.ešü#÷Rd -:hR·��DЫ©öûk?6eë‡}À) Ý§ÙºÃÀ;Á,=]ÃÎyC¿e_ùRëHªD0[,3&å/jžB°Üb¶V.ŠfoÇl-—CùL¦î¢ªísq2(*/\ù,bë1Ú éÏÈ‘LZ¡Ï"«kdwZÁ›ð­_ÈÀws²xå‡ôeè=�M‡£Õê^|K\eBŠ�®�œ®ú?ܺv} DžýF¥ø ÄCïE!ÿ6LæB½ƒŠ Õ­wŽÚÙª Ò~6lY§K®+’,_œ ž�–ßÞÇlZón—q§(’�5KÏáR¼Å¤|^tÉ«ŸÛÅÛëöŽŠÎ`4WÙÉJǧñòw,‡]ŠB¶ÈýÅ?Xs>ƒw'oš:É}ÔòPK{uÌ�2]’eNâ-.òø<žŽF)‘‰ ¥2c^ŒºÎ¨D׿/ç/‘ŒJÁ×þ§¤ÌùV"ÆSò§£‚³ OWcDr,M$Á"ÉÆ(ç©°Ìf)úHW˜aDp’!ÎF’”X`Eàƒp0ãU™vF”max•“­¹ps¹±è.#‚hØs�¸,sš`½ØEŸ‰`% ¹•€Ç@Ixž“D¥ ÓR(s=‘ÁÌ�F°v.”œÁÈ3Tâm‰ó’ÞßÃJ¹ ±ÃÔ‘æÒ hhš=M‹å¤ùî�5-¶m¥2oÇTCB(ãRÅ .ñŠæÐNä }½ÓfF"ôLÁ¦ 8„h–DèNôÍ:Ç·\|ëF¥T~�Ü“:Ÿ¢Ÿ_¹fVqRVàÿo´!*¦¬¬Ô [ÓŠþqà R8ã‹éóKôÖšsÙÅØiqÖš2ª€„J€‡OÏ.ãË ×¥¶%4]QV}j€*AW•íͪbªr]µÜÏ/¢éÅh¤xÉ�Èm¬Hd73‘‡8Ý2fÁd”)²1Ú4ÓµSä·ªX‹|�æ‹i4ª2RËÆZÛ€øVµcÕ[œÓ4†¿•fâ=:£ïÇèbŒž¡fØ2¡ZÅ•Èk3 H¯—m|[H«üæÝä7JùË9N�–£füW9Ä,SªœM&vš(áÅÄ {"ˆTg¸¤g6³àcyæœÀà8Òßjݪ¬qܤEÈ¢©8‘6”Ñdõ²IÓh�· œ/´áR:»F› m+¡›ŽZ…‚üUQA Ò¡^gÆÌñÒjN±Â+,I c >è©kqºrã´Ä'mPK‹´ SG}M7UCƒ{LÕˆ°õE“¥‰ŸœX@kɬcØÒiëÙåÃñ¶Õ¢Z¾¹úiܦæCMNý¸ÊÓÒ{ÀÊf„í½]¿UôbBo!ä1NSP‰ìxƒÊ&Tß’L‡_‘m;¨Ž¥ß Œb°m?Ó;@,Û†Æ,Dׄ¾�˜¿/‰ýKxí”4H‡Þ]!�×ÅÒ޽¢»È‹ô¿~õvyîS1"Õ¿'—¤Rí­7—úSédy°›N�Á a<–|­îà�2çpa°ÚèMÛpP¨‚©N²Àkoàv™m>üÑè*®œÍ ü!ºßCXZr ¤¯ª�Ò3þ·ã('À…9²e °ŽöÚkm�“ÑÜîEòšwLúçŸùžÍÇ<¥0;œK^‰¤w\o‚-¶*ãl⩜4ŽÂo¹í÷Ø¿‰¹'”iöIù@>>BÞÍ)»ˆÚžî�‘ô¯Æb� ­ó‡åÜ+ÞG0cç=Q©öÎŽ¨Ô_@'þq”öû ø>zp ä¡Ï*þ…ï‘Ì�Í ™ìˆÜ‹èÁz—‡•ÕE·UêÚž@�Ö!œ'¨sõûy]â‘IÞÙ#sÉ¡m¼ÙdêáþdªwÅ~Íw6Í£U_cÚѽ»Ö8Föï¬Éÿªÿ×Uïï N!zçëDûGííˆ ä kÞCÚ‘¼õ·_ñZéÁõweõ„Ý×ÞÖ5 únß�Ÿ¾{ÛkÔw ×~Ýy xû¶û§€»#µ§98ý×Ã8^©¦¸«úÖ¥jpªïNý-nðÀØ_—þøËâÅì‡étêÌÍn_i%üN©¯áü�ÃPK ¬7GvxbsíÃDefinitions/collectd.yamlUT Ú|V:Vux èè…Q»rÄ ìýú�x’ÖEš›té’žá@¶5AòÝøïƒ�sÆUBË>´`¢Á»ˆ#1 «»aÕ¶Àö+¥\ºÕçä^Üs×EÔP©ØÎy키„Á"�‚‡è1 Ã}¦0Ãämnv æ�Ô(4ÆUƒƒ®j˜�lÖ…™xá¾ëX":[ êÐü÷9ú ÓþCF»ûŠÉEÙúË#}cD¬tÃèÆ*yø[¹ó+~-T1·³þ8ûUW®‰Ù5$�©ðÜE�ø'EÌ¢”’ §�r'�^˜ŠïŒ¡ImËŠy ¤ü[þìÁ1Nœû0ØÛ¶SH,bÌÇIgßaÑ©NrçÜD~ –¥^Aê±´nÿ´·÷/v5Á'NÀ�� ` ûnÄ&ps¶üÛqÕqÛzç–½HËåMb¼QÌ›… Ì°ÇêÝBs2ÎÅ/Ž)Šþçÿ‹À*ÈYQæ Z²ærˆžÍ·‡-¾¾ˆ�_iN*¸Ýa{m¾PK ¬7GÏ®™}P}Scripts/elasticsearch/start.shUT Ú|V:Vux èèuŒ1 €0û¼b%½~Æ\Î@$†ÛÃ÷›ÆÂBØjfؼlÅúV„-eìͪÛ0㨧0LYŵA«ß¦Öç,Ö#½ä3®ñ«æyzPK ¬7GScripts/kibana/UT Ú|Vu´ Vux èèPK ¬7GÐoàÐScripts/kibana/create.shUT Ú|V:Vux èè}‘An„0 E÷œÂÕ,+ �=G/àØˆ "fÍéµÌb­dÉÒ×·å÷}zÑÖm1�Å >GŸ Ñê’à4%øò†ä$�Ø�ë`–׫'—GryQ\ƒŽ‹·Á Œ"KúКã-LY¹ “xRõïòçVU«ªœ|ØörïŒ\Õp/rƒý~½Àÿ¶ùú‡á�‹ šAž!„ŸÃ��>8žî|5x7»e?Å .H¦˜µäà|š½Ð¨Ï¶n‘úªGÇMm�+ƒzÅ›¶äºšÏmgÞ¨aâ‹¥æ½9SÛ¢©­1† ›êˆÁ4Αáu‡‡°-ŒâÊ•?4`wÁmÊé;è‹oPK ¬7G/K{oÉjScripts/kibana/config.shUT Ú|V:Vux èè…�1nÃ0 E÷œ‚E xª•íÐst(™‰ˆ*’@ÒF{ûÈrPY.ä'øþçþÅyÎΣÆÝ¾#+h®¡äŸg!…ö˜¬¬b¦`kk‘€ªqPB ”d!i˜¶ÅH&4ÌÓ*Ño-býk…Y” ]ûø<¼uÿÆÌ KÉÊ £OFG®�¹Åê“ЊoÉhÚü=µ8swJ¼1 êR ˜bQsÃë#qp¸RÍmT·½›Æ¿KºãÆ^�òáùùPK ¬7G%ëÚðMjScripts/kibana/start.shUT Ú|V:Vux èèSVÔOÊÌÓOJ,ÎàRVÉÈ,V(N.Ê,(Q(.I,*)VÈÎLJÌKTH,VHT(N-*ËLNUÈ̢̽.˜D• PS~A I\PK ¬7GScripts/nodejs/UT Ú|Vu´ Vux èèPK ¬7G0z9¹s�Scripts/nodejs/create.shUT Ú|V:Vux èè=�1Â0 ÷¼Â¨sÈÎ;ø€S[ÄU”Ûú{ŠDOºÓ-·Re”ŠÞÒÏ&¾šh€ ìÝaLâÍA456~§„D5²±N—˜v€*>Öfâ¹3–owßü4OëÅ»ÿñ7€|\‹ºK§ÌîXãû�‹^ž�ëÅœÎ$¬Z§”56 ±XíÈ-¡³øµÔÁíív÷C5x|$Ç^Âs·Œ¸P øfž—‰+ÂR58:‹§O²›ÌT­ãX_rÁC~ŧ�<ŽèááæÝû�oX6DQ=Ã7ƒ—yV s4?I|LYv~�»Ý×íZŸÿ¿í¾l÷ß?ßß­õ�“ö®ž&� ÐÂÊj Ëßóþ‘œeÚ GÄ›Á©v§„ø 7›Õ[X)^Ëy‘•öPK ¬7G®8¦F@FScripts/nodejs/start.shUT Ú|V:Vux èèSVÔOÊÌÓOJ,ÎàRVÉÈ,V(N.Ê,(Q(.I,*)V(ÉHUÈËOIÍ*VH,(ÈÉLN,ÉÌÏãË‚%€¢\PK ¬7GScripts/logstash/UT Ú|Vu´ Vux èèPK ¬7Gl©�ô6[Scripts/logstash/create.shUT Ú|V:Vux èè�’?S!Å{>Åš´r˜G{'……6–{°9È@–‹“?¼\’;ÿŒ…å¾ß{ì²¼P­ ªE¶b /Ö1°Î.p� zϰÅ=^‚�]­ÙÅèJv-$Ô=v›˜ç¦Š:Ë�j@†”)Ó›˜Šì¨À� šË©] & [ÓË[¹Í$-¡ñÄ,v½q­f›o>í&Ö&ÇdJQ¼�¥| ¶”t¯Ô9,7ä‘‹ÓL˜µmbîÔúy-^å�ø8R{ªtc@ Ò6ÂÂPûâS­škU%ÔƒÖìÐ…E…"�xzU5R‡¬+Ì;.ÿ™Õ_“˜S"ŒÝã®2ùÉ� BÅê3G—ºø­‘|4Iyã™òÞi§D2ëÆ|ý C|a¸»�Õ•øPK ¬7G`5•=]Scripts/logstash/start.shUT Ú|V:Vux èèSVÔOÊÌÓOJ,ÎàRV*ÍSÈÉO/.r‹ŠS‹Ê2“S2ó€(³D/… &WU\’_€M4±¨„ PK ¬7GScripts/mongodb/UT Ú|Vu´ Vux èèPK ¬7GLMî–ÄScripts/mongodb/create.shUT Ú|V:Vux èè}�ÍNÃ0„ï~Š!凨A�Ê O€Ä¡ª*Ç^«NlÙ› "ž¤ê‰=í®æ›ÑîâJÕ®WµÎ­Xà£uÙ$®Ï¬½ÏèBß[ ¡#—[ÚAÛåÜeJ#%´Û¸Tê<Ë¡z¤ Ýò©š”‰ÌˆÇ÷êõíå®dÚ€ÂR�–yÅ �!2¤FM9êà�âúÆçz“ȓ΄2›ÛBµå¬½—ºÁ³›‚3øA›½MC2”¥w™¥½$ˉܯw5Ä¢ÕLçñø”;\pB,>µc|…tZOJÇN{÷£Ù…^|·ÎV+\¡´(Ô¨“ò®>¥« w±Àzý ¦:¼d¶u}ó�3¤”ŞȞ(âAØÐ“øPK ¬7G­/PQŠç"Scripts/mongodb/create_database.shUT Ú|V:Vux èè}α Â0Æñݧ8ë�º¤»bé*|¹Ô£�´w¡I‘V|w :¿í¿üø6ëÂ:.,†vEu+�Õ `ºÃI¸‘|»ÏàÿJG¯oác\í[H�n(VÇ\yœ^& `‚‚~²ó‡‚.Õéôî�;ˆ¥{KàðJbhA¥´áu–VŸv3XÔ)!î¾hë iz¥,L{·óÌ-¼g=ÂPK ¬7GScripts/collectd/UT Ú|Vu´ Vux èèPK ¬7G {‚yQkScripts/collectd/create.shUT Ú|V:Vux èè=Ë;€ н§¨a&\Æ ”�ؤRuðöºÈø†ç¶¹…Hó‡ûÉgÜ ¹M#L*R’e¼PK ¬7G\Ë‘LnScripts/collectd/start.shUT Ú|V:Vux èèmŒ; À {Oñ‚}¼L.°~ÀQñ-9l’*0Õ0Œ?BÔ¢°:�«*Á´th²ŒH£µ’,C˺5hߨ�Ù½æëhcþÙ}sPK ¬7GScripts/rsyslog/UT Ú|Vu´ Vux èèPK ¬7GÔÛ¥`|Scripts/rsyslog/create.shUT Ú|V:Vux èè=Ì1„0 Ñ>§øˆ:ât[ ÄÈKVˆlSäö4ˆj4͇)q�Y #¶ÂÛ•›ƒ«9‰ÔºÉu‚ê/ÂII;þ—b�KÔ<žÙq·ƒ<û ˆý3ÞFÍÒÂPK ¬7GÁt¬*SVScripts/rsyslog/config.shUT Ú|V:Vux èè…SQOÛ0~ϯ8Òjel©Ûm¼l*Oc Ôñ¶0ê&×ÖÃõy¶(Ðÿ¾sÚ²ŒM"J¢øÎ÷}ß}9wöÄT1•~‘$¸\(¾pÊ(ÈÌÔ¼rè!,¨ ¶ 0#ί¼¦y �À£)�>.xƒÄU`@ιXrÞ?@å•™7hããÓ °Ž¤b4µrd–hÔÒ)9Õøv­,°6¼³Xl¨§È *›`± H—TV÷5Ér”§´t¨mž¾Nd™ý°²ØŠC�nŽ�#ÝÇ£\ŽFÁ\� …Ø6Ý/E _ÈkÔ7ýhQ´mŒKª±iL”X‹;Nxbõ;eTÒÃ.ÃEÜ�¡²–J7­NWPâLV:$z4‘·7У[éLÿ ä'BçOØâÁ:ÅN��!ƒáº÷\åá Û¢52'‰šÁw؃캮>Eµ&¾˜Œmu1ü†“MLM ^€…GX ,!3±ü‘MU²-HdŒ”݈£ä�¸jSG¦Áú ÞOvqÏ?9S�9ÈÒßò{íÅ�þÃ`-^uDú‚¸j¦¾ÙïcÓ¸l¨ÄŸ~3²­aŽöìÁÜ¡…ìW³IZ é_3m©ßJìy‘w/œª?;²—ôÕQesØÔü›Y.ų¿õ$v3Èy÷ŒÊScPË™ÒØ÷”äÝÃçï /Ïå’çŒOˆˆ[©ýØCkÓ¥œƒ•++õµU÷÷òc;ù-È€ñxîC¶…ØíW&æÎȨ@®]wAZŸ˜ÀÇZjòÑ8úOìöoPK ¬7GÆ`MmNlScripts/rsyslog/start.shUT Ú|V:Vux èèSVÔOÊÌÓOJ,ÎàRVÉÈ,V(N.Ê,(Q(.I,*)V(*®,ÎÉOOQH,VHT(N-*ËLNUÈ̢̽.˜TP[~A Y\PK ¬7G+UÍè8f ´�README.txtUTÚ|Vux èèPK ¬7GýA|TOSCA-Metadata/UTÚ|Vux èèPK ¬7G®‚Acw´�ÅTOSCA-Metadata/TOSCA.metaUTÚ|Vux èèPK ¬7GýA{Python/UTÚ|Vux èèPK ¬7GýA¼Python/logstash/UTÚ|Vux èèPK ¬7G•�Eu‰$ý�Python/logstash/configure_rsyslog.pyUTÚ|Vux èèPK ¬7GßnšÑ2è*ý�yPython/logstash/configure_elasticsearch.pyUTÚ|Vux èèPK ¬7G/É΂$²Åï�dÞ_O/o¯?w»³ó…ο?žOTü0¡1§ÞãÛÊÒR(&+Êž†/Év{’ÀE½)ÂÙ¸=…t)ÊÅGKŸ¾ãÈ$l¥HLEFά‚y–LW¯®ByMÙÇ Iä.ˆ¥>å�éÿM'Y*7YÛKÇà «:”ç)FÀéì@±ˆi:L AŒZb`ø�¡²4I4ÇÝî5j^p †¸ŠA FJ©Õå4]ªAJ°,EáWÀoRTöÐe5¶–åáM”-+ÿhÇã€cÕˆŠv à³·RÈù‹;™%<(òãBϧw‚ÊR‚ÑdiÌ©‡(i¯�ôkÊ8ä!eÙ“×;ø˜|T“¦v]šQäY;2E‹˜ŸšýËôMOy¢OYÖD¿Tx-zx¹àHQªÈ*¤ÙÄCÇÚZ0D„+¶Òl!QÇEH—²§ˆëå&ÝR·c³ó#⽊Dš9û4ÝvúÁW+µ‰Žç*·Ç¢E#­‡·rÎê{6Š“¿“ÏÛŠ® °š„›å»S6&e ½a9îþPK ¬7GTOSCA-Metadata/UT Ú|Vu´ Vux èèPK ¬7G®‚AcwTOSCA-Metadata/TOSCA.metaUT Ú|V:Vux èè ñvvÔõM-IÔuËÌIÕ K-*ÎÌϳR0Ô3àrv B1är.JM,IMÑuª´Rðw ö V âÌåšWRT©ë’š–™—YÔPl¥€ÄÑ/É/NNŒOÍÉÖ«LÌÍPK ¬7GPython/UT Ú|Vu´ Vux èèPK ¬7GPython/logstash/UT Ú|Vu´ Vux èèPK ¬7G•�Eu‰$Python/logstash/configure_rsyslog.pyUT Ú|V:Vux èèeRßkÛ0~÷_qS^Èì­l/xmÆÌ‚3ât¥Œ=(òÙ8’&ÉuCéÿ¾“•”– ƒ¹_ß}÷ÝÍÞdƒ³Ù^ªÌ}§U’Ì€ÞZ TkT�|‡�.èwŠ,áZ'µ‚‹ôÌC;…Øâõ~Œ`J{ŠtÐÈR�ÐÓK®Â(}7u:á¤pQ@ï=—*‚q*1äj^¦÷É,Ƨ×yo.³lÇ”O´SmÛ¬�É.[W«²Z½%êç²Õ£s`ñï -ͽ?7ÄLð=ñíùÚo-RÌëÀ|´ÒKÕ.ÁéÆ�Übª¥óVîÿJ¼3OàeÉǰ¼‚¢bð5¯Šj ·Åîûæfánóí6/wŪ‚Í®6åu±+6%Yß /ïàGQ^/I:ê„Ɔ)ˆª ²b�B…Ax|µVht¤å ÙHAªvà-B«ïÑ*š ÚƒtaÅŽHÖÐ˃ôÜ;‚ý7]Žg–ì„•´_¡U#Û�8Mi½n�ç®#õÌN"´ �íjýŒÕ^ Ý“(c´õpññýˆˆáS©å¤¿E�ò>BBcõ¬;:²&ƒê¹:Òb+0™îJTs–¡Ù™Fè¥uvªLƒÉ–ÀF¶N¨ÝeÆlº4¬猱ÉÙ?&ñÔ,öæÙ€Èûó—‰ú³ÓsbIÎß,ôfN�§éÿD¸‹äPK ¬7GßnšÑ2è*Python/logstash/configure_elasticsearch.pyUT Ú|V:Vux èèeRÑjÛ@|×Wl‚mp¥ÒÇ”Ü$¥¢Á†Èi(¥”ói--Èw×»USòïÝ“lj·÷"iw573;¯ò.ø|C&w{n¬I’ �sGMÀ :S¡nNiy:søŠ>�5ð6{Ó8�Zéììm;µÁŒeè ØR‹€ÏÐvçZRF#ôÄÍpÓ'ƒo# Ø +2#˜’_œ”¶§£ 8¹ûÃi˜ÝUž÷}Ÿ©�vf}�·ãpÈïŠëÛeyûZ¨{0-†uäE÷fÊ 3­6·U=Xªö(=¶‘yï‰ÉÔsv˽ò8UØÓ¦ã3óŽ<Å€Ó±OH%e eQÎá±X^=¬G¸ÇÅýýb¹.nKXÝÃõjyS¬‹ÕR¾>Ábù ¾Ë›9 X'7á³óQ…P¥h+V”�dzµÂÖŽ´‚CM[Ò"ÐÔ�ªjû„Þˆ.pèw⊃�¬ ¥±âø=‚ý§.‹áYÇ%íIö«­ÙRÝ §a¬µu`°»Ž£�BD¬,ÅV&PyÝ @’óDÞš†'åiXÆÙàOrÑTQŽšÇÝlDJâ\"&XÏ`C2dË:4Ó4GÖù‘J)fU~†™Åb:‡I?™�’È6WI¼m²¸tœ¦išŒA;(ù�“wtR—àêè¼ÿ á©ðù¤ÓØÀ±ž^†ô¤ì¼e«m;´b¢ÿ6_o/Â.ajCv°êûä_{&?f³äPK ¬7G/^»U-:uÒ’îõ¸!f‚¯‰oË{Ðxm‘r^潕^ªz NW¾ç#P)�·rÝù#óFždÀaÙǰyyÁàӼȋ)Üå«/ËÛU„»›ßÜÌ«üª€å \,—ù*_.(ú óÅ=|Í—S@²Ž:ᣱAQ•ÁV,S(0�Gc…JGZΠ�•$PÕ¯jý€V‘.0h7Ò…;"YB+7Òsâö�º4,Ï* Ù +i¾B«JÖqÊZ];Ï]Cî™.¬Dh]iÀXíµÐ-yB(F[³³w³·)DÈð*�Ôs€E�ò¡äžCeõ†šµ- _Apµ¥ÑtV`2l–6¨NX†^d#‘,LËl¼š†˜M�õì8íjsž¥U“†iã c,w,ŠxÚÇ0È8Œ!Êøð1*ÙŸNv±Œ¶”Xñ®õÃPF&G(뮪Ðþtò7°×oÎfÊðó¿ B—(Âõ½OOð|TáyíBÁw¶AÚPáØ�ãüÖ ýÙˆÀÒ¡žÉ¤ÓäPK ¬7GPython/collectd/UT Ú|Vu´ Vux èèPK ¬7GÓëOt:àPython/collectd/config.pyUT Ú|V:Vux èèeRakÛ0ýî_qS)M ³G cte�µ3 ɨӕ2FQä³-êHš$ÇÍ¿ßÉJÚ†é‹-ÝÝ»wïÞÉ»¬s6[K•™�o´J’ 3—•Ã:U¢ß Ì ôÙG&ð ­“ZÁ4ý£�Àö!6þ ;ÝÁ†ï"˜Ò:‡„"T²EÀg�ƃT ôÆ´’+�ÐKß �ö8)Ït?�𸵬 ëUo4¿±G_u½™Ç?Ô|PK ¬7G?Ý«�×sDefinitions/elasticsearch.yamlUT Ú|V:Vux èè}P1nÃ0 Üõ > 1ÚÕC�¢ÈÖ­h‰nȤ ÒIýûÚŽ´Ko"ŽwÇ]-aÌ4²°³ŠÅ+5[‡|_OµP\p*ñ%>‡�ÉRãê»æ5œ šs2–.À( •äd:·Dp,H¾X†™‹ƒÊ_AGx«˜.s"¡'@çRNNß~O‡±ðа-]¢™¢/•¬_Ïï5»�³îSG¿a£w�ª ‰wÊmr€L�¯”ãØtêÿ·ïú„.ë{î7Üó"I®ÊâzÅÖë‘úÛÙ�møPK ¬7Gì®êç§Definitions/rsyslog.yamlUT Ú|V:Vux èè…�±NÄ0D{ÅþÀYЦ 9!š“�’k¨,co’‰×x—Cù{œ@P*peÏΛYYY‚w{J¤ÄIÜ ‹ÔKº�„æ<¡[ü<¹{wgLD …²nžÐv/Ýåù H@G„–Ãê©÷¢P'Š3ô\`uäÂE( Ö˜Ä�.¥©![™]5±÷úé žyΜ0©me‘‰‡Õ±Ð £ë ÏÍßàæ/øþAçú–ï€Ô8‡)f¦¤»ºžà³¥‰tÙ³ª�?È�X»ÿÙÃ^xõ2°‚“ß~|¤¼ãGMì™S reóPK ¬7GÞ‚·7Definitions/kibana.yamlUT Ú|V:Vux èè…Q½RÃ0 ÞózÈÁÚ�¥×‰&Ÿj+T‡cKi.<=vÚeM–>}?¶MÔ£ 4pbcIêŽT´6`+¤<æHnÁ1º{w×u�Ôζîa7U—æ›Õ�“QAo'‰€† &…ò[±KÈÙ’I7U~½kßfÚ?É`3Úʘ%Q²þdÚö æ-|¤à†"ãæoÞº_è}âBcíõ¤ÐêößQ Yjðo¨•ÇŒ{ŽlËÅâkÂÕiw&]qZˆõW�pÅ.×�Ñç‹ÊÏ™ö[I‰¼é³t]÷ PKÕ’&I íPÂÁ,Definitions/paypalpizzastore_nodejs_app.yamlUT ákÏWákÏWux èè}R=�Û0 Ýý+tèÒ8íê¡ÀázC‡As@Gƒ¶è˜…,©"�Ö÷ë+ÙÇ‚„'’ïƒV/-Ö†:v¬ì�ÔgŠ’.èü$<Kõ„ƒ­¿ÔŸ‹Â�´‘ƒÎ5_ €¿½!ˆúH€!€ö¨€Öú¿“Ó Áægí :B# „èÏlÈ@3Á§Ú�?_ޝðtø.ešü#÷Rd -:hR·��DЫ©öûk?6eë‡}À) Ý§ÙºÃÀ;Á,=]ÃÎyC¿e_ùRëHªD0[,3&å/jžB°Üb¶V.ŠfoÇl-—CùL¦î¢ªísq2(*/\ù,bë1Ú éÏÈ‘LZ¡Ï"«kdwZÁ›ð­_ÈÀws²xå‡ôeè=�M‡£Õê^|K\eBŠ�®�œ®ú?ܺv} DžýF¥ø ÄCïE!ÿ6LæB½ƒŠ Õ­wŽÚÙª Ò~6lY§K®+’,_œ ž�–ßÞÇlZón—q§(’�5KÏáR¼Å¤|^tÉ«ŸÛÅÛëöŽŠÎ`4WÙÉJǧñòw,‡]ŠB¶ÈýÅ?Xs>ƒw'oš:É}ÔòPK{uÌ�2]’eNâ-.òø<žŽF)‘‰ ¥2c^ŒºÎ¨D׿/ç/‘ŒJÁ×þ§¤ÌùV"ÆSò§£‚³ OWcDr,M$Á"ÉÆ(ç©°Ìf)úHW˜aDp’!ÎF’”X`Eàƒp0ãU™vF”max•“­¹ps¹±è.#‚hØs�¸,sš`½ØEŸ‰`% ¹•€Ç@Ixž“D¥ ÓR(s=‘ÁÌ�F°v.”œÁÈ3Tâm‰ó’ÞßÃJ¹ ±ÃÔ‘æÒ hhš=M‹å¤ùî�5-¶m¥2oÇTCB(ãRÅ .ñŠæÐNä }½ÓfF"ôLÁ¦ 8„h–DèNôÍ:Ç·\|ëF¥T~�Ü“:Ÿ¢Ÿ_¹fVqRVàÿo´!*¦¬¬Ô [ÓŠþqà R8ã‹éóKôÖšsÙÅØiqÖš2ª€„J€‡OÏ.ãË ×¥¶%4]QV}j€*AW•íͪbªr]µÜÏ/¢éÅh¤xÉ�Èm¬Hd73‘‡8Ý2fÁd”)²1Ú4ÓµSä·ªX‹|�æ‹i4ª2RËÆZÛ€øVµcÕ[œÓ4†¿•fâ=:£ïÇèbŒž¡fØ2¡ZÅ•Èk3 H¯—m|[H«üæÝä7JùË9N�–£füW9Ä,SªœM&vš(áÅÄ {"ˆTg¸¤g6³àcyæœÀà8Òßjݪ¬qܤEÈ¢©8‘6”Ñdõ²IÓh�· œ/´áR:»F› m+¡›ŽZ…‚üUQA Ò¡^gÆÌñÒjN±Â+,I c >è©kqºrã´Ä'mPK‹´ SG}M7UCƒ{LÕˆ°õE“¥‰ŸœX@kɬcØÒiëÙåÃñ¶Õ¢Z¾¹úiܦæCMNý¸ÊÓÒ{ÀÊf„í½]¿UôbBo!ä1NSP‰ìxƒÊ&Tß’L‡_‘m;¨Ž¥ß Œb°m?Ó;@,Û†Æ,Dׄ¾�˜¿/‰ýKxí”4H‡Þ]!�×ÅÒ޽¢»È‹ô¿~õvyîS1"Õ¿'—¤Rí­7—úSédy°›N�Á a<–|­îà�2çpa°ÚèMÛpP¨‚©N²Àkoàv™m>üÑè*®œÍ ü!ºßCXZr ¤¯ª�Ò3þ·ã('À…9²e °ŽöÚkm�“ÑÜîEòšwLúçŸùžÍÇ<¥0;œK^‰¤w\o‚-¶*ãl⩜4ŽÂo¹í÷Ø¿‰¹'”iöIù@>>BÞÍ)»ˆÚžî�‘ô¯Æb� ­ó‡åÜ+ÞG0cç=Q©öÎŽ¨Ô_@'þq”öû ø>zp ä¡Ï*þ…ï‘Ì�Í ™ìˆÜ‹èÁz—‡•ÕE·UêÚž@�Ö!œ'¨sõûy]â‘IÞÙ#sÉ¡m¼ÙdêáþdªwÅ~Íw6Í£U_cÚѽ»Ö8Föï¬Éÿªÿ×Uïï N!zçëDûGííˆ ä kÞCÚ‘¼õ·_ñZéÁõweõ„Ý×ÞÖ5 únß�Ÿ¾{ÛkÔw ×~Ýy xû¶û§€»#µ§98ý×Ã8^©¦¸«úÖ¥jpªïNý-nðÀØ_—þøËâÅì‡étêÌÍn_i%üN©¯áü�ÃPK ¬7GvxbsíÃDefinitions/collectd.yamlUT Ú|V:Vux èè…Q»rÄ ìýú�x’ÖEš›té’žá@¶5AòÝøïƒ�sÆUBË>´`¢Á»ˆ#1 «»aÕ¶Àö+¥\ºÕçä^Üs×EÔP©ØÎy키„Á"�‚‡è1 Ã}¦0Ãämnv æ�Ô(4ÆUƒƒ®j˜�lÖ…™xá¾ëX":[ êÐü÷9ú ÓþCF»ûŠÉEÙúË#}cD¬tÃèÆ*yø[¹ó+~-T1·³þ8ûUW®‰Ù5$�©ðÜE�ø'EÌ¢”’ §�r'�^˜ŠïŒ¡ImËŠy ¤ü[þìÁ1Nœû0ØÛ¶SH,bÌÇIgßaÑ©NrçÜD~ –¥^Aê±´nÿ´·÷/v5Á'NÀ�� ` ûnÄ&ps¶üÛqÕqÛzç–½HËåMb¼QÌ›… Ì°ÇêÝBs2ÎÅ/Ž)Šþçÿ‹À*ÈYQæ Z²ærˆžÍ·‡-¾¾ˆ�_iN*¸Ýa{m¾PK ¬7GÏ®™}P}Scripts/elasticsearch/start.shUT Ú|V:Vux èèuŒ1 €0û¼b%½~Æ\Î@$†ÛÃ÷›ÆÂBØjfؼlÅúV„-eìͪÛ0㨧0LYŵA«ß¦Öç,Ö#½ä3®ñ«æyzPK ¬7GScripts/kibana/UT Ú|Vu´ Vux èèPK ¬7GÐoàÐScripts/kibana/create.shUT Ú|V:Vux èè}‘An„0 E÷œÂÕ,+ �=G/àØˆ "fÍéµÌb­dÉÒ×·å÷}zÑÖm1�Å >GŸ Ñê’à4%øò†ä$�Ø�ë`–׫'—GryQ\ƒŽ‹·Á Œ"KúКã-LY¹ “xRõïòçVU«ªœ|ØörïŒ\Õp/rƒý~½Àÿ¶ùú‡á�‹ šAž!„ŸÃ��>8žî|5x7»e?Å .H¦˜µäà|š½Ð¨Ï¶n‘úªGÇMm�+ƒzÅ›¶äºšÏmgÞ¨aâ‹¥æ½9SÛ¢©­1† ›êˆÁ4Αáu‡‡°-ŒâÊ•?4`wÁmÊé;è‹oPK ¬7G/K{oÉjScripts/kibana/config.shUT Ú|V:Vux èè…�1nÃ0 E÷œ‚E xª•íÐst(™‰ˆ*’@ÒF{ûÈrPY.ä'øþçþÅyÎΣÆÝ¾#+h®¡äŸg!…ö˜¬¬b¦`kk‘€ªqPB ”d!i˜¶ÅH&4ÌÓ*Ño-býk…Y” ]ûø<¼uÿÆÌ KÉÊ £OFG®�¹Åê“ЊoÉhÚü=µ8swJ¼1 êR ˜bQsÃë#qp¸RÍmT·½›Æ¿KºãÆ^�òáùùPK ¬7G%ëÚðMjScripts/kibana/start.shUT Ú|V:Vux èèSVÔOÊÌÓOJ,ÎàRVÉÈ,V(N.Ê,(Q(.I,*)VÈÎLJÌKTH,VHT(N-*ËLNUÈ̢̽.˜D• PS~A I\PK ¬7GScripts/nodejs/UT Ú|Vu´ Vux èèPK ¬7G0z9¹s�Scripts/nodejs/create.shUT Ú|V:Vux èè=�1Â0 ÷¼Â¨sÈÎ;ø€S[ÄU”Ûú{ŠDOºÓ-·Re”ŠÞÒÏ&¾šh€ ìÝaLâÍA456~§„D5²±N—˜v€*>Öfâ¹3–owßü4OëÅ»ÿñ7€|\‹ºK§ÌîXãû�‹^ž�ëÅœÎ$¬Z§”56 ±XíÈ-¡³øµÔÁíív÷C5x|$Ç^Âs·Œ¸P øfž—‰+ÂR58:‹§O²›ÌT­ãX_rÁC~ŧ�<ŽèááæÝû�oX6DQ=Ã7ƒ—yV s4?I|LYv~�»Ý×íZŸÿ¿í¾l÷ß?ßß­õ�“ö®ž&� ÐÂÊj Ëßóþ‘œeÚ GÄ›Á©v§„ø 7›Õ[X)^Ëy‘•öPK ¬7G®8¦F@FScripts/nodejs/start.shUT Ú|V:Vux èèSVÔOÊÌÓOJ,ÎàRVÉÈ,V(N.Ê,(Q(.I,*)V(ÉHUÈËOIÍ*VH,(ÈÉLN,ÉÌÏãË‚%€¢\PK ¬7GScripts/logstash/UT Ú|Vu´ Vux èèPK ¬7Gl©�ô6[Scripts/logstash/create.shUT Ú|V:Vux èè�’?S!Å{>Åš´r˜G{'……6–{°9È@–‹“?¼\’;ÿŒ…å¾ß{ì²¼P­ ªE¶b /Ö1°Î.p� zϰÅ=^‚�]­ÙÅèJv-$Ô=v›˜ç¦Š:Ë�j@†”)Ó›˜Šì¨À� šË©] & [ÓË[¹Í$-¡ñÄ,v½q­f›o>í&Ö&ÇdJQ¼�¥| ¶”t¯Ô9,7ä‘‹ÓL˜µmbîÔúy-^å�ø8R{ªtc@ Ò6ÂÂPûâS­škU%ÔƒÖìÐ…E…"�xzU5R‡¬+Ì;.ÿ™Õ_“˜S"ŒÝã®2ùÉ� BÅê3G—ºø­‘|4Iyã™òÞi§D2ëÆ|ý C|a¸»�Õ•øPK ¬7G`5•=]Scripts/logstash/start.shUT Ú|V:Vux èèSVÔOÊÌÓOJ,ÎàRV*ÍSÈÉO/.r‹ŠS‹Ê2“S2ó€(³D/… &WU\’_€M4±¨„ PK ¬7GScripts/mongodb/UT Ú|Vu´ Vux èèPK ¬7GLMî–ÄScripts/mongodb/create.shUT Ú|V:Vux èè}�ÍNÃ0„ï~Š!凨A�Ê O€Ä¡ª*Ç^«NlÙ› "ž¤ê‰=í®æ›ÑîâJÕ®WµÎ­Xà£uÙ$®Ï¬½ÏèBß[ ¡#—[ÚAÛåÜeJ#%´Û¸Tê<Ë¡z¤ Ýò©š”‰ÌˆÇ÷êõíå®dÚ€ÂR�–yÅ �!2¤FM9êà�âúÆçz“ȓ΄2›ÛBµå¬½—ºÁ³›‚3øA›½MC2”¥w™¥½$ˉܯw5Ä¢ÕLçñø”;\pB,>µc|…tZOJÇN{÷£Ù…^|·ÎV+\¡´(Ô¨“ò®>¥« w±Àzý ¦:¼d¶u}ó�3¤”ŞȞ(âAØÐ“øPK ¬7G­/PQŠç"Scripts/mongodb/create_database.shUT Ú|V:Vux èè}α Â0Æñݧ8ë�º¤»bé*|¹Ô£�´w¡I‘V|w :¿í¿üø6ëÂ:.,†vEu+�Õ `ºÃI¸‘|»ÏàÿJG¯oác\í[H�n(VÇ\yœ^& `‚‚~²ó‡‚.Õéôî�;ˆ¥{KàðJbhA¥´áu–VŸv3XÔ)!î¾hë iz¥,L{·óÌ-¼g=ÂPK ¬7GScripts/collectd/UT Ú|Vu´ Vux èèPK ¬7G {‚yQkScripts/collectd/create.shUT Ú|V:Vux èè=Ë;€ н§¨a&\Æ ”�ؤRuðöºÈø†ç¶¹…Hó‡ûÉgÜ ¹M#L*R’e¼PK ¬7G\Ë‘LnScripts/collectd/start.shUT Ú|V:Vux èèmŒ; À {Oñ‚}¼L.°~ÀQñ-9l’*0Õ0Œ?BÔ¢°:�«*Á´th²ŒH£µ’,C˺5hߨ�Ù½æëhcþÙ}sPK ¬7GScripts/rsyslog/UT Ú|Vu´ Vux èèPK ¬7GÔÛ¥`|Scripts/rsyslog/create.shUT Ú|V:Vux èè=Ì1„0 Ñ>§øˆ:ât[ ÄÈKVˆlSäö4ˆj4͇)q�Y #¶ÂÛ•›ƒ«9‰ÔºÉu‚ê/ÂII;þ—b�KÔ<žÙq·ƒ<û ˆý3ÞFÍÒÂPK ¬7GÁt¬*SVScripts/rsyslog/config.shUT Ú|V:Vux èè…SQOÛ0~ϯ8Òjel©Ûm¼l*Oc Ôñ¶0ê&×ÖÃõy¶(Ðÿ¾sÚ²ŒM"J¢øÎ÷}ß}9wöÄT1•~‘$¸\(¾pÊ(ÈÌÔ¼rè!,¨ ¶ 0#ί¼¦y �À£)�>.xƒÄU`@ιXrÞ?@å•™7hããÓ °Ž¤b4µrd–hÔÒ)9Õøv­,°6¼³Xl¨§È *›`± H—TV÷5Ér”§´t¨mž¾Nd™ý°²ØŠC�nŽ�#ÝÇ£\ŽFÁ\� …Ø6Ý/E _ÈkÔ7ýhQ´mŒKª±iL”X‹;Nxbõ;eTÒÃ.ÃEÜ�¡²–J7­NWPâLV:$z4‘·7У[éLÿ ä'BçOØâÁ:ÅN��!ƒáº÷\åá Û¢52'‰šÁw؃캮>Eµ&¾˜Œmu1ü†“MLM ^€…GX ,!3±ü‘MU²-HdŒ”݈£ä�¸jSG¦Áú ÞOvqÏ?9S�9ÈÒßò{íÅ�þÃ`-^uDú‚¸j¦¾ÙïcÓ¸l¨ÄŸ~3²­aŽöìÁÜ¡…ìW³IZ é_3m©ßJìy‘w/œª?;²—ôÕQesØÔü›Y.ų¿õ$v3Èy÷ŒÊScPË™ÒØ÷”äÝÃçï /Ïå’çŒOˆˆ[©ýØCkÓ¥œƒ•++õµU÷÷òc;ù-È€ñxîC¶…ØíW&æÎȨ@®]wAZŸ˜ÀÇZjòÑ8úOìöoPK ¬7GÆ`MmNlScripts/rsyslog/start.shUT Ú|V:Vux èèSVÔOÊÌÓOJ,ÎàRVÉÈ,V(N.Ê,(Q(.I,*)V(*®,ÎÉOOQH,VHT(N-*ËLNUÈ̢̽.˜TP[~A Y\PK ¬7G+UÍè8f ´�README.txtUTÚ|Vux èèPK ¬7GýA|TOSCA-Metadata/UTÚ|Vux èèPK ¬7G®‚Acw´�ÅTOSCA-Metadata/TOSCA.metaUTÚ|Vux èèPK ¬7GýA{Python/UTÚ|Vux èèPK ¬7GýA¼Python/logstash/UTÚ|Vux èèPK ¬7G•�Eu‰$ý�Python/logstash/configure_rsyslog.pyUTÚ|Vux èèPK ¬7GßnšÑ2è*ý�yPython/logstash/configure_elasticsearch.pyUTÚ|Vux èèPK ¬7G/–hëK35“,+�]¢(—œwTÕ Â>$(0–¡¡êX·�1©|’!&¼ôÁB�!bBγLB e84Fz³eP…¯n#¾1�_w�&bÏ™·œ?kÁ^w6Ú•Ô6ú©¸ƒM`*±J“4ל£füV 2A…¬½q±æ%Ì†á‚ø¤sûR¶éÖ«¡æÑ÷Ò|:ƒçÕ€j]£b½h#+íßÖÜ¢ #ŒàÔ±}Å_Còö€·lÛe“;’ “:)ãùaa÷£„næ[ªêó(®�–D»ºû¯›§íH¾þªE>ϾPK mtGTOSCA-Metadata/UT �ÈäU³ÈäUux ééPKmtG?|rbhsTOSCA-Metadata/TOSCA.metaUT �ÈäU�ÈäUux éé ñvvÔõM-IÔuËÌIÕ K-*ÎÌϳR0Ô3àrv B1är.JM,IMÑuª´Rðw ö V âÌåšWRT©ë’š–™—YÔPl¥P’_œœŸ‘š““_ž_”“¢W™˜›ÃPK†fG-Àö0u´�tosca_helloworld.yamlUTl°äUux ééPK mtGýATOSCA-Metadata/UT�ÈäUux ééPKmtG?|rbhs´�ÈTOSCA-Metadata/TOSCA.metaUT�ÈäUux ééPKƒ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7843091 tosca_parser-2.15.0/samples/tests/data/CSAR/csar_invalid_entry_def.zip0000664000175000017500000000165415250006202024574 0ustar00zuulzuulPK†fG-Àö0utosca_helloworld.yamlUT l°äUl°äUux ééu’ÁnÂ0 †ï} K»W€š82Mp`š´í…Ô€EÓD±»Ñ=ý\Ú±Vc¹$ñoÿþbE;k ÜSEB¡bó�‰õ°¹HL>–hëK35“,+�]¢(—œwTÕ Â>$(0–¡¡êX·�1©|’!&¼ôÁB�!bBγLB e84Fz³eP…¯n#¾1�_w�&bÏ™·œ?kÁ^w6Ú•Ô6ú©¸ƒM`*±J“4ל£füV 2A…¬½q±æ%Ì†á‚ø¤sûR¶éÖ«¡æÑ÷Ò|:ƒçÕ€j]£b½h#+íßÖÜ¢ #ŒàÔ±}Å_Còö€·lÛe“;’ “:)ãùaa÷£„næ[ªêó(®�–D»ºû¯›§íH¾þªE>ϾPK ísGTOSCA-Metadata/UT ®ÇäUÒÇäUux ééPKísGå7*lTOSCA-Metadata/TOSCA.metaUT ®ÇäU®ÇäUux éé ñvvÔõM-IÔuËÌIÕ K-*ÎÌϳR0Ô3àrv B1är.JM,IMÑuª´Rðw ö V âÌåšWRT©ë’š–™—YÔPl¥�‚àè—ä''Æg¤æää—çå¤èU&ææpPK†fG-Àö0u´�tosca_helloworld.yamlUTl°äUux ééPK ísGýATOSCA-Metadata/UT®ÇäUux ééPKísGå7*l´�ÈTOSCA-Metadata/TOSCA.metaUT®ÇäUux ééPK‡././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7843091 tosca_parser-2.15.0/samples/tests/data/CSAR/csar_invalid_multilevel_imports_validation.zip0000664000175000017500000000437415250006202030770 0ustar00zuulzuulPK2…O Definitions/PKï„O~KŒ¾nDefinitions/level1.yaml…R;rÛ0íy t®DSâGŸÒ™q&M͸Å,�…ˆ0HY¹ZŠ)W@Ñmކྷ»ûïÏ_oÊQH-½4ÚÑ­ ‡¹ANª®EzÕÒ5Ý$ GǬìüÈ9Ž(áØµæªP{"ZLo‰0–aD_~>'I ëÝ!!dEZ°Ý¤Q4I¼éLkNWê1ÐÁcähÃqNμ~vFÍÃïþÚáä3�.ÕbH_xŸ~3ªë=N¼Îš­—£ÐT¨�%çüòyw˜°›àèkæ¼§A[È6zžCIMu¯j´Ô*µó Y¸›¬—$xýŠä.T*8!åàáí‚»÷£þ‰ËwÌ1ò!K‹4{X@¬Avv½Š¢÷€öd¬ô�:×ÀjSVïà\s õžåY^•ù^ð-”b·…u-òÖY)8Ç]]–¬a‹UUð9ì3ä9ãÛ¢.Äž/]íAêÐ�°, |ÏY¸tçûÅÌeó¡Ë‘:F¾?-'㔜²f/€…íûÔÛ[æó:½•ÜVêxùÉ î8s’¦�Ïáà£Vø0i­q«±ß«×]E«b=¦R�’ÿPKÜ„O$û;¬/Definitions/level2.yamlmR½’›0îy uW™`þ ”Næ2)’Æ3n5 Z�"’°Ïyµy¤¼ÂIûðÝmšý~´?úÿ÷ŸU¦Ê�‹^X¡zCO¨�;Td‚Œ�C‡ô²£kCÓh1Ø+ç«òè a8tê"±·„wpR£&\i²“ý¯ç °jP�:\¨E—‹U@H¯ÞÆg\Î|«wVi8xÊ5ìeÀ¹ ÐKLØóS¸gc¸ÚŽÐm;ÕgѬ´P[qµ�ã4±iíéÔL|ÊÀ‚ãÜÈ?HŸqwq‘ïÛA3 {¨;d®,=º;oÚ3ò3Ó¤sZô¶Àî#ŠÂ4ŒžPÓbs4£ôVoÝAia[YÓÂ*Îò¸ÓV¤.›$Jò,)9Û@Æ‹ ¬kžXGg ‹:ËrXÃóÿ‹!ܾ!ØšÞÀ,ø$nøä[ÿut¦Ö1_m—üïx‚ê=ûPK?2…O $Definitions/ ™ ¯#_Õ™ ¯#_Õ1z3ë¶XÕPK?ï„O~KŒ¾n$ *Definitions/level1.yaml öÊ d#_ÕÂSd#_ÕϤ d#_ÕPK?Ü„O$û;¬/$ Definitions/level2.yaml Ë…yP#_Õ+Õ€P#_Õl9yP#_ÕPK?{cO$þFiles/ ó»9ë¶XÕ6“+#_Õ­o9ë¶XÕPK?+…O $"Files/images/ Ñ�0§#_ÕÑ�0§#_Õó»9ë¶XÕPK? …O)$ MFiles/images/cirros-0.4.0-x86_64-disk.img Fî…#_ÕFî…#_ÕFî…#_ÕPK?¼„O?IsØnÍ $ ”root.yaml 1¯Ÿ,#_Õ}‰¦,#_Õ‰Ÿ,#_ÕPK½)././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7843091 tosca_parser-2.15.0/samples/tests/data/CSAR/csar_metadata_not_yaml.zip0000664000175000017500000000165015250006202024565 0ustar00zuulzuulPK†fG-Àö0utosca_helloworld.yamlUT l°äUa¶äUux ééu’ÁnÂ0 †ï} K»W€š82Mp`š´í…Ô€EÓD±»Ñ=ý\Ú±Vc¹$ñoÿþbE;k ÜSEB¡bó�‰õ°¹HL>–hëK35“,+�]¢(—œwTÕ Â>$(0–¡¡êX·�1©|’!&¼ôÁB�!bBγLB e84Fz³eP…¯n#¾1�_w�&bÏ™·œ?kÁ^w6Ú•Ô6ú©¸ƒM`*±J“4ל£füV 2A…¬½q±æ%Ì†á‚ø¤sûR¶éÖ«¡æÑ÷Ò|:ƒçÕ€j]£b½h#+íßÖÜ¢ #ŒàÔ±}Å_Còö€·lÛe“;’ “:)ãùaa÷£„næ[ªêó(®�–D»ºû¯›§íH¾þªE>ϾPK FkGTOSCA-Metadata/UT c¸äU=ÄäUux ééPKFkG™[”hsTOSCA-Metadata/TOSCA.metaUT c¸äUˆ¸äUux éé ñvvÔõM-IÔuËÌIÕ K-*ÎÌÏÓQ0Ô3àrv B1är.JM,IMÑuªÔQðw ö V âÌåšWRT©ë’š–™—YÔP¬£P’_œœŸ‘š““_ž_”“¢W™˜›ÃPK†fG-Àö0u´�tosca_helloworld.yamlUTl°äUux ééPK FkGýATOSCA-Metadata/UTc¸äUux ééPKFkG™[”hs´�ÈTOSCA-Metadata/TOSCA.metaUTc¸äUux ééPKƒ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.785309 tosca_parser-2.15.0/samples/tests/data/CSAR/csar_missing_metadata.zip0000664000175000017500000000164515250006202024420 0ustar00zuulzuulPK†fG-Àö0utosca_helloworld.yamlUT l°äUl°äUux ééu’ÁnÂ0 †ï} K»W€š82Mp`š´í…Ô€EÓD±»Ñ=ý\Ú±Vc¹$ñoÿþbE;k ÜSEB¡bó�‰õ°¹HL>–hëK35“,+�]¢(—œwTÕ Â>$(0–¡¡êX·�1©|’!&¼ôÁB�!bBγLB e84Fz³eP…¯n#¾1�_w�&bÏ™·œ?kÁ^w6Ú•Ô6ú©¸ƒM`*±J“4ל£füV 2A…¬½q±æ%Ì†á‚ø¤sûR¶éÖ«¡æÑ÷Ò|:ƒçÕ€j]£b½h#+íßÖÜ¢ #ŒàÔ±}Å_Còö€·lÛe“;’ “:)ãùaa÷£„næ[ªêó(®�–D»ºû¯›§íH¾þªE>ϾPK àjGTOSCA-Metadata/UT ¤·äUQÅäUux ééPKàjGTµEerTOSCA-Metadata/TOSCA.metaUT ¤·äU¤·äUux éé ñvvÔõM-IÔuËÌIÕ K-*ÎÌϳR0Ô3àrv B1är.JM,IMÑuª´Rðw ö V âÌåšWRT©ë’š–™—YÖP’_œœŸ‘š““_ž_”“¢W™˜›ÃPK†fG-Àö0u´�tosca_helloworld.yamlUTl°äUux ééPK àjGýATOSCA-Metadata/UT¤·äUux ééPKàjGTµEer´�ÈTOSCA-Metadata/TOSCA.metaUT¤·äUux ééPK€././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.785309 tosca_parser-2.15.0/samples/tests/data/CSAR/csar_multiple_deployment_flavour.zip0000664000175000017500000004410215250006202026733 0ustar00zuulzuulPK ÝvQ Definitions/UT Áë;_Âë;_ux èèPKŠvQUº;×ÒY &Definitions/helloworld3_df_simple.yamlUT $ë;_Ië;_ux èèµVK�Û6¾ûWð–K¬•ü^ßš RH‹‹ú%’ö`)R!)íª¿¾C=lÉ«µO5 Ãæ÷iß gì�ËåB‚F;Z ëðËžør�JКåŠ&t1›qá2 …o8Ï J¸(”©s¡=‘ŠU¦´DKžYƒþú6›!ÑXïö3BæDxTËŠ:£â8¡™És£©¯ á¢àj’Uiɯ9'¡”y5VñåšySeŽ5õc`^Ç ‹² ��> c)ðöˆ�`aOœ· �׬^—�¨…5paox™yªY.>$9#ý+³â®;#§ ¥38ß`5lM]v9ëI†º‚ÝR¡§ K?ÅÅ3W¦Îƒ/‡æ¬(ð¼S\.hËÇzL×Q¯YZ¤Ó¨Öƒp½ƒAx¤íŰâW V„–;S+°¾dŠ*Ð/T¼ya5S{òƒ<ý�|¡ägˆµ ¨ë�Î 2NíÃP§‚�–ŠüÖEÞ£4†(Y6|þ ¥ÊòËïÀrži¡‡É�ŸÓÅoÖßÀ…æW(úÎA¿·z>Ÿ´yAß[Ì Y7MisÖ¦~‡0éc‚Ö;kkôõŸd\¤fTE¡ž.Â�x=aáJ/nÔª¹ˆ�µóѨliê�fšf9Ó*^R´(A‰a©PªË<–I[ùCuI2$±·{$÷J!gGA9ólè �ø¹›ÄÈqôX?¼?ÅÑ*Š? œÙ‹+G½ESGcÁŸr¼]'6_¬7#øÄÜiOÒÇl/7ëå£ä[¶–»-KR¹Ü‰4^KÎÅ.]¯7,a[±Ù¬x*8{Œ_f|»JWò‘£0Ú3И|[\4Ž™ ÜËû•™×Å•À�€b‘ß¿ ÿŠî°;Ŷ¼[~Pï^Ö=‰¢‡oX;÷ÐüvXkܼÑlþ¶ÛÐÍjüD�{ƒ+X Æ=ÔO•®M†âNµÜð‘\äÆÖcl„Ò6«u² ~™4‘åõóØZt�zo0#M†Ÿ[äÊÆ¼Ñ3´gOH‹Ãôîå{*n\;Åj,?"ÞdF¹0 ¡¨Vä2Œ {”Ä•5dÝêà8õ3?/NµL¡£L­ƒ�GŸn šã&ººíóÑRØ·wÆáû¢Íupp'g-­©ïhéFòØÿ㇠|Ýf4Ðþ¾2£ùôGé\“fµ�&þÔþé:˧&§¢¼ Ã|Z¿FYcð"&ñj·ÞŽgƒLN!á’þvGë½é݈ UeΙ,¬=NÇ’î=¯º]-oY /(.ÿŠ' `U�c¿&I„ï8Š«ÙPK²ywWznõ£{%Definitions/helloworld3_top.vnfd.yaml}RMoÕ0¼çW¬ÔCO‰x(�BBê!�¸Z޽yµêx�½I!þ;öKòÚ×rŠvfÇ3»Ë•ã rQÌbúé`…¢½E±ÈÑŠF¼+ �QãùÄù!3 ¿¾}-ŠD¤À±+J@ŽF¸a‘l]7BÑ8’¼xŒU{•5»A?çÜ¢µtOÁê÷ÿƒô°Y}V”á‡/˜ÐltÂ�;៿ßIޑƳÅÍYzáÒLN&ÝRm¡ÊûX ©ä1°Ù{ó·YFwðŽÈâ”»{þž{öˆ´¶õMß× Û{%Ëà ÛòÓÔåáã¡Öm-›¦mϽ»­¾¬FŸ"zR,œñâ˜vB¤�ïeÀÇ«¼nªúú5[o0ÒI�)ß@�ùómü”êÃV ø{2󾞌骄Ùž¤Ö¸;�ŒÁI W0Jï×U¥ÃPZœÑÂyMÅ.ñLÁ¸Uát$Å?PK–vQ¸4n7Ë"Definitions/helloworld3_types.yamlUT ;ë;_Ië;_ux èè½TM�Ó0½çWX{Ù ‰TTè‰âÚ ZY{ £õG°�°ù÷8q“T¥]�ЏDÉ›7oÞŒã‰.àYŠälàú�^,Ρ@¦ÓÈG0š7üuQH ÂSgÎç,޲M¡(R†ó1 ÆJ†1·jàÁéºn¸pÆ8˧¤PMªYƒUò”SX'1“léÀŽUçÝ@}•|L8K>< (¹òÎ[¨¦ÜP%õ‰6³R^‡>RVËy¹+ç9Édso¢'ûmESô@6õȾ²4Ižž=ÎßmÓ¶µÀ}‰­€r§`_¾{ƒ²Ü½ÝÕr_CÓì÷ì‘=®zivÐëxø«Ìßý.v“éû¦ªï/»šCGxø�ÅÞçó»Vp oEe/"·`ðÆÂŸaú›§ßöZíÆ1œŠ?Áãtº†“U¦Wmô#â;؈WŒýÑÚOè/{ۢǘÒ0¸þöÛ’÷Ë«éFk|¾\ÓN“øWÚ³”±í±«´0çÉ’; ÎÔâPK�vQ'KÝÕ\ 'Definitions/helloworld3_df_complex.yamlUT /ë;_Ië;_ux èèµVÉŽã6½û+x›K¬–¼µÛ·L˜ñe0 (.v¡)RCRîV¾>E-¶äVÛ§†aó=ÕòªXå`=gTHXãéI:�_v$4�‡¢Ô’Ö¬Ð4£‹ÙLHÏ”¡á<Ûˆ¾!KmëBš@”f'[9¢¬#ßX„Éþ¯/³Ú±.øÝŒ�9‘Á5êD½ÕišQn‹ÂêRú$úšd�Œל£ÔÚ¾Z§ÅrÍ‚-­¶‡š‰1° £c0eÕ†@HŸ‡uD{DH´°#>80‡kV/ÌGÔÒÙénDÅ5¬�’¼Uá•9y׊QP0ÊŽ|è°®¦žeÁzÒ„¡®`·Tè)ÃÚOqñÌW¹ªÈ¡+K<ï7VHÚò±Þ%3uÒk–Äé4*¥ }ï`^ó¶[ƒ8ù³'cÏ�¹'p¡bšj0/T¾é Ó;ò�<ÿ�ý2BÉ�lQ× �ŒdœÛ‡±NE;­ùµ½‡;:ŒQ1>4°7Jóâò;²|`&@ìbòýÇ4Bñ› 7piÄо 0ï­žÏ'm^Ð÷ +@ÕM[º‚µ¹ß!Lú˜ õÎÚ"ýöO6®R3­’XPŸàÈHö¢Jâtª‚¼Q¬æ*6ÖÎG£ºE¤)šiºåL;‰Š¢EZK…ÊPS¹tÔ*ÚÊ«K²!‰½Ý#ùW ;H*X`CmÄߺ)A¬G��õóûSš¬’ôÓÂIÀ_|5ê-B˜>XáXà5>²ùb½ÁGæ�;’?ñeºÜ¬—OJ<²µÚ>²,WË­ÌÓµBnóõzÃ2ö(7›•È¥`O©K.WùJ=‰aÖ“o‹‹Æ1“A€9c?¹}]\  (ùýóðð¯ì»Sl+À»õîeÝ‘$yø‚µóÍoÿÀÁ9ëç�fó·í†nVóè'�âÐä¬d9h÷P?Vº6Š;ÕrÃG YXW�±JÛ¬ÖÙ‚üùyÒ/«ëç±µèõÞ`HZŽŸW[äÊÆ¼Ñ3¶gOH‹Óôîå{.o\;Íj,?"Ár«}œÐPžVä2¬‹›”¤• ðnyû<ÌËcíSè(Sû æÑ§›ƒ¸‹®nû|´ví@Æ¥±ÿºhsÜÉÙ¨}kê+Zº‘<ö¿Áøá¡n3h_™Ñ|ú£‹Žt®I³ÛÀ�plÿv�åÓ“Ó QÁÅa>­_£¬µx³tµ]?Žgƒ–LM!ñ’þvGû½é݈ŒUeÞ[מ cIw�žWÝ®—·¬Å”—?ưª °_³,Áwš¤‹Õì?PK ï.ÑPTOSCA-Metadata/UT R°é^të;_ux èèPKï.ÑPtU ¬ÚTOSCA-Metadata/TOSCA.metaUT R°é^të;_ux èèM�Í‚0„ï}оÀˆ„(7‚zSQ¯¦Ê¢ûCÚ¢ôíEOœ&3™™ïthê v$lI!\Ðy²¦ä™HYíPláK^ÅAüŒOÉê¦:΋Û˜à"¬±#CaJ}Ég&y¢Röc�j×`{ñ6]+¢Ôб½ÔXòÚ'¤åc’;9g=¤")ŒËâZäÐ’ ÒV[бŸv²ïÝå�’Œ@Þ®Ò¢€ÿûPKöuQŠe%sç#-Definitions/etsi_nfv_sol001_common_types.yamlUT ê;_.ê;_ux èèíZÝoÛ6Ï_qh_ZÀœd膼eq H“´ º‡ah‰²¹J¤FRNüßdI‘’Øq± Ø€¥ ?Ž÷}¿;õ-Ü]Ï®O?3Y±<_C²drÁ!Óª€×F( GÑ1X…L¬2 ‹Sž ),î™8:¿eDQæ<^³"��âヷ[ßH¹I´(­;òñîö®>}ƒÛëK˜N� QE�,ÙuÉ ´¨6ÌG¢£ƒ‚[–2ËN,ǘå±d?n�ˆe¶Š�Ê‘bì)ÆŽbû4«ìRiÏBŒ,´÷ükô”§à$¹"ZsK>]Ÿ¥©æÆÌW€Ük±âiLº>}té«R6kécæ~™£ìvÉAÈLé‚Ñ�RpéóÙ90ÿR0çÀŒ ÉSú•¡¥ä‰»S*!mä^)µ*¹¶ÂK@ÿ,‰¥ØS(¸´õ.8œÂ\©œ3Ù¬v¸½-y"2¤ "sÜz°¡‹‚Ë%šQÌE.ìT†ïK¶àî “)(�,¹±ÚK›UÒ‹ 4He#¸È@8b†[’óNW|–ˆþ˨u¹h„Òü¯Jhž¢•�ìÁ˜‰Oöbâ­V"%�µ¬Ë檲pÉÖ\à ä|ÅóZ™B.À 4w’•L£›[tP`e™‹„Ísî-~3bjQþoéAKûÅ,Wx[.bÒ^_a H_§žš$\ÜÔÆCöâu4Ÿobõ†b5(áiv[Öt¬õE]àÃÃ|Î(¡"—µõèFw-{Ò ˜¥ªòÔ¥–Üg–{a—»ûsUY*MòÌ×n7'ŽÑ­JTnZ®H~@'Ð}ÉrßdöñÁž—’f,7¼YÇlFÆEݘ� ‡°BÖÒVèçð;jeõÓ„~~€?ÂAYsdGeñFe}m!a¾àzX]Ÿ±úU‘hα컻( ÍÑ)tl±6ŸÂt,ÿì¹ÀäêÉu‰Œ´52É«”òÂ’;'Ñèø¿ñÅ=©-OÐÃ?2!=˜!/ïÄ=^ÒëØåTÖüÁ„8š&†ÅVªmÒ"”û¸d“ºÜ&=÷ìOd �é§ÄÕ0òÚ±Àçˆ\&¨SŽ? n–(ÉPG¿øU$ä_[&ÛGz€Ûr�nÀuáðÍÜ¿ Œ›p ¾Ç‚Pãk#€Þi¤ˆ 3õ”[d>]Á\jU-–%Öó£ÄjkŸÑ"jÀ��‡—NßÄbwýÎY€-µ,h1a%KÒÇ[gWïŸ�…g‘�Ò1Þd9¡!¿‡Ø;ûGUE ´Š‚Ëj�ú\Æè"£~ xpáõLâéÐÕG@­Á\3I­Ì ú¶D’mý�Õ§²†4û”$ ÖP•ä¡W|ÊE€kd„Ê—Ý…Ë]ˆ)÷×M=AjýÜ.tc¨³f �»%î™7â©Q¯eE}ZjššöûŸ°0òVén·¬þ’¯éƒ#‰”žBI=Ùž.qÏ´4Ûâ+ì ‘íLäûAVdC"æbS �V9ß»úd<¬Â6ÈŠ¤Ê™†«[˜}"€£tJ‡fl�^™9ƿ๱\ë%c7õÙ©ëÚÑ:Ã)lyN‚1üÒ¾¤JºÙ‹Ä|_¢Q�ôÄ]LyƪÜÒf4£MPHNÈú�Ù¦Õ¢‡žËg…�q«UwÏ$üµ�zC§­€93õðEϪËIÂeûBXë›?`¬8ùƒ�¯ýˆÒV°‡×ËÏþƒò�„öµ¬öEÝ�xŒZ ß.½ó£·2§’”—¹Z»ÂŸål¥*=Ú1Y.“õ£Múÿa%…�¬(8¼½r6x )‚ÕéWë6 �À„]fß¹�SŽu K‹ö±û#$ø“\GïÓ9úBä Ëš›òöùw³Öm˜õ�(‚£¸+àBÎ1wiú¢F%{M'ô�:BÅ~öÜÿnÔ숺’mºY�ã®ß¹y¥RþØûÏ0§ajæ#Û7µ^½—`Ã$žK»zÜF×,nJ×@ð Ã0Ç…Forx)ÊG˜;펓ƒƒöR_ÏÑ×G÷挗\¦æZ>ÖÊW*�Ô"úÏ-^çÜÞsÊXZ�—¾„ˬÅÐF¿Þ?=l³L#” ’¡'¼ÌÒä'D®¯Z«Aú¸ôþÔpFtÔ°´B µÒ¥2üÉ9æ�™Ý/E²Ü ý¡×}ƒ@‰»ÓCžÍs‰æß6lÑ ãó*£ï@róÕûâÓÙôèVÓèçèä’ò+Ü}CÏ4=‰Ò¶Ædn þ`ë-5#”ڞݘ~£¯Pá;ÍÕíþ84J˜ø>ºÖK[˜-Än¼{YLbñH]< ´//ñòqéÆšÇÓJõ™{gÞ·P7!vúW‘=úp8 L¨¡"Ü5ØömZwV®`ÀÉïq�Yh«O¥O|þ¾_úq€o+GE/ ®¢·Þ@ À»_¦ÇÑÑr\7Fx?�ßh$CÙË7qxþ�m.¼ñ­�'åÒ´œ„i½v ²E3 RÉ:ž]™ÎæXI’àQÂlšúw.¢. î­ÏÄ¡ž �›‰E¥CãU?qìº'ka°¸ÏUªÖ¡4ÀgÁ7ã�ÔßPKûuQ";Ì,%+¯+Definitions/etsi_nfv_sol001_vnfd_types.yamlUT ê;_@ê;_ux èèí}ksÜ8®è÷ü Vrª&©mw^;Ù9ùrËc';®ŠŸ8ɇ;wŽJ-±»u£–4’ºížº?þàC¤D½ºå$»'S5Ž-‰$ à#öñýùû×—~²õãxÏ‚µŸ¬8[æé†íx^DižÏ_°2…ž=(Ó"ð½�/£$*á]áÉ�^3ñªˆ6Y̽½¿‰½çÞ‹�F·yäQVÒ'o>Þ\°«·ŸÙÍûwìÙ³çl—,CVî3^0£O ê‹ù«ùó^ú¡_ú¯0VrèÞ/¹—øþšñ²ˆ¼d¹óŠ4†þ<ìÏ£þÌoým¹Ns1¼Ûï4øb¬�ÆQð ›æeñ²¶.ˬxýôé2ÍW|ŽÐÍá·§9Ïž”O”OsÿöéŽÆ{ZG H7›4(Ì‘ˆ êâ©<Çgâh;ÿå%@{ÅËÛ4ÿr‘”<_úÿÀÿÜF9ß𤤦 hœG;zˆÍëFWÒ´”ŸsvN,`†r£?dðÙN Ì12‹ÔÐÔM–§ÏˈËÑ£I“¿3š÷׬(ó(Yé‡ÖØ×yº‹à µÞnü@NXÄœzb@eV®¹ Ø\w$†¯ÙÒ� þ Ùý$€Ÿ±t9œb›!ûxÐ%ÌCšïë@-Ò4æ~â†ê" £˜¸`·k#çl¹�—QIÂTæ>L ‹ ¦a�?~øôæ ѯØ/ hÈp¶|�HŽE9aøøíé»›7O\¨”ùVa"YÀÓ,àå ö«ÐÚø™¥�uƒ›,Λ³SlŽÄ3Vª~‰¸–€)ÌPÁK|û…ïOv~¼å,ó£\~jnFú¬ý<¼õsøtPcÊŒÑ2 ˜Š�gqºG l€º Ã|”ï½"Xó�_ÂÉvIxQÚI:—x—®€â«4äçðÂMÚœ/yΘmö8H· ¥‹'D…³kv•kæ'{‹žX]±‹§ïm¡Œ£ò]ˆ>€°äÜq¶àd2�^¥±»*Ÿ¯æJœ4CZ�CëÂR®úéÓr�›ý^M‚zñ¹/½ŠM£T¥>Åm™êX�ÔâÞ´©ÉY”$ðfÈ^·ÒT×¢Q;EÍ–# y–Ñj+jß!¿Œ ÐIu¥3z××€ðk«ÔrîÇXcÆœ ¯?UÛ0²\„�â\ÐÎi å;ÜÉ—þ@ ù˜ £‡�. ¢³êa¸‡í)ü1‡|\púB=¥QŒµ¶Mø• ¡z¡´Qt]ìÅõârΣB�Ù¹üÈ߀ŒK?áé¶`—ðktò‘4àðÄš¢'6t þp‘¹«—ÞŽ  É�bM®5 ù6æóŸz´uÉÊF¡'èûšýÎx°¥Ddt°Ž]g¦²Ç™JnøŒxy‹«-ù+$-Ýa³¤4ô4Ê©M¨“ep¦ä ÀëšlæZ_F‰¤C`ômž�ÒÏWoϨù#‡L>2¶–xxf_ž«A§~… w•e££–³s·Ûиˆ-VF?ÒW·IC´’C¶-”ûí¬‹d™Vþ£­{¾©9‘L¸ªñ;СR°@ò4Ü|,…K0B­ ëQpæuWS¶ƒýúÚΈCzÈ‚v‚‰â›¬Ü³j2zº¤ç “$ϵµábŠ» ‡å 0HˆMæ­ ·Û2RŠç8?ª˜N ÍËH°+!cnçgr±Ü¢¹ Ž”ýdœ,cké¼e)E‡`BV¿—.=1jÀ&cç®Aá‰Þ=è~Ô’d g*Ž˜@2á·‰J)ü•rÓw|õ¶?[íŽÛ¤¤¹-ý¸Ú¨lü»ãiãßý›Ñ¦Mâ£Á©·ûá�‹ÿ»èà�˜çETâŽqü™W”|ùU´5ºÝÌpc{_$kÈ¡m;ZàØUø£÷Ö6Á�+Ѹý¿†R1| ÿL!ó_é Àÿ+½©Å,�…Õåxˆ�´¸¢—i�Æž .1qh7_m€U'¦€(³G9vËܱÁDþ¸–ÃÓ±o÷~´þùëfšˆý=(Z? ÍãS}„1©4\•´h’jD�ÀГkPÔ¹1m=ßAÔä:¡ú*ª¹Eb2#/hgò˜Ž^ÎØ&‹‹óòÅŒEÙîïôóÕŒe߆éÉ-0ÂZ»…õþV„LT0¥Ê=Eý(d�³Š¶Õ¤m9qìîFAª÷~ñ‹6¡éRc/,&uÞªw/úåŠÝ¬a§ˆ{† ö€È!·k.ŽB*fx‡¼ †¯Nê€Ó”·Cæ-T¿þ‚ºM‘T·QÁ�`Êrüòò¼Ož—ò�´)4‰^O¢ådsÇ:©…yŽQ:möË1f ³5CN" —¾…D`#`²YK�¤·u 0ȱJÞd ùY§{…€†âäÛ䤌6½+ñOLè©]ì'ðóŽþYJ _xÐQR€=ôu2Wa¯BRuØ fÇé«zöNŠ 2I{Cý'qâá¦wPä¶d ÈMTPÀß°Ç—?=‘åœÇÃç§~¸Ô&Ù/'—l—ÞûW•ì—ƒ§"ʉ«©åâÚŽ¥©�^ ´4wªñ´íQi|ä 0�i1Q‘qVkÛü¢X†N³Fµ³æƒøß<×HeÖh¥Da~¸–<»8ÿÀŸÅ0³1Ú~r}ržn0õCº-É÷ï"6;B}ÈÃUG^®± º�1ލ1­°Ùˆk=‡ÿ�ƒü0¢�.ºIñ:v;t‘�j®Ùhwëï½(;|¢eîýpd‡E˜4Ï;»f�ÏåéÍoiQ²3˯´óôqÉ1)ò;*Äï÷Š)J£'iêm@ÜÕm Ôjj°›9»`5LÞšŽû,Uœañì!‚õ°ÇÆ�Ž×‡ÆÅ¾�gqÀ»W'x4Ç—ÛØ~@šè�¶Õ¸.$GœIkâû,§ä ©©!Z–TR)j.ñáØÈ9Cű(-ò¾Ôe”ã9bÂŪ�šŒ\GZk™§4bE‚€-(bHc÷„M·âmx_(Àjr¿´q†éç}‡�óS8’)`!ðc‹�Ê„ûÁ°Å#8«’rYš„Deʉà ¢¹,' ®SDª¦U§"(•´Ë3ò÷ëS€6=0Cè·Þ´ ª›»ˆ`^”,SGä{„‘<¯%/B7¸T|…ƒäö”¸¦€ô½íù§�çl•jT:6Òç)U 0~�a÷°àß (xÜq8x$#WëiÛᱞɯ£Y‡M@UÁ¡m[�#º®Ü\®Ã­óO4Õò.&ø`k{ÌQU²|lÞ«#üÂ2HŸ,ƒç‘?ó�©UÇÌg²äÁ>ˆqÍNü�.TÁmÊÀP8ƒbÓ0HA·ÐxZhº'Ñ6ͪÌ¡fô £4 Z QT‚Nb5)ÐÔãhp½2õâJ|‡Áý1%‰¿ðe߃±9Þ\ŒbqF�ÞŠ6“¢!À�!tç¢É`|ÖÜ:¿Á§“�Žá \ö£d¸¼~TßO µîu è⻡€ x§[ö9hÉëü®ôLO‰Öõ@°ý›»òÌh}ì#àhÖ ƒÅ }9ëU÷‡¯jy˪†V›¿\*‹.JvF\k×RÑKÕ©û§_—{1hY7{Jadz‹½·IsN.iöP^QòÌ“¶èHWÊM´Jü¸r¤d~A±ˆ¾ÜóǘIˆ¬ö¾Ü®IÓïF@sc'¶#… £8F+íêídY=CÇoÀ¡Ý «ãt?§@Ø&È4N2Љ&X2Q3̺šÂ‡…ÚrÐ*èý3�‰^i¢±ãµ¹™.Ë‚öH!�K¿Ûœ;Æ,DthLÞ±ÀL�ÑTE/Úégí©F"©ÓL£õ· ¦6֌Іám‘CQ�õS1Ç‹'tt z�۞ʳyU“MpÀh' Ìå6!�çSMv¡˜ÖRÍ©“$‚¢´Ÿáç‰R¼">G¶Ð{ž¾�ø#™¾úrR¾ô­,žDL‘£XÃ]%ÇÒaš ^kK—3’(±³C“(±m›”?êvCN="sú<Ì#Ò0ï/ ó+çVvz5—)qL„}œêWSÀÈ'š¯ù]ɆúUzm@JséHdÖÍM‘ê9žscöF÷Tud!ðPñ°–ž­„JìZ€¯oó¨äØ}ÕU»p� lQ!Ý/"0˜�Ìú»ÇÐøRöÓFaõþ[X³á}�Wa¼ô½©qûW×1nÑ=“K‹£¾-›ž ©ÕV�BÊb+3] Clë%OëQãõ2žmö§,�áaõáňÌjª'²šê¨UQ¢{-õÖR‡wÂÄÛP™DE˜èÍ&]•ÏÜ+è)4ͪ/Ëh�2F¯—ßQ³§¼¨ ‘J”Ì­çÍ>'ª­Ô¶s¾½Øø«#9¸šÓcm™X‘.Kš·Ç£B½K?hlÂAqF –�§*ðÏæ¿ÌŸÁ `êý\Kæë‡Ã·ìvdf_¨(|°îíôéŸkc†ƒ ¾ÛÍ�“ÿ3ùm{�g¦>QÎÒÚ”`žtcéÎÇK�+»Î/R›*ÉaÚDŽ¢—õø9Qã=­aØ~Ž{T¤3ög�Þ¾˜±Ü¿�±]Owë�~ÜÁÏMøE“�éS—'«°‚x‹°Äý¨j€ò#©‘©OutâAçc¿Xå~CüF"eâôáôò@lFæà¹ÐR&w.ôÙ!êLz’•Wì‹’7é:<�NwÅDW:±¯©×zh©ý7ž®õ'Î#yÒÄi"µŸj×à´ûdfŸÒ¯¸†óH[þ„,)ø·çUBàHΘ &ô¯˜:pS¦ùцAK‡†Þi …x×mèÖK2!²~gŒG¼ád›J‘¤ôH%úeé‰B5r‹ÍŒ¬ŽØò«>áq³Ä�”³–d…°QV±Up”w¬<*º—꣮Y;²¤³qð[|ÄåW$ÍÃCë;ëÓ™ ¡ V™äÎ/O{!U©ùýâÿò lHï`ùuKp£WC„Sz7¡ K8\~q:%kÊ^±l9/júW—€¶OS{™•V9ížÊ·`O=‘µ>�i$›û«LâdX׬ƒ'ήŽ3~ÞÔ{¤™4f\……Z* 9L*PtèA¤)�N”fÂÕÛ›;»x{ó¤¡nn2ª†M–Ìç,#ægY Z­˜ZÍaJá·rõ(gQ±Žbždi€Ü²2•ÚiŸM¸ÛK¦%®Ä848T:K—‡ê@ÙÛVývÇ©´ªN›®k·•W2ÂkÚé45ÂìEf&I£ÞÀãS ×¢KŸ†ä\YÇ:í�ó ÂÐÎj™5µƒÕQ¸ J�øf86Ó'Ãõ2eŸ¢žÔü1ªY;4‘ñö´¾Ñ¢Ÿs`§ø˜è)C­ÐI†<ˆòÏäPw ó»,-$ÛêÆ¦âØæ^øž¥ÉP·Æ§<:Ó ÜS£oשz¦=ú6ŠC€æS‘ƒý-ô`ŸÏúpñ7ñ97PûB�Š0°_oÁÓê&på6pZo=•¨î\¯B[C1ƒU( £ƒp’ç‚Já(x©`%L6ï7ÂÆššiYLÏ݇ uʲ�õIE@_¼ùø–}x{Æ^þç/¯Øï¿üѶPb-K{$Õ.õ½·{ÆŽÝ“$º¬xMD9 =jÏßÂj’; E´�öT}ïC¿v@Ò3ë™_® k§ ö8�"& nyó6ëã ¡.e™û«�£”òqШ^GÔ.m§6 +lîjh¼âTØv0-¢Ø¦ù X¸\uÞŽ£°î–@ 2¤UÙ…B'€É71`�“�‡–ÙÄ‹ǵǃ×¶fôÞ3&û LlEˆ�…·1)­.Q¾$Ðq�º .eEŠEªU‰ ¦Côu8âRb=*¤Ç¶uzuF¾,Õ#!$›w*ðÁÉ‹Ÿ1úåçWâ——¿È'??¡Íãµ_´,nÜÎT¸ƒMv2üUr…±JJÔ—}T¯tº™Ô:â¦ÚTD3yÆZò¼õ~à*ì–Jmug©çVPp;#VŸŸëð‹ù…ŽOj vÄœ 4ð6M€2(A1ÿ[•&lÄOU¢9&öý…¤Twv�Â#·H½;Ùû‘ÄMçÎü®ÄÍ>Äò¾�Ÿù Ìtß×'W¿‰jq^ÀwèihÇËj‰™M„Ì+[}¡f(^\’F�÷¨�tÚ"¨-�E]¾\¬£¬`ñ1eæÂ’×|£”–x¥6?‡Ûßüâ, ÍXû½Ä�å;�¢…­ÑÌÌq±y#Œ¢E¹š‰ƒ7I6(2W…!ØÖöÁ;Ÿ®#v;1æA5Ý]ë™ œ‰@ÍÌmÔÜ︃OG£LŠç…‘‘ù©¡ÐnšãÁáw‚ç¼?[¸¾‡ì£¤\Rƒ>¢+ö•©1ö- ‚#‘î^¦�ë‚G€x–m‡Âwvýéqñähø(„´-´=øT_`¬׃  ÈG’wÚ•yºåE�mõ’vYEJé¢ík´µ0rà!œ§Ñ0{c’°WÁ)#.¯bçØ¢k±0³øÁs©¯‘}kP;ØvK°‡84xïXú�cX ÍD0k}[ðò–×jJ#›Àßg™\[v@X´²ø�@ L‚a˾y'@ýSáÕ�zïáˬå nanܸW¡?£Ï4Þ¡�ÓRõ ¤¬Üš5ÖÒ/ôIwlÚ‰j|¨ˆdø])m€®ÐÁÕßßœ�!Uµš@ÕÙ{wvi~×uŠó쨡n9lž}2³afý rßÀþ]ü&LÀí¼–âw<ØšÁCÍ‘…§ÇQW»fmîÒ/XÀ"# 8¼Py”USê^²L+†²Jl†HV ¢SŸtæ³wãYÝ�…œFg¦¤÷ãaL‹G×utN΂ƒ f]ÊÐètdgþË@Ö{hÔpîç ]QñOLÌz2†s„nRë`7Ø­©–ÍÞ3]ㆬ|ClqaxËLiŽ1×fÛ¶.‡aßÒŸ»¤ü@ˆN"� Tý!!ÓIˆ=7ÃYÇnçêjË´÷ƒ5:rYA©Qš}ó¼‘]YqÀì3MÏLΙÍZÎ^ú‡ÅvícÔî3jàÉÚ®?ò‰9KNÇp&’ ¬ÆÃXÃli^2På`)òÓ?ñôSAÆÁs�_W͆ͺnS˜— œsªšûcÒ'žtQ…tð¬ÓçFÃaó^oU¿¾i4Ž?XajVPs3’'t;WW#¸¤êçÕ'«¹Ðð™Déêm»ëL|Öæ5ãlÅŽÑËþ�]1•ò1†Y(b\ˆU_UY9«(d=¿)ê™Á/+qs•ÐŰ–Ç’®x Ï\�5?Üo°´Ç“ �‰§’sB¤ý2Ê4÷¢PÍ*JîSlÊ.Y†ðTóF-ú域.Îõ;‹DÿŒÓ…�eÝ·Iô'V>¯@+·]Õ¶³ 6¦Še9 “¯œ ºa«×U1«j �K•‹oBã©W# ¹VÅç w&yªG€¢_z”"àI¿–+�@ÕÃG¯E·Ý ©�öùóꟌñFÅ4gpÅÐÒG6ýÍW¡�wfB`õß ¬ñéá0ïLÆ9€´qF¶”|·"®ÚD†¿DÕÖ,ldÏøˆZ,ø_G½·�¯Ùãÿæe!V¯w¿?;ùÏ?þýü?ó¶?þãÉÿ{üßôÛß^ÿîŸüuzò¿á�ùÉûUs�΂£¿„Û.†]îÖ_�¹ò袕göÈt�ÝBqH±}àøó«¿¿² *«ËxNäÚb(;úkÙR÷nLe”�y³0ž=-aÕt„0Š‹;àw_XúuçG±U¸¥{öNë°³¤y½~q-*¨¥·cÊ�/^ÌZð4z:¦–qwe÷�.ðëùµJáýn«<ˆÆÕȬùž(ìÄr"úö!6^u€ZUÃ7Cz. m¿u¹Mš�¼L‚è¸b³yÌÛ#˜Už£sÛæP°Ľ8«MôáëÊÀìÌmGRyñ£f’Ý X[�Uì­>¾An“1ÓýF¨‚ÃfRëã¼Ç¦“fF³ä×kñußdùLvKœhTçõjŠÆ%UW7¬�ÝîW»@$¥ˆÁ~v"UM¯+Òï„™9—&—Va‹Î(¨ZV´µ²1+€Æ’Sk_|L�æilóœÓ½òìwölÆžS¼û#Vù ìjGÆÎWG‰(1×ÄÒ^öXiÂÍ­ü“f\ Ì„™@+Êñö1‘9Jg Ú•,±4N¦"TÔŒ"¯gSç+gHN eÀ(éó9PGÖô:˜,©Šz«ƒ… éNŒŠž™ù¡Š®Tvic|-ê¾'UOªPUGÁ,Å� /1Úܫ•ºbSÛmYô§ø�ªæëêâÌæeÝ-0² oË]%U-(S&åbbQãHË·#âñJ�@§ÿ6 �¹eXh}oÂ|"¸¿{D»XÊuõö3»x{úì9VÿÇü%Ý*fôˆÌúMÑq ` x˜ß¯f²ÔƒïU¼­O $:­À—{LØ73]#Xqªc¥3ª�’HÙ;>ªËµ¿‹Ò\ßüxÖ"¡–‹pG¼tYÝX‡CßÈ ˜%VYž»t ]cƒ&U„É#!¿c�±�øý ]¸J‚…Ÿïg”D©i°Îvƒý“¢h¡ƒë“ô»J?�áa &“×2D:^{’ݸšîå³üžŒ>Õ[q´Ñ\eL�”_˜ö÷™¾™“12î\ÖíÀ ª�HŽp`5Þ€?ÂÞöMÍŠ’a6¢PÕ`ÇBϾ7èq-´oY¸Òo†;ô 5Ö±oíFËR�±úÃm�Õ�¶¨• d—ãÔ7‡Iý¤cË•Äesˆé ¿õ(OÑY ¢ç:•nh#+äи'Eö E†›¾NÞ�oŸ¸ï 5.*To…íUÒ+-¸ö­è|<›Sã^GèÈ¥%U³†Ž¾n£ÂRú.Ê¡õ•Û‘»>}x'(Eû;•jíE°â Â¥’ƒmQ¦,ì[%ŸêxX¤†?¸™“‰‹RbíÆß«Á`‰È…w ­£èHVØ“4]†E ·F"óX .8Õ�Å/”ïàâ²ÛwàÊ—Ó‰T¦•TçÒž¬Gݦ¶'|®ö„æ@‹ˆ6kãRI'#}ºúõý§«ó7çrÄî�´£xôpƒÕLûPÔb¯VI1�ûh“›Ö‘¸rè¹6]DªöܵlkÉy2¹dÙÚŸ9’Rë÷1t§¦j–ÀVú®�¡Ê²/­Ãóhƒ¬}<¤Êe8kÿÿ+)õVð]iõ.]Ô’.9N(�$n$VW–jÔy�ÌY9aß…Ð5nP&u¢Ù¡b׸ÒaˆÜIH’¼Y†1¿ v©ÝÔ0ŒYÄU‡±JíÒˆ!ŒB0þ»±‰±i•´º÷�ñ çÜï:m\`€PKï»ézo‘ŠÃ�áßK'43St °o»-èB‚PßЉn:\™T]Er¿ka~Ç-uÞÁNVÎunֳʡÿ6K�þ�šŠôT±Ú…yÞDj…¾uËö<%GÂd£È�x`å ap–XW·ÑI¿‚º¯QL²eÍÉÈAß<¸�‚´Ò‰RŽtœŒèv]z‡‡0<×7Ì't•4þeméê\æw×zþœýþ¼µxylлb/¼ƒöÞ1ûZ|pѲ•«E‡øy”n 7ͨ´(b©– êç­ÜÁ\IúõÞô0^•69¤G�·™Ç´ëwaHÅ>¹ˆ a°ÄØ+Ä¿½Ðô0Û}H�Máï\p¾'³„v{g1‘ûØuÅìëè%�‰i¼GÙ�ãxaE�‘ª¯Kp0{šÁ Ü*1»“Á&דÓÍug×ShFköïS5ŽŸþþÜ0LÚO¥¿ýöë ÝD{öÝ<`öV‹ðªûðÎ:mQç?j¾$R-sSé¸Cj Šƒ&”#D×ÉÌô_×éõŒñ2˜îoÊoƒ‡ÊŸ9îgâe–ªû®‡‰vŸ·^½o=Óig�‰١Öc�%ìŸ|ñ}òÅ ¶xÃ}5�1:\õÞZV†êæH*fâ—ÁšÀ¡- \�ÃÃ\\1>E;Nü“°ß>%§ï.*¢’’]ì0´â¸…âÞŽö I%qÆGìÙWPC �„„Î-TC$@uO·š%a4ÏkMîŸäTü„Ǫ?qù{d^ê¯0—I\�fDäŸ]ÏÙÅœÏgFîË›ÅÕÝÚÕ<—5ž�<¤‘§ù=%a@�¨Ô}}ÄmÚuñ•PλýaP—�^«Oä ªˆ8:^ͼVΈ ü6Ù¤ P 0šxõ%RcÈÀ_“ÔKîJùLÐ)X"ˆ…_zü.óa©ü’ï³2�} r¾ ñ[D? 9�ÕÄLJÁÚfÉþ\/@%ð2C¨¹§¿.¶‰—@'· ñ7ü+‡Aú"ˆ;")\î‰?v*ˆÐ4d%LaR,a<â�”Áè­ñ´È–ô¦Èp�ôr„74Á.ü»ù‹Ÿ±'náŒÀaH%RMø˜'��§Ñ’x'I�õ¢ ²^T`£ ~þ‰(ûOì�R.á²U8üÓË8ÏñÕ0ˆÀ/G@²t¿Ü€îdžôßoK« ÎàÃL0 ºŒ�bÉ 'F/ÐzÛÄ6Ș‚•'~· yüš%)vAìKI‹¿á³,.œ°*£D­ñ÷bm€Oo‰áòt¸4 H¯R€i^z9Õü‡�ܨ¨êJª- ]³,O3¤£®u-2‡ªðJ—µÀ.–¢ŽÃ––mYß5Äì^(r‚ù½3á­Ÿavï‚“âÍ£0Ä,„:_VQP¢¤¯q(iGÇç¦~–hëK35“,+�]¢(—œwTÕ Â>$(0–¡¡êX·�1©|’!&¼ôÁB�!bBγLB e84Fz³eP…¯n#¾1�_w�&bÏ™·œ?kÁ^w6Ú•Ô6ú©¸ƒM`*±J“4ל£füV 2A…¬½q±æ%Ì†á‚ø¤sûR¶éÖ«¡æÑ÷Ò|:ƒçÕ€j]£b½h#+íßÖÜ¢ #ŒàÔ±}Å_Còö€·lÛe“;’ “:)ãùaa÷£„næ[ªêó(®�–D»ºû¯›§íH¾þªE>ϾPK†fG-Àö0u´�tosca_helloworld.yamlUTl°äUux ééPK[././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.785309 tosca_parser-2.15.0/samples/tests/data/CSAR/csar_not_zip.zip0000664000175000017500000000003515250006202022561 0ustar00zuulzuulThis is an invalid CSAR file.././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7863092 tosca_parser-2.15.0/samples/tests/data/CSAR/csar_relative_path_import_check.zip0000664000175000017500000004141115250006202026460 0ustar00zuulzuulPK�O Definitions/PK3oOˆÎç4y$-Definitions/etsi_nfv_sol001_common_types.yamlíZ[oÓ0~ï¯8‚�JÔ hoƒ‚4 Æ`< ¹‰Ó’8ØNGÿ=çØÎ­iÖ E€b£õåøÜÏçcîÃͻ黳·,/Yš® Z°|Î!Q2ƒ%WZÈN‚S0ÿ™ŒŒÔ cžˆ\œÓ¡_tnJ‹¬Hy¸bYž„“Ñý=wœŽb®#% c—¼º¹¾€Ë×áúݘLN ’Y†,™UÁ5´¨ÖÌžOƒ“QÆ ‹™ag#Ãñfx˜³ŒŸ7Z„y² µL‘bè(†–b{5+ÍB*ÇBˆ,´æjüi#:ÊQÀ�\�Ù¡ ÞœžÇ±âZO=W€Ü+±äqHº>ëmú ¥±Ë:ú˜Ú/3”Ý,8ˆ<‘*c4ø—†Þž¿æN¢Ef˜Öbžó˜¾2Ô`žóÈî)¤ÈMö˜BÉ‚+#¬öOƢГ ‰Œç¦škƒ3˜I™r–ÛÑ»×�D‚4A$–=Oz œ,8\ ÅL¤Â¬@&x~ÎæÜ®ay RE ®�râ&eneÀaÈ% q‘€°Ä47$è�*ù‡<ý©u¹¨„Âáï¥P¯Uz_b ºÁÑÃÖ}™¹Ìma1K‘¿†|WÀ¹_ eø¿ù·�ø\ÏÖëzO…6›U{cHaÁóÊ­(¬�:G1©èE>bp\¬rnÆ€`]ZÆå鸕¸ÇPh^ÆòÑ-*÷a€á‹Û Çf}ˆ�ºöIÍœ6,úæÃœ¥·l¥É¬…ó„Øe„TÞ"¹.Q�±¶¢¥"�Ò2¦Ì°àÖMzþhWá#oz‹?´÷$í„¶E>nR«Ð¦ÕÆËû)q QÜ•*öRm�@ÔEX0cpï> ºkK<ožŽs^×ÅL½ŒQ§g\/àËPì‘_¼„ ù‡–ÉŽ‚(^× D(zf1ÎÌ� �M8@zG*³»£ŠW»éîžþ+—«uîè‡-Žë(XˆÖQœz&Ðx[MÖ‰��.nÝþ�ÛB1— 3LE{=¢Þñ2~»°æošƒ² ¬ÃÞ@ Àƒç“Óàä=ú®k-<Ã'jÓP³×:ZÏÔîÙËŽ#å ¢�ü¨Ô —7Q"©/´D*)‚ÉóKÀù kJDË-?MC€þŒ¨j©=ë-…'Ð-‹¬›ˆy©ÜU¬>>àx³�œ¬…áb_±d¥C×|€{Ö‚÷†ïV?PK3oO¹ßÃèº*H+Definitions/etsi_nfv_sol001_vnfd_types.yamlìiSëFì{~ÅΣ3…)ä½¾Þ|éPè‘ xýÐËã8qëØ©íéôÇWÒÞ>×N ¯G§¥`{µ’V«Õj%í»ýöìÛã ?Yûq¼aÁÂOîB6ÏÒ%»³Ê Àö2,Òì·IR„ÙÜÂëð÷u”…Ë0)¨)gÑ}8ó�šã ¨ë4-è3kÌÎè�)ŒPfÀcÀŸÝóŽYÂ{f‘ìšœU–®Â¬ˆsúGMþÎhà�Y^dQrG+�_eé}O ¯Åzé'€ˆÂ4 6³bš˜�†&_ÌŽÙÜ�ópTéb7ÈŸ±t^A©�|½Bò$ FšmÊHMÓ4ý¤«I2‹¿´!ôœ±ù:žGq t&AšU>Œ ‹r¦:aû·×o¾<@Aæ94d8b>'$ÃŽ¢Œ(ÜÿêäüæËƒ:RŠl-(‘rà)9ðL™)‘¨¬êIº¬«"e‚³lÌ#–©~�´@)ŒPøö·pstïÇë�­ü(_ͤH~6{ð3øpcÉòUDó(`U, í*N7ˆ„…P3cÄ?ðQ¶ñò`.I‘Õ‰“lŒ/JÛxW«ÎÓ;�„ø2�…g𢖷€Þ<ÌÂ$â÷ƒt º:? 6œ^±‡¨X0?Ù°˜Cb €b“—ßÚS˜$9ÀÃð “ ðó>dÓ0LX�… ˜³1;�’ß„8æ!ó  vºF‘�r„¢çƒ@æ)‘ÿ¯tLOáûp†Úw €@·ëû ÝÆ<ïØ~BçyDø-§³è²rÁ¦æéÜ žQ‡9@9™Íh�óãSåO£8*6ó–âLvÀ|Ù�­º )dWƾ?{S¯ 5(Oƒò4(¯¯ŸÌ€“0—Pk:á ¶õV%ÍŸWzåLƒ±¿M 'fÆ9ªz[Q —ÜUIƒ&Ñ=z„†\ñAu{ÚzÐ#HKçÖç8¶š™D<£CA”Ä}:[„3æC>D8óõ!‹V÷ÒOp&®òp=K�@iI­ÚeâŠ�€‘Ýã¹b,‰ÕgÕ‰X¿œ´íñzaªv€ñëò¤q�Öó×–�2‡Iuþº{^±›ìÙ”Îs6<ÛåG"ZÎQd÷úÈŽEÊ á›�‘ðæ®?%°)²ê!ÊQ¹´Ïåøƒ!ìù ?{>¨²‡Ô`‰C»cÑÛ³hĤc:éüõΕÎxGÑmZ½˜Ñ(¦.\%²héXH$0Ô½p²DKBQ»*· ዣ؟)÷½gÑ HØœl�Ѳs%îá�‚A=uû ü|¤ÿÝi¥D/<”ä`�{Ð)êudH*O½Áì8¹dr°©åº!“´3è¯t § Ä¢ßyQ­%Ë‘\F9ENà)Û¿¸}sÀ ±î-N{qÆÄ`j;h¶�LíþESû籈VC"l´¤L®Œ¨Ù{uF+{G÷§Œ¥òI,À6j1åÖ¶ýƒÐa׈vÖøQ8_g€Œ³Ñv�ÒàÚφq“‚'g×lÿ4†‘�Ñø£죳t‰±¨×éºÀ#€Zf³-ô'Ϙ î/g§`žÝÃg‡,ì·²‚–ûþ›\¡o b¹Ÿn·”m»#š¬N W@‚htsîÁßxÑjøP šOLþl¬†ÅšT‚Ͼ�ßý3qŒóM ž«SË/õóú¹DŸåôûÓRŠóÑ<õÀ÷ßKßšÚíþc54f οMÕê­j¹ï…’ÓF/PúÑzÑnæîŒ=tXû~pˆâøá]�¨öÒE?Ãzì4I†¯ÈÈ|ãKé2éÜÒõ‹*W)0å¨÷pä¸î‚Ÿ�òeÞçu!nÛiÝ'Mhiœ¬£lAk›Rì °2ðœšÖuµáS‘ûOLA“d˜®Þs¢ßB6ÎÌ\ ,qù¤LB?Xµx'£V2 n•&3dˆ4樯»¤P[SĪª]'ƒ)ÅlççâôQŸ”åt»|¡o:“„8Y­òÅYæEpÞYEÄö0ªçX°p2«Gä:ª//3½<(uƒ@ßvÿó�Çn,/û"uª¢Â†é{`W·ì¿äß *x*ÜrF¸¥(«µñ 0Jl‰EÔ9A‡BF›DnÛó®ËÚs®Ú3®³7µÂË~ž#«d~,¿•§ù¹e• /CìQD³¥Œ°UÎu2ƒMãÂ�øwá’v… kSï¸w`Ä‚n¡(µ­È’…¦“TÄšzѸw$AÒ\tÅ'×n±FˆðõŠÔ#ÉìƒømJÿIð°ÝÉàùÄžX–É8¥F_ñ6;¥ƒ£](༉;A‹Ðw�oB·£€{ ´†³P÷I{KßïzÊr¨}',~èŽ9"¼k¼X_¬…¼‡�…gú|ÊT°vÑÿò±85Z@ö½™�ô™ #6Xí_ß²Úõ�›pþ|.Ì;xw¯ã][— Œ¯° §àz(Õå£a¡–&§7Ý€O! ÉKíÁžÊŸåÊ–iO×ÊMt1Ú±²¿…´ @ Y†ð»Û7iÞpln ï\Ëb UQ.­gy& OÀŠë6¡ó}\ÖÈáx1ú¸Ÿ³^PÓš¯2οSÜ· éæKòÛ¤¤-#¡%lô.ótýyܶáþt6±C[^~ÒH*€§†²/fô¥ÓÕN³qϨ£ü² Ý`’ôì)Ç F/61Ä~fN%(šS‘o´¡X¢�S«C=ùÉøºÈXƒaÜ]ò¨ÉüôùZÔÉlœú3ý8ŽQ5ð€µ{‘]‚ýÉ¿ÁÍ`É�4ZÄ„? jæ�Sš÷æ€Û7ŸÝ~lSÏ{å¿CßxZ­ÜŽz;?ÀÖÁ¹ó6M!Žˆ›�`M¥¼HW[Š`÷ÂNv7yv€òö³‘øÂ8Nå±>3ê=’d‰œhÿ®vçÉü-Um&sÈ ¨^>ÇÛªƒßzás~—¢0´9z1xPì‡EIÿ2c�S½{(0,Í£H›ð';e/G{¥YÙ�µVÝNŒ3¶§ƒf²–Ef×éN*°ÑNNkÉCâYŸfž­¿†j“�ÌøƒEHÆM>äÜÃïhŒ‡ñ"…8QÖí%�ÙëÂm¤°·#‰æ|��Öó©n›ð%Sc)�X{‘ ŠCÐþ>çìP‘;²…Þû´ †fòéùè_„o ýf’a[ª¦øºJ¼ÈŸE,T`[S6­ÞØð$KhÜ8Ñ÷Ú�’]i…»HÖÜ}žf'Ö#6´©«Úb½õÜÉ—MD 1¹ 1B'"zÆ�¸– ìùHI68‘ÃCtHÇʲ°eLE~tM¶³joÎ*ؾ¤}© i@/Ô/JIÜ*MG’ì‡ jÎ÷5¬êü63°…¢ÚaÀ÷[³bO̶L¾pšX,ßÿí–? %•& 穸k=S?}�B\Ø*l|wt,õˆ¸Ôa޲Rƒ²*Ë¡*†!¸/¿m-WZ)ùÙ`‡Ê:YoQ°×¬¼zD;'¬eù¢õ‹Ü«Â5í=„ÙÄkÜÛ‘:º¤ˆ “1É‚|A’½gPÒžÀjÂ.Rfï¥:=bô´K5AV‰òº*´Þ„éMê²ïjÜA?L–þÝ–,GÇöɤãè¦ó‚Æ-‚þxQ_ðÑïÛ X9ž Ç¿:~‹€þ9¬–žî{w;n ¾—�úeÌÚ7ÖR2DÀñ°þ`PƒßòõÒ%àT|Û\šÉO„ï´Œ dSw"Ä',8øH÷á(Ýžaûr™nýšpß D<,¢`QÂ×ô÷7•c®ýß"˜úKü‘Á�)t×mf‡ñíã�¹J)�èoY�M…¤ *ÔKôð—ð©ÆLí�„h8ñQž²ßƒôò„á>HÅ›Eðc1£�ðs9û�ý̘á_G´:+·î‰ØÅ9½•å ü˜“‰�L½Š\0�úùÅØYpT¹%U&Q×'CÉqL%h£Ç©¸n71ðÙ@5ÊÝ ±‘oÀí¸ì3uì¤; ŠqP2 _: UsE¬~ª@ ?§ x�&8R=¼KˆÚ0™ Sø0»‡9—�UNcn¸òxw–�( ñæÜÀ‘ÊÖVB@½ˆœ†œ¿kµzË Éô¨˜Â‡,„oé´Þp©MR|$„Òß}`ÑLö\1 õ¤ÁPmþUçüi‚àSF ƒêVÓò$* –ò޶°þ[Œo»×ýF¿>î¼ÁƒwÞëÚš(¬ßL0fCëBË3‘5!ÑV©ç×g'Ý“Ú1ä‹ Ø·Ó_Á©Qš¿=fp‰„&¨fuz·ÃYŒxT'¤><«NKljÙp2ž—¦è5ST\?Ô8T�ÅYšfkÇp~Fñ®SÀ¬%™àÏ3�;ćÁ±Îš:ýÇM¼&ž £F¥Ã·(”fÛjá^N6œ°.¿º9„œô¯nNϘCÎ£ÖØ–ISʇU_|Ì_­ ®/jL€WÉû·Óû°[%:Rx’¹�rSDó”\ûÞ@¼¥ÒZR—Jv‡jBçìü[y¦Lð¬ø¨ŠÄÒçPW2²ÒÙ'\vÒÃ•ÚæIÕaž"�“"©ÃehS<×oФ3G«zÞ3b[dÒ çËà@µÓRަnqN¹‘Õ<‹6báÏz/RPú)êK%ÕÃéjÈE€ ‹\­Ê…i\%„ÞÇ, j”Jý®*Ë|S½Qrx©ø¡gVû–Á¼‰cß•Ò6¶ÊŠC+bž_ÿùõ Þz4ùꄽzýÉÜS!òuŽÛ˜%XÚXµùÐzº ýßäSî¾/®_T[àöÐú^?®|=ݘ ¶PŽ�xþÓJ¼�À»´üf´òÁ‘XÔ7ãïêê 6i,âñz«(� ‹µóõ9¤(ÀiêÂÕZ¤²³ò°‹™ãx#MçnUV”j-„ý¿ø_ üC”@””•@ùMYTß•Ûý¯´ùÿ¿*xkT�_Èr½š4ù­ß䕯U °ßrÿ­{c¸1ž@¼�à„±ßJîëÊ$é}‹ûôcöã§?7-THXÓRÅö¸Úå°76d\;H¤–5à=G´CíùkXM2,+ÁÜÄþD6¨ÇC½®A¥cØáhv1€'¬‘)Ñ‘%&"psX¶Ù-&r*sp²ãº¹[l$Ô^�X§Hìf¶• ©©0¿ѲnhչؤúsX¹°÷ÝrX�e€P<<;Iè�°ùv,qgè�i¶côâ.бθ¾áb{V¤éOÁ2—¥æë‘”fYÈ*Qûo©ê)„¢,C]�ƒŸ4Uíˆï�‹^Q>–µ¨AÈõM˜ùøR£ˆVïðè‰’å ‚pôú5T�¦_>ú˜ÿòÁ§âÉGï¿VòÂÏ}h;ñ6ß¹é�lŠeê"™†ö+•“&Ô�‚ÜVˆ�!SxÝ·Ÿ71ɨ\�éXÉ£|nÅ 7‹¢þüLdŒ©M[ìp5^‹ÓA·r–Ao(Qœ—5¬†TéàQ Ï~�—b>âñ3ž¾EâJÃÑ7ŒTΉá&¯L@3Ðþ�ú$†\D(Q± CìÖUvˆ/Å1¢Ì°ªü]ñ¥–p'ÑàF®¨ž'hb?:š�ç1jaÀ ÷u÷ ¾óHÆ…nÛ íú?ƒ‡øY�4ËÕÐV0é]5Rr03%äŸQ”DZ,^ò…>�ƒe#[õç <¥ÊF–?´Ea1Ø·ßÞœžW¥ŠBúL‹�Ÿ^ßµžî¼úÕÕCÇð„cë/A˜ø±lëé/4j‚p¶†þdGác¬EdQCÏãQM‘fXúbE"„ðBæ^ª¦^Z  e"®Öb1®– XY1v޵1ZcõŒKñ ÇÔõZ\¹ûW«Ïcg݉ìÝ„ãâÑ ­£3 Á( ÍF  ([AøsèÛ‚ ‹A÷Ž[jò¿Pô-nÐMŒ^¡šÜ¥Án½¤š7žás Ô¢h‰ÅD‘"ÒЇ;­Õ¶ ©¯�W­Nß“<À“X âXÿ33„�žCoÚ£ã.úß±ŽºÕn¼3·ŠÚi¦n@¯b'_õ»(å°îxÉâóUl<ùª6W¢‰Ñ?úD{¡Ó¿ð(• Š’ùºZ5‰(™ Å+¶5ÆÑ<~žüdÀ8Þð¦u#èÆ1ô‡4³Mó|¼ª¿Š¥¿Yýi?fv__ëŽ9 ´$\ËÇãÐtNUèþb?¯D’¨9lr¸x€n`a,ö ‹`Iõú"*Üä•[¯.oY;ÞWAb%šøø |×:¼uÁ€GÌLÏ4¥T‡6V㪠ÔÖâÆ¬¨šº8�J{ˆð1š§A°Î2ˆ(áÑ/¯ÙûܲǴËÀ$Gm~uZ°5Å,½çeû²Ü©»ºÝüA5TåòÆÊµÁÇIÈõ®8YÀ_A°”Î*Yù‡Šé<ô¦$WmQ:£�ƒì¤Õí ³=Vm‘lºÞ¸<&Äà‡Tý§s¢·-µ×>TЪ~öå¦ê'&öYsTÞ­/>ã×õ¼¹>ç¬B¡àI¤¥m ÕɼT6a°†TŸ%ÖöÍBQå”=ôªtÓð�]ú“’q—þFv E†ÎnF¨R%ØðñÒ¦�Þ%ñleq¤ ÿCšðøO¹&ínm‰UM|AL‰Ãni’£†íáû´=,u4�hßÖ¯#‘•ÒÖÓ›Ë/¾}syöåûÙaS-’·†â<­£¿á*’fÚ·Ô%uÆm9±¥3{ š¶æŠèí·� ­$�“sÙdj]«}©ƒÎeíØ^R+’>Ú²)UÍÁ i¢IáŽxdœËÁ·“�ÿéj}üÏÐëmÚˆMOm$„ �ÇÕ\l ¤Üë¸qÖU³Æ©·aÞñ{zO<ÞlèÌã|è9õ¦�“¯~îýÃ%s ß*yAã§·´`£¡²‚è))ØÝ¿NNª–I­·€Q¢Üi=�’²sÐå´´rbÍ�ñ–'¾aZ ÷�k¹.ifæ ¨4aßö_Ð�˜(¬v÷¸6ñŠŒÒ~Þ㢉’ð”»0ѥؒöáï<ìfõRóEõ6 ÑV7U(ðs›þ!ÖuqÔ¹ûoDá³Ü«�GÕ/ç£n®?½Ê¼4ð꬛OçïgL{#«ÂÐx‚­Ôy,ÿ›ÜN*©å7¿@|èëƒN*;k Ö v¢®P�]µ¥è{AI×€þá6 Ã(­VÂMÐ�Ž+@üPÔ”:Z-69¨9íßž“šÒÞyR¸‡Þ)loo]©QÛáKÃñ¨Aåñ kÈ’Âjà—­Ù/¿jÖîÖò�³ÁÉ«h¦0ÞÂÓVíÇ‘T÷9UÎkÏq-¢_±è—ŒG”§Gæ‡Os6£ªè.ð�æHÒ”*¤sÖà®�‹Î»Ôoy î±jÜB#YYô‡�dªØ8vÏú?T•KG©í<™õôaÃ!mã£8MWSð!j×WÜËg÷uYK'µ›œ<ë9 ÇhËqêG@ç6 æºç>ÀÐ룻,]W*ÑCÞä |¹´²|�ÏjõœnÒ¤èl ²Ä�y—*!9±@^áÒz$XJÞi,Ûµ°¬ÚŠê/yú§ i0¤£Ñ­éüzð,›Ú¥¹µ pÁicYYo§áºOŸi ÚfÍ2ÄË‘qâ·-w‡‹¯´Ja*eé©·‰y…YlM5éuËÖ<¦xÄ7´À¢vN‘SźÛípw«b˜-³N†úÆQ†ŒÄOTƒ„nd@y]7ðŒªz¨OtI5üeoðÊræ·Ö)ÂX–ßo*‚Î;®+ÊÇöðêÚcþÁd6r0�ñ¨']çõ<[ø¢¦:j29¨Ž£Öb/å’�7FôW§U éÞ[àEéq˜ÜAutö~99A4%”8XØ6‘@å×É áíOxŠÀFP�•¸ƒE$eyTš…zfïr"aóm›ŒÃ¦íÚB8Îb÷ZŽÝfÞ3L¬Ñíc¨G1 Xâã6ŽŒGž‘&#Y÷�j9:Ø—†3°ÓíÎmIØIþÞJQ^Ž× oÅúaÕØÒíîuãùì?¨ûß—†q­ýU^rÿ°®ôö·‹û2Ѓö³ÁW·¶Oqý-—v¨åW[©Á÷wÖá1dh ÊÈY -Ÿ W¹óM›iYè¨Nêø±otñ¹§Œ„$4»‚×îËéz8û$3Ç/Ø—§¶u†E�Zá…Å� þB$xÏç¿\üërñQ«5^ äT#c¸›8€6Ð3t/Pò]'2ª§¼„¸Û;¦@ŸÞ*ž?Â@.ùˆ ‹ô‚î#”�֩囥…ßë(îlw/d*¥m>ÏS×m°¹Ð¹%!ŽtAÃ\jGÍ“.k[îû™÷±³z_çÓLT.%ÿ¿o¢ÿz:)®'zRö`ÔZâÂÝËëkíyÆAJ”´Ò„g0=Ÿ3jÖéÔ3pœÜÒÝ|s)Ë,nÜP÷6“^¶Ir_™(âÍy*j÷4ݾ9Ž’Þ5ù�KŽy èVÇ¢’7Ú_²žnó¼„ûâH96…îÊvµ»žæzS<–!1©ˆyC=ÉÍÀÏ·v\¿zÿª‹ôziBÄ�jX*Ÿ IŸß�sýú]Rò$ߪ!-‰€ªvä.á.—ä$ºŠŠŠ¼j 5GÀ™Í¬ðJÁN‡:ƒ�Æ”…CÏ@=ÁRW+Dm‰å”y% [Ï)¾^oÉnPYA­�ÂV@è|�¤AJ�îÊ~OÚŸ§eQi¹ þÂú ¸¡ÑQI ѬŠ¡… @D-×ú9 Cž9U„Á®ˆP‚Â~¡ê¼îÁ ¨’4QÝçÞ¥á©�êü�×”‘‘>l@/¯ Z ¸3+©êÀ.W”FØ ÿá»qšJ(=ŠÕÌL…®0E}5-â@ûka·1{ˆ=�H¸ˆH.£ K7I]åWãbSIK¥ØÌ‘Ö)NÀTŒ;}µFØ„j�mÑJ\ã3×h§f²©ÒóÁ‘yZ‚"6-8 +fŸXŠßN뺪ëRà>ÇZ@¾“°Ïß¼Â&߽ޕ;„ªÚïÙ#{\øb'¡SáðO;÷;ßU¦o«¢¼Ýv5¥Žáظžb�¯{›Nï’àœ^E›Nn@㕦ßeü‰/iŸ ŽYoeø _´Ññ:hNFÚs5E>,!4Á ܋Ϩa^0öWkA<£Ûö¶f�9© ·Ýõ·%M›mÑ”;<�FV^xnn¦˜Ã/9ÔhÂrïsÖ“ (®È<ÇŽtÔi3´P“¢0Ìe‰Ð`çÂãÀ&ÈiÓ6È/`žòMIt¢Ó­¿rŽß¿2i‘Ý¢(LPçÝ!bìž¡wš[5pGM’¤\�1dù8äâQõ]Ö`•|ˉ㇟輶§‡lò Š<µÔÐéÂ=†¨àq4¶$qiŒQB¿üÚL/v =¯nð îñQöñg2mïqæµµØy}՘˂ ³A-]Z«£L“Ì5ÈBdσ¢ÒÍr)£-·½©°ã¤¸¶ÎƒÁ‘¥küùˆäÎ\8!—àáÅà–ø)†©9ýR˧ß%q'w+HÔ(]oF½[As¢NûÚ˜«á~S”¯à\}`Õ^dIVÙ^É-j·…´RÙ«¤PRâ®*ŠRØbYæ²B ûe&ä6¯rµ—ëd=h–WÔðA0x'Š|-‚Ÿï‰ÂYZG”þ¸'þF†Ï0  3§_°üñC––iö°¢T‹ê9Œnò»º# –[·¡…ǧª~A·Ú½hvªÈŠº*vFo 2Û ä�)¶Ød•Ñ·MUÕ�ÃëºÔ jØe¨ ¥7eSš�^§ Ï`}\ÞÐà€£yÜd%Ð6©¢y¿çñ×Ç'Ù 8“X+£HYX‡>ÄŸ`Ä‚jœFÖóF³œ�&‰Ä ¼r´!ÝóM’H²žB™¤p½·;ÑØ¡Î³Až$d�ÕvÕ3Â(ã„_׎J€€¡dµæ�mý8�Qz‡%òʬ¦ÑQŒÇÛ›8pÚö ‚I½³ƒªzB1QÛ Ï`I 8o;%#®Ì¿¼[&ÑÞX‰»ˆS²xÂqaÇMŸ…Í dŸàhêГÚ*‡o Ä”,á VHlÓºüUÞwšmA;ʪ¼ªæ‹+ÁÓEÍ‹ôâ eº8_Ìe1çy^;íTÌ—p5Æà¤ëu肾xL°`botËçÒâlW†‰«Í%È,dÏ££Òír†Ñ–ÛÞÔè8)®­`EœÈò¥~½'ò'® ‘Kð<à–ø;©p‡ŒÔ”~Æü-î²t�fw J4(ž|oF¿ =’Ó¡1{æ¸_•Õ ºßìY½EVTe±Sr¥Ún ¯U±Å:+•”¸­Ë²‚6XUkY£„]†²r³®×j'—)ÈÐ6.¯ÈÑ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7863092 tosca_parser-2.15.0/samples/tests/data/CSAR/csar_root_level_yaml.zip0000664000175000017500000000103315250006202024272 0ustar00zuulzuulPKÓƒO…3ÜQwþroot_level.yaml…P1RÃ0ìý uTxì8v—PÐÑ0C«9K§XÄ’Œ$'„¯Qð$¾€ì[а•½»ÚÛ»¯�OoÊQH-½4ÚÑ#Z>jr‘œT}‡ô ª£9]% GǬìýäy‚QM…8x¨B<jr‘œT}‡ô ª£9]% GǬìýäy‚QM…8x¨B<r>BAiW£è@×"—ŒI ¥Wކ™GèQÆ4H È焱„€ƜëNL�% ¬ÏùNyxY§ûéjÍYgk»?qô”q …øŠ°Æ’PŠª†Ö6~ìF¾ÎÅã�¼2ûcëLùóî>6\m;�†øq{¦ãEÇ逼Œ_Òhô+¾%®wÞ¶JF\™¿}زHo¬ÄY⨬¿p&&ri¦[…áÓVážÔ¡'5lŽ5 Jæü�ï‘Äà:ÿe˜wNí¸V¤E±.1K°(!ÙT�%7W(“Íõf-³5¤i–M»“±˜ÈÝ(s‰È¦¤!Î)ñÞÜ<lEoàÑ]Äì.þ�õßDk*ýU6úŸ+áOP¾¢g?PK']OTOSCA-Metadata/PK']O’îÙ ÐTOSCA-Metadata/TOSCA.metaMM»‚@ìï+ø�= !Déj'&blÉ +YåîÈÝð÷‚ÍLf2�Ç­©J¸’ \x$x’ìl¥:Q•'êáµQÍ?ªjÊû>“ª³¿À‰ÞlYV7ÑNÄâB‡­!YÙêͨT�†Šh; 1VêØ{ Ñ™N`>ämžAÏá«Ù ªrVÈ È2­=œ¦‘;Üâ8¸c’çðßQ?PK?�…O $Definitions/  ‚£$_Õ ‚£$_Õ3kûAÕPK?ˆ…O…3ÜQwþ $ *Definitions/tosca_meta_main.yaml M�O$_ÕwU$_Õ AO$_ÕPK?ˆ…O£z3[§$ ßroot_level.yaml ¶jV$_Õ´)^$_ÕsV$_ÕPK?']O$gTOSCA-Metadata/ ¥Zh;çWÕRÕ¦õ#_Õ“Î+FBÕPK?']O’îÙ Ð$ ”TOSCA-Metadata/TOSCA.meta ¾òa;çWÕl;çWÕ¡Ìa;çWÕPKýk././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7863092 tosca_parser-2.15.0/samples/tests/data/CSAR/csar_root_yaml_with_tosca_definition1_0.zip0000664000175000017500000000073615250006202030050 0ustar00zuulzuulPKç\O¸ŒF:Oroot_level.yamluQÁJÄ0½÷+æ¶§–Vª½‰ ìEÅkH“él“�L+Eü2~’¿`Ú´]uNüyoÞc¾>>ÉxÁ™ÄFiEÊhÏt>4@ļêl‹lä]Ë –'‰D/œ²4/=ð M2Ö´æ82Â0à„U ´íɇ.”Ç¡dMËÓ»8 GF‹xrJ—ÑÙ�§»Û0°­;Ô {“ƒzzFÁzß¡Ëà@ r>BAiW£è@×"—ŒI ¥Wކ™GèQÆ4H È焱„€ƜëNL�% ¬ÏùNyxY§ûéjÍYgk»?qô”q …øŠ°Æ’PŠª†Ö6~ìF¾ÎÅã�¼2ûcëLùóî>6\m;�†øq{¦ãEÇ逼Œ_Òhô+¾%®wÞ¶JF\™¿}زHo¬ÄY⨬¿p&&ri¦[…áÓVážÔ¡'5lŽ5 Jæü�ï‘Äà:ÿe˜wNí¸V¤E±.1K°(!ÙT�%7W(“Íõf-³5¤i–M»“±˜ÈÝ(s‰È¦¤!Î)ñÞÜ<lEoàÑ]Äì.þ�õßDk*ýU6úŸ+áOP¾¢g?PKn]O£z3[§root_level2.yamluQËNÃ0¼û+|㔪AE�ÜR/ˆ«µ‰7­!~ÈÞEˆ/ãÀ'ñ 8I“¦ödíìÎÎx¾?¿È†„ÄJEÊš Zô!>r>BAiW£è@×"—ŒI ¥Wކ™GèQÆ4H È焱„€ƜëNL�% ¬ÏùNyxY§ûéjÍYgk»?qô”q …øŠ°Æ’PŠª†Ö6~ìF¾ÎÅã�¼2ûcëLùóî>6\m;�†øq{¦ãEÇ逼Œ_Òhô+¾%®wÞ¶JF\™¿}زHo¬ÄY⨬¿p&&ri¦[…áÓVážÔ¡'5lŽ5 Jæü�ï‘Äà:ÿe˜wNí¸V¤E±.1K°(!ÙT�%7W(“Íõf-³5¤i–M»“±˜ÈÝ(s‰È¦¤!Î)ñÞÜ<lEoàÑ]Äì.þ�õßDk*ýU6úŸ+áOP¾¢g?PK?‚„O£z3[§$ root_level1.yaml  ÿé"_Õê"_Õëõþé"_ÕPK?n]O£z3[§$ ‰root_level2.yaml èsŒçWÕ:³(á"_ÕÎMŒçWÕPKÄ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7863092 tosca_parser-2.15.0/samples/tests/data/CSAR/csar_valid_multilevel_imports_validation.zip0000664000175000017500000000427715250006202030443 0ustar00zuulzuulPKy†O Definitions/PK!†Oÿ?xœt½5=Z/G£)4¨pw¶œñeš°»á˜×¬=ó�o!»˜óJjªÕ ¥FP©�ÍÂÛd½Áõ3‘»P©àˆ”ƒ‡÷¹Œð°HŒXÖ1Ç<¯§,-ÒìiA±ÙÉ *š>º£±Ò·ª&®…Õ¦¬þ¡[pmMš=˳¼*ó½à[(Ån ëFä;l²RpŽ»¦,+Xëªà rØgÈsÆ·ESˆ=_fa´©CÂJ(ðÁ<”³péN3÷ƒ™Ëæ¿.GAèùú² œü‰8¡f/€yWèíù¸NïWî+u¸|‹â…vœ9IÓç×ppÏÑ+|˜´Ö¸ÕØïÕuWѪXÅS©ŽÉ_PK{cOFiles/PK]†O Files/images/PK S†O)Files/images/cirros-0.4.0-x86_64-disk.imgPK†O?IsØnÍ root.yamluR»NÄ0ìýî¨.èP !Ñ $­µ‰7w†ø!{!¾Œ‚Oâp’ËåN€+kgggÆëïÏ/²¡!±VF‘²&ˆ}ˆ—‚OPPÚ5(zÐ�ÈÄcCå•£±ç”1� Æ9a¬¡0 ±àºså„–¶Öü^yx9ý,]1Õ­§0ÌMøÍbó´Á›,|1FÖÙÆn¥¡_׎Ìx6XJQ7ÐÙÖOÕ¨Ú»h1�Wf³+å{¾¿�ר^£!¾cïÇñ²ç´E^EG­FŸò;â*pçm§dÄ•ñ«‡;Ç+qoqr6(™‰³´Ó§a|Ú4â< uèI�Ìé̆„’ç$1¦.~æ;ÎÐN´2+ËU…y‚eɺ†<¹ÿ‹!ܾ!ØšÞÀ,ø$nøä[ÿut¦Ö1_m—üïx‚ê=ûPK?y†O $Definitions/ žó%_ÕLÆ%_Õ1z3ë¶XÕPK?!†Oÿ�Ã{Ëb© ®IEK¢¸ãš S×;”‚hæúò=Ä7°±æ+ 0ôú�ÎÂ⬵] ‡Ú<õ#ª“qü&tR‚¹ùQÁ3a©™vÉá:¡H'À3Pk ’¤´Ü ÔáBÉ *¿©À` xÎ¾Ú†Š¢;¢¨6cY^ØQ^”ßÔ6§ÜUtEE¹æEÿ¹H_ÂÕ컄%6ž2{"¤(APÆ ëÈ^HÂâÿTNàÆCx;„Ó!œÃ£1‹a†óƒA%–­Úb¹CÇÚ^G£ƒˆ‰" "iP‰Ö1bÚÞS¼¾4kN0ßÄÇèÝc)fº.4 qÊ2 QÄ‹LAN¤Ôõrçê/ßÐÞ©˜jL·ó¯·uÀÈ…¯5ÕkºlÓ[®¢F§‘R<�ñ˜:ŠÊÊ:Ú|/¦}@÷tq‘ç ‹ˆv¸¤”}.˜ )Ý¡eÍ¥šè&°l5vª BšÅ9GÊ&¶9Âj£´Õ‹%‰hCw®°—ˆˆëÍ« º/ Næ&òÄEyÂ�e’$�\{Gx¶d«BPO}ê–Öw!6§­’îðލߗ�Ï&«Þ€ß°¢Èˆà9j«ûÈ¿üÐüÚULS bš¡S¥bî%ǧV3r¾E7:×~AK'¬YÐfRLö&Õ3Ò½yçÚÈܰ6Ú½Rmˆ éìúq-/¶HåÑ vÕGÔôöh•£ªº°‚¨ænoºQ‚�ìÉ.|`<ö´‡L‹‚}'÷3ˆ…‚gü B4éðr:ï�¯5Œš›ê5oB¦ä×€é—÷0¼×ðPºZ8Ë^¯ý�Ã%hë³ç›wл—]-×Ém;µÿ¢ôîW¥÷WkÞLõÿ©ŠózhUê®*Æ~ßõ®xŠÉ­ÖˆädÁæÓm®ÖðÞÖú3ù„Cï/t1ÁÇKo3+ÒÐL˜>ôzi§µSš–*§£wg0­u¸<$ "¢5S4RCøy~ž�z6 ·,+~îÆ�Ö¢°ŒÞИ â¸ù~|Œt~y¡j45Lè7,DRä�UŸf8õÅf ÔÃÕ}51áÀÿĪ‘ÙLÅUŽˆ²ñàƒ-$¾ˆ‚½ -a)¥Qþ PK ¬7GScripts/UT Ú|V Vux èèPK ¬7GScripts/WebServer/UT Ú|V Vux èèPK ¬7G¤ÿ¿L\Scripts/WebServer/install.shUT Ú|Vá´ Vux èèSVÔOÊÌÓ/ÎàRÉÈ,V(N.Ê,(QÈÌ+.IÌÉ)VH,HLÎHU(OMR(N-*K-ââJ,(ÑMO-Q(-HI,I…s¡Zt+¡šŒPK ¬7GüUý¼Scripts/WebServer/start.shUT Ú|Vá´ Vux èè#!/bin/sh service apache2 startPK ¬7GScripts/MYSQLDBMS/UT Ú|V Vux èèPK ¬7GÄ™Qª�4Scripts/MYSQLDBMS/install.shUT Ú|Vá´ Vux èè­O»Â0ÛóGËzêä3Ø«¤¹¶'¥IÈ�þ=DE&K¶,Ûr{è<§Î;™M{šY@†ÊE�“¨‹Q`YåA¨^©ãŠâD —œ’1�ü�ÓˆBúD¤A9'k-4¯$¾“ð-ºš³öʼnÜr °‘cðýÎjþÑß»Éqú¹²ÝÂõsG¾ãÂ"œ¦]ýPK ¬7GÓƒêÔ{·Scripts/MYSQLDBMS/configure.shUT Ú|Vá´ Vux èèSVÔOÊÌÓ/Îà*NMQÐÕ-JMO­(ÐM­(IÍKŠ(ëkä•ÄkÙ±f´�®e¬–~Œ¡JJRÃm”É™©�È·€ ‰ÿï 4?‰"ƒîvá ![ >KûPK ¬7GScripts/MYSQLDatabase/UT Ú|V Vux èèPK ¬7G«ƒl¥Ñ"Scripts/MYSQLDatabase/configure.shUT Ú|Vá´ Vux èèMŽÍ ‚@…÷ó·©U`>€�yµ�AC§¨•Œ?` N9J=|I-ÏÇÇ9g>³óKg›šj׌xBû0·¬z­°¬«2æ®ûr½(ólbÙ—�m‚L"øL2�¥“Ñ©¶rH˜°Hö ?r�!¦G?cµ�âhªžnh£ ÕÔÚ ”p#ÉŽ>xç�ô�¤ Ä!ÝýÕ:O\’÷ùPK ¬7G…¡3={ ´�README.txtUTÚ|Vux èèPK {u´È¾{~~÷î°â2"AL,cŠñL/THü2e¶$Kó„’&Á(z^Le$X®LÌàîë|r eä‚/þ_3µ‚5q.¨”XÓ$$‹!ÝÈçxjEA’”V›¾ç!JŽù¤Að5ÏS<ç _nEñ8¢¨cY^” Q^TßÔ&§cÜUtIEµæ°ÿR¤!â ˜Ì~HXpQò©¨”Š¢A ¬™½�„Åþ-¨ÃŒðng¸€G‡A†sÉ Ë–}\îð`¯Ùh1Q$$’ú5X�´ŽÓñâõ•Y³€ù:>ïK1Ó¥°Ô€Ä)Ë€D/29‘R×Ë 8WÇœòã-Š©Æt3ÿvÛF_¸X3\¹¦‹>0½e+jpZ’bBÆcj]TUÖºÍ=Å4‚¯¤OÃË]9›Y‘æõçš^/mµvJÓ åløþ¦ —‡Ð "Z1E#¥m¯çÁù™Pªp˲âu›?>~¢ôè �¹ N€}{�.ü¡Ö—ª±¦6ž"© 9¿¨Ÿgø"‹Í©~øÜÛŸÕ5{bõsÖ¼Xk�ˆ*ùàÂCYHœˆ‚½ [‚ J[ù/PK l8G…¡3={ README.txtUT Ú|VNqe_ux èèmSKoÛ0 ¾ëWðÖzh4¬Û)· �SƒvMÑÆfb¢²äIr ÿû‘Šƒ&i}²^ß‹äóÝâvy77æ¥å7«Å3ÔÁgdŸ�ƒ†6ì9s�un1F‚HÿŽÔÀ&D¹Ñ»0²ßŸ›§H)ô ,ÇÕï’œ:à®2�`gô5Ycî|Ž£lP‡ÊR ûj�QÌÜÆ0l[@!Ö-¥1Ë;é,ÏØ‘yy\Ý,fKÊØ`Æïei;YZ(öô’‚︡-oÛ™£¹i¨….™’ÅŽbÒMa¬#æ°QT¢²p?DYÄ.DºÎà}`Ÿå1ä ×Í#‡!AÑt’ªŠš²�|aÓôeí’•êPÉê¢D6»ý@¸Ø“¨>�Ã{Ëb© ®IEK¢¸ãš S×;”‚hæúò=Ä7°±æ+ 0ôú�ÎÂ⬵] ‡Ú<õ#ª“qü&tR‚¹ùQÁ3a©™vÉá:¡HÃm”É™©�È·€ ‰ÿï 4?‰"ƒîvá ![ >KûPK l8GScripts/MYSQLDBMS/UT Ú|Vfqe_ux èèPK l8GÄ™Qª�4Scripts/MYSQLDBMS/install.shUT Ú|Vfqe_ux èè­O»Â0ÛóGËzêä3Ø«¤¹¶'¥IÈ�þ=DE&K¶,Ûr{è<§Î;™M{šY@†ÊE�“¨‹Q`YåA¨^©ãŠâD —œ’1�ü�ÓˆBúD¤A9'k-4¯$¾“ð-ºš³öʼnÜr °‘cðýÎjþÑß»Éqú¹²ÝÂõsG¾ãÂ"œ¦]ýPK l8GÓƒêÔ{·Scripts/MYSQLDBMS/configure.shUT Ú|Vfqe_ux èèSVÔOÊÌÓ/Îà*NMQÐÕ-JMO­(ÐM­(IÍKŠ(ëkä•ÄkÙ±f´�®e¬–~Œ¡JJR€�yµ�AC§¨•Œ?` N9J=|I-ÏÇÇ9g>³óKg›šj׌xBû0·¬z­°¬«2æ®ûr½(ólbÙ—�m‚L"øL2�¥“Ñ©¶rH˜°Hö ?r�!¦G?cµ�âhªžnh£ ÕÔÚ ”p#ÉŽ>xç�ô�¤ Ä!ÝýÕ:O\’÷ùPK l8GScripts/WebServer/UT Ú|Vfqe_ux èèPK l8G¤ÿ¿L\Scripts/WebServer/install.shUT Ú|Vfqe_ux èèSVÔOÊÌÓ/ÎàRÉÈ,V(N.Ê,(QÈÌ+.IÌÉ)VH,HLÎHU(OMR(N-*K-ââJ,(ÑMO-Q(-HI,I…s¡Zt+¡šŒPK l8GüUý¼Scripts/WebServer/start.shUT Ú|Vfqe_ux èè#!/bin/sh service apache2 startPK {5=GTOSCA-Metadata/UT š´ Vfqe_ux èèPK{5=GNï'?”ÉTOSCA-Metadata/TOSCA.metaUT š´ Vfqe_ux èèMÌA Â0…á}N‘ $Õmv5*¸�‚ nËÐŒ¨“� Jn¯Õ…]¾ÿçg{uÆ êgTW,¹Õa]Y?[a BÅ vÍÈ¡w''ýHoÅ�jij�·H±~6r5ºšx‚‘#Ýg#qšp|¥rAfÝà1 ›¨"Uå[F#!ç9N°ôÝ“‚NÀ‘õÒáOÿÒ7PK 2^3Q ýADefinitions/UTÀqe_ux èèPK l8GHOÀ5î´�FDefinitions/wordpress.yamlUTÚ|Vux èèPK%^3Q°„uœŠ% 0´�ˆDefinitions/tosca_single_instance_wordpress.yamlUT¦qe_ux èèPK l8G…¡3={ ´�|README.txtUTÚ|Vux èèPK l8GýAýScripts/UTÚ|Vux èèPK l8GýA?Scripts/WordPress/UTÚ|Vux èèPK l8G¬¹CV´�‹Scripts/WordPress/install.shUTÚ|Vux èèPK l8G$¨€ç´�$ Scripts/WordPress/configure.shUTÚ|Vux èèPK l8GýAü Scripts/MYSQLDBMS/UTÚ|Vux èèPK l8GÄ™Qª�4´�H Scripts/MYSQLDBMS/install.shUTÚ|Vux èèPK l8GÓƒêÔ{·´�- Scripts/MYSQLDBMS/configure.shUTÚ|Vux èèPK l8GÆEþ™!!´� Scripts/MYSQLDBMS/start.shUTÚ|Vux èèPK l8GýAu Scripts/MYSQLDatabase/UTÚ|Vux èèPK l8G«ƒl¥Ñ"´�Å Scripts/MYSQLDatabase/configure.shUTÚ|Vux èèPK l8GýAÆ Scripts/WebServer/UTÚ|Vux èèPK l8G¤ÿ¿L\´�Scripts/WebServer/install.shUTÚ|Vux èèPK l8GüUý¼´�´Scripts/WebServer/start.shUTÚ|Vux èèPK {5=GýA'TOSCA-Metadata/UTš´ Vux èèPK{5=GNï'?”É´�pTOSCA-Metadata/TOSCA.metaUTš´ Vux èèPKôW././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7863092 tosca_parser-2.15.0/samples/tests/data/CSAR/csar_wordpress_invalid_artifact_multi.zip0000664000175000017500000001417115250006202027732 0ustar00zuulzuulPK 'NœT Definitions/UT cjbcjbux èèPK'NœT]k<0Àç 0Definitions/tosca_single_instance_wordpress.yamlUT cjbcjbux èè½WÛnÛ8}÷WÌ8JÜAª‡š¤],�l³ë.‚¢(Z¤m¢’¨’T\µØßJ¢Hßš Åú!1È3‡‡3‡CÚ*“³Œ‹¥¬¤•ª2٣п¤`Ý”‘e]ˆ¬ee‘Ͳ³É„ “kY[‡ùmðþÝüú5t8¨µZJü¿‘v ¥y­…1S؈¡‘XÅ¡lÍ—Tv-À°Rô“Éd‚2šòu`r§y‹#¸LÂÏÐÎû÷ùm©õÏßܾ�v­öS�¤ 2Lên¤Kî�ÈíLïFû†y€¡ëÂGhÆBL!;ÆÐ„9bÀ«»ùóí•1úf¸+B“Q»ß5õõ§9,êµOuW®=+v½ƒÛ;•ø`E»‡HèÞ7ø÷‡Þ%ºƒ¾ÝïÚ_Qzg½çaªÿŸªøUŸZ•1ÀWÅá´½kUbr‡Æš³š-d!cw»­«ï;ôáÒ|Æ'õ7\bv¿_E“USfîý›ž†¶Žv)ÊžåüìÕÜ�<Ê�Ã{Ëb© ®IEK¢¸ãš S×;”‚hæúò=Ä7°±æ+ 0ôú�ÎÂ⬵] ‡Ú<õ#ª“qü&tR‚¹ùQÁ3a©™vÉá:¡HÃm”É™©�È·€ ‰ÿï 4?‰"ƒîvá ![ >KûPK $8GScripts/MYSQLDBMS/UT Ú|VPajbux èèPK $8GÆEþ™!!Scripts/MYSQLDBMS/start.shUT Ú|Vfbux èè#!/bin/sh /etc/init.d/mysql startPK $8GÄ™Qª�4Scripts/MYSQLDBMS/install.shUT Ú|Vfbux èè­O»Â0ÛóGËzêä3Ø«¤¹¶'¥IÈ�þ=DE&K¶,Ûr{è<§Î;™M{šY@†ÊE�“¨‹Q`YåA¨^©ãŠâD —œ’1�ü�ÓˆBúD¤A9'k-4¯$¾“ð-ºš³öʼnÜr °‘cðýÎjþÑß»Éqú¹²ÝÂõsG¾ãÂ"œ¦]ýPK $8GÓƒêÔ{·Scripts/MYSQLDBMS/configure.shUT Ú|Vfbux èèSVÔOÊÌÓ/Îà*NMQÐÕ-JMO­(ÐM­(IÍKŠ(ëkä•ÄkÙ±f´�®e¬–~Œ¡JJR€�yµ�AC§¨•Œ?` N9J=|I-ÏÇÇ9g>³óKg›šj׌xBû0·¬z­°¬«2æ®ûr½(ólbÙ—�m‚L"øL2�¥“Ñ©¶rH˜°Hö ?r�!¦G?cµ�âhªžnh£ ÕÔÚ ”p#ÉŽ>xç�ô�¤ Ä!ÝýÕ:O\’÷ùPK cHœTTOSCA-Metadata/UT IXjbPajbux èèPK{­�Ã{Ëb© ®IEK¢¸ãš S×;”‚hæúò=Ä7°±æ+ 0ôú�ÎÂ⬵] ‡Ú<õ#ª“qü&tR‚¹ùQÁ3a©™vÉá:¡HÁ¯ Ä�ž�§;àë´ÑpSßæmÈÌ…ü0sóFXpJWÇçØÁãu_p8dŒv.°saøz÷²kä¶rÛMí¿(½ÿVÙù­5m§úÿTÅïzhUš¾*6~ßñ.xŽÉ­/Ö„2c é¶GkíÞÕæ'eê¿p‹á>Ÿ“E™Çö…Bo†6Z;§y¥r<øpãF‡«Cl™,™¦‰6ÂËéI|r¸,ܰ¢|Ùô�¬Yé½¢)—$ðoþái40ùå¥nÐ40á¾q)³ÚP𬺞à«/µÏ@󸺫_LøOÀ#«ŸÌöU\çˆhçî]!ñF”ìi‰+)ƒò_PK ¬7GScripts/UT ÍV ~�Vux èèPK ¬7GScripts/WebServer/UT ÍV ~�Vux èèPK ¬7G¤ÿ¿L\Scripts/WebServer/install.shUT ÍVÍVux èèSVÔOÊÌÓ/ÎàRÉÈ,V(N.Ê,(QÈÌ+.IÌÉ)VH,HLÎHU(OMR(N-*K-ââJ,(ÑMO-Q(-HI,I…s¡Zt+¡šŒPK ¬7GüUý¼Scripts/WebServer/start.shUT ÍVÍVux èè#!/bin/sh service apache2 startPK ¬7GScripts/MYSQLDBMS/UT ÍV ~�Vux èèPK ¬7GÄ™Qª�4Scripts/MYSQLDBMS/install.shUT ÍVÍVux èè­O»Â0ÛóGËzêä3Ø«¤¹¶'¥IÈ�þ=DE&K¶,Ûr{è<§Î;™M{šY@†ÊE�“¨‹Q`YåA¨^©ãŠâD —œ’1�ü�ÓˆBúD¤A9'k-4¯$¾“ð-ºš³öʼnÜr °‘cðýÎjþÑß»Éqú¹²ÝÂõsG¾ãÂ"œ¦]ýPK ¬7GÓƒêÔ{·Scripts/MYSQLDBMS/configure.shUT ÍVÍVux èèSVÔOÊÌÓ/Îà*NMQÐÕ-JMO­(ÐM­(IÍKŠ(ëkä•ÄkÙ±f´�®e¬–~Œ¡JJRÃm”É™©�È·€ ‰ÿï 4?‰"ƒîvá ![ >KûPK ¬7GScripts/MYSQLDatabase/UT ÍV ~�Vux èèPK ¬7G«ƒl¥Ñ"Scripts/MYSQLDatabase/configure.shUT ÍVÍVux èèMŽÍ ‚@…÷ó·©U`>€�yµ�AC§¨•Œ?` N9J=|I-ÏÇÇ9g>³óKg›šj׌xBû0·¬z­°¬«2æ®ûr½(ólbÙ—�m‚L"øL2�¥“Ñ©¶rH˜°Hö ?r�!¦G?cµ�âhªžnh£ ÕÔÚ ”p#ÉŽ>xç�ô�¤ Ä!ÝýÕ:O\’÷ùPK ¬7G…¡3={ ´�README.txtUTÍVux èèPK {u�Ã{Ëb© ®IEK¢¸ãš S×;”‚hæúò=Ä7°±æ+ 0ôú�ÎÂ⬵] ‡Ú<õ#ª“qü&tR‚¹ùQÁ3a©™vÉá:¡HŒ¹7röF»!õ†Ø�Þî0®m`iižÍà uû{´ËѪöa Zü{óz?Jp¤æä>|à xšÓ2# Íœ|šA,Äã¿ D“^Þ.À7êFÏM7͇�Ñ@þ0š¼ÇLÃcép ;Þø€Ã%rtô€Û Í÷Ðû$»$·—Ûqjÿ‹Òûÿ*ÿk-†©þªâo=¶*ý_gÿTxWªÄävƒ•^ž©(DH· mpûXÐ'æ_§?ñŠÙ ¼¹ 6e]&î…BOK;­]ò²U9=yy·½Ž2ǸÁt¶–g–0„çgÉÙi`ÐdáFÈúÇ®ÿøÀJë†Ñ×Ãm”É™©�È·€ ‰ÿï 4?‰"ƒîvá ![ >KûPK ¬7GScripts/MYSQLDatabase/UT Ú|VÑ Vux èèPK ¬7G«ƒl¥Ñ"Scripts/MYSQLDatabase/configure.shUT Ú|VÑ Vux èèMŽÍ ‚@…÷ó·©U`>€�yµ�AC§¨•Œ?` N9J=|I-ÏÇÇ9g>³óKg›šj׌xBû0·¬z­°¬«2æ®ûr½(ólbÙ—�m‚L"øL2�¥“Ñ©¶rH˜°Hö ?r�!¦G?cµ�âhªžnh£ ÕÔÚ ”p#ÉŽ>xç�ô�¤ Ä!ÝýÕ:O\’÷ùPK ¬7G…¡3={ ´�README.txtUTÚ|Vux èèPK {u�Ã{Ëb© ®IEK¢¸ãš S×;”‚hæúò=Ä7°±æ+ 0ôú�ÎÂ⬵] ‡Ú<õ#ª“qü&tR‚¹ùQÁ3a©™vÉá:¡H‡ëéws.ËxªPÊ1&EK‚2NØDöJR–„ø· j �0ÂÛ!œ ឬY…9^Ì•X¾èŠå{� "!šDDÑ +0¬cÄŒ½§xseל X%Çè=`)¦¦.4 IÆr qÌ‹\ƒ J™z9’s}Œ—ohïTl5&ëÙ×»&`äÂךâÊ �w‰™-WQ«ÓJ)ÈyBEUem¾Û�9 ‚] ‘²˜7�KJu@Ò—‚IšÑ Z–\é±i‚’­ÖNTHóDp¤l\6GXoT¶c9'1méÎ4ö‘I³bx•ÔôÌl.Ô‰ ñ„!È$Mµôìy>g‹BROš~6!eB·õÜÉ E¿#[Ÿ•뮀߰ H‡ä‚J½6ä_{X²ûºUl; bÛ W¥¦í%G¦Q³r¾E?47~)+'¬]ÊvRlöÆõÒ ½}çÆÈÞ°1Ú¼Rcˆ­èìvƒZ],ÊÔÑôõд…SœÔDM~`wÖ9ÚAUV°ªÙ‡»Û~”`HåÉ>|`<åi™…ò…ÜÏ bžñ„h²À«Él|�a4ÜÔïx2óofÞÜÃóÞÁC骟¶-vðzݯ.™@;Ø=ß¼‡Þ½ì¹^n»©ý¥w¿';¯fíTÿŸª8¯‡V¥9àªbí÷]ïšg˜Üúa�‰ K™O·½ZË{W˜OÂÔ3Ž»¿ÐÅè>^y›y‘…v¶ô¡7K­�ѬR9;}w“F‡«C 2^2Mcm0„Ÿçáù™gPfáŽåÅÏÍøq´ŠŠ’Ñ[špI<7Ù�.‚S“_^èMú ™ÖyÕ§)Î{‰ÍXõPÏJ8ê?³zX¶óp�#¢Ëxpá±,$¾ˆ’½"-a%ePþ PK ¬7GScripts/UT Ú|VÑ Vux èèPK ¬7GScripts/WebServer/UT Ú|VÑ Vux èèPK ¬7G¤ÿ¿L\Scripts/WebServer/install.shUT Ú|VÑ Vux èèSVÔOÊÌÓ/ÎàRÉÈ,V(N.Ê,(QÈÌ+.IÌÉ)VH,HLÎHU(OMR(N-*K-ââJ,(ÑMO-Q(-HI,I…s¡Zt+¡šŒPK ¬7GüUý¼Scripts/WebServer/start.shUT Ú|VÑ Vux èè#!/bin/sh service apache2 startPK ¬7GScripts/MYSQLDBMS/UT Ú|VÑ Vux èèPK ¬7GÄ™Qª�4Scripts/MYSQLDBMS/install.shUT Ú|VÑ Vux èè­O»Â0ÛóGËzêä3Ø«¤¹¶'¥IÈ�þ=DE&K¶,Ûr{è<§Î;™M{šY@†ÊE�“¨‹Q`YåA¨^©ãŠâD —œ’1�ü�ÓˆBúD¤A9'k-4¯$¾“ð-ºš³öʼnÜr °‘cðýÎjþÑß»Éqú¹²ÝÂõsG¾ãÂ"œ¦]ýPK ¬7GÓƒêÔ{·Scripts/MYSQLDBMS/configure.shUT Ú|VÑ Vux èèSVÔOÊÌÓ/Îà*NMQÐÕ-JMO­(ÐM­(IÍKŠ(ëkä•ÄkÙ±f´�®e¬–~Œ¡JJRÃm”É™©�È·€ ‰ÿï 4?‰"ƒîvá ![ >KûPK ¬7GScripts/MYSQLDatabase/UT Ú|VÑ Vux èèPK ¬7G«ƒl¥Ñ"Scripts/MYSQLDatabase/configure.shUT Ú|VÑ Vux èèMŽÍ ‚@…÷ó·©U`>€�yµ�AC§¨•Œ?` N9J=|I-ÏÇÇ9g>³óKg›šj׌xBû0·¬z­°¬«2æ®ûr½(ólbÙ—�m‚L"øL2�¥“Ñ©¶rH˜°Hö ?r�!¦G?cµ�âhªžnh£ ÕÔÚ ”p#ÉŽ>xç�ô�¤ Ä!ÝýÕ:O\’÷ùPK ¬7G…¡3={ ´�README.txtUTÚ|Vux èèPK {u�Ã{Ëb© ®IEK¢¸ãš S×;”‚hæúò=Ä7°±æ+ 0ôú�ÎÂ⬵] ‡Ú<õ#ª“qü&tR‚¹ùQÁ3a©™vÉá:¡HÃm”É™©�È·€ ‰ÿï 4?‰"ƒîvá ![ >KûPK ¬7GScripts/MYSQLDatabase/UT Ú|VÑ Vux èèPK ¬7G«ƒl¥Ñ"Scripts/MYSQLDatabase/configure.shUT Ú|VÑ Vux èèMŽÍ ‚@…÷ó·©U`>€�yµ�AC§¨•Œ?` N9J=|I-ÏÇÇ9g>³óKg›šj׌xBû0·¬z­°¬«2æ®ûr½(ólbÙ—�m‚L"øL2�¥“Ñ©¶rH˜°Hö ?r�!¦G?cµ�âhªžnh£ ÕÔÚ ”p#ÉŽ>xç�ô�¤ Ä!ÝýÕ:O\’÷ùPK ¬7G…¡3={ ´�README.txtUTÚ|Vux èèPK {ugø»bj +.ÒRP)û°¢1H*H‘B¾–OðÔ’‚$9m6ƒ^q¸P2Dä“!Ð ôzŠ—<ã‹u¤(†#Šj3V”Uí�”Uó@­K⮢ *š5/û/UcB|ãé s.ê|šTj�IQ‚ ŒÖ™=“Œ¥~WT†p£>¼ëÃiÎáÁ˜¥qTàÁüd‰‹]¹Üb`m¯³ÑI¤D‘˜H´`¦õ0mï!^]š5 X®Ò×àÝa)¦º65 iÎ I«BAI¤Ôõ²çê5Q¾£½E1Õ˜¬gßnº„Q>ÖW®è|˜Þ²58¥èPð”Z5•µjó£˜F´ƒ îh|Q–KˆXRAŸ*&hN7Ô²äR…º jm9;mR-Ò’£Êº9¢v£±Õ2s’Pw¦°—ˆH»•Z¯s¶¨õV@÷§NŒÔÙÞX�^ãA„bÊ=Âkߣ~ÜZt^Po;�–4ËœU=;B‚ÁÌØË�%x`ãrY'êó´¿fW>“8¢JŠ't™4� `AUdÆIØö/üµF¦·ŒLŸuF­~· ±¬Ýa�4‹sùVÅߪ¾Cñä'6GË‘Oó†3gÝO;éš7ü®õTœ}¼¹î×SèÁ!ÉñtIÝö4äîñÜdzÛÛÎ’=õ€:Ó¢ž±AtEˆ&x9™ßÎ4:Ý´cÔ™ž„ÛÓ#ï8…ycèXu%‚êw[;x¼Ã[’d™¯\Ò‰ît0{¾ùõ¾¨] ·W·»Uû¥·ãüàu1s©þ?U±Q�­Jç`«bì_:Þ˜çHn;XR’˜eÌW·9š}WèOÊä#¾6cˆÑ>]z›E•Gæiç‹^/m´vNóåtøþ &—ǤAD²dŠ&JË~�ŸEg§žAÍ +ª_›ùãË&®j�^Ó” â؇õè<j~y¥:ij1aܨY›�w©~žâs+5w©~ÕÜÙ›uÅYûV5ÏÑ–#¢ê|pá¾.$NDÁžQ-Q¥¥üPK l8G…¡3={ README.txtUT Ú|V|Çe_ux ììmSKoÛ0 ¾ëWðÖzh4¬Û)· �SƒvMÑÆfb¢²äIr ÿû‘Šƒ&i}²^ß‹äóÝâvy77æ¥å7«Å3ÔÁgdŸ�ƒ†6ì9s�un1F‚HÿŽÔÀ&D¹Ñ»0²ßŸ›§H)ô ,ÇÕï’œ:à®2�`gô5Ycî|Ž£lP‡ÊR ûj�QÌÜÆ0l[@!Ö-¥1Ë;é,ÏØ‘yy\Ý,fKÊØ`Æïei;YZ(öô’‚︡-oÛ™£¹i¨….™’ÅŽbÒMa¬#æ°QT¢²p?DYÄ.DºÎà}`Ÿå1ä ×Í#‡!AÑt’ªŠš²�|aÓôeí’•êPÉê¢D6»ý@¸Ø“¨>�Ã{Ëb© ®IEK¢¸ãš S×;”‚hæúò=Ä7°±æ+ 0ôú�ÎÂ⬵] ‡Ú<õ#ª“qü&tR‚¹ùQÁ3a©™vÉá:¡HÃm”É™©�È·€ ‰ÿï 4?‰"ƒîvá ![ >KûPK l8GScripts/MYSQLDBMS/UT Ú|V|Çe_ux ììPK l8GÄ™Qª�4Scripts/MYSQLDBMS/install.shUT Ú|V|Çe_ux ìì­O»Â0ÛóGËzêä3Ø«¤¹¶'¥IÈ�þ=DE&K¶,Ûr{è<§Î;™M{šY@†ÊE�“¨‹Q`YåA¨^©ãŠâD —œ’1�ü�ÓˆBúD¤A9'k-4¯$¾“ð-ºš³öʼnÜr °‘cðýÎjþÑß»Éqú¹²ÝÂõsG¾ãÂ"œ¦]ýPK l8GÓƒêÔ{·Scripts/MYSQLDBMS/configure.shUT Ú|V|Çe_ux ììSVÔOÊÌÓ/Îà*NMQÐÕ-JMO­(ÐM­(IÍKŠ(ëkä•ÄkÙ±f´�®e¬–~Œ¡JJR€�yµ�AC§¨•Œ?` N9J=|I-ÏÇÇ9g>³óKg›šj׌xBû0·¬z­°¬«2æ®ûr½(ólbÙ—�m‚L"øL2�¥“Ñ©¶rH˜°Hö ?r�!¦G?cµ�âhªžnh£ ÕÔÚ ”p#ÉŽ>xç�ô�¤ Ä!ÝýÕ:O\’÷ùPK l8GScripts/WebServer/UT Ú|V|Çe_ux ììPK l8G¤ÿ¿L\Scripts/WebServer/install.shUT Ú|V|Çe_ux ììSVÔOÊÌÓ/ÎàRÉÈ,V(N.Ê,(QÈÌ+.IÌÉ)VH,HLÎHU(OMR(N-*K-ââJ,(ÑMO-Q(-HI,I…s¡Zt+¡šŒPK l8GüUý¼Scripts/WebServer/start.shUT Ú|V|Çe_ux ìì#!/bin/sh service apache2 startPK {5=GTOSCA-Metadata/UT š´ V|Çe_ux ììPK{5=GNï'?”ÉTOSCA-Metadata/TOSCA.metaUT š´ V|Çe_ux ììMÌA Â0…á}N‘ $Õmv5*¸�‚ nËÐŒ¨“� Jn¯Õ…]¾ÿçg{uÆ êgTW,¹Õa]Y?[a BÅ vÍÈ¡w''ýHoÅ�jij�·H±~6r5ºšx‚‘#Ýg#qšp|¥rAfÝà1 ›¨"Uå[F#!ç9N°ôÝ“‚NÀ‘õÒáOÿÒ7PK D4Q ýADefinitions/UT�9f_ux ììPK l8GHOÀ5î´�FDefinitions/wordpress.yamlUTÚ|Vux ììPK4Q;|ׂ 0´�ˆDefinitions/tosca_single_instance_wordpress.yamlUT@9f_ux ììPK l8G…¡3={ ´�tREADME.txtUTÚ|Vux ììPK l8GýAõScripts/UTÚ|Vux ììPK l8GýA7Scripts/WordPress/UTÚ|Vux ììPK l8G¬¹CV´�ƒScripts/WordPress/install.shUTÚ|Vux ììPK l8G$¨€ç´� Scripts/WordPress/configure.shUTÚ|Vux ììPK l8GýAô Scripts/MYSQLDBMS/UTÚ|Vux ììPK l8GÄ™Qª�4´�@ Scripts/MYSQLDBMS/install.shUTÚ|Vux ììPK l8GÓƒêÔ{·´�% Scripts/MYSQLDBMS/configure.shUTÚ|Vux ììPK l8GÆEþ™!!´�ø Scripts/MYSQLDBMS/start.shUTÚ|Vux ììPK l8GýAm Scripts/MYSQLDatabase/UTÚ|Vux ììPK l8G«ƒl¥Ñ"´�½ Scripts/MYSQLDatabase/configure.shUTÚ|Vux ììPK l8GýA¾ Scripts/WebServer/UTÚ|Vux ììPK l8G¤ÿ¿L\´� Scripts/WebServer/install.shUTÚ|Vux ììPK l8GüUý¼´�¬Scripts/WebServer/start.shUTÚ|Vux ììPK {5=GýATOSCA-Metadata/UTš´ Vux ììPK{5=GNï'?”É´�hTOSCA-Metadata/TOSCA.metaUTš´ Vux ììPKôO././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7873092 tosca_parser-2.15.0/samples/tests/data/CSAR/csar_wordpress_valid_artifact_multi.zip0000664000175000017500000001416415250006202027405 0ustar00zuulzuulPK P™T Definitions/UT (fb*fbux èèPKP™TMõß6»ã 0Definitions/tosca_single_instance_wordpress.yamlUT (fb(fbux èè½WmoÛ6þî_q?ÀQ’!2}Ð$mQ é²¹C0…@‹´MTU’Š« ûﻣ$Š”_š Eý!1È»çÞ=w¤­29˸XÉJZ©*“= mðK ÖmYÖ…ÈZVÙyv6›qar-kël~›|ø}qó :;¨µZIü¿•v[¥y­…1sØŠ%¡XÅ¡lÍ—Tv#À°Rô›Él†8J[“"òɈ��Ù̪ZjÝfV`8f™Éªn:€¼núo¶­EŠ»V¬…î×"öï›r‰„Ô nþ2°RºãÓSé93¾Ì*\šÏøœþCœŸÁÛëh³jÊ̽]cÑÓÒ¤µKQö(g¿^Âýˆ£Ìsh0�o¤¹%Â׫Ëìò"2è²p'«æë”?>Ý–M§Ñ7‚+Í"ÿËáü*9£üªÆŽÒ$1aܬÑÅ@(ºTß=à{’»»”žm�þfÝÊÏrxŒ»÷ö�#f;>¸ð±+䜞1O¨–¬‡")ÿPK $8GHOÀ5îDefinitions/wordpress.yamlUT Ú|Vfbux èè•�ANÄ0 E÷=E.@ÛîFÀ ¤YFnã‚¥Ö ¶;£Þž&´3Eƒ�È*ú~ßþ¶EíÀì‰É(²úŠ.ŸÆY))�i@?Ã8ø_Uz›jS¹o¨ÎšÖGl) ÔAîT£„A-œs…N|/qlþðXðs"ÁÙV»sw.€A Š9¤Hl[)¿´4�Í[÷‹BË�çÕR?­MvÖãg¤_ Á¡äÓJ¼×´~ŒÌØ™¾Åb[†¡ôÐáeƒW á›8M× ó;'ZÏ0â^]½\¼qjBü~ƒOŠò<�ê9îsÜX¾PK $8G…¡3={ README.txtUT Ú|Vfbux èèmSKoÛ0 ¾ëWðÖzh4¬Û)· �SƒvMÑÆfb¢²äIr ÿû‘Šƒ&i}²^ß‹äóÝâvy77æ¥å7«Å3ÔÁgdŸ�ƒ†6ì9s�un1F‚HÿŽÔÀ&D¹Ñ»0²ßŸ›§H)ô ,ÇÕï’œ:à®2�`gô5Ycî|Ž£lP‡ÊR ûj�QÌÜÆ0l[@!Ö-¥1Ë;é,ÏØ‘yy\Ý,fKÊØ`Æïei;YZ(öô’‚︡-oÛ™£¹i¨….™’ÅŽbÒMa¬#æ°QT¢²p?DYÄ.DºÎà}`Ÿå1ä ×Í#‡!AÑt’ªŠš²�|aÓôeí’•êPÉê¢D6»ý@¸Ø“¨>�Ã{Ëb© ®IEK¢¸ãš S×;”‚hæúò=Ä7°±æ+ 0ôú�ÎÂ⬵] ‡Ú<õ#ª“qü&tR‚¹ùQÁ3a©™vÉá:¡HÃm”É™©�È·€ ‰ÿï 4?‰"ƒîvá ![ >KûPK $8GScripts/MYSQLDBMS/UT Ú|V=fbux èèPK $8GÆEþ™!!Scripts/MYSQLDBMS/start.shUT Ú|Vfbux èè#!/bin/sh /etc/init.d/mysql startPK $8GÄ™Qª�4Scripts/MYSQLDBMS/install.shUT Ú|Vfbux èè­O»Â0ÛóGËzêä3Ø«¤¹¶'¥IÈ�þ=DE&K¶,Ûr{è<§Î;™M{šY@†ÊE�“¨‹Q`YåA¨^©ãŠâD —œ’1�ü�ÓˆBúD¤A9'k-4¯$¾“ð-ºš³öʼnÜr °‘cðýÎjþÑß»Éqú¹²ÝÂõsG¾ãÂ"œ¦]ýPK $8GÓƒêÔ{·Scripts/MYSQLDBMS/configure.shUT Ú|Vfbux èèSVÔOÊÌÓ/Îà*NMQÐÕ-JMO­(ÐM­(IÍKŠ(ëkä•ÄkÙ±f´�®e¬–~Œ¡JJR€�yµ�AC§¨•Œ?` N9J=|I-ÏÇÇ9g>³óKg›šj׌xBû0·¬z­°¬«2æ®ûr½(ólbÙ—�m‚L"øL2�¥“Ñ©¶rH˜°Hö ?r�!¦G?cµ�âhªžnh£ ÕÔÚ ”p#ÉŽ>xç�ô�¤ Ä!ÝýÕ:O\’÷ùPK {­G Definitions/PKኞX¼¦kq€œ 0Definitions/tosca_single_instance_wordpress.yaml½WÝnÚ0¾ç)ΰSUu¹˜ÔŸušT66:USUE&1`5‰]Û)eSß}Çvâ$ü” MËE öw>ŸŸï8ÍUL¢„ÎYÎ4㹊ž©Tø!·¥X&R­I–F£hØë%TÅ’ m1{·ß¦—çàp $Ÿ3ü¿bz +.!©R}XÑ(*‘Hž@¶VO)ðô’‚"-7ƒ^y¸Ô*Dæw°ÔZ¨p0 /ÄÐ1Ïž50Nõzš žòÅ:Ò1DScÊrQX|bQ˜OöÑkACÜÕtAe¹ÖŠèk‘ÍÐI>‡ËÉOs.ÑGï^ic¢´$Hã‰�·Ï$eI„ ªB¸‡QÞ÷á¤gð`aÉ,Ê1ض3ÈÄòÅ._nñ`ƒGo¬ ÑdF *²Ý:†Ìà[ŒWvÍŠUr ß–bbJá]’d,ǼÈ5¢”©—?@r®�9åâ=‹­Æx=ý~ãùŒVÚ\\¹¢óm2·UUÔñ4RŠ9O¨W‘«l­áæ)esÆ@wtv.DÊbbŽ |RJIŸ &iF7Ô²äJ‡¦1œ¶êïTDóDpTYè&ª6ÖÊXÎIL¼S�ýEd•àR¯’š¾ØÙN ¥LÒ4PË–ÏçlQH§Õú1]nC!.¥A0˜Ú«��{à�7HmÙ~V"ªZþÀ‚¢D$Tê5¶ÑFì}'àxÝÁRöDƒÛÏRI® S…µl†n±_9Wíz–‡°f=›I±Ù «[¤vÝÆ² 2«5Ȼٖ]¯�ÔZ6ËÔÑlª«¢Æ¿°E«m¨ª‹¬à QM?Ý\ï—R•¾ý–fwŸe•éýÖb›¡¾&»h Ñ Þa yC€ãé~ñÕÌÛºi^æ�Ì}¼ 4«æ.Ã#Õåî·mí˜ðv_p¸$õ»gàÕ{P»H×ÖíaÕþ‹Òû—Ê›/­©…üתøS»VÅÔU±øCá]ò “[]¬1dÆRÖR· ÍÛ™zÄ9ø71Âç‹Öf^d‘07Do–6Z;£YÉr2üp 㚇«.n/™¦±62„—³ÓèôÄê,ܰ¼xÙðßÌW³Âiôš&\’À�ü£³`hòË m¥éÅ„çF…LÃ]SÕ— } ¾øÝ´|W Løà‘U³Š«íüÁ…{WÈ>FÍž žRR)ÿPK l8GHOÀ5íDefinitions/wordpress.yaml•QMOÃ0 ½÷WôPÁµ7Ü‘@Ú1r,5N°ÓMý÷äc+c“&í�’ç÷ìç$zÁXœˆ)’g5{M‡¾­%%f4+¸Ù<™Ç¦aoÑÄ5 öM[E]æ´ÛáðÂL#äNÝ΋}Ô¬K°(´Gk&ñ®¿á+bÁŸ…rÌö‚‡ÖB„ ² ž8¦Ò† 4S\OÝ7†Ò�·£¥{=69³æÿ"]Šj¤¹äÓo 'ñ9§Ý‹gÆ1ê§/¶4 e‚· >"°±õ^5a)n8cÃà0³H/ž2jâ¯+ù¢(wȨÒïܰüPK l8G…¡3<{ README.txtmSMS1 ½ûWèÛ!î”öÄ-ÃÇ© zì(^%«Ákomo˜ý÷•µI „=­mé½§'éázyu{}aÌSÇ.—àb(È!z-­9pá(çÒaL‰þŽœ¨…uL1ø8qØÀï˜ÚûD9 -ÜN�¿~B €�åÕ“÷ÃX»`pd�¹%Mr!@=V…Rt#Y™â¸éÄä:Ê%a‘Î{�"ƒ%�=™§»ÇËåâ– ¶Xð«m/G µ< ªà[n)CÇ›náiKþ�€<:¡ËF½ØRÊõR]"eŽkEj•…›1É!õ1Ñpy"‡"ÉPb 7[LÇ ªéÀÕYÔìí¾"Ŷ꾜}¶æInH½:QËWo'3Ùžê^;–’ºèÛ¬Z2¥-;‚Býà±Põ\3_czñ[k>a©–Ç¡þ£·°üЇÒhŸã®wJ¤õ�(3ž_„NZpa¾5ð@¨=“)ùNèº#åÖœ7p#蟾^€sû†§óúÊ4¼÷à4Ä–ô:Ÿ‰ÎWì¹Lû*Î6U‹Àé—¥ªúûY$h'¥jèq0ßx¦ÄëIå¯Föm] -Ç$td7Vr:‰Ò1o`Eå•HÉ«¬C¢m�?Ašk±pwà®Ò”‡š½§Ø�Ò ó®¸¦î¦ÀÍ}p‚-“˜t=Ô{)Œk~4pÐ#te”ÒŽfâTwãÃ¥“%®.þÙ?gIpUc+ã3znkÖX—ö°ž¸šwT%î™5ÿPK l8GScripts/PK l8GScripts/MYSQLDatabase/PK l8G«ƒl¥Ñ"Scripts/MYSQLDatabase/configure.shMŽÍ ‚@…÷ó·©U`=€�yµ�AC§¨•Œ?` N9J=|$-ÏÇÇ9g>[g×vm*’«0òáÍÓÜk°è´îÁ²nʘ‡îŠÍ¢ÈÒ‘¥?Bv12‰à1É\– ŒF«šÒ&AÌB L8ÄüĘ@NÆj 2:ÆÁ”ÝÒZ窮´é)ᆒû=p/_iš¤6ñÅ1ÙÿÕÚÏ\’Ïù7PK l8GScripts/MYSQLDBMS/PK l8GÓƒêÔ|·Scripts/MYSQLDBMS/configure.shm‹Í Â0„ïyеzÐÂvõ(¨/bEl³­“Æì"õí�?A30ßÇL'Ô¸@r6Â÷“ð-ºš³E.¹zx“½wÃÆjþÑ?`@N¿V>·ìú:ÖN|µ ‹p ›úPK l8GÆEþ™!!Scripts/MYSQLDBMS/start.sh#!/bin/sh /etc/init.d/mysql startPK l8GScripts/WebServer/PK l8G¤ÿ¿L\Scripts/WebServer/install.sh=Ë1 €0 н§øâ\ žÅ ¤5Ø@)¡‰Š·w)Žoxë’²ôd5¬{ƒ•!ê�nN­H©TÆÃÆãæ©Ç“—ä<ùÄw¦íPK l8GüUý¼Scripts/WebServer/start.sh#!/bin/sh service apache2 startPK l8GScripts/WordPress/PK l8G$¨€çScripts/WordPress/configure.sh•Œ;Â0{Ÿb´f�­íUÉ?¼6†ˆÃŠ(´)ßèÍ\/h–„âUH °KÝUÆ‘«+•eƒOª8Æ@ßb8¸š×¥€vÿ’Ëö8 ¿(–À‚­ßò÷yUl}†Û(“3S!‘Ÿ0$þ\ 4ï�D‘A÷}vá ![ >KûPK l8G¬¹FVScripts/WordPress/install.shEÊÁ €0 Ð{§ˆô\ºŒ Tl Ô�·÷"öøàÅ%o22Zˆkvu’/½ƒîÓª!õt°Ó¥µ8ü+¥gæPK{5=GTOSCA-Metadata/PK{5=GNï'?“ÉTOSCA-Metadata/TOSCA.metaMÌA Â0…á}N‘ $Úmv5*¸�‚)nKhF ÄIÈ Jn¯‘.߃ÿg{uöê¨+TŠ�ìôVX×_ÖO'lÏÔ®9ôîääÈÑŠrmj·ˆ‘?¹Î4û‰"ÞL‰=Î0½r ¥‘nþ‘„ÍÈ€¬ÆVÀH_Jгÿö›'�=EÒ ¤ÃŸþ¥oPK?è@>G $Definitions/ j1• ûÐPK?ኞX¼¦kq€œ 0$ *Definitions/tosca_single_instance_wordpress.yaml ÎÂ/�ךÚPK? l8GHOÀ5í$€øDefinitions/wordpress.yaml ©”‚öÐPK? l8G…¡3<{ $€README.txt ©”‚öÐPK? l8G$�Scripts/ ©”‚öÐPK? l8G$§Scripts/MYSQLDatabase/ ©”‚öÐPK? l8G«ƒl¥Ñ"$€ÛScripts/MYSQLDatabase/configure.sh ©”‚öÐPK? l8G$ÀScripts/MYSQLDBMS/ ©”‚öÐPK? l8GÓƒêÔ|·$€ðScripts/MYSQLDBMS/configure.sh ©”‚öÐPK? l8GÄ™Qª�4$€¨ Scripts/MYSQLDBMS/install.sh ©”‚öÐPK? l8GÆEþ™!!$€q Scripts/MYSQLDBMS/start.sh ©”‚öÐPK? l8G$Ê Scripts/WebServer/ ©”‚öÐPK? l8G¤ÿ¿L\$€ú Scripts/WebServer/install.sh ©”‚öÐPK? l8GüUý¼$€€ Scripts/WebServer/start.sh ©”‚öÐPK? l8G$× Scripts/WordPress/ ©”‚öÐPK? l8G$¨€ç$€ Scripts/WordPress/configure.sh ©”‚öÐPK? l8G¬¹FV$€Ã Scripts/WordPress/install.sh ©”‚öÐPK?{5=G$C TOSCA-Metadata/  [Å6úÐPK?{5=GNï'?“É$€p TOSCA-Metadata/TOSCA.meta  [Å6úÐPKØ:././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7873092 tosca_parser-2.15.0/samples/tests/data/CSAR/csar_wrong_metadata_file.zip0000664000175000017500000000155115250006202025076 0ustar00zuulzuulPK†fG-Àö0utosca_helloworld.yamlUT l°äUl°äUux ééu’ÁnÂ0 †ï} K»W€š82Mp`š´í…Ô€EÓD±»Ñ=ý\Ú±Vc¹$ñoÿþbE;k ÜSEB¡bó�‰õ°¹HL>–hëK35“,+�]¢(—œwTÕ Â>$(0–¡¡êX·�1©|’!&¼ôÁB�!bBγLB e84Fz³eP…¯n#¾1�_w�&bÏ™·œ?kÁ^w6Ú•Ô6ú©¸ƒM`*±J“4ל£füV 2A…¬½q±æ%Ì†á‚ø¤sûR¶éÖ«¡æÑ÷Ò|:ƒçÕ€j]£b½h#+íßÖÜ¢ #ŒàÔ±}Å_Còö€·lÛe“;’ “:)ãùaa÷£„næ[ªêó(®�–D»ºû¯›§íH¾þªE>ϾPK )jGTOSCA-metadate/UT N¶äUQ¶äUux ééPK jGÝBÁ3))TOSCA-metadate/TOSCA.metaUT ¶äU@¶äUux ééEntry-Definitions: tosca_helloworld.yaml PK†fG-Àö0u´�tosca_helloworld.yamlUTl°äUux ééPK )jGýATOSCA-metadate/UTN¶äUux ééPK jGÝBÁ3))´�ÈTOSCA-metadate/TOSCA.metaUT¶äUux ééPKD././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7873092 tosca_parser-2.15.0/samples/tests/data/CSAR/multi_level_imports_response.yaml0000664000175000017500000000135015250006202026244 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_2 description: Sample metadata: template_name: my_template template_author: Niraj template_version: 1.0 imports: - Definitions/level1.yaml topology_template: inputs: selected_flavour: type: string description: VNF deployment flavour selected by the consumer. It is provided in the API node_templates: VNF: type: company.sample.VNF properties: flavour_id: { get_input: selected_flavour } descriptor_id: b1bb0ce7-ebca-4fa7-95ed-4840d70a1177 provider: Company product_name: Sample VNF software_version: '1.0' descriptor_version: '1.0' vnfm_info: - Tacker ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7873092 tosca_parser-2.15.0/samples/tests/data/CSAR/root_level_file.yaml0000664000175000017500000000137615250006202023411 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_2 description: Sample metadata: template_name: my_template template_author: Niraj template_version: 1.0 topology_template: node_templates: dbBackend: type: tosca.nodes.nfv.Vdu.Compute properties: name: dbBackend description: dbBackend compute node vdu_profile: min_number_of_instances: 1 max_number_of_instances: 1 sw_image_data: name: Software of dbBackend version: '0.4.0' checksum: algorithm: sha-256 hash: b9c3036539fd7a5f87a1bf38eb05fdde8b556a1a7e664dbeda90ed3cd74b4f9d container_format: bare disk_format: qcow2 min_disk: 1 GB size: 1 GB ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7873092 tosca_parser-2.15.0/samples/tests/data/CSAR/tosca_meta_file.yaml0000664000175000017500000000137615250006202023356 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_2 description: Sample metadata: template_name: my_template template_author: Niraj template_version: 1.0 topology_template: node_templates: dbBackend: type: tosca.nodes.nfv.Vdu.Compute properties: name: dbBackend description: dbBackend compute node vdu_profile: min_number_of_instances: 1 max_number_of_instances: 1 sw_image_data: name: Software of dbBackend version: '0.4.0' checksum: algorithm: sha-256 hash: b9c3036539fd7a5f87a1bf38eb05fdde8b556a1a7e664dbeda90ed3cd74b4f9d container_format: bare disk_format: qcow2 min_disk: 1 GB size: 1 GB ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4803922 tosca_parser-2.15.0/samples/tests/data/artifacts/0000775000175000017500000000000015250006256020606 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873902.497395 tosca_parser-2.15.0/samples/tests/data/artifacts/collectd/0000775000175000017500000000000015250006256022377 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7873092 tosca_parser-2.15.0/samples/tests/data/artifacts/collectd/config.py0000775000175000017500000000174015250006202024212 0ustar00zuulzuul#!/usr/bin/python # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # This script configures collectd to send metric data to the # logstash server port 25826 # The environment variable logstash_ip is expected to be set up import os with open("/etc/collectd/collectd.conf.d/tosca_elk.conf", "w") as fh: fh.write(""" LoadPlugin network Server "%s" "25826" """ % (os.environ['logstash_ip'])) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7873092 tosca_parser-2.15.0/samples/tests/data/artifacts/collectd/create.sh0000775000175000017500000000015315250006202024167 0ustar00zuulzuul#!/bin/bash # This script install collectd for monitoring data apt-get update apt-get install -y collectd ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7873092 tosca_parser-2.15.0/samples/tests/data/artifacts/collectd/start.sh0000775000175000017500000000015615250006202024064 0ustar00zuulzuul#!/bin/bash # This script starts collectd as a service in init.d service collectd stop service collectd start ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4983952 tosca_parser-2.15.0/samples/tests/data/artifacts/elasticsearch/0000775000175000017500000000000015250006256023420 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7873092 tosca_parser-2.15.0/samples/tests/data/artifacts/elasticsearch/create.sh0000775000175000017500000000066015250006202025213 0ustar00zuulzuul#!/bin/bash # This script installs java and elasticsearch apt-get update apt-get install -y openjdk-7-jre-headless wget -qO - https://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add - echo "deb http://packages.elasticsearch.org/elasticsearch/1.5/debian stable main" | tee -a /etc/apt/sources.list apt-get update apt-get install -y elasticsearch # set up to run as service update-rc.d elasticsearch defaults 95 10 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7873092 tosca_parser-2.15.0/samples/tests/data/artifacts/elasticsearch/start.sh0000775000175000017500000000017515250006202025106 0ustar00zuulzuul#!/bin/bash # This script starts elasticsearch as a service in init.d service elasticsearch stop service elasticsearch start ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4983952 tosca_parser-2.15.0/samples/tests/data/artifacts/kibana/0000775000175000017500000000000015250006256022033 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/kibana/config.sh0000775000175000017500000000055215250006202023630 0ustar00zuulzuul#!/bin/bash # This script configures kibana to connect to the elasticsearch server # to access data and to export the app url on port 5601: # The environment variable elasticsearch_ip and kibana_ip are expected # to be set up. sed -i 's/localhost/'$elasticsearch_ip'/' /opt/kibana/config/kibana.yml sed -i 's/0.0.0.0/'$kibana_ip'/' /opt/kibana/config/kibana.yml ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/kibana/create.sh0000775000175000017500000000072015250006202023623 0ustar00zuulzuul#!/bin/bash # This script installs kibana and sets it up to run as a service in init.d cd /opt wget https://download.elastic.co/kibana/kibana/kibana-4.1.0-linux-x64.tar.gz tar xzvf kibana-4.1.0-linux-x64.tar.gz mv kibana-4.1.0-linux-x64 kibana # set up to run as service cd /etc/init.d wget https://gist.githubusercontent.com/thisismitch/8b15ac909aed214ad04a/raw/bce61d85643c2dcdfbc2728c55a41dab444dca20/kibana4 chmod +x kibana4 update-rc.d kibana4 defaults 96 9 ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/kibana/start.sh0000775000175000017500000000015215250006202023514 0ustar00zuulzuul#!/bin/bash # This script starts kibana as a service in init.d service kibana4 stop service kibana4 start ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4993954 tosca_parser-2.15.0/samples/tests/data/artifacts/logstash/0000775000175000017500000000000015250006256022432 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/logstash/configure_collectd.py0000775000175000017500000000213115250006202026625 0ustar00zuulzuul#!/usr/bin/python # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # This script configures the logstash input using the udp protocol on # port 25826. This is intended to receive data from collectd from # any source with open("/etc/logstash/conf.d/collectd.conf", "w") as fh: fh.write(""" input { udp { port => 25826 # 25826 is the default for collectd buffer_size => 1452 # 1452 is the default for collectd codec => collectd { } tags => ["metrics"] type => "collectd" } }""") ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/logstash/configure_elasticsearch.py0000775000175000017500000000175015250006202027654 0ustar00zuulzuul#!/usr/bin/python # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # This script configures the logstash output to forward to elasticsearch # The environment variable elasticsearch_ip is expected to be set up import os with open("/etc/logstash/conf.d/elasticsearch.conf", 'w') as fh: fh.write(""" output { elasticsearch { action => index host => "%s" protocol => "http" } }""" % (os.environ['elasticsearch_ip'])) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/logstash/configure_rsyslog.py0000775000175000017500000000161115250006202026540 0ustar00zuulzuul#!/usr/bin/python # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # This script configures the logstash input using the RELP protocol on # port 2514 This is intended to receive logs from rsyslog from # any source with open("/etc/logstash/conf.d/rsyslog.conf", "w") as fh: fh.write(""" input { relp { port => 2514 tags => ["logs"] } }""") ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/logstash/create.sh0000775000175000017500000000113315250006202024221 0ustar00zuulzuul#!/bin/bash # This script installs java, logstash and the contrib package for logstash # install java as prereq apt-get update apt-get install -y openjdk-7-jre-headless mkdir /etc/logstash # install by apt-get from repo wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add - echo "deb http://packages.elasticsearch.org/logstash/1.4/debian stable main" | tee -a /etc/apt/sources.list apt-get update apt-get install -y logstash # install contrib to get the relp plugin /opt/logstash/bin/plugin install contrib # set up to run as service update-rc.d logstash defaults 95 10 ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/logstash/start.sh0000775000175000017500000000013515250006202024114 0ustar00zuulzuul#!/bin/bash # Run logstash as service in init.d service logstash stop service logstash start ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4993954 tosca_parser-2.15.0/samples/tests/data/artifacts/mongodb/0000775000175000017500000000000015250006256022233 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/mongodb/config.sh0000775000175000017500000000054415250006202024031 0ustar00zuulzuul#!/bin/bash # Edit the file /etc/mongod.conf, update with real IP of Mongo server # This script configures the mongodb server to export its service on # the server IP # bind_ip = 127.0.0.1 -> bind_ip = # The environment variable mongodb_ip is expected to be set up sed -i "s/= 127.0.0.1/= $mongodb_ip,127.0.0.1/" /etc/mongod.conf ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/mongodb/create.sh0000775000175000017500000000070415250006202024025 0ustar00zuulzuul#!/bin/bash # This script installs mongodb apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.0.list apt-get update apt-get install -y mongodb-org #Wait for mongodb initialization while [[ ! -d "/var/lib/mongodb/_tmp" ]]; do echo "Waiting for mongodb initialization ..." sleep 5 done ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/mongodb/create_database.sh0000775000175000017500000000034715250006202025654 0ustar00zuulzuul#!/bin/bash echo "conn = new Mongo();" > setup.js echo "db = conn.getDB('paypal_pizza');" >> setup.js echo "db.about.insert({'name': 'PayPal Pizza Store'});" >> setup.js mongo setup.js ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/mongodb/start.sh0000775000175000017500000000016215250006202023715 0ustar00zuulzuul#!/bin/bash # This script starts mongodb service mongod stop rm /var/lib/mongodb/mongod.lock service mongod start ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5003955 tosca_parser-2.15.0/samples/tests/data/artifacts/mysql/0000775000175000017500000000000015250006257021754 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/mysql/mysql_database_configure.sh0000775000175000017500000000032115250006202027327 0ustar00zuulzuul#!/bin/sh cat << EOF | mysql -u root --password=$db_root_password CREATE DATABASE $db_name; GRANT ALL PRIVILEGES ON $db_name.* TO "$db_user"@"localhost" IDENTIFIED BY "$db_password"; FLUSH PRIVILEGES; EXIT EOF././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/mysql/mysql_dbms_configure.sh0000775000175000017500000000026715250006202026521 0ustar00zuulzuul#!/bin/sh sed --regexp-extended "s/(port\s*=\s*)[0-9]*/\1$db_port/g" /tmp/my.cnf mv -f /tmp/my.cnf /etc/mysql/my.cnf /etc/init.d/mysql stop /etc/init.d/mysql start././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/mysql/mysql_dbms_install.sh0000775000175000017500000000046415250006202026205 0ustar00zuulzuul#!/bin/bash #This script installs mysql server apt-get update debconf-set-selections <<< "mysql-server mysql-server/root_password password $db_root_password" debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $db_root_password" apt-get -y install --fix-missing mysql-server././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.788309 tosca_parser-2.15.0/samples/tests/data/artifacts/mysql/mysql_dbms_start.sh0000775000175000017500000000004115250006202025663 0ustar00zuulzuul#!/bin/sh /etc/init.d/mysql start././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5003955 tosca_parser-2.15.0/samples/tests/data/artifacts/nodejs/0000775000175000017500000000000015250006257022071 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7893093 tosca_parser-2.15.0/samples/tests/data/artifacts/nodejs/config.sh0000775000175000017500000000134415250006202023665 0ustar00zuulzuul#!/bin/bash # This script installs an app for nodejs: the app intended is the paypal app # and it is configured to connect to the mongodb server # The environment variables github_url and mongodb_ip are expected to be set up export app_dir=/opt/app git clone $github_url /opt/app if [ -f /opt/app/package.json ]; then cd /opt/app/ && npm install sed -i "s/localhost/$mongodb_ip/" config.json fi cat > /etc/init/nodeapp.conf <> /var/log/nodeapp.log 2>&1 & end script EOS ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7893093 tosca_parser-2.15.0/samples/tests/data/artifacts/nodejs/create.sh0000775000175000017500000000023515250006202023661 0ustar00zuulzuul#!/bin/bash # This script installs nodejs and the prereq add-apt-repository ppa:chris-lea/node.js apt-get update apt-get install -y nodejs build-essential ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7893093 tosca_parser-2.15.0/samples/tests/data/artifacts/nodejs/start.sh0000775000175000017500000000010615250006202023550 0ustar00zuulzuul#!/bin/bash # This script starts the nodejs application start nodeapp ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5013957 tosca_parser-2.15.0/samples/tests/data/artifacts/rsyslog/0000775000175000017500000000000015250006257022311 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7893093 tosca_parser-2.15.0/samples/tests/data/artifacts/rsyslog/config.sh0000775000175000017500000000212615250006202024104 0ustar00zuulzuul#!/bin/bash # This script configures the output for rsyslogd to send logs to the # logstash server port 2514 using the RELP protocol # The environment variable logstash_ip is expected to be set up echo "module(load=\"omrelp\") action(type=\"omrelp\" target=\"$logstash_ip\" port=\"2514\")" > /etc/rsyslog.d/tosca_elk.conf # Remove the /dev/xconsole configuration as xconsole # is not available by default l=`awk '/=warn.*\|.*\/dev\/xconsole/{print NR - 1}' /etc/rsyslog.d/50-default.conf` if [ ! -z $l ]; then l=`expr $l + 1` line=`cat /etc/rsyslog.d/50-default.conf | head -n $l | tail -1` if [[ ! $line == \#* ]]; then l0=`expr $l - 3` sed -i -r -e "${l0},${l}s/^.{0}/&#/" /etc/rsyslog.d/50-default.conf fi fi # Enable nodejs logs for rsyslog if ! grep -q nodeapp "/etc/rsyslog.conf"; then sed -i 's/\$PrivDropToGroup\ syslog/\$PrivDropToGroup adm/' /etc/rsyslog.conf echo "\$ModLoad imfile.so \$InputFileName /var/log/nodeapp.log \$InputFileTag paypal_pizza: \$InputFileStateFile stat-nodeapp \$InputRunFileMonitor \$InputFilePollInterval 1" >> /etc/rsyslog.conf fi ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7893093 tosca_parser-2.15.0/samples/tests/data/artifacts/rsyslog/create.sh0000775000175000017500000000017415250006202024103 0ustar00zuulzuul#!/bin/bash # This script installs rsyslog and the library for RELP apt-get update apt-get install -y rsyslog rsyslog-relp ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7893093 tosca_parser-2.15.0/samples/tests/data/artifacts/rsyslog/start.sh0000775000175000017500000000015415250006202023773 0ustar00zuulzuul#!/bin/bash # This script starts rsyslogd as a service in init.d service rsyslog stop service rsyslog start ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5013957 tosca_parser-2.15.0/samples/tests/data/artifacts/webserver/0000775000175000017500000000000015250006257022613 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7893093 tosca_parser-2.15.0/samples/tests/data/artifacts/webserver/webserver_install.sh0000775000175000017500000000013415250006202026670 0ustar00zuulzuul#!/bin/sh #This script installs apache web server apt-get update apt-get install -y apache2././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7893093 tosca_parser-2.15.0/samples/tests/data/artifacts/webserver/webserver_start.sh0000775000175000017500000000003715250006202026361 0ustar00zuulzuul#!/bin/sh service apache2 start././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5013957 tosca_parser-2.15.0/samples/tests/data/artifacts/wordpress/0000775000175000017500000000000015250006257022637 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7893093 tosca_parser-2.15.0/samples/tests/data/artifacts/wordpress/wordpress_configure.sh0000775000175000017500000000034715250006202027261 0ustar00zuulzuul#!/bin/sh ln -s /usr/share/wordpress /var/www/html/wordpress gzip -d /usr/share/doc/wordpress/examples/setup-mysql.gz echo $wp_db_password | bash /usr/share/doc/wordpress/examples/setup-mysql -e $wp_db_name -u $wp_db_user localhost././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7893093 tosca_parser-2.15.0/samples/tests/data/artifacts/wordpress/wordpress_install.sh0000775000175000017500000000012615250006202026741 0ustar00zuulzuul#!/bin/sh #This script installs wordpress apt-get update apt-get install -y wordpress././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5023959 tosca_parser-2.15.0/samples/tests/data/containers/0000775000175000017500000000000015250006257020774 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7893093 tosca_parser-2.15.0/samples/tests/data/containers/test_container_docker_mysql.yaml0000664000175000017500000000232315250006202027443 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA simple profile with mysql docker container. # Repositories to retrieve code artifacts from repositories: docker_hub: https://registry.hub.docker.com/ topology_template: inputs: mysql_root_pwd: type: string description: Root password for MySQL. node_templates: # The MYSQL container based on official MySQL image in Docker hub mysql_container: type: tosca.nodes.Container.Application.Docker requirements: - host: mysql_runtime artifacts: my_image: file: mysql type: tosca.artifacts.Deployment.Image.Container.Docker repository: docker_hub interfaces: Standard: create: implementation: my_image inputs: MYSQL_ROOT_PASSWORD: { get_input: mysql_root_pwd } # The properties of the runtime to host the container mysql_runtime: type: tosca.nodes.Container.Runtime capabilities: host: properties: num_cpus: 1 disk_size: 10 GB mem_size: 2 MB requirements: - host: my_server my_server: type: tosca.nodes.Compute ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5063963 tosca_parser-2.15.0/samples/tests/data/custom_types/0000775000175000017500000000000015250006257021365 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/collectd.yaml0000664000175000017500000000070315250006202024030 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > collectd is a daemon which gathers statistics about the system it is running on. node_types: tosca.nodes.SoftwareComponent.Collectd: derived_from: tosca.nodes.SoftwareComponent requirements: - log_endpoint: capability: tosca.capabilities.Endpoint node: tosca.nodes.SoftwareComponent.Logstash relationship: tosca.relationships.ConnectsTo././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/compute_with_attribute_list.yaml0000664000175000017500000000043615250006202030067 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Compute node type with a list attribute node_types: tosca.nodes.ComputeWithAttrList: derived_from: tosca.nodes.Compute attributes: attr_list: type: map entry_schema: type: string ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/compute_with_nested_atributes.yaml0000664000175000017500000000101415250006202030366 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Compute node type with capability with an attribute of type list capability_types: tosca.capabilities.indigo.Endpoint: derived_from: tosca.capabilities.Endpoint attributes: credential: type: list entry_schema: type: tosca.datatypes.Credential node_types: tosca.nodes.ComputeWithCapWithAttr: derived_from: tosca.nodes.Compute capabilities: endpoint: type: tosca.capabilities.indigo.Endpoint ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/compute_with_prop.yaml0000664000175000017500000000044715250006202026013 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Compute node type with a parameter for the get property with host test node_types: tosca.nodes.ComputeWithProp: derived_from: tosca.nodes.Compute properties: test: required: false type: integer ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/container_cap_child.yaml0000664000175000017500000000155615250006202026216 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Define a capability class that inherits from tosca.capabilities.Container capability_types: tosca.capabilities.ContainerChild: derived_from: tosca.capabilities.Container node_types: tosca.nodes.SomeNode: derived_from: tosca.nodes.Root properties: some_prop: type: string requirements: - host_child: capability: tosca.capabilities.ContainerChild node: tosca.nodes.SomeNode2 relationship: tosca.relationships.HostedOn tosca.nodes.SomeNode2: derived_from: tosca.nodes.Root capabilities: host_child: type: tosca.capabilities.ContainerChild requirements: - host: capability: tosca.capabilities.Container node: tosca.nodes.Compute relationship: tosca.relationships.HostedOn ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/custom_cap.yaml0000664000175000017500000000104215250006202024371 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 capability_types: tosca.capabilities.SomeCap: derived_from: tosca.capabilities.Container node_types: tosca.nodes.NodeWithReq: derived_from: tosca.nodes.SoftwareComponent requirements: - host: capability: tosca.capabilities.SomeCap relationship: tosca.relationships.HostedOn occurrences: [1, 1] tosca.nodes.NodeWithCap: derived_from: tosca.nodes.SoftwareComponent capabilities: host: type: tosca.capabilities.SomeCap ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/custom_cap_with_datatype.yaml0000664000175000017500000000110615250006202027320 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 node_types: tosca.nodes.SomeNode: derived_from: tosca.nodes.Root capabilities: cap1: type: tosca.capabilities.SomeCap capability_types: tosca.capabilities.SomeCap: derived_from: tosca.capabilities.Root properties: data: type: tosca.datatypes.SomeData data_types: tosca.datatypes.SomeData: derived_from: tosca.datatypes.Root properties: name: type: string required: true value: type: integer required: false default: 100 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/custom_caps_def.yaml0000664000175000017500000000074615250006202025404 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Definition of a node with a capiblity and a parent capability defined in an imported file capability_types: tosca.capabilities.SomeCap: derived_from: tosca.capabilities.Root tosca.capabilities.SomeChildCap: derived_from: tosca.capabilities.SomeCap node_types: tosca.nodes.SomeNode: derived_from: tosca.nodes.Root capabilities: lrms: type: tosca.capabilities.SomeChildCap ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/custom_data_type.yaml0000664000175000017500000000065015250006202025604 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 data_types: tosca.datatypes.SomeType: derived_from: tosca.datatypes.Root properties: tasks: type: map entry_schema: type: string node_types: tosca.nodes.SomeApp: derived_from: tosca.nodes.SoftwareComponent attributes: some_new_att: type: map entry_schema: type: tosca.datatypes.SomeType ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/custom_interface.yaml0000664000175000017500000000075515250006202025600 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > This template contains custom defined interface type and a node type which uses this custom interface interface_types: tosca.interfaces.CustomInterface: derived_from: tosca.interfaces.Root CustomOp: CustomOp2: node_types: tosca.nodes.CustomInterfaceTest: derived_from: tosca.nodes.WebApplication interfaces: CustomInterface: type: tosca.interfaces.CustomInterface CustomOp3: ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/custom_nested_data_types.yaml0000664000175000017500000000112515250006202027327 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 data_types: tosca.datatypes.SomeTask: derived_from: tosca.datatypes.Root properties: state: type: string output: type: string tosca.datatypes.OtherTask: derived_from: tosca.datatypes.Root properties: tasks: type: map entry_schema: type: tosca.datatypes.SomeTask node_types: tosca.nodes.SomeApp: derived_from: tosca.nodes.SoftwareComponent attributes: some_new_att: type: map entry_schema: type: tosca.datatypes.OtherTask ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/custom_policy.yaml0000664000175000017500000000043315250006202025130 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_1 policy_types: tosca.policies.somePolicy: derived_from: tosca.policies.Root properties: name: type: string required: true value: type: integer required: false default: 100 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/custom_relationship_type_defs.yaml0000664000175000017500000000117415250006202030377 0ustar00zuulzuulnode_types: tosca.nodes.HACompute: derived_from: tosca.nodes.Compute capabilities: high_availability: type: tosca.capabilities.HA requirements: - high_availability: capability: tosca.capabilities.HA relationship: tosca.relationships.HA node: tosca.nodes.HACompute occurences: [ 0, 1 ] relationship_types: tosca.relationships.HA: derived_from: tosca.relationships.Root valid_target_types: [ tosca.capabilities.HA ] capability_types: tosca.capabilities.HA: derived_from: tosca.capabilities.Root valid_source_types: [ tosca.nodes.HACompute ] ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/db_with_list_param.yaml0000664000175000017500000000035415250006202026074 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 node_types: tosca.nodes.DatabaseWithListParam: derived_from: tosca.nodes.Database properties: list_prop: type: list entry_schema: type: integer ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/elasticsearch.yaml0000664000175000017500000000056515250006202025057 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Elasticsearch is an open-source search engine built on top of Apache Lucene, a full-text search-engine library. node_types: tosca.nodes.SoftwareComponent.Elasticsearch: derived_from: tosca.nodes.SoftwareComponent capabilities: search_endpoint: type: tosca.capabilities.Endpoint ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/imported_sample.yaml0000664000175000017500000000230015250006202025416 0ustar00zuulzuultosca1_definitions_version: tosca_simple_yaml_1_0 tosca_definitions_version: tosca_simple_yaml_1_10 descriptions: > Pizza store app that allows you to explore the features provided by PayPal's REST APIs. More detail can be found at https://github.com/paypal/rest-api-sample-app-nodejs/ node_typess: node_types: tosca.nodes.SoftwareComponent.Logstash: derived_from: tosca.nodes.SoftwareComponent requirements: - search_endpoint: capability: tosca.capabilities.Endpoint node: tosca.nodes.SoftwareComponent.Elasticsearch relationship: type: tosca.relationships.ConnectsTo interfaces: Configure: pre_configure_source: inputs: elasticsearch_ip: type: string capabilities1: log_endpoint: type: tosca.capabilities.Endpoint policy_types1: policy_types: mycompany.mytypes.myScalingPolicy: derived1_from: tosca.policies.Scaling metadata: type: map entry_schema: type: string relationship_types1: relationship_types: test.relation.connects: derived_from4: tosca.relationships.ConnectsTo ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/invalid_template_version.yaml0000664000175000017500000000021015250006202027316 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_XXX node_types: tosca.nodes.SomeNode: derived_from: tosca.nodes.SoftwareComponent ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7903092 tosca_parser-2.15.0/samples/tests/data/custom_types/kibana.yaml0000664000175000017500000000106515250006202023466 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Kibana is an open source analytics and visualization platform designed to work with Elasticsearch. You use Kibana to search, view, and interact with data stored in Elasticsearch. node_types: tosca.nodes.SoftwareComponent.Kibana: derived_from: tosca.nodes.SoftwareComponent requirements: - search_endpoint: capability: tosca.capabilities.Endpoint node: tosca.nodes.SoftwareComponent.Elasticsearch relationship: tosca.relationships.ConnectsTo ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.791309 tosca_parser-2.15.0/samples/tests/data/custom_types/logstash.yaml0000664000175000017500000000166015250006202024066 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 imports: - elasticsearch: data/custom_types/elasticsearch.yaml description: > Logstash is a tool for receiving, processing and outputting logs. All kinds of logs. System logs, webserver logs, error logs, application logs, and just about anything you can throw at it. node_types: tosca.nodes.SoftwareComponent.Logstash: derived_from: tosca.nodes.SoftwareComponent requirements: - search_endpoint: capability: tosca.capabilities.Endpoint node: tosca.nodes.SoftwareComponent.Elasticsearch relationship: type: tosca.relationships.ConnectsTo interfaces: Configure: pre_configure_source: inputs: elasticsearch_ip: type: string capabilities: log_endpoint: type: tosca.capabilities.Endpoint ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.791309 tosca_parser-2.15.0/samples/tests/data/custom_types/nested_rsyslog.yaml0000664000175000017500000000071415250006202025305 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > RSYSLOG is the Rocket-fast SYStem for LOG processing. imports: - test_import: file: custom_types/logstash.yaml node_types: Rsyslog: derived_from: tosca.nodes.SoftwareComponent requirements: - log_endpoint: capability: tosca.capabilities.Endpoint node: tosca.nodes.SoftwareComponent.Logstash relationship: tosca.relationships.ConnectsTo ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.791309 tosca_parser-2.15.0/samples/tests/data/custom_types/nested_test_kibana.yaml0000664000175000017500000000012715250006202026065 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 imports: - custom_types/kibana.yaml ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.791309 tosca_parser-2.15.0/samples/tests/data/custom_types/nested_test_wordpress.yaml0000664000175000017500000000172015250006202026670 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 imports: - test_prefix_defs: file: custom_types/nested_rsyslog.yaml namespace_prefix: test_namespace_prefix - test_second_time_with_another_prefix: file: custom_types/nested_rsyslog.yaml namespace_prefix: test_2nd_namespace_prefix node_types: tosca.nodes.SoftwareComponent.Rsyslog.TestRsyslogType: derived_from: test_namespace_prefix.Rsyslog Test2ndRsyslogType: derived_from: test_2nd_namespace_prefix.Rsyslog tosca.nodes.WebApplication.WordPress: derived_from: tosca.nodes.WebApplication requirements: - database_endpoint: capability: tosca.capabilities.Endpoint.Database node: tosca.nodes.Database relationship: tosca.relationships.ConnectsTo interfaces: Standard: inputs: wp_db_name: type: string wp_db_user: type: string wp_db_password: type: string ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.791309 tosca_parser-2.15.0/samples/tests/data/custom_types/node_with_cap.yaml0000664000175000017500000000155115250006202025044 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Node type that has a requirement of a capability with a defined value capability_types: tosca.capabilities.SomeCap: derived_from: tosca.capabilities.Container properties: type: type: string required: true default: someval constraints: - equal: someval node_types: tosca.nodes.SomeNode: derived_from: tosca.nodes.Root properties: some_prop: type: string required: false default: some requirements: - some_req: capability: tosca.capabilities.SomeCap node: tosca.nodes.NodeWithCap relationship: tosca.relationships.HostedOn tosca.nodes.NodeWithCap: derived_from: tosca.nodes.Root capabilities: some_req: type: tosca.capabilities.SomeCap ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.791309 tosca_parser-2.15.0/samples/tests/data/custom_types/paypalpizzastore_nodejs_app.yaml0000664000175000017500000000170115250006202030061 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Pizza store app that allows you to explore the features provided by PayPal's REST APIs. More detail can be found at https://github.com/paypal/rest-api-sample-app-nodejs/ node_types: tosca.nodes.WebApplication.PayPalPizzaStore: derived_from: tosca.nodes.WebApplication properties: github_url: required: false type: string description: location of the application on the github. default: https://github.com/sample.git requirements: #WebApplication inherits Computer, so host implied. - database_connection: capability: tosca.capabilities.Endpoint.Database node: tosca.nodes.Database relationship: tosca.relationships.ConnectsTo interfaces: Standard: configure: inputs: github_url: type: string mongodb_ip: type: string ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.791309 tosca_parser-2.15.0/samples/tests/data/custom_types/rsyslog.yaml0000664000175000017500000000064715250006202023750 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > RSYSLOG is the Rocket-fast SYStem for LOG processing. node_types: tosca.nodes.SoftwareComponent.Rsyslog: derived_from: tosca.nodes.SoftwareComponent requirements: - log_endpoint: capability: tosca.capabilities.Endpoint node: tosca.nodes.SoftwareComponent.Logstash relationship: tosca.relationships.ConnectsTo ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.791309 tosca_parser-2.15.0/samples/tests/data/custom_types/template_metadata.yaml0000664000175000017500000000033115250006202025707 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 metadata: template_name: name template_version: 1.0.0 template_author: me node_types: tosca.nodes.SomeNode: derived_from: tosca.nodes.SoftwareComponent ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.791309 tosca_parser-2.15.0/samples/tests/data/custom_types/template_version_1_3.yaml0000664000175000017500000000020715250006202026260 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_3 node_types: tosca.nodes.SomeNode: derived_from: tosca.nodes.SoftwareComponent ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.791309 tosca_parser-2.15.0/samples/tests/data/custom_types/wordpress.yaml0000664000175000017500000000103015250006202024261 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 node_types: tosca.nodes.WebApplication.WordPress: derived_from: tosca.nodes.WebApplication requirements: - database_endpoint: capability: tosca.capabilities.Endpoint.Database node: tosca.nodes.Database relationship: tosca.relationships.ConnectsTo interfaces: Standard: inputs: wp_db_name: type: string wp_db_user: type: string wp_db_password: type: string ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7923093 tosca_parser-2.15.0/samples/tests/data/custom_types/wordpress.yml0000664000175000017500000000103015250006202024120 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 node_types: tosca.nodes.WebApplication.WordPress: derived_from: tosca.nodes.WebApplication requirements: - database_endpoint: capability: tosca.capabilities.Endpoint.Database node: tosca.nodes.Database relationship: tosca.relationships.ConnectsTo interfaces: Standard: inputs: wp_db_name: type: string wp_db_user: type: string wp_db_password: type: string ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5063963 tosca_parser-2.15.0/samples/tests/data/datatypes/0000775000175000017500000000000015250006257020625 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7923093 tosca_parser-2.15.0/samples/tests/data/datatypes/custom_datatype_def.yaml0000664000175000017500000000224415250006202025524 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Custom type and node definition used to test custom datatypes. node_types: tosca.nodes.my.SomeNode: derived_from: tosca.nodes.Root properties: people: type: tosca.my.datatypes.People data_types: tosca.my.datatypes.PeopleBase: properties: name: type: string required: true constraints: - min_length: 2 gender: type: string required: false default: unknown tosca.my.datatypes.People: derived_from: tosca.my.datatypes.PeopleBase properties: addresses: type: map required: false entry_schema: type: string contacts: type: list required: false entry_schema: type: tosca.my.datatypes.ContactInfo tosca.my.datatypes.ContactInfo: description: simple contact information properties: contact_name: type: string required: true constraints: - min_length: 2 contact_email: type: string required: false contact_phone: type: string required: false ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7923093 tosca_parser-2.15.0/samples/tests/data/datatypes/test_custom_datatypes_in_current_template.yaml0000664000175000017500000000320215250006202032246 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA templates used to test custom datatypes. node_types: tosca.nodes.my.SomeNode: derived_from: tosca.nodes.Root properties: people: type: tosca.my.datatypes.People data_types: tosca.my.datatypes.PeopleBase: properties: name: type: string required: true constraints: - min_length: 2 gender: type: string required: false default: unknown tosca.my.datatypes.People: derived_from: tosca.my.datatypes.PeopleBase properties: addresses: type: map required: false entry_schema: type: string contacts: type: list required: false entry_schema: type: tosca.my.datatypes.ContactInfo tosca.my.datatypes.ContactInfo: description: simple contact information properties: contact_name: type: string required: true constraints: - min_length: 2 contact_email: type: string required: false contact_phone: type: string required: false topology_template: node_templates: positive: type: tosca.nodes.my.SomeNode properties: people: name: Mike gender: male addresses: {Home: 1 foo street, Office: 9 bar avenue} contacts: - {contact_name: Tom, contact_email: tom@email.com, contact_phone: '123456789'} - {contact_name: Jerry, contact_email: jerry@email.com, contact_phone: '321654987'} ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7923093 tosca_parser-2.15.0/samples/tests/data/datatypes/test_custom_datatypes_nested_datatype_error.yaml0000664000175000017500000000126515250006202032600 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA templates used to test custom datatypes. imports: - custom_datatype_def.yaml topology_template: node_templates: # 123456789 is not a string error in nested datatype: type: tosca.nodes.my.SomeNode properties: people: name: Mike gender: male addresses: {Home: 1 foo street, Office: 9 bar avenue} contacts: - {contact_name: Tom, contact_email: tom@email.com, contact_phone: 123456789} - {contact_name: Jerry, contact_email: jerry@email.com, contact_phone: '321654987'} ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7923093 tosca_parser-2.15.0/samples/tests/data/datatypes/test_custom_datatypes_positive.yaml0000664000175000017500000000120715250006202030050 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA templates used to test custom datatypes. imports: - custom_datatype_def.yaml topology_template: node_templates: positive: type: tosca.nodes.my.SomeNode properties: people: name: Mike gender: male addresses: {Home: 1 foo street, Office: 9 bar avenue} contacts: - {contact_name: Tom, contact_email: tom@email.com, contact_phone: '123456789'} - {contact_name: Jerry, contact_email: jerry@email.com, contact_phone: '321654987'} ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7923093 tosca_parser-2.15.0/samples/tests/data/datatypes/test_custom_datatypes_value_error.yaml0000664000175000017500000000063215250006202030534 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA templates used to test custom datatypes. imports: - custom_datatype_def.yaml topology_template: node_templates: # addresses is not a map error in field value: type: tosca.nodes.my.SomeNode properties: people: name: Mike gender: male addresses: [1 foo street, 9 bar avenue] ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7923093 tosca_parser-2.15.0/samples/tests/data/datatypes/test_datatype_portspec_add_req.yaml0000664000175000017500000000156315250006202027754 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: TOSCA test PortSpec Additional Requirement clauses node_types: MyNodeType: derived_from: Root properties: test_port: type: PortSpec topology_template: node_templates: # Test invalid source value below (default) specified range constraint test_node2: type: MyNodeType properties: test_port: protocol: tcp source: 0 # Test invalid source value over specified range test_node3: type: MyNodeType properties: test_port: protocol: tcp source: 65535 source_range: [ 2, 65534 ] # Test invalid source value under specified range test_node4: type: MyNodeType properties: test_port: protocol: tcp source: 1 source_range: [ 2, 65534 ] ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5073965 tosca_parser-2.15.0/samples/tests/data/dsl_definitions/0000775000175000017500000000000015250006257022004 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7923093 tosca_parser-2.15.0/samples/tests/data/dsl_definitions/test_nested_dsl_def.yaml0000664000175000017500000000076215250006202026664 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Test template demonstrating usage of nested dsl_definitions value. dsl_definitions: caps: &caps host: properties: disk_size: 10 GB num_cpus: 2 mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 topology_template: node_templates: my_server: type: tosca.nodes.Compute capabilities: *caps././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5073965 tosca_parser-2.15.0/samples/tests/data/extensions/0000775000175000017500000000000015250006257021026 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/extensions/tosca_helloworld_nfv.yaml0000664000175000017500000000171715250006202026123 0ustar00zuulzuultosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0 description: Template for deploying a single server with predefined properties. metadata: template_name: TOSCA NFV Sample Template topology_template: node_templates: VNF1: type: tosca.nodes.nfv.VNF properties: id: vnf1 vendor: acmetelco version: 1.0 requirements: - virtualLink: PrivateNetwork VDU1: type: tosca.nodes.nfv.VDU CP1: type: tosca.nodes.nfv.CP properties: type: vPort requirements: - virtualLink: PrivateNetwork - virtualBinding: VDU1 # Added to pass the requirement validation # as the tosca.nodes.nfv.CP inherits from tosca.nodes.Port # This type was removed from the final version of the NFV profile - link: PrivateNetwork - binding: VDU1 PrivateNetwork: type: tosca.nodes.nfv.VL properties: vendor: ACME Networks ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5113971 tosca_parser-2.15.0/samples/tests/data/functions/0000775000175000017500000000000015250006257020637 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/functions/test_capabilties_inheritance.yaml0000664000175000017500000000104115250006202027375 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: TOSCA simple profile to test the attribute inheritance imports: - ../custom_types/node_with_cap.yaml topology_template: node_templates: some_node: type: tosca.nodes.SomeNode requirements: - some_req: node_cap interfaces: Standard: configure: implementation: some_script.sh inputs: some_input: { get_property: [ SELF, some_req, type ] } node_cap: type: tosca.nodes.NodeWithCap ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/functions/test_concat.yaml0000664000175000017500000000161515250006202024022 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Template for deploying a single server with concat function. topology_template: node_templates: server: type: tosca.nodes.Compute capabilities: # Host container properties host: properties: num_cpus: 2 disk_size: 10 GB mem_size: 512 MB # Guest Operating System properties os: properties: # host Operating System image properties architecture: x86_64 type: Linux distribution: RHEL version: 6.5 outputs: url: description: Concatenate the URL for a server from template values. value: { concat: [ 'http://', get_attribute: [ server, public_address ], ':' , get_attribute: [ server, port ] ] }././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/functions/test_concat_invalid.yaml0000664000175000017500000000041415250006202025524 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Template for deploying a single server with invalid concat function. topology_template: outputs: invalid_concat_syntax: description: test concat with invalid syntax. value: { concat: []}././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/functions/test_container_cap_child.yaml0000664000175000017500000000116115250006202026517 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA simple profile to test the get attribute function with HOST parameter using a node that has as capability a child class of Container imports: - ../custom_types/container_cap_child.yaml topology_template: node_templates: test_node: type: tosca.nodes.SomeNode properties: some_prop: { get_attribute: [ HOST, public_address ] } requirements: - host_child: test_node2 test_node2: type: tosca.nodes.SomeNode2 requirements: - host: server server: type: tosca.nodes.Compute ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/functions/test_get_attribute_custom_data_type.yaml0000664000175000017500000000154715250006202031045 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Template for testing get_attribute with a custom data type imports: - ../custom_types/custom_data_type.yaml topology_template: node_templates: some_app: type: tosca.nodes.SomeApp requirements: - host: server server: type: tosca.nodes.Compute capabilities: # Host container properties host: properties: num_cpus: 2 disk_size: 10 GB mem_size: 512 MB # Guest Operating System properties os: properties: # host Operating System image properties architecture: x86_64 type: Linux distribution: RHEL version: 6.5 outputs: url: value: { get_attribute: [ some_app, some_new_att, map_value, tasks, other_map ]} ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/functions/test_get_attribute_host_keyword.yaml0000664000175000017500000000150515250006202030214 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA template for testing get_attribute with HOST keyword. topology_template: node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: num_cpus: 2 dbms: type: tosca.nodes.DBMS requirements: - host: server interfaces: Standard: configure: implementation: configure.sh inputs: ip_address: { get_attribute: [ HOST, private_address ] } database: type: tosca.nodes.Database requirements: - host: dbms interfaces: Standard: configure: implementation: configure.sh inputs: ip_address: { get_attribute: [ HOST, private_address ] } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/functions/test_get_attribute_host_not_found.yaml0000664000175000017500000000073715250006202030531 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA template for testing get_attribute with HOST keyword. topology_template: node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: num_cpus: 2 interfaces: Standard: configure: implementation: configure.sh inputs: ip_address: { get_attribute: [ HOST, private_address ] } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/functions/test_get_attribute_illegal_host_in_outputs.yaml0000664000175000017500000000056515250006202032437 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA template for testing get_attribute with HOST keyword. topology_template: node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: num_cpus: 2 outputs: ip_address: value: { get_attribute: [ HOST, private_address ] } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/functions/test_get_attribute_nested_data_types.yaml0000664000175000017500000000156715250006202031202 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Template for testing get_attribute with a custom data type imports: - ../custom_types/custom_nested_data_types.yaml topology_template: node_templates: some_app: type: tosca.nodes.SomeApp requirements: - host: server server: type: tosca.nodes.Compute capabilities: # Host container properties host: properties: num_cpus: 2 disk_size: 10 GB mem_size: 512 MB # Guest Operating System properties os: properties: # host Operating System image properties architecture: x86_64 type: Linux distribution: RHEL version: 6.5 outputs: url: value: { get_attribute: [ some_app, some_new_att, map_value, tasks, other_map, output ]} ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/functions/test_get_attribute_source_target_keywords.yaml0000664000175000017500000000144615250006202032274 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA template for testing get_attribute with TARGET ans SOURCE keywords. topology_template: node_templates: mysql: type: tosca.nodes.DBMS properties: root_password: rootpw port: 3306 requirements: - host: node: db_server relationship: type: tosca.relationships.HostedOn interfaces: Configure: pre_configure_source: implementation: some_script.sh inputs: target_test: { get_attribute: [ TARGET, public_address ] } source_port: { get_attribute: [ SOURCE, tosca_name ] } db_server: type: tosca.nodes.Compute ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/functions/test_get_attribute_unknown_attribute_name.yaml0000664000175000017500000000114315250006202032253 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Tosca template for testing unknown attribute name in get_attribute function. topology_template: inputs: image_id: type: string node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: num_cpus: 2 interfaces: Standard: configure: implementation: start_server.sh inputs: image_id: { get_input: image_id } outputs: ip_address: value: { get_attribute: [ server, unknown_attribute ] } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/functions/test_get_attribute_unknown_node_template_name.yaml0000664000175000017500000000131515250006202033071 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Tosca template for testing unknown node template name in get_attribute function. topology_template: inputs: image_id: type: string node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: num_cpus: 2 interfaces: Standard: configure: implementation: start_server.sh inputs: image_id: { get_input: image_id } outputs: ip_address: value: { get_attribute: [ unknown_node_template, private_address ] } network: value: { get_attribute: [ unknown_node_template, networks, public ] } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/functions/test_get_attribute_with_index.yaml0000664000175000017500000000074715250006202027644 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA template for testing get_attribute with a list attribute and an index imports: - ../custom_types/compute_with_attribute_list.yaml topology_template: node_templates: server: type: tosca.nodes.ComputeWithAttrList interfaces: Standard: configure: implementation: configure.sh inputs: ip_address: { get_attribute: [ SELF, attr_list, 0 ] } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/functions/test_get_attribute_with_index_error.yaml0000664000175000017500000000074215250006202031050 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA template for testing get_attribute with an incorrect index imports: - ../custom_types/compute_with_attribute_list.yaml topology_template: node_templates: server: type: tosca.nodes.ComputeWithAttrList interfaces: Standard: configure: implementation: configure.sh inputs: ip_address: { get_attribute: [ SELF, private_address, 0 ] } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7933092 tosca_parser-2.15.0/samples/tests/data/functions/test_get_attribute_with_nested_params.yaml0000664000175000017500000000110315250006202031345 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA template for testing get_attribute with nested attributes imports: - ../custom_types/compute_with_nested_atributes.yaml topology_template: node_templates: server: type: tosca.nodes.ComputeWithCapWithAttr capabilities: endpoint: properties: port: 80 interfaces: Standard: configure: implementation: configure.sh inputs: ip_address: { get_attribute: [ SELF, endpoint, credential, 0, token ] } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7943091 tosca_parser-2.15.0/samples/tests/data/functions/test_get_implicit_attribute.yaml0000664000175000017500000000134715250006202027311 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Attribute can be defined explicitly as part of type definition or implicitly via property. This TOSCA template tests validation of attribute name implicitly created as a property and referenced via get_attribute function. node_types: ServerNode: derived_from: SoftwareComponent properties: notification_port: type: integer topology_template: node_templates: my_server: type: ServerNode properties: notification_port: 8000 requirements: - host: my_server_host my_server_host: type: tosca.nodes.Compute outputs: ip_address: value: { get_attribute: [ my_server, notification_port ] }././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7943091 tosca_parser-2.15.0/samples/tests/data/functions/test_get_prop_cap_bool.yaml0000664000175000017500000000142315250006202026225 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: TOSCA test for boolean properties node_types: tosca.nodes.SoftwareComponentTest: derived_from: tosca.nodes.SoftwareComponent properties: some_prop: type: boolean tosca.nodes.ComputeTest: derived_from: tosca.nodes.Compute capabilities: endpoint: type: tosca.capabilities.Endpoint topology_template: node_templates: software: type: tosca.nodes.SoftwareComponentTest properties: some_prop: { get_property: [ HOST, endpoint, secure ] } requirements: - host: server server: type: tosca.nodes.ComputeTest capabilities: endpoint: properties: network_name: PUBLIC secure: false ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7943091 tosca_parser-2.15.0/samples/tests/data/functions/test_get_prop_cap_host.yaml0000664000175000017500000000075315250006202026254 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: TOSCA test for the IM imports: - test: ../custom_types/node_with_cap.yaml topology_template: node_templates: some_node: type: tosca.nodes.SomeNode properties: some_prop: { get_property: [ HOST, some_req, type ] } requirements: - some_req: server server: type: tosca.nodes.NodeWithCap capabilities: some_req: properties: type: someval ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7943091 tosca_parser-2.15.0/samples/tests/data/functions/test_get_property_source_target_keywords.yaml0000664000175000017500000000156215250006202032154 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA template for testing get_property with TARGET ans SOURCE keywords. imports: - ../custom_types/compute_with_prop.yaml topology_template: node_templates: mysql: type: tosca.nodes.DBMS properties: root_password: rootpw port: 3306 requirements: - host: node: db_server relationship: type: tosca.relationships.HostedOn interfaces: Configure: pre_configure_source: implementation: some_script.sh inputs: target_test: { get_property: [ TARGET, test ] } source_port: { get_property: [ SOURCE, port ] } db_server: type: tosca.nodes.ComputeWithProp properties: test: 1 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7943091 tosca_parser-2.15.0/samples/tests/data/functions/test_get_property_with_host.yaml0000664000175000017500000000313015250006202027360 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA simple profile to test the get property function with HOST parameter imports: - ../custom_types/compute_with_prop.yaml topology_template: inputs: db_name: type: string description: The name of the database. default: wordpress db_user: type: string description: The user name of the DB user. default: wp_user db_pwd: type: string description: The WordPress database admin account password. default: wp_pass db_root_pwd: type: string description: Root password for MySQL. db_port: type: PortDef description: Port for the MySQL database. default: 3306 node_templates: mysql_database: type: tosca.nodes.Database properties: name: { get_input: db_name } user: { get_input: db_user } password: { get_input: db_pwd } capabilities: database_endpoint: properties: port: { get_input: db_port } requirements: - host: mysql_dbms interfaces: Standard: configure: implementation: mysql/mysql_database_configure.sh inputs: db_port: { get_property: [ HOST, port ] } test: { get_property: [ HOST, test ] } mysql_dbms: type: tosca.nodes.DBMS properties: root_password: { get_input: db_root_pwd } port: { get_input: db_port } requirements: - host: server server: type: tosca.nodes.ComputeWithProp properties: test: 1 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7943091 tosca_parser-2.15.0/samples/tests/data/functions/test_invalid_function_signature.yaml0000664000175000017500000000153515250006202030170 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA simple profile template to test invalid get_input function. topology_template: inputs: cpus: type: integer description: Number of CPUs for the server. constraints: - valid_values: [ 1, 2, 4, 8 ] node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: # compute properties (flavor) disk_size: 10 GB num_cpus: { get_input: [cpus, cpus] } mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Fedora version: 18.0 outputs: server_address: description: IP address of server instance. value: { get_attribute: [server, private_address] } ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.795309 tosca_parser-2.15.0/samples/tests/data/functions/test_invalid_input.yaml0000664000175000017500000000063715250006202025423 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Template for deploying a single server with invalid input function. topology_template: inputs: cpus: type: integer description: Number of CPUs default: 1 node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: num_cpus: { get_input: non_existent_input } ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.795309 tosca_parser-2.15.0/samples/tests/data/functions/test_token.yaml0000664000175000017500000000062315250006202023671 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Template for deploying a single server with token function. topology_template: node_templates: server: type: tosca.nodes.Compute outputs: url: description: Get the first part of the ip value: { token: [ get_attribute: [ server, public_address ], '.' , 0 ] } ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.795309 tosca_parser-2.15.0/samples/tests/data/functions/test_token_invalid.yaml0000664000175000017500000000111215250006202025371 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Template for deploying a single server with invalid token function. topology_template: outputs: invalid_token_syntax_1: description: test token with only two paremeters. value: { token: ["some_string", "_"]} invalid_token_syntax_2: description: test token with invalid string as third argument. value: { token: ["some_string", "_", "1"]} invalid_token_syntax_3: description: test token with invalid string as second argument. value: { token: ["some_string", "aa", "1"]} ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.795309 tosca_parser-2.15.0/samples/tests/data/functions/test_unknown_capability_property.yaml0000664000175000017500000000160015250006202030411 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Tosca template for testing an unknown capability property. topology_template: node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: num_cpus: 2 dbms: type: tosca.nodes.DBMS properties: root_password: 1234 port: 3672 database: type: tosca.nodes.Database properties: name: my_db user: abcd password: 1234 capabilities: database_endpoint: properties: port: { get_property: [ dbms, port ] } requirements: - host: dbms interfaces: Standard: configure: implementation: database_configure.sh inputs: db_port: { get_property: [ SELF, database_endpoint, unknown ] } ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.795309 tosca_parser-2.15.0/samples/tests/data/functions/test_unknown_input_in_interface.yaml0000664000175000017500000000067615250006202030205 0ustar00zuulzuul tosca_definitions_version: tosca_simple_yaml_1_0 description: > Tosca template for testing an unknown input. topology_template: node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: num_cpus: 2 interfaces: Standard: configure: implementation: start_server.sh inputs: image_id: { get_input: image_id } ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.795309 tosca_parser-2.15.0/samples/tests/data/functions/test_unknown_input_in_property.yaml0000664000175000017500000000050015250006202030113 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Tosca template for testing an unknown input. topology_template: node_templates: obj_store_server: type: tosca.nodes.ObjectStorage properties: name: { get_input: objectstore_name } size: 1024 MB maxsize: 1 GB ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.795309 tosca_parser-2.15.0/samples/tests/data/functions/tosca_nested_property_names_indexes.yaml0000664000175000017500000000231115250006202031027 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: TOSCA simple profile with nested property names or indexes. imports: - ../custom_types/wordpress.yaml - ../custom_types/db_with_list_param.yaml topology_template: node_templates: wordpress: type: tosca.nodes.WebApplication.WordPress requirements: - host: server - database_endpoint: mysql_database interfaces: Standard: configure: implementation: wordpress/wordpress_configure.sh inputs: wp_endpoint_protocol: { get_property: [ SELF, database_endpoint, ports, user_port, protocol ] } wp_list_prop: { get_property: [ mysql_database, list_prop, 2 ] } mysql_database: type: tosca.nodes.DatabaseWithListParam properties: list_prop: [1,2,3] capabilities: database_endpoint: properties: ports: user_port: protocol: tcp target: 50000 source: 9000 requirements: - host: mysql_dbms mysql_dbms: type: tosca.nodes.DBMS requirements: - host: server server: type: tosca.nodes.Compute ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5113971 tosca_parser-2.15.0/samples/tests/data/interfaces/0000775000175000017500000000000015250006257020752 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7963092 tosca_parser-2.15.0/samples/tests/data/interfaces/test_custom_interface_in_template.yaml0000664000175000017500000000131215250006202030573 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA simple profile with valid custom interface and operations. imports: - ../custom_types/custom_interface.yaml topology_template: node_templates: customInterfaceTest: type: tosca.nodes.CustomInterfaceTest interfaces: CustomInterface: CustomOp: # operation from interface_type with additional inputs inputs: param: type: string CustomOp3: # operation from node_type with additional inputs inputs: param3: type: string requirements: - host: my_server my_server: type: tosca.nodes.Compute ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7963092 tosca_parser-2.15.0/samples/tests/data/interfaces/test_custom_interface_invalid_operation.yaml0000664000175000017500000000101315250006202031776 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA simple profile with invalid custom operation. imports: - ../custom_types/custom_interface.yaml topology_template: node_templates: customInterfaceTest: type: tosca.nodes.CustomInterfaceTest interfaces: CustomInterface: CustomOp4: # invalid operation inputs: param3: type: string requirements: - host: compute compute: type: tosca.nodes.Compute././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7973092 tosca_parser-2.15.0/samples/tests/data/interfaces/test_custom_interface_notifications.yaml0000664000175000017500000000151315250006202031146 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_3 description: > This template contains custom defined interface type and a node type which uses this custom interface topology_template: node_templates: customInterfaceTest: type: tosca.nodes.CustomInterfaceTest interfaces: CustomInterface: operations: CustomOp: notifications: CustomNo: requirements: - host: compute compute: type: tosca.nodes.Compute interface_types: tosca.interfaces.CustomInterface: derived_from: tosca.interfaces.Root operations: CustomOp: notifications: CustomNo: node_types: tosca.nodes.CustomInterfaceTest: derived_from: tosca.nodes.WebApplication interfaces: CustomInterface: type: tosca.interfaces.CustomInterface ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7973092 tosca_parser-2.15.0/samples/tests/data/interfaces/test_custom_interface_operations.yaml0000664000175000017500000000151015250006202030455 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_3 description: > This template contains custom defined interface type and a node type which uses this custom interface topology_template: node_templates: customInterfaceTest: type: tosca.nodes.CustomInterfaceTest interfaces: CustomInterface: operations: CustomOp: # operation from interface_type with additional outputs outputs: requirements: - host: compute compute: type: tosca.nodes.Compute interface_types: tosca.interfaces.CustomInterface: derived_from: tosca.interfaces.Root operations: CustomOp: node_types: tosca.nodes.CustomInterfaceTest: derived_from: tosca.nodes.WebApplication interfaces: CustomInterface: type: tosca.interfaces.CustomInterface ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5113971 tosca_parser-2.15.0/samples/tests/data/node_filter/0000775000175000017500000000000015250006257021121 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7973092 tosca_parser-2.15.0/samples/tests/data/node_filter/test_node_filter.yaml0000664000175000017500000000072015250006202025323 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Template with requirements against hosting infrastructure. topology_template: node_templates: test: type: tosca.nodes.DBMS requirements: - host: node_filter: capabilities: - host: properties: - num_cpus: { in_range: [ 1, 4 ] } - mem_size: { greater_or_equal: 2 GB } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5123973 tosca_parser-2.15.0/samples/tests/data/policies/0000775000175000017500000000000015250006257020436 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.798309 tosca_parser-2.15.0/samples/tests/data/policies/custom_definitions.yaml0000664000175000017500000000055715250006202025224 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 policy_types: mycompany.mytypes.myScalingPolicy: derived_from: tosca.policies.Scaling metadata: type: map entry_schema: type: string tosca.policies.Adva.Failure: derived_from: tosca.policies.Root tosca.policies.Adva.Failure.Restart: derived_from: tosca.policies.Adva.Failure ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.798309 tosca_parser-2.15.0/samples/tests/data/policies/tacker_defs.yaml0000664000175000017500000001147215250006202023567 0ustar00zuulzuultosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0 data_types: tosca.datatypes.tacker.ActionMap: properties: trigger: type: string required: true action: type: string required: true params: type: map entry_schema: type: string required: false tosca.datatypes.tacker.MonitoringParams: properties: monitoring_delay: type: int required: false count: type: int required: false interval: type: int required: false timeout: type: int required: false retry: type: int required: false port: type: int required: false tosca.datatypes.tacker.MonitoringType: properties: name: type: string required: true actions: type: map required: true parameters: type: tosca.datatypes.tacker.MonitoringParams required: false tosca.datatypes.compute_properties: properties: num_cpus: type: integer required: false mem_size: type: string required: false disk_size: type: string required: false mem_page_size: type: string required: false numa_node_count: type: integer constraints: - greater_or_equal: 2 required: false numa_nodes: type: map required: false cpu_allocation: type: map required: false policy_types: tosca.policies.tacker.Placement: derived_from: tosca.policies.Root tosca.policies.tacker.Failure: derived_from: tosca.policies.Root action: type: string tosca.policies.tacker.Failure.Respawn: derived_from: tosca.policies.tacker.Failure action: respawn tosca.policies.tacker.Failure.Terminate: derived_from: tosca.policies.tacker.Failure action: log_and_kill tosca.policies.tacker.Failure.Log: derived_from: tosca.policies.tacker.Failure action: log tosca.policies.tacker.Monitoring: derived_from: tosca.policies.Root properties: name: type: string required: true parameters: type: map entry_schema: type: string required: false actions: type: map entry_schema: type: string required: true tosca.policies.tacker.Monitoring.NoOp: derived_from: tosca.policies.tacker.Monitoring properties: name: noop tosca.policies.tacker.Monitoring.Ping: derived_from: tosca.policies.tacker.Monitoring properties: name: ping tosca.policies.tacker.Monitoring.HttpPing: derived_from: tosca.policies.tacker.Monitoring.Ping properties: name: http-ping tosca.policies.tacker.Alarming: derived_from: tosca.policies.Monitoring triggers: resize_compute: event_type: type: map entry_schema: type: string required: true metrics: type: string required: true condition: type: map entry_schema: type: string required: false action: type: map entry_schema: type: string required: true tosca.policies.tacker.Scaling: derived_from: tosca.policies.Scaling description: Defines policy for scaling the given targets. properties: increment: type: integer required: true description: Number of nodes to add or remove during the scale out/in. targets: type: list entry_schema: type: string required: true description: List of Scaling nodes. min_instances: type: integer required: true description: Minimum number of instances to scale in. max_instances: type: integer required: true description: Maximum number of instances to scale out. default_instances: type: integer required: true description: Initial number of instances. cooldown: type: integer required: false default: 120 description: Wait time (in seconds) between consecutive scaling operations. During the cooldown period... tosca.policies.tacker.Reservation: derived_from: tosca.policies.Reservation reservation: start_actions: type: map entry_schema: type: string required: True before_end_actions: type: map entry_schema: type: string required: True end_actions: type: map entry_schema: type: string required: True properties: lease_id: type: string required: True ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.798309 tosca_parser-2.15.0/samples/tests/data/policies/tacker_nfv_defs.yaml0000664000175000017500000001315515250006202024440 0ustar00zuulzuultosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0 data_types: tosca.nfv.datatypes.pathType: properties: forwarder: type: string required: true capability: type: string required: true tosca.nfv.datatypes.aclType: properties: eth_type: type: string required: false eth_src: type: string required: false eth_dst: type: string required: false vlan_id: type: integer constraints: - in_range: [ 1, 4094 ] required: false vlan_pcp: type: integer constraints: - in_range: [ 0, 7 ] required: false mpls_label: type: integer constraints: - in_range: [ 16, 1048575] required: false mpls_tc: type: integer constraints: - in_range: [ 0, 7 ] required: false ip_dscp: type: integer constraints: - in_range: [ 0, 63 ] required: false ip_ecn: type: integer constraints: - in_range: [ 0, 3 ] required: false ip_src_prefix: type: string required: false ip_dst_prefix: type: string required: false ip_proto: type: integer constraints: - in_range: [ 1, 254 ] required: false destination_port_range: type: string required: false source_port_range: type: string required: false network_src_port_id: type: string required: false network_dst_port_id: type: string required: false network_id: type: string required: false network_name: type: string required: false tenant_id: type: string required: false icmpv4_type: type: integer constraints: - in_range: [ 0, 254 ] required: false icmpv4_code: type: integer constraints: - in_range: [ 0, 15 ] required: false arp_op: type: integer constraints: - in_range: [ 1, 25 ] required: false arp_spa: type: string required: false arp_tpa: type: string required: false arp_sha: type: string required: false arp_tha: type: string required: false ipv6_src: type: string required: false ipv6_dst: type: string required: false ipv6_flabel: type: integer constraints: - in_range: [ 0, 1048575] required: false icmpv6_type: type: integer constraints: - in_range: [ 0, 255] required: false icmpv6_code: type: integer constraints: - in_range: [ 0, 7] required: false ipv6_nd_target: type: string required: false ipv6_nd_sll: type: string required: false ipv6_nd_tll: type: string required: false tosca.nfv.datatypes.policyType: properties: type: type: string required: false constraints: - valid_values: [ ACL ] criteria: type: list required: true entry_schema: type: tosca.nfv.datatypes.aclType node_types: tosca.nodes.nfv.VDU.Tacker: derived_from: tosca.nodes.nfv.VDU capabilities: nfv_compute: type: tosca.datatypes.compute_properties properties: name: type: string required: false image: # type: tosca.artifacts.Deployment.Image.VM type: string required: false flavor: type: string required: false availability_zone: type: string required: false metadata: type: map entry_schema: type: string required: false config_drive: type: boolean default: false required: false placement_policy: # type: tosca.policies.tacker.Placement type: string required: false monitoring_policy: # type: tosca.policies.tacker.Monitoring # type: tosca.datatypes.tacker.MonitoringType type: map required: false config: type: string required: false mgmt_driver: type: string default: noop required: false service_type: type: string required: false user_data: type: string required: false user_data_format: type: string required: false key_name: type: string required: false tosca.nodes.nfv.CP.Tacker: derived_from: tosca.nodes.nfv.CP properties: mac_address: type: string required: false name: type: string required: false management: type: boolean required: false anti_spoofing_protection: type: boolean required: false security_groups: type: list required: false type: type: string required: false constraints: - valid_values: [ sriov, vnic ] tosca.nodes.nfv.FP.Tacker: derived_from: tosca.nodes.Root properties: id: type: integer required: false policy: type: tosca.nfv.datatypes.policyType required: true description: policy to use to match traffic for this FP path: type: list required: true entry_schema: type: tosca.nfv.datatypes.pathType ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.798309 tosca_parser-2.15.0/samples/tests/data/policies/test_policies_without_required_property.yaml0000664000175000017500000000464515250006202031616 0ustar00zuulzuultosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0 description: sample-tosca-vnfd-scaling imports: - tacker_defs.yaml - tacker_nfv_defs.yaml metadata: template_name: sample-tosca-vnfd-scaling topology_template: node_templates: VDU1: type: tosca.nodes.nfv.VDU.Tacker properties: image: cirros-0.3.4-x86_64-uec mgmt_driver: noop availability_zone: nova flavor: m1.tiny CP1: type: tosca.nodes.nfv.CP.Tacker properties: management: true order: 0 anti_spoofing_protection: false requirements: - virtualLink: node: VL1 - virtualBinding: node: VDU1 VDU2: type: tosca.nodes.nfv.VDU.Tacker properties: image: cirros-0.3.4-x86_64-uec mgmt_driver: noop availability_zone: nova flavor: m1.tiny CP2: type: tosca.nodes.nfv.CP.Tacker properties: management: true order: 0 anti_spoofing_protection: false requirements: - virtualLink: node: VL1 - virtualBinding: node: VDU2 VL1: type: tosca.nodes.nfv.VL properties: network_name: net_mgmt vendor: Tacker policies: - SP1: type: tosca.policies.tacker.Scaling targets: [VDU1] properties: increment: 1 cooldown: 120 min_instances: 1 max_instances: 2 default_instances: 1 targets: [VDU1] - SP2: type: tosca.policies.tacker.Scaling targets: [VDU2] properties: #increment: 1 cooldown: 120 min_instances: 1 max_instances: 2 default_instances: 1 targets: [VDU2] - ALRM1: type: tosca.policies.tacker.Monitoring triggers: resize_compute: event_type: type: tosca.events.resource.utilization implementation: ceilometer condition: constraint: 50 granularity: 600 evaluations: 1 aggregation_method: mean resource_type: instance action: resize_compute: action_name: SP1 properties: name: alrm1 actions: resize_compute: "action_name: SP1" ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7993093 tosca_parser-2.15.0/samples/tests/data/policies/test_tosca_nfv_multiple_policies.yaml0000664000175000017500000000557315250006202030145 0ustar00zuulzuultosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0 description: sample-tosca-vnfd-scaling imports: - tacker_defs.yaml - tacker_nfv_defs.yaml metadata: template_name: sample-tosca-vnfd-scaling topology_template: node_templates: VDU1: type: tosca.nodes.nfv.VDU.Tacker properties: image: cirros-0.3.4-x86_64-uec mgmt_driver: noop availability_zone: nova flavor: m1.tiny CP1: type: tosca.nodes.nfv.CP.Tacker properties: management: true order: 0 anti_spoofing_protection: false requirements: - virtualLink: node: VL1 - virtualBinding: node: VDU1 # Added to pass the requirement validation # as the tosca.nodes.nfv.CP inherits from tosca.nodes.Port # This type was removed from the final version of the NFV profile - link: VL1 - binding: VDU1 VDU2: type: tosca.nodes.nfv.VDU.Tacker properties: image: cirros-0.3.4-x86_64-uec mgmt_driver: noop availability_zone: nova flavor: m1.tiny CP2: type: tosca.nodes.nfv.CP.Tacker properties: management: true order: 0 anti_spoofing_protection: false requirements: - virtualLink: node: VL1 - virtualBinding: node: VDU2 # Added to pass the requirement validation # as the tosca.nodes.nfv.CP inherits from tosca.nodes.Port # This type was removed from the final version of the NFV profile - link: VL1 - binding: VDU2 VL1: type: tosca.nodes.nfv.VL properties: network_name: net_mgmt vendor: Tacker policies: - SP1: type: tosca.policies.tacker.Scaling targets: [VDU1] properties: increment: 1 cooldown: 120 min_instances: 1 max_instances: 2 default_instances: 1 targets: [VDU1] - SP2: type: tosca.policies.tacker.Scaling targets: [VDU2] properties: increment: 1 cooldown: 120 min_instances: 1 max_instances: 2 default_instances: 1 targets: [VDU2] - ALRM1: type: tosca.policies.tacker.Monitoring triggers: resize_compute: event_type: type: tosca.events.resource.utilization implementation: ceilometer condition: constraint: 50 granularity: 600 evaluations: 1 aggregation_method: mean resource_type: instance action: resize_compute: action_name: SP1 properties: name: alrm1 actions: resize_compute: "action_name: SP1" ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7993093 tosca_parser-2.15.0/samples/tests/data/policies/tosca_custom_policy_template.yaml0000664000175000017500000000221315250006202027263 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Template for deploying servers based on policies. imports: - custom_definitions.yaml topology_template: node_templates: my_server_1: type: tosca.nodes.Compute capabilities: # Host container properties host: properties: num_cpus: 2 disk_size: 10 GB mem_size: 512 MB # Guest Operating System properties os: properties: # host Operating System image properties architecture: x86_64 type: Linux distribution: RHEL version: 6.5 my_server_2: type: tosca.nodes.Compute capabilities: host: properties: disk_size: 10 GB num_cpus: 2 mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 policies: - My_failure_policy_restart: type: tosca.policies.Adva.Failure.Restart description: respawn the VDU targets: [my_server_1] ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7993093 tosca_parser-2.15.0/samples/tests/data/policies/tosca_policy_template.yaml0000664000175000017500000000626315250006202025702 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Template for deploying servers based on policies. imports: - custom_definitions.yaml topology_template: node_templates: my_server_1: type: tosca.nodes.Compute capabilities: # Host container properties host: properties: num_cpus: 2 disk_size: 10 GB mem_size: 512 MB # Guest Operating System properties os: properties: # host Operating System image properties architecture: x86_64 type: Linux distribution: RHEL version: 6.5 my_server_2: type: tosca.nodes.Compute capabilities: host: properties: disk_size: 10 GB num_cpus: 2 mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 groups: webserver_group: members: [ my_server_1, my_server_2 ] type: tosca.groups.Root metadata: { user1: 1008, user2: 1002 } policies: - my_compute_placement_policy: type: tosca.policies.Placement description: Apply placement policy to servers metadata: { user1: 1001, user2: 1002 } targets: [ my_server_1, my_server_2 ] triggers: resize_compute: description: trigger event_type: tosca.events.resource.utilization schedule: start_time: "2015-05-07T07:00:00Z" end_time: "2015-06-07T07:00:00Z" target_filter: node: master-container requirement: host capability: Container condition: constraint: { greater_than: 50 } granularity: 60 evaluations: 1 aggregation_method: mean resource_type: instance action: resize: # Operation name inputs: strategy: LEAST_USED implementation: Senlin.webhook() high_cpu_usage: description: trigger metric: cpu_util condition: constraint: utilization greater_than 60% threshold: 60 granularity: 600 evaluations: 1 aggregation_method: mean resource_type: instance comparison_operator: gt metadata: SG1 action: [SP1] low_cpu_usage: description: trigger metric: cpu_util condition: constraint: utilization less_than 20% threshold: 20 granularity: 600 evaluations: 1 aggregation_method: mean resource_type: instance comparison_operator: gt metadata: SG1 action: [SP1] - my_groups_placement: type: mycompany.mytypes.myScalingPolicy targets: [ webserver_group ] description: my company scaling policy metadata: user1: 1001 user2: 1003 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5133975 tosca_parser-2.15.0/samples/tests/data/relationship/0000775000175000017500000000000015250006257021330 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7993093 tosca_parser-2.15.0/samples/tests/data/relationship/test_custom_relationship.yaml0000664000175000017500000000243015250006202027333 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Test template for deploying a single server with predefined properties and custom relationship types imports: - ../custom_types/custom_relationship_type_defs.yaml topology_template: node_templates: server1: type: tosca.nodes.HACompute capabilities: # Host container properties host: properties: num_cpus: 2 disk_size: 10 GB mem_size: 512 MB # Guest Operating System properties os: properties: # host Operating System image properties architecture: x86_64 type: Linux distribution: RHEL version: 6.5 requirements: - high_availability: server2 server2: type: tosca.nodes.HACompute capabilities: # Host container properties host: properties: num_cpus: 2 disk_size: 10 GB mem_size: 512 MB # Guest Operating System properties os: properties: # host Operating System image properties architecture: x86_64 type: Linux distribution: RHEL version: 6.5 requirements: - high_availability: server1 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7993093 tosca_parser-2.15.0/samples/tests/data/relationship/test_custom_relationship_key_schema.yaml0000664000175000017500000000101515250006202031521 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_3 description: > This template contains custom defined interface type and a node type which uses this custom interface topology_template: relationship_templates: customRelationshipTest: type: tosca.nodes.CustomRelationshipTest properties: property_test: 'test_key': 'test_value' relationship_types: tosca.nodes.CustomRelationshipTest: properties: property_test: type: map key_schema: type: string ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5133975 tosca_parser-2.15.0/samples/tests/data/repositories/0000775000175000017500000000000015250006257021356 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7993093 tosca_parser-2.15.0/samples/tests/data/repositories/test_repositories_definition.yaml0000664000175000017500000000101015250006202030216 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 repositories: some_repository: description: Some repo url: https://example.com/custom_types/ credential: #type: Credential token_type: basic_auth token: myusername:mypassword imports: - some_import: file: compute_with_prop.yaml repository: some_repository description: > TOSCA test for testing repositories definition node_templates: server: type: tosca.nodes.ComputeWithProp properties: test: yes ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7993093 tosca_parser-2.15.0/samples/tests/data/repositories/tosca_repositories_test_definition.yaml0000664000175000017500000000155715250006202031427 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: TOSCA simple profile with repositories validation and imports. repositories: repo_code0: https://raw.githubusercontent.com/nandinivemula/intern repo_code1: description: My project's code Repository in github usercontent. url: https://raw.githubusercontent.com/nandinivemula/intern/master credential: #type: Credential token_type: basic_auth token: myusername:mypassword repo_code2: description: My Project's code Repository in github. url: https://github.com/nandinivemula/intern/master credential: #type: Credential token_type: basic_auth token: myusername:mypassword imports: - sample_import: file: tosca_repository_import.yaml repository: repo_code1 namespace_uri: https://github.com/nandinivemula/intern namespace_prefix: intern ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5133975 tosca_parser-2.15.0/samples/tests/data/requirements/0000775000175000017500000000000015250006257021352 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7993093 tosca_parser-2.15.0/samples/tests/data/requirements/test_requirements.yaml0000664000175000017500000000407215250006202026011 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Test Requirements. imports: - ../custom_types/wordpress.yaml topology_template: node_templates: my_app: description: > Specify multiple requirement via node and relationship keyword, as an explicit relationship. Also demonstrates relationship with type keyword and without it as an in-line reference. type: tosca.nodes.WebApplication.WordPress requirements: - req1: node: my_webserver relationship: tosca.relationships.HostedOn - req2: node: mysql_database relationship: type: tosca.relationships.ConnectsTo - host: my_webserver - database_endpoint: mysql_database mysql_database: description: Specify requirement via a capability as an implicit relationship. type: tosca.nodes.Database requirements: - host: node: my_dbms relationship: tosca.relationships.HostedOn my_dbms: type: tosca.nodes.DBMS requirements: - host: node: my_server my_webserver: type: tosca.nodes.WebServer requirements: - host: node: my_server my_server: description: > Specify requirement via a relationship template, as an explicit relationship. type: tosca.nodes.Compute capabilities: host: properties: num_cpus: 2 disk_size: 10 GB mem_size: 4 MB os: properties: # host Operating System image properties architecture: x86_64 type: linux distribution: rhel version: 6.5 requirements: - req1: node: my_storage relationship: storage_attachment my_storage: type: tosca.nodes.BlockStorage properties: size: 1 GiB snapshot_id: id relationship_templates: storage_attachment: type: tosca.relationships.AttachesTo properties: location: /temp ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7993093 tosca_parser-2.15.0/samples/tests/data/test_attributes_inheritance.yaml0000664000175000017500000000104115250006202025273 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: TOSCA simple profile to test the attribute inheritance imports: - custom_types/compute_with_prop.yaml topology_template: node_templates: server: type: tosca.nodes.ComputeWithProp properties: test: yes capabilities: host: properties: num_cpus: 1 mem_size: 1 GB os: properties: type: linux outputs: server_ip: value: { get_attribute: [ server, public_address ] } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.7993093 tosca_parser-2.15.0/samples/tests/data/test_available_rel_tpls.yaml0000664000175000017500000000060615250006202024366 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: TOSCA test for bug 1527214 topology_template: node_templates: test_db: type: tosca.nodes.Database requirements: - host: node: mysql mysql: type: tosca.nodes.DBMS requirements: - host: node: db_server db_server: type: tosca.nodes.Compute ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8003092 tosca_parser-2.15.0/samples/tests/data/test_capability_without_properties.yaml0000664000175000017500000000211615250006202026720 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Test resources for which properties are not defined in the parent of capabilitytype. TestApp has capabilities->test_cap, and the type of test_cap is TestCapabilityAA. The parents of TestCapabilityAA is TestCapabilityA, and TestCapabilityA has no properties. node_types: tosca.nodes.WebApplication.TestApp: derived_from: tosca.nodes.WebApplication capabilities: test_cap: type: tosca.capabilities.TestCapabilityAA # Node whose parent is Root and does not have properties tosca.capabilities.TestCapabilityA: derived_from: tosca.capabilities.Root tosca.capabilities.TestCapabilityAA: derived_from: tosca.capabilities.TestCapabilityA properties: test: type: integer required: false topology_template: node_templates: test_app: type: tosca.nodes.WebApplication.TestApp capabilities: test_cap: properties: test: 1 requirements: - host: test_server test_server: type: tosca.nodes.Compute ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8003092 tosca_parser-2.15.0/samples/tests/data/test_credential_datatype.yaml0000664000175000017500000000333715250006202024553 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA simple profile with to demonstrate the usage of the TOSCA Credential Data Type. imports: - custom_types/wordpress.yaml relationship_types: my.types.WordpressDbConnection: derived_from: tosca.relationships.ConnectsTo properties: credential: user: db_user token: db_pwd topology_template: node_templates: wordpress: type: tosca.nodes.WebApplication.WordPress requirements: - host: webserver - database_endpoint: node: mysql_database relationship: my.types.WordpressDbConnection mysql_database: type: tosca.nodes.Database properties: name: db_name user: db_user password: db_pwd capabilities: database_endpoint: properties: port: 3306 requirements: - host: node: mysql_dbms mysql_dbms: type: tosca.nodes.DBMS properties: root_password: db_root_pwd port: 3306 requirements: - host: server webserver: type: tosca.nodes.WebServer properties: admin_credential: user: username token: some_pass requirements: - host: server server: type: tosca.nodes.Compute capabilities: host: properties: disk_size: 10 GB num_cpus: 1 mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 outputs: website_url: description: URL for Wordpress wiki. value: { get_attribute: [server, private_address] } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8003092 tosca_parser-2.15.0/samples/tests/data/test_custom_capabilty.yaml0000664000175000017500000000066515250006202024111 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: TOSCA simple profile to test a custom defined capability imports: - custom_types/custom_cap.yaml topology_template: node_templates: node_req: type: tosca.nodes.NodeWithReq requirements: - host: node_cap node_cap: type: tosca.nodes.NodeWithCap requirements: - host: server server: type: tosca.nodes.Compute ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8003092 tosca_parser-2.15.0/samples/tests/data/test_custom_caps_def.yaml0000664000175000017500000000037515250006202023703 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: TOSCA simple profile to test a custom defined capability imports: - custom_types/custom_caps_def.yaml topology_template: node_templates: server: type: tosca.nodes.SomeNode ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8003092 tosca_parser-2.15.0/samples/tests/data/test_custom_caps_with_datatype.yaml0000664000175000017500000000062715250006202026013 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: TOSCA simple profile to test a custom defined capability with custom datatype imports: - custom_types/custom_cap_with_datatype.yaml topology_template: node_templates: TestNode: type: tosca.nodes.SomeNode capabilities: cap1: properties: data: name: test value: 1 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8003092 tosca_parser-2.15.0/samples/tests/data/test_endpoint_on_compute.yaml0000664000175000017500000000075615250006202024620 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 topology_template: node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: disk_size: 10 GB num_cpus: 1 mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 endpoint: properties: network_name: PUBLIC ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8003092 tosca_parser-2.15.0/samples/tests/data/test_import_invalid_template_version.yaml0000664000175000017500000000042515250006202027221 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 imports: - invalid: custom_types/invalid_template_version.yaml description: > Test to import a template with an invalid template version. topology_template: node_templates: test: type: tosca.nodes.SomeNode ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.801309 tosca_parser-2.15.0/samples/tests/data/test_import_metadata.yml0000664000175000017500000000052515250006202023553 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 imports: - invalid: custom_types/template_metadata.yaml description: > Test to import a template with metadata topology_template: node_templates: test: type: tosca.nodes.SomeNode requirements: - host: my_server my_server: type: tosca.nodes.Compute ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.801309 tosca_parser-2.15.0/samples/tests/data/test_import_tosca_version_1_3.yaml0000664000175000017500000000054715250006202025460 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_3 imports: - custom_types/template_version_1_3.yaml description: > Test to import a template with an template version1.3. topology_template: node_templates: test: type: tosca.nodes.SomeNode requirements: - host: test_server test_server: type: tosca.nodes.Compute././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.801309 tosca_parser-2.15.0/samples/tests/data/test_instance_nested_imports.yaml0000664000175000017500000000240215250006202025461 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA simple profile with wordpress, web server and mysql on the same server. imports: - wordpress: custom_types/nested_test_wordpress.yaml - custom_types/nested_test_kibana.yaml topology_template: node_templates: wordpress: type: tosca.nodes.WebApplication.WordPress requirements: - host: server - database_endpoint: wordpress_db testrsyslogtype: type: tosca.nodes.SoftwareComponent.Rsyslog.TestRsyslogType requirements: - log_endpoint: logstash - host: server rsyslog: type: Test2ndRsyslogType requirements: - log_endpoint: logstash - host: server logstash: type: tosca.nodes.SoftwareComponent.Logstash requirements: - search_endpoint: elasticsearch - host: server kibana: type: tosca.nodes.SoftwareComponent.Kibana requirements: - search_endpoint: elasticsearch - host: server elasticsearch: type: tosca.nodes.SoftwareComponent.Elasticsearch requirements: - host: server server: type: tosca.nodes.Compute wordpress_db: type: tosca.nodes.Database requirements: - host: server././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.801309 tosca_parser-2.15.0/samples/tests/data/test_invalid_input_defaults.yaml0000664000175000017500000000041015250006202025267 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Test template with default not matching required type. topology_template: inputs: invalid_default: type: integer default: two valid_default: type: integer default: 2 ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.801309 tosca_parser-2.15.0/samples/tests/data/test_invalid_section_names.yaml0000664000175000017500000000101215250006202025067 0ustar00zuulzuultosca_definitions_versions: tosca_simple_yaml_1_0 descriptions: > TOSCA profile with invalid top-level section names. import: - imported.yaml topology_templates: node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: disk_size: 10 GB num_cpus: 1 mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.801309 tosca_parser-2.15.0/samples/tests/data/test_invalid_template_version.yaml0000664000175000017500000000041415250006202025625 0ustar00zuulzuultosca_definitions_version: tosca_xyz description: > Test template with an invalid template version. topology_template: node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: num_cpus: 2 ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.801309 tosca_parser-2.15.0/samples/tests/data/test_long_rel.yaml0000664000175000017500000000120715250006202022341 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: TOSCA simple profile to test a relatinship in log format node_types: tosca.nodes.SomeSoftwareComponent: derived_from: tosca.nodes.SoftwareComponent properties: test: type: string topology_template: node_templates: some: type: tosca.nodes.SomeSoftwareComponent properties: test: { get_attribute: [ HOST, private_address ] } requirements: - host: node: server capability: tosca.capabilities.Container relationship: tosca.relationships.HostedOn server: type: tosca.nodes.Compute ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.801309 tosca_parser-2.15.0/samples/tests/data/test_multiple_validation_errors.yaml0000664000175000017500000000714015250006202026203 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1 description: > TOSCA simple profile with wordpress, web server and mysql on the same server. imports: - custom_types/not_there.yaml topology_template: inputs: cpus: type: integer description: Number of CPUs for the server. constraints: - valid_values: [ 1, 2, 4, 8 ] default: 1 db_name: type: string description: The name of the database. default: wordpress db_user: type: string description: The user name of the DB user. default: wp_user db_pwd: type: string description: The WordPress database admin account password. default: wp_pass db_root_pwd: type: string description: Root password for MySQL. db_port: type: PortDef description: Port for the MySQL database. default: 3306 node_templates: xyz: type: tosca.nodes.XYZ wordpress: type: tosca.nodes.WebApplication.WordPress requirement: - host: webserver - database_endpoint: mysql_database interfaces: Standard: create: wordpress/wordpress_install.sh configure: implementation: wordpress/wordpress_configure.sh inputs: wp_db_name: { get_property: [ mysql_database, name ] } wp_db_user: { get_property: [ mysql_database, user ] } wp_db_password: { get_property: [ mysql_database, password ] } mysql_database: type: tosca.nodes.Database properties: name: { get_input: db_name } user: { get_input: db_user } password: { get_input: db_pwd } capabilities: database_endpoint: properties: port: { get_input: db_port } requirements: - host: mysql_dbms interfaces: Standard: configure: implementation: mysql/mysql_database_configure.sh inputs: db_name: { get_property: [ SELF, name ] } db_user: { get_property: [ SELF, user ] } db_password: { get_property: [ SELF, passwords ] } db_root_password: { get_property: [ mysql_dbms, root_password ] } mysql_dbms: type1: tosca.nodes.DBMS properties: root_password: { get_input: db_root_pwd } port: { get_input: db_port } requirements: - host: server interfaces: Standard: create: implementation: mysql/mysql_dbms_install.sh inputs: db_root_password: { get_property: [ mysql_dbms, root_password ] } start: mysql/mysql_dbms_start.sh configure: implementation: mysql/mysql_dbms_configure.sh inputs: db_port: { get_property: [ mysql_dbms, port ] } webserver: type: tosca.nodes.WebServer requirements: - host: server1 - database_endpoint: node: webserver relationship: type1: tosca.relationships.ConnectsTo interfaces: Standard: create: webserver/webserver_install.sh start: webserver/webserver_start.sh server: type: tosca.nodes.Compute capabilities: host: properties: disk_size: 10 GB num_cpus: { get_input: cpus } mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 outputs: website_url: description: URL for Wordpress wiki. value: { get_attribute: [server, private_address] } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8023093 tosca_parser-2.15.0/samples/tests/data/test_no_inputs_in_template.yaml0000664000175000017500000000047115250006202025141 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Tosca template for testing a template with no inputs. metadata: test topology_template: node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: num_cpus: 2 outputs: ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8023093 tosca_parser-2.15.0/samples/tests/data/test_no_outputs_in_template.yaml0000664000175000017500000000045715250006202025346 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Tosca template for testing a template with no outputs. topology_template: inputs: node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: num_cpus: 2 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8023093 tosca_parser-2.15.0/samples/tests/data/test_nodetype_without_relationship.yaml0000664000175000017500000000123115250006202026730 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Test NodeType which requirements has no relationship. node_types: sample.SC: derived_from: tosca.nodes.SoftwareComponent requirements: - custom_host: capability: tosca.capabilities.Attachment node: tosca.nodes.Compute topology_template: node_templates: SampleSC1: type: sample.SC requirements: - custom_host: Compute1 - host: Compute1 Compute1: type: tosca.nodes.Compute SC2: type: tosca.nodes.SoftwareComponent requirements: - host: Compute2 Compute2: type: tosca.nodes.Compute ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8023093 tosca_parser-2.15.0/samples/tests/data/test_normative_type_properties_override.yaml0000664000175000017500000000205615250006202027763 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Test template for deploying a server with custom properties for image, flavor and key_name. This template provides an example of how to override TOSCA normative type's (e.g. Compute) properties. Here new properties are injected in the tosca.nodes.myserver which derives from tosca.nodes.Compute. Note that tosca.nodes.myserver can not be a name of another normative type (e.g. tosca.nodes.WebServer or tosca.nodes.nfv.VDU) because that will create conflict while resolving type definition by the TOSCA Parser. node_types: tosca.nodes.myserver: derived_from: tosca.nodes.Compute properties: key_name: type: string image: type: string flavor: type: string topology_template: inputs: key_name: type: string default: inputkey node_templates: my_server: type: tosca.nodes.myserver properties: flavor: m1.medium image: rhel-6.5-test-image key_name: get_input: key_name ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8023093 tosca_parser-2.15.0/samples/tests/data/test_scalar_unit_without_unit.yaml0000664000175000017500000000024215250006202025664 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 topology_template: node_templates: my_block_storage: type: BlockStorage properties: size: 10 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8033092 tosca_parser-2.15.0/samples/tests/data/test_template_without_requirement.yaml0000664000175000017500000000027515250006202026562 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Webserver without host requirement topology_template: node_templates: webserver: type: tosca.nodes.WebServer ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8033092 tosca_parser-2.15.0/samples/tests/data/test_tosca_custom_rel.yaml0000664000175000017500000000116515250006202024110 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 topology_template: node_templates: my_block_storage: type: BlockStorage properties: size: 10 MB some_compute: type: Compute requirements: - local_storage: node: my_block_storage relationship: type: MyAttachesTo properties: location: /some_other_data_location relationship_types: MyAttachesTo: derived_from: AttachesTo properties: location: /default_location interfaces: Configure: post_configure_target: implementation: default_script.sh ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8033092 tosca_parser-2.15.0/samples/tests/data/test_tosca_custom_rel_with_script.yaml0000664000175000017500000000102015250006202026515 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Test template of a custom relationship with a configure script topology_template: node_templates: apache: type: tosca.nodes.WebServer requirements: - host: node: web_server relationship: my_custom_rel web_server: type: tosca.nodes.Compute relationship_templates: my_custom_rel: type: HostedOn interfaces: Configure: pre_configure_source: scripts/wp_db_configure.sh ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8033092 tosca_parser-2.15.0/samples/tests/data/test_tosca_normative_type_by_shortname.yaml0000664000175000017500000000144515250006202027554 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA simple profile with short type name for Compute. topology_template: inputs: cpus: type: integer description: Number of CPUs for the server. constraints: - valid_values: [ 1, 2, 4, 8 ] default: 2 node_templates: server: type: Compute capabilities: host: properties: disk_size: 10 GB num_cpus: { get_input: cpus } mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Fedora version: 18.0 outputs: server_address: description: IP address of server instance. value: { get_attribute: [server, private_address] } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8033092 tosca_parser-2.15.0/samples/tests/data/test_tosca_top_level_error1.yaml0000664000175000017500000000007615250006202025217 0ustar00zuulzuuldescription: > TOSCA simple profile missing version section.././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8033092 tosca_parser-2.15.0/samples/tests/data/test_tosca_top_level_error2.yaml0000664000175000017500000000033015250006202025211 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA simple profile with invalid top-level key: 'node_template'. topology_template: node_template: server: type: tosca.nodes.Compute ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8033092 tosca_parser-2.15.0/samples/tests/data/test_tosca_version_1_3.yaml0000664000175000017500000000043115250006202024056 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_3 description: > Test template with an valid template version 1.3. topology_template: node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: num_cpus: 2 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5143976 tosca_parser-2.15.0/samples/tests/data/topology_template/0000775000175000017500000000000015250006257022376 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8033092 tosca_parser-2.15.0/samples/tests/data/topology_template/databasesubsystem.yaml0000664000175000017500000000354515250006202027002 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Database subsystem, which is service template with topology_template, act as a nested system inside another system and also act as stand alone service template. imports: - definitions.yaml topology_template: description: Template of a database including its hosting stack. inputs: user: type: string description: the user name of database. default: test port: type: integer description: the port of database. default: 3306 name: type: string description: the name of database. default: test my_cpus: type: integer description: Number of CPUs for the server. default: 2 constraints: - valid_values: [ 1, 2, 4, 8 ] substitution_mappings: node_type: example.DatabaseSubsystem capabilities: database_endpoint: [ db_app, database_endpoint ] node_templates: db_app: type: tosca.nodes.Database properties: user: { get_input: user } port: { get_input: port } name: { get_input: name } capabilities: database_endpoint: properties: port: 1234 requirements: - host: node: dbms dbms: type: tosca.nodes.DBMS properties: port: 3306 root_password: 123456789 requirements: - host: node: server server: type: tosca.nodes.Compute capabilities: host: properties: disk_size: 10 GB num_cpus: { get_input: my_cpus } mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 groups: dbserver_group: members: [ dbms, server ] type: tosca.groups.Root ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8033092 tosca_parser-2.15.0/samples/tests/data/topology_template/definitions.yaml0000664000175000017500000000364415250006202025572 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 node_types: example.QueuingSubsystem: derived_from: tosca.nodes.SoftwareComponent properties: server_ip: type: string server_port: type: integer attributes: server_ip: type: string server_port: type: integer requirements: - receiver1: node: example.TransactionSubsystem capability: example.capabilities.Receiver relationship: tosca.relationships.ConnectsTo - receiver2: node: example.TransactionSubsystem capability: example.capabilities.Receiver relationship: tosca.relationships.ConnectsTo example.TransactionSubsystem: properties: mq_server_ip: type: string required: False receiver_port: type: integer required: False attributes: receiver_ip: type: string receiver_port: type: integer capabilities: message_receiver: type: example.capabilities.Receiver requirements: - database_endpoint: node: tosca.nodes.Database capability: tosca.capabilities.Endpoint.Database relationship: tosca.relationships.ConnectsTo example.DatabaseSubsystem: derived_from: tosca.nodes.Database example.SomeApp: derived_from: tosca.nodes.WebApplication properties: admin_user: type: string required: False pool_size: type: integer required: False capabilities: message_receiver: type: example.capabilities.Receiver requirements: - database: node: tosca.nodes.Database capability: tosca.capabilities.Endpoint.Database relationship: tosca.relationships.ConnectsTo capability_types: example.capabilities.Receiver: derived_from: tosca.capabilities.Endpoint properties: server_ip: type: string ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8033092 tosca_parser-2.15.0/samples/tests/data/topology_template/definitions_1_2.yaml0000664000175000017500000000352215250006202026226 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_2 policy_types: tosca.policies.nfv.InstantiationLevels: derived_from: tosca.policies.Root description: The InstantiationLevels properties: levels: type: map description: Describes the various levels of resources. required: true entry_schema: type: tosca.datatypes.nfv.InstantiationLevel constraints: - min_length: 1 default_level: type: string description: The default instantiation level for this flavour. required: false tosca.policies.nfv.VduInstantiationLevels: derived_from: tosca.policies.Root description: The VduInstantiationLevels properties: levels: type: map description: Describes the Vdu.Compute required: true entry_schema: type: tosca.datatypes.nfv.VduLevel constraints: - min_length: 1 targets: [ tosca.nodes.nfv.Vdu.Compute ] node_types: tosca.nodes.nfv.Vdu.Compute: derived_from: tosca.nodes.Root description: '' properties: name: type: string required: true description: type: string required: false monitoring_parameters: type: list description: '' required: false entry_schema: type: tosca.datatypes.nfv.VnfcMonitoringParameter sw_image_data: type: tosca.datatypes.nfv.SwImageData required: false tosca.datatypes.nfv.SwImageData: derived_from: tosca.datatypes.Root description: describes information related to a software image artifact properties: # in SOL001 v0.8.0: "properties or metadata:" name: type: string description: Name of this software image required: true ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8033092 tosca_parser-2.15.0/samples/tests/data/topology_template/queuingsubsystem.yaml0000664000175000017500000000365615250006202026716 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Queue subsystem, which is service template with topology_template, act as a nested system inside another system and also act as stand alone service template. imports: - definitions.yaml topology_template: description: Template of a database including its hosting stack. inputs: server_ip: type: string description: IP address of the message queuing server to receive messages from. default: 127.0.0.1 server_port: type: integer description: Port to be used for receiving messages. default: 8080 my_cpus: type: integer description: Number of CPUs for the server. default: 2 constraints: - valid_values: [ 1, 2, 4, 8 ] substitution_mappings: node_type: example.QueuingSubsystem # capabilities: # message_receiver: [ app, message_receiver ] requirements: receiver1: [ tran_app, receiver1 ] receiver2: [ tran_app, receiver2 ] node_templates: tran_app: type: example.QueuingSubsystem properties: server_ip: { get_input: server_ip } server_port: { get_input: server_port } requirements: - host: node: server server: type: tosca.nodes.Compute capabilities: host: properties: disk_size: 10 GB num_cpus: { get_input: my_cpus } mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 outputs: server_ip: description: server_ip of the message receiver application value: { get_input: server_ip } server_port: description: server_port of the message receiver application value: { get_input: server_port } groups: tran_server_group: members: [ tran_app, server ] type: tosca.groups.Root ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8043091 tosca_parser-2.15.0/samples/tests/data/topology_template/system.yaml0000664000175000017500000000371615250006202024603 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 imports: - queuingsubsystem.yaml - transactionsubsystem.yaml - databasesubsystem.yaml topology_template: description: Template of online transaction processing service. inputs: mq_server_ip: type: string default: 127.0.0.1 description: IP address of the message queuing server to receive messages from. mq_server_port: type: integer default: 8080 description: Port to be used for receiving messages. node_templates: mq: type: example.QueuingSubsystem properties: server_ip: { get_input: mq_server_ip } server_port: { get_input: mq_server_port } # capabilities: # message_queue_endpoint: # to be updated when substitution_mapping is validated later requirements: - receiver1: trans1 - receiver2: trans2 - host: server trans1: type: example.TransactionSubsystem properties: mq_server_ip: { get_attribute: [ mq, server_ip ] } receiver_port: { get_attribute: [ mq, server_port ] } # capabilities: # message_receiver: # to be updated when substitution_mapping is validated later requirements: - database_endpoint: dbsys trans2: type: example.TransactionSubsystem properties: mq_server_ip: { get_attribute: [ mq, server_ip ] } receiver_port: { get_attribute: [ mq, server_port ] } # capabilities: # message_receiver: # to be updated when substitution_mapping is validated later requirements: - database_endpoint: dbsys dbsys: type: example.DatabaseSubsystem # properties: # to be updated when substitution_mapping is validated later # capabilities: # database_endpoint: # to be updated when substitution_mapping is validated later requirements: - host: server server: type: tosca.nodes.Compute././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8043091 tosca_parser-2.15.0/samples/tests/data/topology_template/transactionsubsystem.yaml0000664000175000017500000000454715250006202027566 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Transaction subsystem, which is service template with topology_template, act as a nested system inside another system and also act as stand alone service template. imports: - definitions.yaml topology_template: description: Template of a database including its hosting stack. inputs: mq_server_ip: type: string description: IP address of the message queuing server to receive messages from. default: 127.0.0.1 receiver_port: type: integer description: Port to be used for receiving messages. default: 8080 my_cpus: type: integer description: Number of CPUs for the server. default: 2 constraints: - valid_values: [ 1, 2, 4, 8 ] substitution_mappings: node_type: example.TransactionSubsystem capabilities: message_receiver: [ app, message_receiver ] requirements: database_endpoint: [ app, database ] node_templates: app: type: example.SomeApp properties: admin_user: foo pool_size: 10 capabilities: message_receiver: properties: server_ip: { get_input: mq_server_ip } requirements: - host: node: websrv - database: node: db db: type: example.DatabaseSubsystem requirements: - host: node: server websrv: type: tosca.nodes.WebServer capabilities: data_endpoint: properties: port_name: { get_input: receiver_port } requirements: - host: node: server server: type: tosca.nodes.Compute capabilities: host: properties: disk_size: 10 GB num_cpus: { get_input: my_cpus } mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 outputs: receiver_ip: description: private IP address of the message receiver application value: { get_attribute: [ server, private_address ] } receiver_port: description: receiver_port of the message receiver application value: { get_input: receiver_port } groups: webserver_group: members: [ websrv, server ] type: tosca.groups.Root ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5153978 tosca_parser-2.15.0/samples/tests/data/topology_template/validate/0000775000175000017500000000000015250006257024167 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000021300000000000010211 xustar00111 path=tosca_parser-2.15.0/samples/tests/data/topology_template/validate/queuingsubsystem_invalid_input.yaml 28 mtime=1788873857.8043091 tosca_parser-2.15.0/samples/tests/data/topology_template/validate/queuingsubsystem_invalid_input.yam0000664000175000017500000000457015250006202033254 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > This template is a test template which contains invalid input needed for substitution mappings. The required properties without default value in substituted node template which be mapped must be as inputs of nested service template which defines substutition mappings, and the inputs of nested service template which are not in the properties of the substituted node template must provide default values. This template provides an additional input of server_port1/my_cpus/my_input which are not defined in example.QueuingSubsystem, and the default value are 8080/2/123, all of these are right. But the required property of server_port defined in example.QueuingSubsystem is not appeared in inputs definiton, so will raise excepton of "MissingRequiredInputError". imports: - ../definitions.yaml topology_template: description: Template of a database including its hosting stack. inputs: server_ip: type: string description: IP address of the message queuing server to receive messages from. default: 127.0.0.1 server_port1: type: integer description: Port to be used for receiving messages. default: 8080 my_cpus: type: integer description: Number of CPUs for the server. default: 2 constraints: - valid_values: [ 1, 2, 4, 8 ] my_input: type: integer description: test for input validation. default: 123 substitution_mappings: node_type: example.QueuingSubsystem node_templates: tran_app: type: example.QueuingSubsystem properties: server_ip: { get_input: server_ip } server_port: { get_input: server_port1 } requirements: - host: node: server server: type: tosca.nodes.Compute capabilities: host: properties: disk_size: 10 GB num_cpus: { get_input: my_cpus } mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 outputs: receiver_ip: description: private IP address of the message receiver application value: { get_attribute: [ server, private_address ] } groups: tran_server_group: members: [ tran_app, server ] type: tosca.groups.Root ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8043091 tosca_parser-2.15.0/samples/tests/data/topology_template/validate/system_invalid_input.yaml0000664000175000017500000000116215250006202031312 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 imports: - queuingsubsystem_invalid_input.yaml topology_template: description: Test template with invalid input. inputs: mq_server_ip: type: string default: 127.0.0.1 description: IP address of the message queuing server to receive messages from. mq_server_port: type: integer default: 8080 description: Port to be used for receiving messages. node_templates: mq: type: example.QueuingSubsystem properties: server_ip: { get_input: mq_server_ip } server_port: { get_input: mq_server_port } ././@PaxHeader0000000000000000000000000000022300000000000010212 xustar00119 path=tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_example_app_substitution_mappings.yaml 28 mtime=1788873857.8043091 tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_example_app_substitution_mapp0000664000175000017500000000331115250006202033301 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > Template showing an example TOSCA type to demonstrate usage of output in the substitution mappings. node_types: example.app: derived_from: tosca.nodes.WebApplication properties: mq_server_ip: type: string required: False receiver_port: type: integer required: False attributes: receiver_ip: type: string receiver_port: type: integer topology_template: inputs: mq_server_ip: type: string description: IP address of the message queuing server to receive messages from. default: 127.0.0.1 receiver_port: type: integer description: Port to be used for receiving messages. default: 8080 my_cpus: type: integer description: Number of CPUs for the server. default: 2 constraints: - valid_values: [ 1, 2, 4, 8 ] substitution_mappings: node_type: example.app properties: receiver_port: 8080 node_templates: app: type: example.app properties: mq_server_ip: { get_input: mq_server_ip } receiver_port: { get_input: receiver_port } requirements: - host: node: websrv websrv: type: tosca.nodes.WebServer requirements: - host: node: server server: type: tosca.nodes.Compute capabilities: host: properties: disk_size: 10 GB num_cpus: { get_input: my_cpus } mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 ././@PaxHeader0000000000000000000000000000023500000000000010215 xustar00129 path=tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_substitution_mappings_error_capability_type.yaml 28 mtime=1788873857.8043091 tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_substitution_mappings_error_c0000664000175000017500000000110515250006202033321 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_3 topology_template: inputs: my_property: type: string substitution_mappings: node_type: my.company.MyService substitution_filter: node_filter: properties: - my_property: 'property_value' capabilities: capability_name_or_type_1: properties: - cap_1_property_filter_def_1 - cap_1_property_filter_def_2 node_types: my.company.MyService: derived_from: tosca.nodes.Root properties: my_property: type: string././@PaxHeader0000000000000000000000000000023100000000000010211 xustar00125 path=tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_substitution_mappings_error_node_filter.yaml 28 mtime=1788873857.8043091 tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_substitution_mappings_error_n0000664000175000017500000000111415250006202033334 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_3 topology_template: inputs: my_property: type: string substitution_mappings: node_type: my.company.MyService substitution_filter: node_filter_test: properties: - my_property: 'property_value' capabilities: - capability_name_or_type_1: properties: - cap_1_property_filter_def_1 - cap_1_property_filter_def_2 node_types: my.company.MyService: derived_from: tosca.nodes.Root properties: my_property: type: string././@PaxHeader0000000000000000000000000000023500000000000010215 xustar00129 path=tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_substitution_mappings_error_node_filter_key.yaml 28 mtime=1788873857.8043091 tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_substitution_mappings_error_n0000664000175000017500000000111415250006202033334 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_3 topology_template: inputs: my_property: type: string substitution_mappings: node_type: my.company.MyService substitution_filter: node_filter: properties_test: - my_property: 'property_value' capabilities: - capability_name_or_type_1: properties: - cap_1_property_filter_def_1 - cap_1_property_filter_def_2 node_types: my.company.MyService: derived_from: tosca.nodes.Root properties: my_property: type: string././@PaxHeader0000000000000000000000000000023300000000000010213 xustar00127 path=tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_substitution_mappings_error_property_type.yaml 28 mtime=1788873857.8043091 tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_substitution_mappings_error_p0000664000175000017500000000110515250006202033336 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_3 topology_template: inputs: my_property: type: string substitution_mappings: node_type: my.company.MyService substitution_filter: node_filter: properties: my_property: 'property_value' capabilities: - capability_name_or_type_1: properties: - cap_1_property_filter_def_1 - cap_1_property_filter_def_2 node_types: my.company.MyService: derived_from: tosca.nodes.Root properties: my_property: type: string././@PaxHeader0000000000000000000000000000022600000000000010215 xustar00122 path=tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_substitution_mappings_invalid_output.yaml 28 mtime=1788873857.8043091 tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_substitution_mappings_invalid0000664000175000017500000000162115250006202033317 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 imports: - test_example_app_substitution_mappings.yaml topology_template: description: > Test template showing valid output section containing attribute defined in the substitution mappings in the imported yaml file. inputs: mq_server_ip: type: string default: 127.0.0.1 description: IP address of the message queuing server to receive messages from. mq_server_port: type: integer default: 8080 description: Port to be used for receiving messages. node_templates: substitute_app: type: example.app properties: mq_server_ip: { get_input: mq_server_ip } receiver_port: { get_input: mq_server_port } outputs: receiver_ip: description: private IP address of the message receiver application value: { get_attribute: [ substitute_app, my_cpu_output ] }././@PaxHeader0000000000000000000000000000021700000000000010215 xustar00115 path=tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_substitution_mappings_section.yaml 28 mtime=1788873857.8043091 tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_substitution_mappings_section0000664000175000017500000000227115250006202033337 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_3 topology_template: inputs: my_property: type: string substitution_mappings: node_type: my.company.MyService interfaces: Standard: start: my_start_node.start attributes: receiver_ip: my_property substitution_filter: node_filter: properties: - my_property: 'property_value' capabilities: - capability_name_or_type_1: properties: - cap_1_property_filter_def_1 - cap_1_property_filter_def_2 node_templates: my_start_node: type: my.company.MyServiceCompute properties: my_property: { get_input: my_property } interfaces: Standard: start: implementation: scripts/start.sh inputs: my_property: { get_property: [ SELF, my_property ] } node_types: my.company.MyService: derived_from: tosca.nodes.Root properties: my_property: type: string attributes: receiver_ip: type: string my.company.MyServiceCompute: derived_from: tosca.nodes.Compute properties: my_property: type: string ././@PaxHeader0000000000000000000000000000022400000000000010213 xustar00120 path=tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_substitution_mappings_valid_output.yaml 28 mtime=1788873857.8043091 tosca_parser-2.15.0/samples/tests/data/topology_template/validate/test_substitution_mappings_valid_o0000664000175000017500000000161515250006202033311 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 imports: - test_example_app_substitution_mappings.yaml topology_template: description: > Test template showing valid output section containing attribute defined in the substitution mappings in the imported yaml file. inputs: mq_server_ip: type: string default: 127.0.0.1 description: IP address of the message queuing server to receive messages from. mq_server_port: type: integer default: 8080 description: Port to be used for receiving messages. node_templates: sustitute_app: type: example.app properties: mq_server_ip: { get_input: mq_server_ip } receiver_port: { get_input: mq_server_port } outputs: receiver_ip: description: private IP address of the message receiver application value: { get_attribute: [ sustitute_app, receiver_ip ] }././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8053093 tosca_parser-2.15.0/samples/tests/data/tosca_elk.yaml0000664000175000017500000001535715250006202021460 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > This TOSCA simple profile deploys nodejs, mongodb, elasticsearch, logstash and kibana each on a separate server with monitoring enabled for nodejs server where a sample nodejs application is running. The rsyslog and collectd are installed on a nodejs server. imports: - custom_types/paypalpizzastore_nodejs_app.yaml - custom_types/elasticsearch.yaml - custom_types/logstash.yaml - custom_types/kibana.yaml - custom_types/collectd.yaml - custom_types/rsyslog.yaml dsl_definitions: host_capabilities: &host_capabilities disk_size: 10 GB num_cpus: { get_input: my_cpus } mem_size: 4096 MB os_capabilities: &os_capabilities architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 topology_template: inputs: my_cpus: type: integer description: Number of CPUs for the server. constraints: - valid_values: [ 1, 2, 4, 8 ] default: 1 github_url: type: string description: The URL to download nodejs. default: http://github.com/paypal/rest-api-sample-app-nodejs.git node_templates: paypal_pizzastore: type: tosca.nodes.WebApplication.PayPalPizzaStore properties: github_url: { get_input: github_url } requirements: - host: nodejs - database_connection: mongo_db interfaces: Standard: configure: implementation: nodejs/config.sh inputs: github_url: { get_property: [ SELF, github_url ] } mongodb_ip: { get_attribute: [mongo_server, private_address] } start: nodejs/start.sh nodejs: type: tosca.nodes.WebServer requirements: - host: app_server interfaces: Standard: create: nodejs/create.sh mongo_db: type: tosca.nodes.Database requirements: - host: mongo_dbms interfaces: Standard: create: mongodb/create_database.sh mongo_dbms: type: tosca.nodes.DBMS requirements: - host: mongo_server interfaces: Standard: create: mongodb/create.sh configure: implementation: mongodb/config.sh inputs: mongodb_ip: { get_attribute: [mongo_server, private_address] } start: mongodb/start.sh elasticsearch: type: tosca.nodes.SoftwareComponent.Elasticsearch requirements: - host: elasticsearch_server interfaces: Standard: create: elasticsearch/create.sh start: elasticsearch/start.sh logstash: type: tosca.nodes.SoftwareComponent.Logstash requirements: - host: logstash_server - search_endpoint: node: elasticsearch capability: search_endpoint relationship: type: tosca.relationships.ConnectsTo interfaces: Configure: pre_configure_source: implementation: logstash/configure_elasticsearch.py inputs: elasticsearch_ip: { get_attribute: [elasticsearch_server, private_address] } interfaces: Standard: create: logstash/create.sh start: logstash/start.sh kibana: type: tosca.nodes.SoftwareComponent.Kibana requirements: - host: kibana_server - search_endpoint: elasticsearch interfaces: Standard: create: kibana/create.sh configure: implementation: kibana/config.sh inputs: elasticsearch_ip: { get_attribute: [elasticsearch_server, private_address] } kibana_ip: { get_attribute: [kibana_server, private_address] } start: kibana/start.sh app_collectd: type: tosca.nodes.SoftwareComponent.Collectd requirements: - host: app_server - log_endpoint: node: logstash capability: log_endpoint relationship: type: tosca.relationships.ConnectsTo interfaces: Configure: pre_configure_target: implementation: logstash/configure_collectd.py interfaces: Standard: create: collectd/create.sh configure: implementation: collectd/config.py inputs: logstash_ip: { get_attribute: [logstash_server, private_address] } start: collectd/start.sh app_rsyslog: type: tosca.nodes.SoftwareComponent.Rsyslog requirements: - host: app_server - log_endpoint: node: logstash capability: log_endpoint relationship: type: tosca.relationships.ConnectsTo interfaces: Configure: pre_configure_target: implementation: logstash/configure_rsyslog.py interfaces: Standard: create: rsyslog/create.sh configure: implementation: rsyslog/config.sh inputs: logstash_ip: { get_attribute: [logstash_server, private_address] } start: rsyslog/start.sh app_server: type: tosca.nodes.Compute capabilities: host: properties: *host_capabilities os: properties: *os_capabilities mongo_server: type: tosca.nodes.Compute capabilities: host: properties: *host_capabilities os: properties: *os_capabilities elasticsearch_server: type: tosca.nodes.Compute capabilities: host: properties: *host_capabilities os: properties: *os_capabilities logstash_server: type: tosca.nodes.Compute capabilities: host: properties: *host_capabilities os: properties: *os_capabilities kibana_server: type: tosca.nodes.Compute capabilities: host: properties: *host_capabilities os: properties: *os_capabilities outputs: nodejs_url: description: URL for the nodejs server, http://:3000 value: { get_attribute: [ app_server, private_address ] } mongodb_url: description: URL for the mongodb server. value: { get_attribute: [ mongo_server, private_address ] } elasticsearch_url: description: URL for the elasticsearch server. value: { get_attribute: [ elasticsearch_server, private_address ] } logstash_url: description: URL for the logstash server. value: { get_attribute: [ logstash_server, private_address ] } kibana_url: description: URL for the kibana server. value: { get_attribute: [ kibana_server, private_address ] } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8053093 tosca_parser-2.15.0/samples/tests/data/tosca_helloworld.yaml0000664000175000017500000000116515250006202023050 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Template for deploying a single server with predefined properties. topology_template: node_templates: my_server: type: tosca.nodes.Compute capabilities: # Host container properties host: properties: num_cpus: 2 disk_size: 10 GB mem_size: 512 MB # Guest Operating System properties os: properties: # host Operating System image properties architecture: x86_64 type: Linux distribution: RHEL version: 6.5 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8053093 tosca_parser-2.15.0/samples/tests/data/tosca_imports_validation.yaml0000664000175000017500000000264015250006202024603 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: Template to test invalid imports. imports: - custom_types/imported_sample.yaml topology_template: node_templates: logstash: type: tosca.nodes.SoftwareComponent.Logstash requirements: - search_endpoint: capability: search_endpoint relationship: type: tosca.relationships.ConnectsTo interfaces: Configure: pre_configure_source: implementation: logstash/configure_elasticsearch.py inputs: elasticsearch_ip: { get_attribute: [elasticsearch_server, private_address] } interfaces: Standard: create: logstash/create.sh start: logstash/start.sh policies: - my_compute_placement_policy: type: tosca.policies.Placement description: Apply placement policy to servers metadata: { user1: 1001, user2: 1002 } targets: [ my_server_1, my_server_2 ] - my_groups_placement: type: mycompany.mytypes.myScalingPolicy targets: [ webserver_group ] description: my company scaling policy metadata: user1: 1001 user2: 1003 relationship_templates: my_custom_rel: type: test.relation.connects interfaces: Configure: pre_configure_source: scripts/wp_db_configure.sh ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8053093 tosca_parser-2.15.0/samples/tests/data/tosca_single_instance_wordpress.yaml0000664000175000017500000000666315250006202026162 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA simple profile with wordpress, web server and mysql on the same server. imports: - custom_types/wordpress.yaml topology_template: inputs: cpus: type: integer description: Number of CPUs for the server. constraints: - valid_values: [ 1, 2, 4, 8 ] default: 1 db_name: type: string description: The name of the database. default: wordpress db_user: type: string description: The user name of the DB user. default: wp_user db_pwd: type: string description: The WordPress database admin account password. default: wp_pass db_root_pwd: type: string description: Root password for MySQL. db_port: type: PortDef description: Port for the MySQL database. default: 3306 node_templates: wordpress: type: tosca.nodes.WebApplication.WordPress requirements: - host: webserver - database_endpoint: mysql_database interfaces: Standard: create: wordpress/wordpress_install.sh configure: implementation: wordpress/wordpress_configure.sh inputs: wp_db_name: { get_property: [ mysql_database, name ] } wp_db_user: { get_property: [ mysql_database, user ] } wp_db_password: { get_property: [ mysql_database, password ] } mysql_database: type: tosca.nodes.Database properties: name: { get_input: db_name } user: { get_input: db_user } password: { get_input: db_pwd } capabilities: database_endpoint: properties: port: { get_input: db_port } requirements: - host: mysql_dbms interfaces: Standard: configure: implementation: mysql/mysql_database_configure.sh inputs: db_name: { get_property: [ SELF, name ] } db_user: { get_property: [ SELF, user ] } db_password: { get_property: [ SELF, password ] } db_root_password: { get_property: [ mysql_dbms, root_password ] } mysql_dbms: type: tosca.nodes.DBMS properties: root_password: { get_input: db_root_pwd } port: { get_input: db_port } requirements: - host: server interfaces: Standard: create: implementation: mysql/mysql_dbms_install.sh inputs: db_root_password: { get_property: [ mysql_dbms, root_password ] } start: mysql/mysql_dbms_start.sh configure: implementation: mysql/mysql_dbms_configure.sh inputs: db_port: { get_property: [ mysql_dbms, port ] } webserver: type: tosca.nodes.WebServer requirements: - host: server interfaces: Standard: create: webserver/webserver_install.sh start: webserver/webserver_start.sh server: type: tosca.nodes.Compute capabilities: host: properties: disk_size: 10 GB num_cpus: { get_input: cpus } mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 outputs: website_url: description: URL for Wordpress wiki. value: { get_attribute: [server, private_address] } ././@PaxHeader0000000000000000000000000000021300000000000010211 xustar00111 path=tosca_parser-2.15.0/samples/tests/data/tosca_single_instance_wordpress_with_local_abspath_import.yaml 28 mtime=1788873857.8053093 tosca_parser-2.15.0/samples/tests/data/tosca_single_instance_wordpress_with_local_abspath_import.yam0000664000175000017500000000647115250006202033304 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA simple profile with wordpress, web server and mysql on the same server. Parsing of this test template will fail with errors if provided imports does not refer to a valid absolute path. imports: - /tmp/tosca-parser/toscaparser/tests/data/custom_types/wordpress.yaml topology_template: inputs: cpus: type: integer description: Number of CPUs for the server. constraints: - valid_values: [ 1, 2, 4, 8 ] default: 1 db_name: type: string description: The name of the database. default: wordpress db_user: type: string description: The user name of the DB user. default: wp_user db_pwd: type: string description: The WordPress database admin account password. default: wp_pass db_root_pwd: type: string description: Root password for MySQL. db_port: type: PortDef description: Port for the MySQL database. default: 3306 node_templates: wordpress: type: tosca.nodes.WebApplication.WordPress requirements: - host: webserver - database_endpoint: mysql_database interfaces: Standard: create: wordpress/wordpress_install.sh configure: implementation: wordpress/wordpress_configure.sh inputs: wp_db_name: wordpress wp_db_user: wp_user wp_db_password: wp_pass mysql_database: type: tosca.nodes.Database properties: name: { get_input: db_name } user: { get_input: db_user } password: { get_input: db_pwd } capabilities: database_endpoint: properties: port: { get_input: db_port } requirements: - host: node: mysql_dbms interfaces: Standard: configure: implementation: mysql/mysql_database_configure.sh inputs: db_name: wordpress db_user: wp_user db_password: wp_pass db_root_password: passw0rd mysql_dbms: type: tosca.nodes.DBMS properties: root_password: { get_input: db_root_pwd } port: { get_input: db_port } requirements: - host: server interfaces: Standard: create: implementation: mysql/mysql_dbms_install.sh inputs: db_root_password: passw0rd start: mysql/mysql_dbms_start.sh configure: implementation: mysql/mysql_dbms_configure.sh inputs: db_port: 3366 webserver: type: tosca.nodes.WebServer requirements: - host: server interfaces: Standard: create: webserver/webserver_install.sh start: webserver/webserver_start.sh server: type: tosca.nodes.Compute capabilities: host: properties: disk_size: 10 GB num_cpus: { get_input: cpus } mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 outputs: website_url: description: URL for Wordpress wiki. value: { get_attribute: [server, private_address] } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8053093 tosca_parser-2.15.0/samples/tests/data/tosca_single_instance_wordpress_with_url_import.yaml0000664000175000017500000000625715250006202031470 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: > TOSCA simple profile with wordpress, web server and mysql on the same server. imports: - https://example.com/custom_types/wordpress.yaml topology_template: inputs: cpus: type: integer description: Number of CPUs for the server. constraints: - valid_values: [ 1, 2, 4, 8 ] default: 1 db_name: type: string description: The name of the database. default: wordpress db_user: type: string description: The user name of the DB user. default: wp_user db_pwd: type: string description: The WordPress database admin account password. default: wp_pass db_root_pwd: type: string description: Root password for MySQL. db_port: type: PortDef description: Port for the MySQL database. default: 3306 node_templates: wordpress: type: tosca.nodes.WebApplication.WordPress requirements: - host: webserver - database_endpoint: mysql_database interfaces: Standard: create: wordpress/wordpress_install.sh configure: implementation: wordpress/wordpress_configure.sh inputs: wp_db_name: wordpress wp_db_user: wp_user wp_db_password: wp_pass mysql_database: type: tosca.nodes.Database properties: name: { get_input: db_name } user: { get_input: db_user } password: { get_input: db_pwd } capabilities: database_endpoint: properties: port: { get_input: db_port } requirements: - host: node: mysql_dbms interfaces: Standard: configure: implementation: mysql/mysql_database_configure.sh inputs: db_name: wordpress db_user: wp_user db_password: wp_pass db_root_password: passw0rd mysql_dbms: type: tosca.nodes.DBMS properties: root_password: { get_input: db_root_pwd } port: { get_input: db_port } requirements: - host: server interfaces: Standard: create: implementation: mysql/mysql_dbms_install.sh inputs: db_root_password: passw0rd start: mysql/mysql_dbms_start.sh configure: implementation: mysql/mysql_dbms_configure.sh inputs: db_port: 3366 webserver: type: tosca.nodes.WebServer requirements: - host: server interfaces: Standard: create: webserver/webserver_install.sh start: webserver/webserver_start.sh server: type: tosca.nodes.Compute capabilities: host: properties: disk_size: 10 GB num_cpus: { get_input: cpus } mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Ubuntu version: 14.04 outputs: website_url: description: URL for Wordpress wiki. value: { get_attribute: [server, private_address] } ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8053093 tosca_parser-2.15.0/samples/tests/data/tosca_test_get_operation_output.yaml0000664000175000017500000000073015250006202026210 0ustar00zuulzuultosca_definitions_version: tosca_simple_yaml_1_0 description: TOSCA simple profile to test the GET OPERATION OUTPUT functionality imports: - custom_types/compute_with_prop.yaml topology_template: node_templates: front_end: type: tosca.nodes.ComputeWithProp interfaces: Standard: create: implementation: nodejs/create.sh inputs: data_dir: {get_operation_output: [front_end,Standard,create,data_dir]} ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5304003 tosca_parser-2.15.0/setup.cfg0000664000175000017500000000244215250006257014733 0ustar00zuulzuul[metadata] name = tosca-parser base_url = https://launchpad.net/tosca-parser description = Parser for TOSCA Simple Profile in YAML. long_description = file: README.rst author = OpenStack author_email = openstack-discuss@lists.openstack.org url = https://docs.openstack.org/tosca-parser/latest/ python_requires = >=3.6 classifiers = Environment :: OpenStack Intended Audience :: Information Technology Intended Audience :: System Administrators License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 [files] packages = toscaparser [entry_points] console_scripts = tosca-parser = toscaparser.shell:main toscaparser.extensions = tosca_simple_profile_for_nfv_1_0_0 = toscaparser.extensions.nfv.tosca_simple_profile_for_nfv_1_0_0:NfvProfile_1_0_0 tosca_simple_profile_for_mec_1_0_0 = toscaparser.extensions.mec.tosca_simple_profile_for_mec_1_0_0:MecProfile_1_0_0 [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8053093 tosca_parser-2.15.0/setup.py0000664000175000017500000000137615250006202014617 0ustar00zuulzuul# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. # THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT import setuptools setuptools.setup( setup_requires=['pbr>=2.0.0'], pbr=True) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8063092 tosca_parser-2.15.0/test-requirements.txt0000664000175000017500000000071715250006202017344 0ustar00zuulzuul# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. hacking>=7.0.0,<7.1.0 # Apache-2.0 coverage>=4.4.1 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD oslotest>=5.0.1 # Apache-2.0 python-subunit>=1.4.4 # Apache-2.0/BSD stestr>=2.0.0 # Apache-2.0 testscenarios>=0.5.0 # Apache-2.0/BSD testtools>=2.7.2 # MIT ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873902.516398 tosca_parser-2.15.0/tosca_parser.egg-info/0000775000175000017500000000000015250006257017267 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4253836 tosca_parser-2.15.0/tosca_parser.egg-info/PKG-INFO0000644000175000017500000000653015250006256020365 0ustar00zuulzuulMetadata-Version: 2.4 Name: tosca-parser Version: 2.15.0 Summary: Parser for TOSCA Simple Profile in YAML. Home-page: https://docs.openstack.org/tosca-parser/latest/ Author: OpenStack Author-email: openstack-discuss@lists.openstack.org Classifier: Environment :: OpenStack Classifier: Intended Audience :: Information Technology Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Requires-Python: >=3.6 License-File: LICENSE Requires-Dist: pbr>=6.0.0 Requires-Dist: cliff>=4.9.1 Requires-Dist: PyYAML>=3.12 Requires-Dist: python-dateutil>=2.9.0 Requires-Dist: stevedore>=2.0.1 Requires-Dist: requests>=2.32.3 Dynamic: author Dynamic: author-email Dynamic: license-file Dynamic: requires-dist Dynamic: requires-python Dynamic: summary ======================== Team and repository tags ======================== .. image:: http://governance.openstack.org/badges/tosca-parser.svg :target: http://governance.openstack.org/reference/tags/index.html .. Change things from this point on =============== TOSCA Parser =============== Overview -------- The TOSCA Parser is an OpenStack project and licensed under Apache 2. It is developed to parse TOSCA Simple Profile in YAML. It reads the TOSCA templates and creates an in-memory graph of TOSCA nodes and their relationship. Architecture ------------ The TOSCA Parser takes TOSCA YAML template or TOSCA Cloud Service Archive (CSAR) file as an input, with optional input of dictionary of needed parameters with their values, and produces in-memory objects of different TOSCA elements with their relationship to each other. It also creates a graph of TOSCA node templates and their relationship. The ToscaTemplate class located in the toscaparser/tosca_template.py is an entry class of the parser and various functionality of parser can be used by initiating this class. In order to see an example usage of TOSCA Parser from a separate tool, refer to the OpenStack heat-translator class TranslateTemplate located in the translator/osc/v1/translate.py module. The toscaparser/shell.py module of tosca-parser also provides a good reference on how to invoke TOSCA Parser from Command Line Interface. The toscaparser/elements sub-directory contains various modules to handle various TOSCA type elements like node type, relationship type etc. The entity_type.py module is a parent of all type elements. The toscaparser directory contains various python module to handle service template including topology template, node templates, relationship templates etc. The entity_template.py is a parent of all template elements. How To Use ---------- Please refer to `doc/source/usage.rst `_ Project Info ------------ * License: Apache License, Version 2.0 * Source: https://opendev.org/openstack/tosca-parser/ ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873902.472391 tosca_parser-2.15.0/tosca_parser.egg-info/SOURCES.txt0000664000175000017500000003471315250006256021162 0ustar00zuulzuul.coveragerc .mailmap .stestr.conf .zuul.yaml AUTHORS CONTRIBUTING.rst ChangeLog HACKING.rst LICENSE README.rst requirements.txt setup.cfg setup.py test-requirements.txt tosca_parser.py tox.ini doc/requirements.txt doc/source/conf.py doc/source/contributing.rst doc/source/index.rst doc/source/installation.rst doc/source/usage.rst doc/source/contributor/contributing.rst samples/tests/data/test_attributes_inheritance.yaml samples/tests/data/test_available_rel_tpls.yaml samples/tests/data/test_capability_without_properties.yaml samples/tests/data/test_credential_datatype.yaml samples/tests/data/test_custom_capabilty.yaml samples/tests/data/test_custom_caps_def.yaml samples/tests/data/test_custom_caps_with_datatype.yaml samples/tests/data/test_endpoint_on_compute.yaml samples/tests/data/test_import_invalid_template_version.yaml samples/tests/data/test_import_metadata.yml samples/tests/data/test_import_tosca_version_1_3.yaml samples/tests/data/test_instance_nested_imports.yaml samples/tests/data/test_invalid_input_defaults.yaml samples/tests/data/test_invalid_section_names.yaml samples/tests/data/test_invalid_template_version.yaml samples/tests/data/test_long_rel.yaml samples/tests/data/test_multiple_validation_errors.yaml samples/tests/data/test_no_inputs_in_template.yaml samples/tests/data/test_no_outputs_in_template.yaml samples/tests/data/test_nodetype_without_relationship.yaml samples/tests/data/test_normative_type_properties_override.yaml samples/tests/data/test_scalar_unit_without_unit.yaml samples/tests/data/test_template_without_requirement.yaml samples/tests/data/test_tosca_custom_rel.yaml samples/tests/data/test_tosca_custom_rel_with_script.yaml samples/tests/data/test_tosca_normative_type_by_shortname.yaml samples/tests/data/test_tosca_top_level_error1.yaml samples/tests/data/test_tosca_top_level_error2.yaml samples/tests/data/test_tosca_version_1_3.yaml samples/tests/data/tosca_elk.yaml samples/tests/data/tosca_helloworld.yaml samples/tests/data/tosca_imports_validation.yaml samples/tests/data/tosca_single_instance_wordpress.yaml samples/tests/data/tosca_single_instance_wordpress_with_local_abspath_import.yaml samples/tests/data/tosca_single_instance_wordpress_with_url_import.yaml samples/tests/data/tosca_test_get_operation_output.yaml samples/tests/data/CSAR/csar_elk.csar samples/tests/data/CSAR/csar_elk.zip samples/tests/data/CSAR/csar_hello_world.zip samples/tests/data/CSAR/csar_invalid_entry_def.zip samples/tests/data/CSAR/csar_invalid_multilevel_imports_validation.zip samples/tests/data/CSAR/csar_metadata_not_yaml.zip samples/tests/data/CSAR/csar_missing_metadata.zip samples/tests/data/CSAR/csar_multiple_deployment_flavour.zip samples/tests/data/CSAR/csar_no_metadata_file.zip samples/tests/data/CSAR/csar_not_zip.zip samples/tests/data/CSAR/csar_relative_path_import_check.zip samples/tests/data/CSAR/csar_root_level_yaml.zip samples/tests/data/CSAR/csar_root_level_yaml_and_tosca_metadata.zip samples/tests/data/CSAR/csar_root_yaml_with_tosca_definition1_0.zip samples/tests/data/CSAR/csar_two_root_level_yaml.zip samples/tests/data/CSAR/csar_valid_multilevel_imports_validation.zip samples/tests/data/CSAR/csar_wordpress.zip samples/tests/data/CSAR/csar_wordpress_invalid_artifact.zip samples/tests/data/CSAR/csar_wordpress_invalid_artifact_multi.zip samples/tests/data/CSAR/csar_wordpress_invalid_import_path.zip samples/tests/data/CSAR/csar_wordpress_invalid_import_url.zip samples/tests/data/CSAR/csar_wordpress_invalid_script_path.zip samples/tests/data/CSAR/csar_wordpress_invalid_script_url.zip samples/tests/data/CSAR/csar_wordpress_valid_artifact.zip samples/tests/data/CSAR/csar_wordpress_valid_artifact_multi.zip samples/tests/data/CSAR/csar_wordpress_with_url_import_and_script.zip samples/tests/data/CSAR/csar_wrong_metadata_file.zip samples/tests/data/CSAR/multi_level_imports_response.yaml samples/tests/data/CSAR/root_level_file.yaml samples/tests/data/CSAR/tosca_meta_file.yaml samples/tests/data/artifacts/collectd/config.py samples/tests/data/artifacts/collectd/create.sh samples/tests/data/artifacts/collectd/start.sh samples/tests/data/artifacts/elasticsearch/create.sh samples/tests/data/artifacts/elasticsearch/start.sh samples/tests/data/artifacts/kibana/config.sh samples/tests/data/artifacts/kibana/create.sh samples/tests/data/artifacts/kibana/start.sh samples/tests/data/artifacts/logstash/configure_collectd.py samples/tests/data/artifacts/logstash/configure_elasticsearch.py samples/tests/data/artifacts/logstash/configure_rsyslog.py samples/tests/data/artifacts/logstash/create.sh samples/tests/data/artifacts/logstash/start.sh samples/tests/data/artifacts/mongodb/config.sh samples/tests/data/artifacts/mongodb/create.sh samples/tests/data/artifacts/mongodb/create_database.sh samples/tests/data/artifacts/mongodb/start.sh samples/tests/data/artifacts/mysql/mysql_database_configure.sh samples/tests/data/artifacts/mysql/mysql_dbms_configure.sh samples/tests/data/artifacts/mysql/mysql_dbms_install.sh samples/tests/data/artifacts/mysql/mysql_dbms_start.sh samples/tests/data/artifacts/nodejs/config.sh samples/tests/data/artifacts/nodejs/create.sh samples/tests/data/artifacts/nodejs/start.sh samples/tests/data/artifacts/rsyslog/config.sh samples/tests/data/artifacts/rsyslog/create.sh samples/tests/data/artifacts/rsyslog/start.sh samples/tests/data/artifacts/webserver/webserver_install.sh samples/tests/data/artifacts/webserver/webserver_start.sh samples/tests/data/artifacts/wordpress/wordpress_configure.sh samples/tests/data/artifacts/wordpress/wordpress_install.sh samples/tests/data/containers/test_container_docker_mysql.yaml samples/tests/data/custom_types/collectd.yaml samples/tests/data/custom_types/compute_with_attribute_list.yaml samples/tests/data/custom_types/compute_with_nested_atributes.yaml samples/tests/data/custom_types/compute_with_prop.yaml samples/tests/data/custom_types/container_cap_child.yaml samples/tests/data/custom_types/custom_cap.yaml samples/tests/data/custom_types/custom_cap_with_datatype.yaml samples/tests/data/custom_types/custom_caps_def.yaml samples/tests/data/custom_types/custom_data_type.yaml samples/tests/data/custom_types/custom_interface.yaml samples/tests/data/custom_types/custom_nested_data_types.yaml samples/tests/data/custom_types/custom_policy.yaml samples/tests/data/custom_types/custom_relationship_type_defs.yaml samples/tests/data/custom_types/db_with_list_param.yaml samples/tests/data/custom_types/elasticsearch.yaml samples/tests/data/custom_types/imported_sample.yaml samples/tests/data/custom_types/invalid_template_version.yaml samples/tests/data/custom_types/kibana.yaml samples/tests/data/custom_types/logstash.yaml samples/tests/data/custom_types/nested_rsyslog.yaml samples/tests/data/custom_types/nested_test_kibana.yaml samples/tests/data/custom_types/nested_test_wordpress.yaml samples/tests/data/custom_types/node_with_cap.yaml samples/tests/data/custom_types/paypalpizzastore_nodejs_app.yaml samples/tests/data/custom_types/rsyslog.yaml samples/tests/data/custom_types/template_metadata.yaml samples/tests/data/custom_types/template_version_1_3.yaml samples/tests/data/custom_types/wordpress.yaml samples/tests/data/custom_types/wordpress.yml samples/tests/data/datatypes/custom_datatype_def.yaml samples/tests/data/datatypes/test_custom_datatypes_in_current_template.yaml samples/tests/data/datatypes/test_custom_datatypes_nested_datatype_error.yaml samples/tests/data/datatypes/test_custom_datatypes_positive.yaml samples/tests/data/datatypes/test_custom_datatypes_value_error.yaml samples/tests/data/datatypes/test_datatype_portspec_add_req.yaml samples/tests/data/dsl_definitions/test_nested_dsl_def.yaml samples/tests/data/extensions/tosca_helloworld_nfv.yaml samples/tests/data/functions/test_capabilties_inheritance.yaml samples/tests/data/functions/test_concat.yaml samples/tests/data/functions/test_concat_invalid.yaml samples/tests/data/functions/test_container_cap_child.yaml samples/tests/data/functions/test_get_attribute_custom_data_type.yaml samples/tests/data/functions/test_get_attribute_host_keyword.yaml samples/tests/data/functions/test_get_attribute_host_not_found.yaml samples/tests/data/functions/test_get_attribute_illegal_host_in_outputs.yaml samples/tests/data/functions/test_get_attribute_nested_data_types.yaml samples/tests/data/functions/test_get_attribute_source_target_keywords.yaml samples/tests/data/functions/test_get_attribute_unknown_attribute_name.yaml samples/tests/data/functions/test_get_attribute_unknown_node_template_name.yaml samples/tests/data/functions/test_get_attribute_with_index.yaml samples/tests/data/functions/test_get_attribute_with_index_error.yaml samples/tests/data/functions/test_get_attribute_with_nested_params.yaml samples/tests/data/functions/test_get_implicit_attribute.yaml samples/tests/data/functions/test_get_prop_cap_bool.yaml samples/tests/data/functions/test_get_prop_cap_host.yaml samples/tests/data/functions/test_get_property_source_target_keywords.yaml samples/tests/data/functions/test_get_property_with_host.yaml samples/tests/data/functions/test_invalid_function_signature.yaml samples/tests/data/functions/test_invalid_input.yaml samples/tests/data/functions/test_token.yaml samples/tests/data/functions/test_token_invalid.yaml samples/tests/data/functions/test_unknown_capability_property.yaml samples/tests/data/functions/test_unknown_input_in_interface.yaml samples/tests/data/functions/test_unknown_input_in_property.yaml samples/tests/data/functions/tosca_nested_property_names_indexes.yaml samples/tests/data/interfaces/test_custom_interface_in_template.yaml samples/tests/data/interfaces/test_custom_interface_invalid_operation.yaml samples/tests/data/interfaces/test_custom_interface_notifications.yaml samples/tests/data/interfaces/test_custom_interface_operations.yaml samples/tests/data/node_filter/test_node_filter.yaml samples/tests/data/policies/custom_definitions.yaml samples/tests/data/policies/tacker_defs.yaml samples/tests/data/policies/tacker_nfv_defs.yaml samples/tests/data/policies/test_policies_without_required_property.yaml samples/tests/data/policies/test_tosca_nfv_multiple_policies.yaml samples/tests/data/policies/tosca_custom_policy_template.yaml samples/tests/data/policies/tosca_policy_template.yaml samples/tests/data/relationship/test_custom_relationship.yaml samples/tests/data/relationship/test_custom_relationship_key_schema.yaml samples/tests/data/repositories/test_repositories_definition.yaml samples/tests/data/repositories/tosca_repositories_test_definition.yaml samples/tests/data/requirements/test_requirements.yaml samples/tests/data/topology_template/databasesubsystem.yaml samples/tests/data/topology_template/definitions.yaml samples/tests/data/topology_template/definitions_1_2.yaml samples/tests/data/topology_template/queuingsubsystem.yaml samples/tests/data/topology_template/system.yaml samples/tests/data/topology_template/transactionsubsystem.yaml samples/tests/data/topology_template/validate/queuingsubsystem_invalid_input.yaml samples/tests/data/topology_template/validate/system_invalid_input.yaml samples/tests/data/topology_template/validate/test_example_app_substitution_mappings.yaml samples/tests/data/topology_template/validate/test_substitution_mappings_error_capability_type.yaml samples/tests/data/topology_template/validate/test_substitution_mappings_error_node_filter.yaml samples/tests/data/topology_template/validate/test_substitution_mappings_error_node_filter_key.yaml samples/tests/data/topology_template/validate/test_substitution_mappings_error_property_type.yaml samples/tests/data/topology_template/validate/test_substitution_mappings_invalid_output.yaml samples/tests/data/topology_template/validate/test_substitution_mappings_section.yaml samples/tests/data/topology_template/validate/test_substitution_mappings_valid_output.yaml tosca_parser.egg-info/PKG-INFO tosca_parser.egg-info/SOURCES.txt tosca_parser.egg-info/dependency_links.txt tosca_parser.egg-info/entry_points.txt tosca_parser.egg-info/not-zip-safe tosca_parser.egg-info/pbr.json tosca_parser.egg-info/requires.txt tosca_parser.egg-info/top_level.txt toscaparser/__init__.py toscaparser/capabilities.py toscaparser/dataentity.py toscaparser/entity_template.py toscaparser/functions.py toscaparser/groups.py toscaparser/imports.py toscaparser/nodetemplate.py toscaparser/parameters.py toscaparser/policy.py toscaparser/properties.py toscaparser/relationship_template.py toscaparser/repositories.py toscaparser/reservation.py toscaparser/shell.py toscaparser/substitution_mappings.py toscaparser/topology_template.py toscaparser/tosca_template.py toscaparser/tpl_relationship_graph.py toscaparser/triggers.py toscaparser/unsupportedtype.py toscaparser/common/__init__.py toscaparser/common/exception.py toscaparser/elements/TOSCA_definition.yaml toscaparser/elements/__init__.py toscaparser/elements/artifacttype.py toscaparser/elements/attribute_definition.py toscaparser/elements/capabilitytype.py toscaparser/elements/constraints.py toscaparser/elements/datatype.py toscaparser/elements/entity_type.py toscaparser/elements/grouptype.py toscaparser/elements/interfaces.py toscaparser/elements/nodetype.py toscaparser/elements/policytype.py toscaparser/elements/portspectype.py toscaparser/elements/property_definition.py toscaparser/elements/relationshiptype.py toscaparser/elements/scalarunit.py toscaparser/elements/statefulentitytype.py toscaparser/elements/tosca_type_validation.py toscaparser/extensions/__init__.py toscaparser/extensions/exttools.py toscaparser/extensions/mec/TOSCA_mec_definition_1_0_0.yaml toscaparser/extensions/mec/__init__.py toscaparser/extensions/mec/tosca_simple_profile_for_mec_1_0_0.py toscaparser/extensions/nfv/TOSCA_nfv_definition_1_0_0.yaml toscaparser/extensions/nfv/__init__.py toscaparser/extensions/nfv/tosca_simple_profile_for_nfv_1_0_0.py toscaparser/prereq/__init__.py toscaparser/prereq/csar.py toscaparser/tests/__init__.py toscaparser/tests/base.py toscaparser/tests/test_constraints.py toscaparser/tests/test_custom_relationships.py toscaparser/tests/test_datatypes.py toscaparser/tests/test_exception.py toscaparser/tests/test_functions.py toscaparser/tests/test_prereq.py toscaparser/tests/test_properties.py toscaparser/tests/test_scalarunit.py toscaparser/tests/test_shell.py toscaparser/tests/test_topology_template.py toscaparser/tests/test_tosca_nfv_tpl.py toscaparser/tests/test_toscadef.py toscaparser/tests/test_toscatpl.py toscaparser/tests/test_toscatplvalidation.py toscaparser/tests/test_utils.py toscaparser/tests/test_validate_tosca_version.py toscaparser/tests/utils.py toscaparser/utils/__init__.py toscaparser/utils/gettextutils.py toscaparser/utils/urlutils.py toscaparser/utils/validateutils.py toscaparser/utils/yamlparser.py././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4253836 tosca_parser-2.15.0/tosca_parser.egg-info/dependency_links.txt0000664000175000017500000000000115250006256023334 0ustar00zuulzuul ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4263837 tosca_parser-2.15.0/tosca_parser.egg-info/entry_points.txt0000664000175000017500000000047215250006256022567 0ustar00zuulzuul[console_scripts] tosca-parser = toscaparser.shell:main [toscaparser.extensions] tosca_simple_profile_for_mec_1_0_0 = toscaparser.extensions.mec.tosca_simple_profile_for_mec_1_0_0:MecProfile_1_0_0 tosca_simple_profile_for_nfv_1_0_0 = toscaparser.extensions.nfv.tosca_simple_profile_for_nfv_1_0_0:NfvProfile_1_0_0 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4253836 tosca_parser-2.15.0/tosca_parser.egg-info/not-zip-safe0000664000175000017500000000000115250006256021514 0ustar00zuulzuul ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4253836 tosca_parser-2.15.0/tosca_parser.egg-info/pbr.json0000664000175000017500000000005615250006256020745 0ustar00zuulzuul{"git_version": "11b686a", "is_release": true}././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4263837 tosca_parser-2.15.0/tosca_parser.egg-info/requires.txt0000664000175000017500000000013615250006256021666 0ustar00zuulzuulpbr>=6.0.0 cliff>=4.9.1 PyYAML>=3.12 python-dateutil>=2.9.0 stevedore>=2.0.1 requests>=2.32.3 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.4263837 tosca_parser-2.15.0/tosca_parser.egg-info/top_level.txt0000664000175000017500000000001415250006256022013 0ustar00zuulzuultoscaparser ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8063092 tosca_parser-2.15.0/tosca_parser.py0000664000175000017500000000220215250006202016131 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser import shell as parser_shell """ Test utility to show how TOSCA Parser can be used programmatically It can be used as, #python tosca_parser.py --template-file= #python tosca_parser.py --template-file= #python tosca_parser.py --template-file= e.g. #python tosca_parser.py --template-file=toscaparser/tests/data/tosca_helloworld.yaml #python tosca_parser.py --template-file=toscaparser/tests/data/CSAR/csar_hello_world.zip """ if __name__ == '__main__': parser_shell.main() ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5203986 tosca_parser-2.15.0/toscaparser/0000775000175000017500000000000015250006257015436 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8063092 tosca_parser-2.15.0/toscaparser/__init__.py0000664000175000017500000000120315250006202017531 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import pbr.version __version__ = pbr.version.VersionInfo( 'tosca-parser').version_string() ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8063092 tosca_parser-2.15.0/toscaparser/capabilities.py0000664000175000017500000000346215250006202020434 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.properties import Property class Capability(object): '''TOSCA built-in capabilities type.''' def __init__(self, name, properties, definition, custom_def=None): self.name = name self._properties = properties self.definition = definition self.custom_def = custom_def def get_properties_objects(self): '''Return a list of property objects.''' properties = [] props = self._properties if props: for name, value in props.items(): props_def = self.definition.get_properties_def() if props_def and name in props_def: properties.append(Property(name, value, props_def[name].schema, self.custom_def)) return properties def get_properties(self): '''Return a dictionary of property name-object pairs.''' return {prop.name: prop for prop in self.get_properties_objects()} def get_property_value(self, name): '''Return the value of a given property name.''' props = self.get_properties() if props and name in props: return props[name].value ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5203986 tosca_parser-2.15.0/toscaparser/common/0000775000175000017500000000000015250006257016726 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8063092 tosca_parser-2.15.0/toscaparser/common/__init__.py0000664000175000017500000000000015250006202021013 0ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8063092 tosca_parser-2.15.0/toscaparser/common/exception.py0000664000175000017500000001661615250006202021276 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ''' TOSCA exception classes ''' import logging import sys import traceback from toscaparser.utils.gettextutils import _ log = logging.getLogger(__name__) class TOSCAException(Exception): '''Base exception class for TOSCA To correctly use this class, inherit from it and define a 'msg_fmt' property. ''' _FATAL_EXCEPTION_FORMAT_ERRORS = False message = _('An unknown exception occurred.') def __init__(self, **kwargs): try: self.message = self.msg_fmt % kwargs except KeyError: exc_info = sys.exc_info() log.exception('Exception in string format operation: %s' % exc_info[1]) if TOSCAException._FATAL_EXCEPTION_FORMAT_ERRORS: raise exc_info[0] def __str__(self): return self.message @staticmethod def generate_inv_schema_property_error(self, attr, value, valid_values): msg = (_('Schema definition of "%(propname)s" has ' '"%(attr)s" attribute with invalid value ' '"%(value1)s". The value must be one of ' '"%(value2)s".') % {"propname": self.name, "attr": attr, "value1": value, "value2": valid_values}) ExceptionCollector.appendException( InvalidSchemaError(message=msg)) @staticmethod def set_fatal_format_exception(flag): if isinstance(flag, bool): TOSCAException._FATAL_EXCEPTION_FORMAT_ERRORS = flag class UnsupportedTypeError(TOSCAException): msg_fmt = _('Type "%(what)s" is valid TOSCA type' ' but not supported at this time.') class MissingRequiredFieldError(TOSCAException): msg_fmt = _('%(what)s is missing required field "%(required)s".') class UnknownFieldError(TOSCAException): msg_fmt = _('%(what)s contains unknown field "%(field)s". Refer to the ' 'definition to verify valid values.') class TypeMismatchError(TOSCAException): msg_fmt = _('%(what)s must be of type "%(type)s".') class InvalidNodeTypeError(TOSCAException): msg_fmt = _('Node type "%(what)s" is not a valid type.') class InvalidTypeError(TOSCAException): msg_fmt = _('Type "%(what)s" is not a valid type.') class InvalidTypeAdditionalRequirementsError(TOSCAException): msg_fmt = _('Additional requirements for type "%(type)s" not met.') class RangeValueError(TOSCAException): msg_fmt = _('The value "%(pvalue)s" of property "%(pname)s" is out of ' 'range "(min:%(vmin)s, max:%(vmax)s)".') class InvalidSchemaError(TOSCAException): msg_fmt = _('%(message)s') class ValidationError(TOSCAException): msg_fmt = _('%(message)s') class UnknownInputError(TOSCAException): msg_fmt = _('Unknown input "%(input_name)s".') class UnknownOutputError(TOSCAException): msg_fmt = _('Unknown output "%(output_name)s" in %(where)s.') class MissingRequiredInputError(TOSCAException): msg_fmt = _('%(what)s is missing required input definition ' 'of input "%(input_name)s".') class MissingRequiredParameterError(TOSCAException): msg_fmt = _('%(what)s is missing required parameter for input ' '"%(input_name)s".') class MissingDefaultValueError(TOSCAException): msg_fmt = _('%(what)s is missing required default value ' 'of input "%(input_name)s".') class MissingRequiredOutputError(TOSCAException): msg_fmt = _('%(what)s is missing required output definition ' 'of output "%(output_name)s".') class InvalidPropertyValueError(TOSCAException): msg_fmt = _('Value of property "%(what)s" is invalid.') class InvalidTemplateVersion(TOSCAException): msg_fmt = _('The template version "%(what)s" is invalid. ' 'Valid versions are "%(valid_versions)s".') class InvalidTOSCAVersionPropertyException(TOSCAException): msg_fmt = _('Value of TOSCA version property "%(what)s" is invalid.') class URLException(TOSCAException): msg_fmt = _('%(what)s') class ToscaExtImportError(TOSCAException): msg_fmt = _('Unable to import extension "%(ext_name)s". ' 'Check to see that it exists and has no ' 'language definition errors.') class ToscaExtAttributeError(TOSCAException): msg_fmt = _('Missing attribute in extension "%(ext_name)s". ' 'Check to see that it has required attributes ' '"%(attrs)s" defined.') class InvalidGroupTargetException(TOSCAException): msg_fmt = _('"%(message)s"') class ExceptionCollector(object): exceptions = [] collecting = False @staticmethod def clear(): del ExceptionCollector.exceptions[:] @staticmethod def start(): ExceptionCollector.clear() ExceptionCollector.collecting = True @staticmethod def stop(): ExceptionCollector.collecting = False @staticmethod def contains(exception): for ex in ExceptionCollector.exceptions: if str(ex) == str(exception): return True return False @staticmethod def appendException(exception): if ExceptionCollector.collecting: if not ExceptionCollector.contains(exception): exception.trace = traceback.extract_stack()[:-1] ExceptionCollector.exceptions.append(exception) else: raise exception @staticmethod def exceptionsCaught(): return len(ExceptionCollector.exceptions) > 0 @staticmethod def getTraceString(traceList): traceString = '' for entry in traceList: f, l, m, c = entry[0], entry[1], entry[2], entry[3] traceString += (_('\t\tFile %(file)s, line %(line)s, in ' '%(method)s\n\t\t\t%(call)s\n') % {'file': f, 'line': l, 'method': m, 'call': c}) return traceString @staticmethod def getExceptionReportEntry(exception, full=True): entry = exception.__class__.__name__ + ': ' + str(exception) if full: entry += '\n' + ExceptionCollector.getTraceString(exception.trace) return entry @staticmethod def getExceptions(): return ExceptionCollector.exceptions @staticmethod def getExceptionsReport(full=True): report = [] for exception in ExceptionCollector.exceptions: report.append( ExceptionCollector.getExceptionReportEntry(exception, full)) return report @staticmethod def assertExceptionMessage(exception, message): err_msg = exception.__name__ + ': ' + message report = ExceptionCollector.getExceptionsReport(False) assert err_msg in report, (_('Could not find "%(msg)s" in "%(rep)s".') % {'rep': report.__str__(), 'msg': err_msg}) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8063092 tosca_parser-2.15.0/toscaparser/dataentity.py0000664000175000017500000002167215250006202020154 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import MissingRequiredFieldError from toscaparser.common.exception import TypeMismatchError from toscaparser.common.exception import UnknownFieldError from toscaparser.elements.constraints import Schema from toscaparser.elements.datatype import DataType from toscaparser.elements.portspectype import PortSpec from toscaparser.elements.scalarunit import ScalarUnit_Frequency from toscaparser.elements.scalarunit import ScalarUnit_Size from toscaparser.elements.scalarunit import ScalarUnit_Time from toscaparser.utils.gettextutils import _ from toscaparser.utils import validateutils class DataEntity(object): '''A complex data value entity.''' def __init__(self, datatypename, value_dict, custom_def=None, prop_name=None): self.custom_def = custom_def self.datatype = DataType(datatypename, custom_def) self.schema = self.datatype.get_all_properties() self.value = value_dict self.property_name = prop_name def validate(self): '''Validate the value by the definition of the datatype.''' # A datatype can not have both 'type' and 'properties' definitions. # If the datatype has 'type' definition if self.datatype.value_type: self.value = DataEntity.validate_datatype(self.datatype.value_type, self.value, None, self.custom_def) schema = Schema(self.property_name, self.datatype.defs) for constraint in schema.constraints: constraint.validate(self.value) # If the datatype has 'properties' definition else: if not isinstance(self.value, dict): ExceptionCollector.appendException( TypeMismatchError(what=self.value, type=self.datatype.type)) allowed_props = [] required_props = [] default_props = {} if self.schema: allowed_props = self.schema.keys() for name, prop_def in self.schema.items(): if prop_def.required: required_props.append(name) if prop_def.default: default_props[name] = prop_def.default # check allowed field for value_key in list(self.value.keys()): if value_key not in allowed_props: ExceptionCollector.appendException( UnknownFieldError(what=(_('Data value of type "%s"') % self.datatype.type), field=value_key)) # check default field for def_key, def_value in list(default_props.items()): if def_key not in list(self.value.keys()): self.value[def_key] = def_value # check missing field missingprop = [] for req_key in required_props: if req_key not in list(self.value.keys()): missingprop.append(req_key) if missingprop: ExceptionCollector.appendException( MissingRequiredFieldError( what=(_('Data value of type "%s"') % self.datatype.type), required=missingprop)) # check every field for name, value in list(self.value.items()): schema_name = self._find_schema(name) if not schema_name: continue prop_schema = Schema(name, schema_name) # check if field value meets type defined DataEntity.validate_datatype(prop_schema.type, value, prop_schema.entry_schema, self.custom_def, None, prop_schema.key_schema) # check if field value meets constraints defined if prop_schema.constraints: for constraint in prop_schema.constraints: if isinstance(value, list): for val in value: constraint.validate(val) else: constraint.validate(value) return self.value def _find_schema(self, name): if self.schema and name in self.schema.keys(): return self.schema[name].schema @staticmethod def validate_datatype(type, value, entry_schema=None, custom_def=None, prop_name=None, key_schema=None): '''Validate value with given type. If type is list or map, validate its entry by entry_schema(if defined) If type is a user-defined complex datatype, custom_def is required. ''' from toscaparser.functions import is_function if is_function(value): return value if type == Schema.STRING: return validateutils.validate_string(value) elif type == Schema.INTEGER: return validateutils.validate_integer(value) elif type == Schema.FLOAT: return validateutils.validate_float(value) elif type == Schema.NUMBER: return validateutils.validate_numeric(value) elif type == Schema.BOOLEAN: return validateutils.validate_boolean(value) elif type == Schema.RANGE: return validateutils.validate_range(value) elif type == Schema.TIMESTAMP: validateutils.validate_timestamp(value) return value elif type == Schema.LIST: validateutils.validate_list(value) if entry_schema: DataEntity.validate_entry(value, entry_schema, custom_def) return value elif type == Schema.SCALAR_UNIT_SIZE: return ScalarUnit_Size(value).validate_scalar_unit() elif type == Schema.SCALAR_UNIT_FREQUENCY: return ScalarUnit_Frequency(value).validate_scalar_unit() elif type == Schema.SCALAR_UNIT_TIME: return ScalarUnit_Time(value).validate_scalar_unit() elif type == Schema.VERSION: return validateutils.TOSCAVersionProperty(value).get_version() elif type == Schema.MAP: validateutils.validate_map(value) if key_schema: DataEntity.validate_key(value, key_schema, custom_def) if entry_schema: DataEntity.validate_entry(value, entry_schema, custom_def) return value elif type == Schema.PORTSPEC: # TODO(TBD) bug 1567063, validate source & target as PortDef type # as complex types not just as integers PortSpec.validate_additional_req(value, prop_name, custom_def) else: data = DataEntity(type, value, custom_def) return data.validate() @staticmethod def validate_entry(value, entry_schema, custom_def=None): '''Validate entries for map and list.''' schema = Schema(None, entry_schema) valuelist = value if isinstance(value, dict): valuelist = list(value.values()) for v in valuelist: DataEntity.validate_datatype(schema.type, v, schema.entry_schema, custom_def, None, schema.key_schema) if schema.constraints: for constraint in schema.constraints: constraint.validate(v) return value def validate_key(value, key_schema, custom_def=None): '''Validate keys for map''' schema = Schema(None, key_schema) valuelist = value if isinstance(value, dict): valuelist = list(value.keys()) for v in valuelist: DataEntity.validate_datatype(schema.type, v, schema.entry_schema, custom_def, None, schema.key_schema) if schema.constraints: for constraint in schema.constraints: constraint.validate(v) return value ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873902.523399 tosca_parser-2.15.0/toscaparser/elements/0000775000175000017500000000000015250006257017252 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8063092 tosca_parser-2.15.0/toscaparser/elements/TOSCA_definition.yaml0000664000175000017500000007615715250006202023225 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ########################################################################## # The content of this file reflects TOSCA Simple Profile in YAML version # 1.0.3. It describes the definition for TOSCA types including Node Type, # Relationship Type, Capability Type and Interfaces. ########################################################################## ########################################################################## # Node Type. # A Node Type is a reusable entity that defines the type of one or more # Node Templates. ########################################################################## node_types: tosca.nodes.Root: description: > The TOSCA root node all other TOSCA base node types derive from. attributes: tosca_id: type: string tosca_name: type: string state: type: string capabilities: feature: type: tosca.capabilities.Node requirements: - dependency: capability: tosca.capabilities.Node node: tosca.nodes.Root relationship: tosca.relationships.DependsOn occurrences: [ 0, UNBOUNDED ] interfaces: Standard: type: tosca.interfaces.node.lifecycle.Standard tosca.nodes.Compute: derived_from: tosca.nodes.Root attributes: private_address: type: string public_address: type: string networks: type: map entry_schema: type: tosca.datatypes.network.NetworkInfo ports: type: map entry_schema: type: tosca.datatypes.network.PortInfo capabilities: host: type: tosca.capabilities.Container binding: type: tosca.capabilities.network.Bindable os: type: tosca.capabilities.OperatingSystem scalable: type: tosca.capabilities.Scalable endpoint: type: tosca.capabilities.Endpoint.Admin requirements: - local_storage: capability: tosca.capabilities.Attachment node: tosca.nodes.BlockStorage relationship: tosca.relationships.AttachesTo occurrences: [0, UNBOUNDED] tosca.nodes.SoftwareComponent: derived_from: tosca.nodes.Root properties: # domain-specific software component version component_version: type: version required: false description: > Software component version. admin_credential: type: tosca.datatypes.Credential required: false requirements: - host: capability: tosca.capabilities.Container node: tosca.nodes.Compute relationship: tosca.relationships.HostedOn tosca.nodes.DBMS: derived_from: tosca.nodes.SoftwareComponent properties: port: required: false type: integer description: > The port the DBMS service will listen to for data and requests. root_password: required: false type: string description: > The root password for the DBMS service. capabilities: host: type: tosca.capabilities.Container valid_source_types: [tosca.nodes.Database] tosca.nodes.Database: derived_from: tosca.nodes.Root properties: user: required: false type: string description: > User account name for DB administration port: required: false type: integer description: > The port the database service will use to listen for incoming data and requests. name: required: false type: string description: > The name of the database. password: required: false type: string description: > The password for the DB user account requirements: - host: capability: tosca.capabilities.Container node: tosca.nodes.DBMS relationship: tosca.relationships.HostedOn capabilities: database_endpoint: type: tosca.capabilities.Endpoint.Database tosca.nodes.WebServer: derived_from: tosca.nodes.SoftwareComponent capabilities: data_endpoint: type: tosca.capabilities.Endpoint admin_endpoint: type: tosca.capabilities.Endpoint.Admin host: type: tosca.capabilities.Container valid_source_types: [tosca.nodes.WebApplication] tosca.nodes.WebApplication: derived_from: tosca.nodes.Root properties: context_root: type: string required: false requirements: - host: capability: tosca.capabilities.Container node: tosca.nodes.WebServer relationship: tosca.relationships.HostedOn capabilities: app_endpoint: type: tosca.capabilities.Endpoint tosca.nodes.BlockStorage: derived_from: tosca.nodes.Root properties: size: type: scalar-unit.size constraints: - greater_or_equal: 1 MB volume_id: type: string required: false snapshot_id: type: string required: false attributes: volume_id: type: string capabilities: attachment: type: tosca.capabilities.Attachment tosca.nodes.network.Network: derived_from: tosca.nodes.Root description: > The TOSCA Network node represents a simple, logical network service. properties: ip_version: type: integer required: false default: 4 constraints: - valid_values: [ 4, 6 ] description: > The IP version of the requested network. Valid values are 4 for ipv4 or 6 for ipv6. cidr: type: string required: false description: > The cidr block of the requested network. start_ip: type: string required: false description: > The IP address to be used as the start of a pool of addresses within the full IP range derived from the cidr block. end_ip: type: string required: false description: > The IP address to be used as the end of a pool of addresses within the full IP range derived from the cidr block. gateway_ip: type: string required: false description: > The gateway IP address. network_name: type: string required: false description: > An identifier that represents an existing Network instance in the underlying cloud infrastructure or can be used as the name of the newly created network. If network_name is provided and no other properties are provided (with exception of network_id), then an existing network instance will be used. If network_name is provided alongside with more properties then a new network with this name will be created. network_id: type: string required: false description: > An identifier that represents an existing Network instance in the underlying cloud infrastructure. This property is mutually exclusive with all other properties except network_name. This can be used alone or together with network_name to identify an existing network. segmentation_id: type: string required: false description: > A segmentation identifier in the underlying cloud infrastructure. E.g. VLAN ID, GRE tunnel ID, etc.. network_type: type: string required: false description: > It specifies the nature of the physical network in the underlying cloud infrastructure. Examples are flat, vlan, gre or vxlan. For flat and vlan types, physical_network should be provided too. physical_network: type: string required: false description: > It identifies the physical network on top of which the network is implemented, e.g. physnet1. This property is required if network_type is flat or vlan. dhcp_enabled: type: boolean required: false default: true description: > Indicates should DHCP service be enabled on the network or not. capabilities: link: type: tosca.capabilities.network.Linkable tosca.nodes.network.Port: derived_from: tosca.nodes.Root description: > The TOSCA Port node represents a logical entity that associates between Compute and Network normative types. The Port node type effectively represents a single virtual NIC on the Compute node instance. properties: ip_address: type: string required: false description: > Allow the user to set a static IP. order: type: integer required: false default: 0 constraints: - greater_or_equal: 0 description: > The order of the NIC on the compute instance (e.g. eth2). is_default: type: boolean required: false default: false description: > If is_default=true this port will be used for the default gateway route. Only one port that is associated to single compute node can set as is_default=true. ip_range_start: type: string required: false description: > Defines the starting IP of a range to be allocated for the compute instances that are associated with this Port. ip_range_end: type: string required: false description: > Defines the ending IP of a range to be allocated for the compute instances that are associated with this Port. attributes: ip_address: type: string requirements: - binding: description: > Binding requirement expresses the relationship between Port and Compute nodes. Effectively it indicates that the Port will be attached to specific Compute node instance capability: tosca.capabilities.network.Bindable relationship: tosca.relationships.network.BindsTo node: tosca.nodes.Compute - link: description: > Link requirement expresses the relationship between Port and Network nodes. It indicates which network this port will connect to. capability: tosca.capabilities.network.Linkable relationship: tosca.relationships.network.LinksTo node: tosca.nodes.network.Network tosca.nodes.network.FloatingIP: derived_from: tosca.nodes.Root description: > The TOSCA FloatingIP node represents a floating IP that can associate to a Port. properties: floating_network: type: string required: true floating_ip_address: type: string required: false port_id: type: string required: false requirements: - link: capability: tosca.capabilities.network.Linkable relationship: tosca.relationships.network.LinksTo node: tosca.nodes.network.Port tosca.nodes.ObjectStorage: derived_from: tosca.nodes.Root description: > The TOSCA ObjectStorage node represents storage that provides the ability to store data as objects (or BLOBs of data) without consideration for the underlying filesystem or devices properties: name: type: string required: true description: > The logical name of the object store (or container). size: type: scalar-unit.size required: false constraints: - greater_or_equal: 0 GB description: > The requested initial storage size. maxsize: type: scalar-unit.size required: false constraints: - greater_or_equal: 0 GB description: > The requested maximum storage size. capabilities: storage_endpoint: type: tosca.capabilities.Endpoint tosca.nodes.LoadBalancer: derived_from: tosca.nodes.Root properties: algorithm: type: string required: false status: experimental capabilities: client: type: tosca.capabilities.Endpoint.Public occurrences: [0, UNBOUNDED] description: the Floating (IP) client’s on the public network can connect to requirements: - application: capability: tosca.capabilities.Endpoint relationship: tosca.relationships.RoutesTo occurrences: [0, UNBOUNDED] description: Connection to one or more load balanced applications tosca.nodes.Container.Application: derived_from: tosca.nodes.Root requirements: - host: capability: tosca.capabilities.Container node: tosca.nodes.Container.Runtime relationship: tosca.relationships.HostedOn tosca.nodes.Container.Runtime: derived_from: tosca.nodes.SoftwareComponent capabilities: host: type: tosca.capabilities.Container scalable: type: tosca.capabilities.Scalable tosca.nodes.Container.Application.Docker: derived_from: tosca.nodes.Container.Application requirements: - host: capability: tosca.capabilities.Container.Docker ########################################################################## # Relationship Type. # A Relationship Type is a reusable entity that defines the type of one # or more relationships between Node Types or Node Templates. ########################################################################## relationship_types: tosca.relationships.Root: description: > The TOSCA root Relationship Type all other TOSCA base Relationship Types derive from. attributes: tosca_id: type: string tosca_name: type: string interfaces: Configure: type: tosca.interfaces.relationship.Configure tosca.relationships.DependsOn: derived_from: tosca.relationships.Root tosca.relationships.HostedOn: derived_from: tosca.relationships.Root valid_target_types: [ tosca.capabilities.Container ] tosca.relationships.ConnectsTo: derived_from: tosca.relationships.Root valid_target_types: [ tosca.capabilities.Endpoint ] credential: type: tosca.datatypes.Credential required: false tosca.relationships.AttachesTo: derived_from: tosca.relationships.Root valid_target_types: [ tosca.capabilities.Attachment ] properties: location: required: true type: string constraints: - min_length: 1 device: required: false type: string tosca.relationships.RoutesTo: derived_from: tosca.relationships.ConnectsTo valid_target_types: [ tosca.capabilities.Endpoint ] tosca.relationships.network.LinksTo: derived_from: tosca.relationships.DependsOn valid_target_types: [ tosca.capabilities.network.Linkable ] tosca.relationships.network.BindsTo: derived_from: tosca.relationships.DependsOn valid_target_types: [ tosca.capabilities.network.Bindable ] ########################################################################## # Capability Type. # A Capability Type is a reusable entity that describes a kind of # capability that a Node Type can declare to expose. ########################################################################## capability_types: tosca.capabilities.Root: description: > The TOSCA root Capability Type all other TOSCA base Capability Types derive from. tosca.capabilities.Node: derived_from: tosca.capabilities.Root tosca.capabilities.Container: derived_from: tosca.capabilities.Root properties: num_cpus: required: false type: integer constraints: - greater_or_equal: 1 cpu_frequency: required: false type: scalar-unit.frequency constraints: - greater_or_equal: 0.1 GHz disk_size: required: false type: scalar-unit.size constraints: - greater_or_equal: 0 MB mem_size: required: false type: scalar-unit.size constraints: - greater_or_equal: 0 MB tosca.capabilities.Endpoint: derived_from: tosca.capabilities.Root properties: protocol: type: string required: true default: tcp port: type: tosca.datatypes.network.PortDef required: false secure: type: boolean required: false default: false url_path: type: string required: false port_name: type: string required: false network_name: type: string required: false default: PRIVATE initiator: type: string required: false default: source constraints: - valid_values: [source, target, peer] ports: type: map required: false constraints: - min_length: 1 entry_schema: type: tosca.datatypes.network.PortSpec attributes: ip_address: type: string tosca.capabilities.Endpoint.Admin: derived_from: tosca.capabilities.Endpoint properties: secure: type: boolean default: true constraints: - equal: true tosca.capabilities.Endpoint.Public: derived_from: tosca.capabilities.Endpoint properties: # Change the default network_name to use the first public network found network_name: type: string default: PUBLIC constraints: - equal: PUBLIC floating: description: > Indicates that the public address should be allocated from a pool of floating IPs that are associated with the network. type: boolean default: false status: experimental dns_name: description: The optional name to register with DNS type: string required: false status: experimental tosca.capabilities.Scalable: derived_from: tosca.capabilities.Root properties: min_instances: type: integer required: true default: 1 description: > This property is used to indicate the minimum number of instances that should be created for the associated TOSCA Node Template by a TOSCA orchestrator. max_instances: type: integer required: true default: 1 description: > This property is used to indicate the maximum number of instances that should be created for the associated TOSCA Node Template by a TOSCA orchestrator. default_instances: type: integer required: false description: > An optional property that indicates the requested default number of instances that should be the starting number of instances a TOSCA orchestrator should attempt to allocate. The value for this property MUST be in the range between the values set for min_instances and max_instances properties. tosca.capabilities.Endpoint.Database: derived_from: tosca.capabilities.Endpoint tosca.capabilities.Attachment: derived_from: tosca.capabilities.Root tosca.capabilities.network.Linkable: derived_from: tosca.capabilities.Root description: > A node type that includes the Linkable capability indicates that it can be pointed by tosca.relationships.network.LinksTo relationship type, which represents an association relationship between Port and Network node types. tosca.capabilities.network.Bindable: derived_from: tosca.capabilities.Root description: > A node type that includes the Bindable capability indicates that it can be pointed by tosca.relationships.network.BindsTo relationship type, which represents a network association relationship between Port and Compute node types. tosca.capabilities.OperatingSystem: derived_from: tosca.capabilities.Root properties: architecture: required: false type: string description: > The host Operating System (OS) architecture. type: required: false type: string description: > The host Operating System (OS) type. distribution: required: false type: string description: > The host Operating System (OS) distribution. Examples of valid values for an “typeâ€� of “Linuxâ€� would include: debian, fedora, rhel and ubuntu. version: required: false type: version description: > The host Operating System version. tosca.capabilities.Container.Docker: derived_from: tosca.capabilities.Container properties: version: type: list required: false entry_schema: type: version description: > The Docker version capability. publish_all: type: boolean default: false required: false description: > Indicates that all ports (ranges) listed in the dockerfile using the EXPOSE keyword be published. publish_ports: type: list entry_schema: type: tosca.datatypes.network.PortSpec required: false description: > List of ports mappings from source (Docker container) to target (host) ports to publish. expose_ports: type: list entry_schema: type: tosca.datatypes.network.PortSpec required: false description: > List of ports mappings from source (Docker container) to expose to other Docker containers (not accessible outside host). volumes: type: list entry_schema: type: string required: false description: > The dockerfile VOLUME command which is used to enable access from the Docker container to a directory on the host machine. host_id: type: string required: false description: > The optional identifier of an existing host resource that should be used to run this container on. volume_id: type: string required: false description: > The optional identifier of an existing storage volume (resource) that should be used to create the container's mount point(s) on. ########################################################################## # Interfaces Type. # The Interfaces element describes a list of one or more interface # definitions for a modelable entity (e.g., a Node or Relationship Type) # as defined within the TOSCA Simple Profile specification. ########################################################################## interface_types: tosca.interfaces.node.lifecycle.Standard: create: description: Standard lifecycle create operation. configure: description: Standard lifecycle configure operation. start: description: Standard lifecycle start operation. stop: description: Standard lifecycle stop operation. delete: description: Standard lifecycle delete operation. tosca.interfaces.relationship.Configure: pre_configure_source: description: Operation to pre-configure the source endpoint. pre_configure_target: description: Operation to pre-configure the target endpoint. post_configure_source: description: Operation to post-configure the source endpoint. post_configure_target: description: Operation to post-configure the target endpoint. add_target: description: Operation to add a target node. remove_target: description: Operation to remove a target node. add_source: > description: Operation to notify the target node of a source node which is now available via a relationship. description: target_changed: > description: Operation to notify source some property or attribute of the target changed ########################################################################## # Data Type. # A Datatype is a complex data type declaration which contains other # complex or simple data types. ########################################################################## data_types: tosca.datatypes.Root: description: > The TOSCA root Data Type all other TOSCA base Data Types derive from tosca.datatypes.network.NetworkInfo: derived_from: tosca.datatypes.Root properties: network_name: type: string network_id: type: string addresses: type: list entry_schema: type: string tosca.datatypes.network.PortInfo: derived_from: tosca.datatypes.Root properties: port_name: type: string port_id: type: string network_id: type: string mac_address: type: string addresses: type: list entry_schema: type: string tosca.datatypes.network.PortDef: derived_from: tosca.datatypes.Root type: integer constraints: - in_range: [ 1, 65535 ] tosca.datatypes.network.PortSpec: derived_from: tosca.datatypes.Root properties: protocol: type: string required: true default: tcp constraints: - valid_values: [ udp, tcp, igmp ] target: type: tosca.datatypes.network.PortDef required: false target_range: type: range required: false constraints: - in_range: [ 1, 65535 ] source: type: tosca.datatypes.network.PortDef required: false source_range: type: range required: false constraints: - in_range: [ 1, 65535 ] tosca.datatypes.Credential: derived_from: tosca.datatypes.Root properties: protocol: type: string required: false token_type: type: string default: password required: true token: type: string required: true keys: type: map entry_schema: type: string required: false user: type: string required: false ########################################################################## # Artifact Type. # An Artifact Type is a reusable entity that defines the type of one or more # files which Node Types or Node Templates can have dependent relationships # and used during operations such as during installation or deployment. ########################################################################## artifact_types: tosca.artifacts.Root: description: > The TOSCA Artifact Type all other TOSCA Artifact Types derive from properties: version: version tosca.artifacts.File: derived_from: tosca.artifacts.Root tosca.artifacts.Deployment: derived_from: tosca.artifacts.Root description: TOSCA base type for deployment artifacts tosca.artifacts.Deployment.Image: derived_from: tosca.artifacts.Deployment tosca.artifacts.Deployment.Image.VM: derived_from: tosca.artifacts.Deployment.Image tosca.artifacts.Implementation: derived_from: tosca.artifacts.Root description: TOSCA base type for implementation artifacts tosca.artifacts.Implementation.Bash: derived_from: tosca.artifacts.Implementation description: Script artifact for the Unix Bash shell mime_type: application/x-sh file_ext: [ sh ] tosca.artifacts.Implementation.Python: derived_from: tosca.artifacts.Implementation description: Artifact for the interpreted Python language mime_type: application/x-python file_ext: [ py ] tosca.artifacts.Deployment.Image.Container.Docker: derived_from: tosca.artifacts.Deployment.Image description: Docker container image tosca.artifacts.Deployment.Image.VM.ISO: derived_from: tosca.artifacts.Deployment.Image description: Virtual Machine (VM) image in ISO disk format mime_type: application/octet-stream file_ext: [ iso ] tosca.artifacts.Deployment.Image.VM.QCOW2: derived_from: tosca.artifacts.Deployment.Image description: Virtual Machine (VM) image in QCOW v2 standard disk format mime_type: application/octet-stream file_ext: [ qcow2 ] # Added in TOSCA1.3 tosca.artifacts.template: derived_from: tosca.artifacts.Root description: TOSCA base type for template type artifacts # Added in TOSCA1.3 tosca.artifacts.template.Jinja2: derived_from: tosca.artifacts.template description: Jinja2 template file # Added in TOSCA1.3 tosca.artifacts.template.Twig: derived_from: tosca.artifacts.template description: Twig template file ########################################################################## # Policy Type. # TOSCA Policy Types represent logical grouping of TOSCA nodes that have # an implied relationship and need to be orchestrated or managed together # to achieve some result. ########################################################################## policy_types: tosca.policies.Root: description: The TOSCA Policy Type all other TOSCA Policy Types derive from. tosca.policies.Placement: derived_from: tosca.policies.Root description: The TOSCA Policy Type definition that is used to govern placement of TOSCA nodes or groups of nodes. tosca.policies.Scaling: derived_from: tosca.policies.Root description: The TOSCA Policy Type definition that is used to govern scaling of TOSCA nodes or groups of nodes. tosca.policies.Monitoring: derived_from: tosca.policies.Root description: The TOSCA Policy Type definition that is used to govern monitoring of TOSCA nodes or groups of nodes. tosca.policies.Update: derived_from: tosca.policies.Root description: The TOSCA Policy Type definition that is used to govern update of TOSCA nodes or groups of nodes. tosca.policies.Performance: derived_from: tosca.policies.Root description: The TOSCA Policy Type definition that is used to declare performance requirements for TOSCA nodes or groups of nodes. tosca.policies.Reservation: derived_from: tosca.policies.Root description: The TOSCA Policy Type definition that is used to create TOSCA nodes or group of nodes based on the reservation. ########################################################################## # Group Type. # Group Type represents logical grouping of TOSCA nodes that have an # implied membership relationship and may need to be orchestrated or # managed together to achieve some result. ########################################################################## group_types: tosca.groups.Root: description: The TOSCA Group Type all other TOSCA Group Types derive from interfaces: Standard: type: tosca.interfaces.node.lifecycle.Standard ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8063092 tosca_parser-2.15.0/toscaparser/elements/__init__.py0000664000175000017500000000000015250006202021337 0ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8073092 tosca_parser-2.15.0/toscaparser/elements/artifacttype.py0000664000175000017500000000400215250006202022305 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.elements.statefulentitytype import StatefulEntityType class ArtifactTypeDef(StatefulEntityType): '''TOSCA built-in artifacts type.''' def __init__(self, atype, custom_def=None): super(ArtifactTypeDef, self).__init__(atype, self.ARTIFACT_PREFIX, custom_def) self.type = atype self.custom_def = custom_def self.properties = None if self.PROPERTIES in self.defs: self.properties = self.defs[self.PROPERTIES] self.parent_artifacts = self._get_parent_artifacts() def _get_parent_artifacts(self): artifacts = {} parent_artif = self.parent_type.type if self.parent_type else None if parent_artif: while parent_artif != 'tosca.artifacts.Root': artifacts[parent_artif] = self.TOSCA_DEF[parent_artif] parent_artif = artifacts[parent_artif]['derived_from'] return artifacts @property def parent_type(self): '''Return a artifact entity from which this entity is derived.''' if not hasattr(self, 'defs'): return None partifact_entity = self.derived_from(self.defs) if partifact_entity: return ArtifactTypeDef(partifact_entity, self.custom_def) def get_artifact(self, name): '''Return the definition of an artifact field by name.''' if name in self.defs: return self.defs[name] ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8073092 tosca_parser-2.15.0/toscaparser/elements/attribute_definition.py0000664000175000017500000000141415250006202024025 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. class AttributeDef(object): '''TOSCA built-in Attribute type.''' def __init__(self, name, value=None, schema=None): self.name = name self.value = value self.schema = schema ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8073092 tosca_parser-2.15.0/toscaparser/elements/capabilitytype.py0000664000175000017500000001007215250006202022635 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.elements.property_definition import PropertyDef from toscaparser.elements.statefulentitytype import StatefulEntityType class CapabilityTypeDef(StatefulEntityType): '''TOSCA built-in capabilities type.''' TOSCA_TYPEURI_CAPABILITY_ROOT = 'tosca.capabilities.Root' def __init__(self, name, ctype, ntype, custom_def=None): self.name = name super(CapabilityTypeDef, self).__init__(ctype, self.CAPABILITY_PREFIX, custom_def) self.nodetype = ntype self.properties = None self.custom_def = custom_def if self.PROPERTIES in self.defs: self.properties = self.defs[self.PROPERTIES] self.parent_capabilities = self._get_parent_capabilities(custom_def) def get_properties_def_objects(self): '''Return a list of property definition objects.''' properties = [] parent_properties = {} if self.parent_capabilities: for type, value in self.parent_capabilities.items(): if self.PROPERTIES in value: parent_properties[type] = value.get(self.PROPERTIES) if self.properties: for prop, schema in self.properties.items(): properties.append(PropertyDef(prop, None, schema)) if parent_properties: for parent, props in parent_properties.items(): for prop, schema in props.items(): # add parent property if not overridden by children type if not self.properties or \ prop not in self.properties.keys(): properties.append(PropertyDef(prop, None, schema)) return properties def get_properties_def(self): '''Return a dictionary of property definition name-object pairs.''' return {prop.name: prop for prop in self.get_properties_def_objects()} def get_property_def_value(self, name): '''Return the definition of a given property name.''' props_def = self.get_properties_def() if props_def and name in props_def: return props_def[name].value def _get_parent_capabilities(self, custom_def=None): capabilities = {} parent_cap = self.parent_type if parent_cap: parent_cap = parent_cap.type while parent_cap != self.TOSCA_TYPEURI_CAPABILITY_ROOT: if custom_def and parent_cap in custom_def.keys(): capabilities[parent_cap] = custom_def[parent_cap] elif parent_cap in self.TOSCA_DEF.keys(): capabilities[parent_cap] = self.TOSCA_DEF[parent_cap] parent_cap = capabilities[parent_cap]['derived_from'] return capabilities @property def parent_type(self): '''Return a capability this capability is derived from.''' if not hasattr(self, 'defs'): return None pnode = self.derived_from(self.defs) if pnode: return CapabilityTypeDef(self.name, pnode, self.nodetype, self.custom_def) def inherits_from(self, type_names): '''Check this capability is in type_names Check if this capability or some of its parent types are in the list of types: type_names ''' if self.type in type_names: return True elif self.parent_type: return self.parent_type.inherits_from(type_names) else: return False ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.808309 tosca_parser-2.15.0/toscaparser/elements/constraints.py0000664000175000017500000005437015250006202022172 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import collections.abc import datetime import re import toscaparser from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import InvalidSchemaError from toscaparser.common.exception import ValidationError from toscaparser.elements.portspectype import PortSpec from toscaparser.elements import scalarunit from toscaparser.utils.gettextutils import _ class Schema(collections.abc.Mapping): KEYS = ( TYPE, REQUIRED, DESCRIPTION, DEFAULT, CONSTRAINTS, KEYSCHEMA, ENTRYSCHEMA, STATUS ) = ( 'type', 'required', 'description', 'default', 'constraints', 'key_schema', 'entry_schema', 'status' ) PROPERTY_TYPES = ( INTEGER, STRING, BOOLEAN, FLOAT, RANGE, NUMBER, TIMESTAMP, LIST, MAP, SCALAR_UNIT_SIZE, SCALAR_UNIT_FREQUENCY, SCALAR_UNIT_TIME, VERSION, PORTDEF, PORTSPEC ) = ( 'integer', 'string', 'boolean', 'float', 'range', 'number', 'timestamp', 'list', 'map', 'scalar-unit.size', 'scalar-unit.frequency', 'scalar-unit.time', 'version', 'PortDef', PortSpec.SHORTNAME ) SCALAR_UNIT_SIZE_DEFAULT = 'B' SCALAR_UNIT_SIZE_DICT = {'B': 1, 'KB': 1000, 'KIB': 1024, 'MB': 1000000, 'MIB': 1048576, 'GB': 1000000000, 'GIB': 1073741824, 'TB': 1000000000000, 'TIB': 1099511627776} def __init__(self, name, schema_dict): self.name = name if not isinstance(schema_dict, collections.abc.Mapping): msg = (_('Schema definition of "%(pname)s" must be a dict.') % dict(pname=name)) ExceptionCollector.appendException(InvalidSchemaError(message=msg)) try: schema_dict['type'] except KeyError: msg = (_('Schema definition of "%(pname)s" must have a "type" ' 'attribute.') % dict(pname=name)) ExceptionCollector.appendException(InvalidSchemaError(message=msg)) self.schema = schema_dict self._len = None self.constraints_list = [] @property def type(self): return self.schema[self.TYPE] @property def required(self): return self.schema.get(self.REQUIRED, True) @property def description(self): return self.schema.get(self.DESCRIPTION, '') @property def default(self): return self.schema.get(self.DEFAULT) @property def status(self): return self.schema.get(self.STATUS, '') @property def constraints(self): if not self.constraints_list: constraint_schemata = self.schema.get(self.CONSTRAINTS) if constraint_schemata: self.constraints_list = [Constraint(self.name, self.type, cschema) for cschema in constraint_schemata] return self.constraints_list @property def key_schema(self): return self.schema.get(self.KEYSCHEMA) @property def entry_schema(self): return self.schema.get(self.ENTRYSCHEMA) def __getitem__(self, key): return self.schema[key] def __iter__(self): for k in self.KEYS: try: self.schema[k] except KeyError: pass else: yield k def __len__(self): if self._len is None: self._len = len(list(iter(self))) return self._len class Constraint(object): '''Parent class for constraints for a Property or Input.''' CONSTRAINTS = (EQUAL, GREATER_THAN, GREATER_OR_EQUAL, LESS_THAN, LESS_OR_EQUAL, IN_RANGE, VALID_VALUES, LENGTH, MIN_LENGTH, MAX_LENGTH, PATTERN) = \ ('equal', 'greater_than', 'greater_or_equal', 'less_than', 'less_or_equal', 'in_range', 'valid_values', 'length', 'min_length', 'max_length', 'pattern') def __new__(cls, property_name=None, property_type=None, constraint=None): if cls is not Constraint: return super(Constraint, cls).__new__(cls) if (not isinstance(constraint, collections.abc.Mapping) or len(constraint) != 1): ExceptionCollector.appendException( InvalidSchemaError(message=_('Invalid constraint schema.'))) for type in constraint.keys(): ConstraintClass = get_constraint_class(type) if not ConstraintClass: msg = _('Invalid property "%s".') % type ExceptionCollector.appendException( InvalidSchemaError(message=msg)) return ConstraintClass(property_name, property_type, constraint) def __init__(self, property_name, property_type, constraint): self.property_name = property_name self.property_type = property_type self.constraint_value = constraint[self.constraint_key] self.constraint_value_msg = self.constraint_value if self.property_type in scalarunit.ScalarUnit.SCALAR_UNIT_TYPES: self.constraint_value = self._get_scalarunit_constraint_value() # check if constraint is valid for property type if property_type not in self.valid_prop_types: msg = _('Property "%(ctype)s" is not valid for data type ' '"%(dtype)s".') % dict( ctype=self.constraint_key, dtype=property_type) ExceptionCollector.appendException(InvalidSchemaError(message=msg)) def _get_scalarunit_constraint_value(self): if self.property_type in scalarunit.ScalarUnit.SCALAR_UNIT_TYPES: ScalarUnit_Class = (scalarunit. get_scalarunit_class(self.property_type)) if isinstance(self.constraint_value, list): return [ScalarUnit_Class(v).get_num_from_scalar_unit() for v in self.constraint_value] else: return (ScalarUnit_Class(self.constraint_value). get_num_from_scalar_unit()) def _err_msg(self, value): return _('Property "%s" could not be validated.') % self.property_name def validate(self, value): self.value_msg = value if self.property_type in scalarunit.ScalarUnit.SCALAR_UNIT_TYPES: value = scalarunit.get_scalarunit_value(self.property_type, value) if not self._is_valid(value): err_msg = self._err_msg(value) ExceptionCollector.appendException( ValidationError(message=err_msg)) class Equal(Constraint): """Constraint class for "equal" Constrains a property or parameter to a value equal to ('=') the value declared. """ constraint_key = Constraint.EQUAL valid_prop_types = Schema.PROPERTY_TYPES def _is_valid(self, value): if value == self.constraint_value: return True return False def _err_msg(self, value): return (_('The value "%(pvalue)s" of property "%(pname)s" is not ' 'equal to "%(cvalue)s".') % dict(pname=self.property_name, pvalue=self.value_msg, cvalue=self.constraint_value_msg)) class GreaterThan(Constraint): """Constraint class for "greater_than" Constrains a property or parameter to a value greater than ('>') the value declared. """ constraint_key = Constraint.GREATER_THAN valid_types = (int, float, datetime.date, datetime.time, datetime.datetime) valid_prop_types = (Schema.INTEGER, Schema.FLOAT, Schema.TIMESTAMP, Schema.SCALAR_UNIT_SIZE, Schema.SCALAR_UNIT_FREQUENCY, Schema.SCALAR_UNIT_TIME) def __init__(self, property_name, property_type, constraint): super(GreaterThan, self).__init__(property_name, property_type, constraint) if not isinstance(constraint[self.GREATER_THAN], self.valid_types): ExceptionCollector.appendException( InvalidSchemaError(message=_('The property "greater_than" ' 'expects comparable values.'))) def _is_valid(self, value): if value > self.constraint_value: return True return False def _err_msg(self, value): return (_('The value "%(pvalue)s" of property "%(pname)s" must be ' 'greater than "%(cvalue)s".') % dict(pname=self.property_name, pvalue=self.value_msg, cvalue=self.constraint_value_msg)) class GreaterOrEqual(Constraint): """Constraint class for "greater_or_equal" Constrains a property or parameter to a value greater than or equal to ('>=') the value declared. """ constraint_key = Constraint.GREATER_OR_EQUAL valid_types = (int, float, datetime.date, datetime.time, datetime.datetime) valid_prop_types = (Schema.INTEGER, Schema.FLOAT, Schema.TIMESTAMP, Schema.SCALAR_UNIT_SIZE, Schema.SCALAR_UNIT_FREQUENCY, Schema.SCALAR_UNIT_TIME) def __init__(self, property_name, property_type, constraint): super(GreaterOrEqual, self).__init__(property_name, property_type, constraint) if not isinstance(self.constraint_value, self.valid_types): ExceptionCollector.appendException( InvalidSchemaError(message=_('The property ' '"greater_or_equal" expects ' 'comparable values.'))) def _is_valid(self, value): if value is not None and (toscaparser.functions.is_function(value) or value >= self.constraint_value): return True return False def _err_msg(self, value): return (_('The value "%(pvalue)s" of property "%(pname)s" must be ' 'greater than or equal to "%(cvalue)s".') % dict(pname=self.property_name, pvalue=self.value_msg, cvalue=self.constraint_value_msg)) class LessThan(Constraint): """Constraint class for "less_than" Constrains a property or parameter to a value less than ('<') the value declared. """ constraint_key = Constraint.LESS_THAN valid_types = (int, float, datetime.date, datetime.time, datetime.datetime) valid_prop_types = (Schema.INTEGER, Schema.FLOAT, Schema.TIMESTAMP, Schema.SCALAR_UNIT_SIZE, Schema.SCALAR_UNIT_FREQUENCY, Schema.SCALAR_UNIT_TIME) def __init__(self, property_name, property_type, constraint): super(LessThan, self).__init__(property_name, property_type, constraint) if not isinstance(self.constraint_value, self.valid_types): ExceptionCollector.appendException( InvalidSchemaError(message=_('The property "less_than" ' 'expects comparable values.'))) def _is_valid(self, value): if value < self.constraint_value: return True return False def _err_msg(self, value): return (_('The value "%(pvalue)s" of property "%(pname)s" must be ' 'less than "%(cvalue)s".') % dict(pname=self.property_name, pvalue=self.value_msg, cvalue=self.constraint_value_msg)) class LessOrEqual(Constraint): """Constraint class for "less_or_equal" Constrains a property or parameter to a value less than or equal to ('<=') the value declared. """ constraint_key = Constraint.LESS_OR_EQUAL valid_types = (int, float, datetime.date, datetime.time, datetime.datetime) valid_prop_types = (Schema.INTEGER, Schema.FLOAT, Schema.TIMESTAMP, Schema.SCALAR_UNIT_SIZE, Schema.SCALAR_UNIT_FREQUENCY, Schema.SCALAR_UNIT_TIME) def __init__(self, property_name, property_type, constraint): super(LessOrEqual, self).__init__(property_name, property_type, constraint) if not isinstance(self.constraint_value, self.valid_types): ExceptionCollector.appendException( InvalidSchemaError(message=_('The property "less_or_equal" ' 'expects comparable values.'))) def _is_valid(self, value): if value <= self.constraint_value: return True return False def _err_msg(self, value): return (_('The value "%(pvalue)s" of property "%(pname)s" must be ' 'less than or equal to "%(cvalue)s".') % dict(pname=self.property_name, pvalue=self.value_msg, cvalue=self.constraint_value_msg)) class InRange(Constraint): """Constraint class for "in_range" Constrains a property or parameter to a value in range of (inclusive) the two values declared. """ UNBOUNDED = 'UNBOUNDED' constraint_key = Constraint.IN_RANGE valid_types = (int, float, datetime.date, datetime.time, datetime.datetime, str) valid_prop_types = (Schema.INTEGER, Schema.FLOAT, Schema.TIMESTAMP, Schema.SCALAR_UNIT_SIZE, Schema.SCALAR_UNIT_FREQUENCY, Schema.SCALAR_UNIT_TIME, Schema.RANGE) def __init__(self, property_name, property_type, constraint): super(InRange, self).__init__(property_name, property_type, constraint) if (not isinstance(self.constraint_value, collections.abc.Sequence) or (len(constraint[self.IN_RANGE]) != 2)): ExceptionCollector.appendException( InvalidSchemaError(message=_('The property "in_range" ' 'expects a list.'))) msg = _('The property "in_range" expects comparable values.') for value in self.constraint_value: if not isinstance(value, self.valid_types): ExceptionCollector.appendException( InvalidSchemaError(message=msg)) # The only string we allow for range is the special value # 'UNBOUNDED' if (isinstance(value, str) and value != self.UNBOUNDED): ExceptionCollector.appendException( InvalidSchemaError(message=msg)) self.min = self.constraint_value[0] self.max = self.constraint_value[1] def _is_valid(self, value): if not isinstance(self.min, str): if value < self.min: return False elif self.min != self.UNBOUNDED: return False if not isinstance(self.max, str): if value > self.max: return False elif self.max != self.UNBOUNDED: return False return True def _err_msg(self, value): return (_('The value "%(pvalue)s" of property "%(pname)s" is out of ' 'range "(min:%(vmin)s, max:%(vmax)s)".') % dict(pname=self.property_name, pvalue=self.value_msg, vmin=self.constraint_value_msg[0], vmax=self.constraint_value_msg[1])) class ValidValues(Constraint): """Constraint class for "valid_values" Constrains a property or parameter to a value that is in the list of declared values. """ constraint_key = Constraint.VALID_VALUES valid_prop_types = Schema.PROPERTY_TYPES def __init__(self, property_name, property_type, constraint): super(ValidValues, self).__init__(property_name, property_type, constraint) if not isinstance(self.constraint_value, collections.abc.Sequence): ExceptionCollector.appendException( InvalidSchemaError(message=_('The property "valid_values" ' 'expects a list.'))) def _is_valid(self, value): if isinstance(value, list): return all(v in self.constraint_value for v in value) return value in self.constraint_value def _err_msg(self, value): allowed = '[%s]' % ', '.join(str(a) for a in self.constraint_value) return (_('The value "%(pvalue)s" of property "%(pname)s" is not ' 'valid. Expected a value from "%(cvalue)s".') % dict(pname=self.property_name, pvalue=value, cvalue=allowed)) class Length(Constraint): """Constraint class for "length" Constrains the property or parameter to a value of a given length. """ constraint_key = Constraint.LENGTH valid_types = (int, ) valid_prop_types = (Schema.STRING, ) def __init__(self, property_name, property_type, constraint): super(Length, self).__init__(property_name, property_type, constraint) if not isinstance(self.constraint_value, self.valid_types): ExceptionCollector.appendException( InvalidSchemaError(message=_('The property "length" expects ' 'an integer.'))) def _is_valid(self, value): if isinstance(value, str) and len(value) == self.constraint_value: return True return False def _err_msg(self, value): return (_('Length of value "%(pvalue)s" of property "%(pname)s" ' 'must be equal to "%(cvalue)s".') % dict(pname=self.property_name, pvalue=value, cvalue=self.constraint_value)) class MinLength(Constraint): """Constraint class for "min_length" Constrains the property or parameter to a value to a minimum length. """ constraint_key = Constraint.MIN_LENGTH valid_types = (int, ) valid_prop_types = (Schema.STRING, Schema.MAP, Schema.LIST) def __init__(self, property_name, property_type, constraint): super(MinLength, self).__init__(property_name, property_type, constraint) if not isinstance(self.constraint_value, self.valid_types): ExceptionCollector.appendException( InvalidSchemaError(message=_('The property "min_length" ' 'expects an integer.'))) def _is_valid(self, value): if (isinstance(value, (str, dict, list)) and len(value) >= self.constraint_value): return True return False def _err_msg(self, value): return (_('Length of value "%(pvalue)s" of property "%(pname)s" ' 'must be at least "%(cvalue)s".') % dict(pname=self.property_name, pvalue=value, cvalue=self.constraint_value)) class MaxLength(Constraint): """Constraint class for "max_length" Constrains the property or parameter to a value to a maximum length. """ constraint_key = Constraint.MAX_LENGTH valid_types = (int, ) valid_prop_types = (Schema.STRING, Schema.MAP, Schema.LIST) def __init__(self, property_name, property_type, constraint): super(MaxLength, self).__init__(property_name, property_type, constraint) if not isinstance(self.constraint_value, self.valid_types): ExceptionCollector.appendException( InvalidSchemaError(message=_('The property "max_length" ' 'expects an integer.'))) def _is_valid(self, value): if (isinstance(value, (str, dict, list)) and len(value) <= self.constraint_value): return True return False def _err_msg(self, value): return (_('Length of value "%(pvalue)s" of property "%(pname)s" ' 'must be no greater than "%(cvalue)s".') % dict(pname=self.property_name, pvalue=value, cvalue=self.constraint_value)) class Pattern(Constraint): """Constraint class for "pattern" Constrains the property or parameter to a value that is allowed by the provided regular expression. """ constraint_key = Constraint.PATTERN valid_types = (str, ) valid_prop_types = (Schema.STRING, ) def __init__(self, property_name, property_type, constraint): super(Pattern, self).__init__(property_name, property_type, constraint) if not isinstance(self.constraint_value, self.valid_types): ExceptionCollector.appendException( InvalidSchemaError(message=_('The property "pattern" ' 'expects a string.'))) self.match = re.compile(self.constraint_value).match def _is_valid(self, value): match = self.match(value) return match is not None and match.end() == len(value) def _err_msg(self, value): return (_('The value "%(pvalue)s" of property "%(pname)s" does not ' 'match pattern "%(cvalue)s".') % dict(pname=self.property_name, pvalue=value, cvalue=self.constraint_value)) constraint_mapping = { Constraint.EQUAL: Equal, Constraint.GREATER_THAN: GreaterThan, Constraint.GREATER_OR_EQUAL: GreaterOrEqual, Constraint.LESS_THAN: LessThan, Constraint.LESS_OR_EQUAL: LessOrEqual, Constraint.IN_RANGE: InRange, Constraint.VALID_VALUES: ValidValues, Constraint.LENGTH: Length, Constraint.MIN_LENGTH: MinLength, Constraint.MAX_LENGTH: MaxLength, Constraint.PATTERN: Pattern } def get_constraint_class(type): return constraint_mapping.get(type) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.808309 tosca_parser-2.15.0/toscaparser/elements/datatype.py0000664000175000017500000000424015250006202021425 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.elements.statefulentitytype import StatefulEntityType class DataType(StatefulEntityType): '''TOSCA built-in and user defined complex data type.''' def __init__(self, datatypename, custom_def=None): super(DataType, self).__init__(datatypename, self.DATATYPE_NETWORK_PREFIX, custom_def) self.custom_def = custom_def @property def parent_type(self): '''Return a datatype this datatype is derived from.''' ptype = self.derived_from(self.defs) if ptype: return DataType(ptype, self.custom_def) return None @property def value_type(self): '''Return 'type' section in the datatype schema.''' return self.entity_value(self.defs, 'type') def get_all_properties_objects(self): '''Return all properties objects defined in type and parent type.''' props_def = self.get_properties_def_objects() ptype = self.parent_type while ptype: props_def.extend(ptype.get_properties_def_objects()) ptype = ptype.parent_type return props_def def get_all_properties(self): '''Return a dictionary of all property definition name-object pairs.''' return {prop.name: prop for prop in self.get_all_properties_objects()} def get_all_property_value(self, name): '''Return the value of a given property name.''' props_def = self.get_all_properties() if props_def and name in props_def.key(): return props_def[name].value ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.808309 tosca_parser-2.15.0/toscaparser/elements/entity_type.py0000664000175000017500000001405015250006202022167 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import copy import logging import os from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import ValidationError from toscaparser.extensions.exttools import ExtTools import toscaparser.utils.yamlparser log = logging.getLogger('tosca') class EntityType(object): '''Base class for TOSCA elements.''' SECTIONS = (DERIVED_FROM, PROPERTIES, ATTRIBUTES, REQUIREMENTS, INTERFACES, CAPABILITIES, TYPE, ARTIFACTS) = \ ('derived_from', 'properties', 'attributes', 'requirements', 'interfaces', 'capabilities', 'type', 'artifacts') TOSCA_DEF_SECTIONS = ['node_types', 'data_types', 'artifact_types', 'group_types', 'relationship_types', 'capability_types', 'interface_types', 'policy_types'] '''TOSCA definition file.''' TOSCA_DEF_FILE = os.path.join( os.path.dirname(os.path.abspath(__file__)), "TOSCA_definition.yaml") loader = toscaparser.utils.yamlparser.load_yaml TOSCA_DEF_LOAD_AS_IS = loader(TOSCA_DEF_FILE) # Map of definition with pre-loaded values of TOSCA_DEF_FILE_SECTIONS TOSCA_DEF = {} for section in TOSCA_DEF_SECTIONS: if section in TOSCA_DEF_LOAD_AS_IS.keys(): value = TOSCA_DEF_LOAD_AS_IS[section] for key in value.keys(): TOSCA_DEF[key] = value[key] RELATIONSHIP_TYPE = (DEPENDSON, HOSTEDON, CONNECTSTO, ATTACHESTO, LINKSTO, BINDSTO) = \ ('tosca.relationships.DependsOn', 'tosca.relationships.HostedOn', 'tosca.relationships.ConnectsTo', 'tosca.relationships.AttachesTo', 'tosca.relationships.network.LinksTo', 'tosca.relationships.network.BindsTo') NODE_PREFIX = 'tosca.nodes.' RELATIONSHIP_PREFIX = 'tosca.relationships.' CAPABILITY_PREFIX = 'tosca.capabilities.' INTERFACE_PREFIX = 'tosca.interfaces.' ARTIFACT_PREFIX = 'tosca.artifacts.' POLICY_PREFIX = 'tosca.policies.' GROUP_PREFIX = 'tosca.groups.' # currently the data types are defined only for network # but may have changes in the future. DATATYPE_PREFIX = 'tosca.datatypes.' DATATYPE_NETWORK_PREFIX = DATATYPE_PREFIX + 'network.' TOSCA = 'tosca' def derived_from(self, defs): '''Return a type this type is derived from.''' return self.entity_value(defs, 'derived_from') def is_derived_from(self, type_str): '''Check if object inherits from the given type. Returns true if this object is derived from 'type_str'. False otherwise. ''' if not self.type: return False elif self.type == type_str: return True elif self.parent_type: return self.parent_type.is_derived_from(type_str) else: return False def entity_value(self, defs, key): if defs and key in defs: return defs[key] def get_value(self, ndtype, defs=None, parent=None): value = None if defs is None: if not hasattr(self, 'defs'): return None defs = self.defs if defs and ndtype in defs: # copy the value to avoid that next operations add items in the # item definitions value = copy.copy(defs[ndtype]) if parent: p = self if p: while p: if p.defs and ndtype in p.defs: # get the parent value parent_value = p.defs[ndtype] if value: if isinstance(value, dict): for k, v in parent_value.items(): if k not in value.keys(): value[k] = v if isinstance(value, list): for p_value in parent_value: if p_value not in value: value.append(p_value) else: value = copy.copy(parent_value) p = p.parent_type return value def get_definition(self, ndtype): value = None if not hasattr(self, 'defs'): defs = None ExceptionCollector.appendException( ValidationError(message="defs is " + str(defs))) else: defs = self.defs if defs is not None and ndtype in defs: value = defs[ndtype] p = self.parent_type if p: inherited = p.get_definition(ndtype) if inherited: inherited = dict(inherited) if not value: value = inherited else: inherited.update(value) value.update(inherited) return value def update_definitions(version): exttools = ExtTools() extension_defs_file = exttools.get_defs_file(version) loader = toscaparser.utils.yamlparser.load_yaml nfv_def_file = loader(extension_defs_file) nfv_def = {} for section in EntityType.TOSCA_DEF_SECTIONS: if section in nfv_def_file.keys(): value = nfv_def_file[section] for key in value.keys(): nfv_def[key] = value[key] EntityType.TOSCA_DEF.update(nfv_def) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.808309 tosca_parser-2.15.0/toscaparser/elements/grouptype.py0000664000175000017500000000760115250006202021654 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import InvalidTypeError from toscaparser.common.exception import UnknownFieldError from toscaparser.elements.statefulentitytype import StatefulEntityType class GroupType(StatefulEntityType): '''TOSCA built-in group type.''' # In TOSCA1.3, the section name 'interfaces' is not defined for group type. # It will be ignored if the 'interfaces' is defined as TOSCA1.3. SECTIONS = (DERIVED_FROM, VERSION, METADATA, DESCRIPTION, PROPERTIES, MEMBERS, INTERFACES, ATTRIBUTES) = \ ("derived_from", "version", "metadata", "description", "properties", "members", "interfaces", "attributes") def __init__(self, grouptype, custom_def=None): super(GroupType, self).__init__(grouptype, self.GROUP_PREFIX, custom_def) self.custom_def = custom_def self.grouptype = grouptype self._validate_fields() self.group_description = None if self.DESCRIPTION in self.defs: self.group_description = self.defs[self.DESCRIPTION] self.group_version = None if self.VERSION in self.defs: self.group_version = self.defs[self.VERSION] self.group_properties = None if self.PROPERTIES in self.defs: self.group_properties = self.defs[self.PROPERTIES] self.group_members = None if self.MEMBERS in self.defs: self.group_members = self.defs[self.MEMBERS] if self.METADATA in self.defs: self.meta_data = self.defs[self.METADATA] self._validate_metadata(self.meta_data) @property def parent_type(self): '''Return a group statefulentity of this entity is derived from.''' if not hasattr(self, 'defs'): return None pgroup_entity = self.derived_from(self.defs) if pgroup_entity: return GroupType(pgroup_entity, self.custom_def) @property def description(self): return self.group_description @property def version(self): return self.group_version @property def interfaces(self): return self.get_value(self.INTERFACES) def _validate_fields(self): if self.defs: for name in self.defs.keys(): if name not in self.SECTIONS: ExceptionCollector.appendException( UnknownFieldError(what='Group Type %s' % self.grouptype, field=name)) def _validate_metadata(self, meta_data): if not meta_data.get('type') in ['map', 'tosca:map']: ExceptionCollector.appendException( InvalidTypeError(what='"%s" defined in group for ' 'metadata' % (meta_data.get('type')))) for entry_schema, entry_schema_type in meta_data.items(): if isinstance(entry_schema_type, dict) and not \ entry_schema_type.get('type') == 'string': ExceptionCollector.appendException( InvalidTypeError(what='"%s" defined in group for ' 'metadata "%s"' % (entry_schema_type.get('type'), entry_schema))) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.808309 tosca_parser-2.15.0/toscaparser/elements/interfaces.py0000664000175000017500000000776515250006202021754 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import UnknownFieldError from toscaparser.elements.statefulentitytype import StatefulEntityType SECTIONS = (LIFECYCLE, CONFIGURE, LIFECYCLE_SHORTNAME, CONFIGURE_SHORTNAME) = \ ('tosca.interfaces.node.lifecycle.Standard', 'tosca.interfaces.relationship.Configure', 'Standard', 'Configure') INTERFACEVALUE = (IMPLEMENTATION, INPUTS, OUTPUTS) = \ ('implementation', 'inputs', 'outputs') INTERFACE_DEF_RESERVED_WORDS = ['type', 'inputs', 'derived_from', 'version', 'description'] class InterfacesDef(StatefulEntityType): '''TOSCA built-in interfaces type.''' def __init__(self, node_type, interfacename, node_template=None, name=None, value=None): self.ntype = node_type self.node_template = node_template self.type = interfacename self.interfacename = interfacename self.name = name self.value = value self.implementation = None self.inputs = None self.outputs = None self.defs = {} if interfacename == LIFECYCLE_SHORTNAME: self.interfacetype = LIFECYCLE elif interfacename == CONFIGURE_SHORTNAME: self.interfacetype = CONFIGURE elif hasattr(self.ntype, 'interfaces') \ and self.ntype.interfaces \ and interfacename in self.ntype.interfaces: self.interfacetype = self.ntype.interfaces[interfacename]['type'] if not self.interfacetype: ExceptionCollector.appendException( TypeError("Interface type for interface \"{0}\" not found" .format(self.interfacename)) ) if node_type: if self.node_template and self.node_template.custom_def \ and self.interfacetype in self.node_template.custom_def: self.defs = self.node_template.custom_def[self.interfacetype] elif self.interfacetype in self.TOSCA_DEF: self.defs = self.TOSCA_DEF[self.interfacetype] if not self.defs: ExceptionCollector.appendException( TypeError("Interface type definition for interface \"{0}\" " "not found".format(self.interfacetype)) ) if value: if isinstance(self.value, dict): for i, j in self.value.items(): if i == IMPLEMENTATION: self.implementation = j elif i == INPUTS: self.inputs = j elif i == OUTPUTS: self.outputs = j else: what = ('"interfaces" of template "%s"' % self.node_template.name) ExceptionCollector.appendException( UnknownFieldError(what=what, field=i)) else: self.implementation = value @property def lifecycle_ops(self): if self.defs: if self.type == LIFECYCLE: return self._ops() @property def configure_ops(self): if self.defs: if self.type == CONFIGURE: return self._ops() def _ops(self): ops = [] for name in list(self.defs.keys()): ops.append(name) return ops ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.808309 tosca_parser-2.15.0/toscaparser/elements/nodetype.py0000664000175000017500000002236215250006202021446 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import UnknownFieldError from toscaparser.elements.capabilitytype import CapabilityTypeDef import toscaparser.elements.interfaces as ifaces from toscaparser.elements.interfaces import InterfacesDef from toscaparser.elements.relationshiptype import RelationshipType from toscaparser.elements.statefulentitytype import StatefulEntityType class NodeType(StatefulEntityType): '''TOSCA built-in node type.''' SECTIONS = (DERIVED_FROM, METADATA, PROPERTIES, VERSION, DESCRIPTION, ATTRIBUTES, REQUIREMENTS, CAPABILITIES, INTERFACES, ARTIFACTS) = \ ('derived_from', 'metadata', 'properties', 'version', 'description', 'attributes', 'requirements', 'capabilities', 'interfaces', 'artifacts') def __init__(self, ntype, custom_def=None): super(NodeType, self).__init__(ntype, self.NODE_PREFIX, custom_def) self.ntype = ntype self.custom_def = custom_def self._validate_keys() @property def parent_type(self): '''Return a node this node is derived from.''' if not hasattr(self, 'defs'): return None pnode = self.derived_from(self.defs) if pnode: return NodeType(pnode, self.custom_def) @property def relationship(self): '''Return a dictionary of relationships to other node types. This method returns a dictionary of named relationships that nodes of the current node type (self) can have to other nodes (of specific types) in a TOSCA template. ''' relationship = {} requires = self.get_all_requirements() if requires: # NOTE(sdmonov): Check if requires is a dict. # If it is a dict convert it to a list of dicts. # This is needed because currently the code below supports only # lists as requirements definition. The following check will # make sure if a map (dict) was provided it will be converted to # a list before proceeding to the parsing. if isinstance(requires, dict): requires = [{key: value} for key, value in requires.items()] keyword = None node_type = None for require in requires: for key, req in require.items(): if 'relationship' in req: relation = req.get('relationship') if 'type' in relation: relation = relation.get('type') node_type = req.get('node') value = req if node_type: keyword = 'node' else: # If value is a dict and has a type key # we need to lookup the node type using # the capability type value = req if isinstance(value, dict): captype = value['capability'] value = (self. _get_node_type_by_cap(captype)) keyword = key node_type = value rtype = RelationshipType(relation, keyword, self.custom_def) relatednode = NodeType(node_type, self.custom_def) relationship[rtype] = relatednode return relationship def _get_node_type_by_cap(self, cap): '''Find the node type that has the provided capability This method will lookup all node types if they have the provided capability. ''' # Filter the node types node_types = [node_type for node_type in self.TOSCA_DEF.keys() if node_type.startswith(self.NODE_PREFIX) and node_type != 'tosca.nodes.Root'] custom_node_types = [node_type for node_type in self.custom_def.keys() if node_type.startswith(self.NODE_PREFIX) and node_type != 'tosca.nodes.Root'] for node_type in node_types + custom_node_types: if node_type in self.TOSCA_DEF: node_def = self.TOSCA_DEF[node_type] else: node_def = self.custom_def[node_type] if isinstance(node_def, dict) and 'capabilities' in node_def: node_caps = node_def['capabilities'] for value in node_caps.values(): if isinstance(value, dict) and \ 'type' in value and value['type'] == cap: return node_type def _get_relation(self, key, ndtype): relation = None ntype = NodeType(ndtype, self.custom_def) caps = ntype.get_capabilities() if caps and key in caps.keys(): c = caps[key] for r in self.RELATIONSHIP_TYPE: rtypedef = ntype.TOSCA_DEF[r] for properties in rtypedef.values(): if c.type in properties: relation = r break if relation: break else: for properties in rtypedef.values(): if c.parent_type in properties: relation = r break return relation def get_capabilities_objects(self): '''Return a list of capability objects.''' typecapabilities = [] caps = self.get_value(self.CAPABILITIES, None, True) if caps: # 'name' is symbolic name of the capability # 'value' is a dict { 'type': } for name, value in caps.items(): ctype = value.get('type') cap = CapabilityTypeDef(name, ctype, self.type, self.custom_def) typecapabilities.append(cap) return typecapabilities def get_capabilities(self): '''Return a dictionary of capability name-objects pairs.''' return {cap.name: cap for cap in self.get_capabilities_objects()} @property def requirements(self): return self.get_value(self.REQUIREMENTS, None, True) def get_all_requirements(self): return self.requirements @property def interfaces(self): interfaces = self.get_value(self.INTERFACES) if self.parent_type is not None: if self.parent_type.interfaces is not None: import copy parent_interfaces = copy.deepcopy(self.parent_type.interfaces) parent_interfaces.pop(ifaces.LIFECYCLE, None) parent_interfaces.pop(ifaces.CONFIGURE, None) parent_interfaces.pop(ifaces.LIFECYCLE_SHORTNAME, None) parent_interfaces.pop(ifaces.CONFIGURE_SHORTNAME, None) if parent_interfaces: if interfaces: parent_interfaces.update(interfaces) interfaces = parent_interfaces return interfaces @property def lifecycle_inputs(self): '''Return inputs to life cycle operations if found.''' inputs = [] interfaces = self.interfaces if interfaces: for name, value in interfaces.items(): if name == ifaces.LIFECYCLE: for x, y in value.items(): if x == 'inputs': for i in y.iterkeys(): inputs.append(i) return inputs @property def lifecycle_operations(self): '''Return available life cycle operations if found.''' ops = None interfaces = self.interfaces if interfaces: i = InterfacesDef(self.type, ifaces.LIFECYCLE) ops = i.lifecycle_ops return ops def get_capability(self, name): caps = self.get_capabilities() if caps and name in caps.keys(): return caps[name].value def get_capability_type(self, name): captype = self.get_capability(name) if captype and name in captype.keys(): return captype[name].value def _validate_keys(self): if self.defs: for key in self.defs.keys(): if key not in self.SECTIONS: ExceptionCollector.appendException( UnknownFieldError(what='Nodetype"%s"' % self.ntype, field=key)) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.808309 tosca_parser-2.15.0/toscaparser/elements/policytype.py0000664000175000017500000001232715250006202022020 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import InvalidTypeError from toscaparser.common.exception import UnknownFieldError from toscaparser.elements.statefulentitytype import StatefulEntityType from toscaparser.utils.validateutils import TOSCAVersionProperty class PolicyType(StatefulEntityType): '''TOSCA built-in policies type.''' SECTIONS = (DERIVED_FROM, METADATA, PROPERTIES, VERSION, DESCRIPTION, TARGETS, TRIGGERS, TYPE, RESERVATION) = \ ('derived_from', 'metadata', 'properties', 'version', 'description', 'targets', 'triggers', 'type', 'reservation') def __init__(self, ptype, custom_def=None): super(PolicyType, self).__init__(ptype, self.POLICY_PREFIX, custom_def) self.type = ptype self.custom_def = custom_def self._validate_keys() self.meta_data = None if self.METADATA in self.defs: self.meta_data = self.defs[self.METADATA] self._validate_metadata(self.meta_data) self.properties = None if self.PROPERTIES in self.defs: self.properties = self.defs[self.PROPERTIES] self.parent_policies = self._get_parent_policies() self.policy_version = None if self.VERSION in self.defs: self.policy_version = TOSCAVersionProperty( self.defs[self.VERSION]).get_version() self.policy_description = self.defs[self.DESCRIPTION] \ if self.DESCRIPTION in self.defs else None self.targets_list = None if self.TARGETS in self.defs: self.targets_list = self.defs[self.TARGETS] self._validate_targets(self.targets_list, custom_def) self.reservation = None if self.RESERVATION in self.defs: self.reservation = self.defs[self.RESERVATION] def _get_parent_policies(self): policies = {} parent_policy = self.parent_type.type if self.parent_type else None if parent_policy: while parent_policy != 'tosca.policies.Root': if parent_policy in self.TOSCA_DEF: policies[parent_policy] = self.TOSCA_DEF[parent_policy] parent_policy = policies[parent_policy]['derived_from'] elif self.custom_def and parent_policy in self.custom_def: policies[parent_policy] = self.custom_def[parent_policy] parent_policy = policies[parent_policy]['derived_from'] return policies @property def parent_type(self): '''Return a policy statefulentity of this node is derived from.''' if not hasattr(self, 'defs'): return None ppolicy_entity = self.derived_from(self.defs) if ppolicy_entity: return PolicyType(ppolicy_entity, self.custom_def) def get_policy(self, name): '''Return the definition of a policy field by name.''' if name in self.defs: return self.defs[name] @property def targets(self): '''Return targets.''' return self.targets_list @property def description(self): return self.policy_description @property def version(self): return self.policy_version def _validate_keys(self): for key in self.defs.keys(): if key not in self.SECTIONS: ExceptionCollector.appendException( UnknownFieldError(what='Policy "%s"' % self.type, field=key)) def _validate_targets(self, targets_list, custom_def): for nodetype in targets_list: if nodetype not in custom_def: ExceptionCollector.appendException( InvalidTypeError(what='"%s" defined in targets for ' 'policy "%s"' % (nodetype, self.type))) def _validate_metadata(self, meta_data): if not meta_data.get('type') in ['map', 'tosca:map']: ExceptionCollector.appendException( InvalidTypeError(what='"%s" defined in policy for ' 'metadata' % (meta_data.get('type')))) for entry_schema, entry_schema_type in meta_data.items(): if isinstance(entry_schema_type, dict) and not \ entry_schema_type.get('type') == 'string': ExceptionCollector.appendException( InvalidTypeError(what='"%s" defined in policy for ' 'metadata "%s"' % (entry_schema_type.get('type'), entry_schema))) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.808309 tosca_parser-2.15.0/toscaparser/elements/portspectype.py0000664000175000017500000000732515250006202022362 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import InvalidTypeAdditionalRequirementsError from toscaparser.utils.gettextutils import _ import toscaparser.utils.validateutils as validateutils log = logging.getLogger('tosca') class PortSpec(object): '''Parent class for tosca.datatypes.network.PortSpec type.''' SHORTNAME = 'PortSpec' TYPE_URI = 'tosca.datatypes.network.' + SHORTNAME PROPERTY_NAMES = ( PROTOCOL, SOURCE, SOURCE_RANGE, TARGET, TARGET_RANGE ) = ( 'protocol', 'source', 'source_range', 'target', 'target_range' ) # TODO(TBD) May want to make this a subclass of DataType # and change init method to set PortSpec's properties def __init__(self): pass # The following additional requirements MUST be tested: # 1) A valid PortSpec MUST have at least one of the following properties: # target, target_range, source or source_range. # 2) A valid PortSpec MUST have a value for the source property that # is within the numeric range specified by the property source_range # when source_range is specified. # 3) A valid PortSpec MUST have a value for the target property that is # within the numeric range specified by the property target_range # when target_range is specified. @staticmethod def validate_additional_req(properties, prop_name, custom_def=None, ): try: source = properties.get(PortSpec.SOURCE) source_range = properties.get(PortSpec.SOURCE_RANGE) target = properties.get(PortSpec.TARGET) target_range = properties.get(PortSpec.TARGET_RANGE) # verify one of the specified values is set if source is None and source_range is None and \ target is None and target_range is None: ExceptionCollector.appendException( InvalidTypeAdditionalRequirementsError( type=PortSpec.TYPE_URI)) # Validate source value is in specified range if source and source_range: validateutils.validate_value_in_range(source, source_range, PortSpec.SOURCE) else: from toscaparser.dataentity import DataEntity portdef = DataEntity('PortDef', source, None, PortSpec.SOURCE) portdef.validate() # Validate target value is in specified range if target and target_range: validateutils.validate_value_in_range(target, target_range, PortSpec.TARGET) else: from toscaparser.dataentity import DataEntity portdef = DataEntity('PortDef', source, None, PortSpec.TARGET) portdef.validate() except Exception: msg = _('"%(value)s" do not meet requirements ' 'for type "%(type)s".') \ % {'value': properties, 'type': PortSpec.SHORTNAME} ExceptionCollector.appendException( ValueError(msg)) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.808309 tosca_parser-2.15.0/toscaparser/elements/property_definition.py0000664000175000017500000000771215250006202023715 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import InvalidSchemaError from toscaparser.common.exception import TOSCAException from toscaparser.utils.gettextutils import _ class PropertyDef(object): '''TOSCA built-in Property type.''' VALID_PROPERTY_KEYNAMES = (PROPERTY_KEYNAME_DEFAULT, PROPERTY_KEYNAME_REQUIRED, PROPERTY_KEYNAME_STATUS) = \ ('default', 'required', 'status') PROPERTY_REQUIRED_DEFAULT = True VALID_REQUIRED_VALUES = ['true', 'false'] VALID_STATUS_VALUES = (PROPERTY_STATUS_SUPPORTED, PROPERTY_STATUS_EXPERIMENTAL) = \ ('supported', 'experimental') PROPERTY_STATUS_DEFAULT = PROPERTY_STATUS_SUPPORTED def __init__(self, name, value=None, schema=None): self.name = name self.value = value self.schema = schema self._status = self.PROPERTY_STATUS_DEFAULT self._required = self.PROPERTY_REQUIRED_DEFAULT # Validate required 'type' property exists try: self.schema['type'] except KeyError: msg = (_('Schema definition of "%(pname)s" must have a "type" ' 'attribute.') % dict(pname=self.name)) ExceptionCollector.appendException( InvalidSchemaError(message=msg)) if self.schema: self._load_required_attr_from_schema() self._load_status_attr_from_schema() @property def default(self): if self.schema: for prop_key, prop_value in self.schema.items(): if prop_key == self.PROPERTY_KEYNAME_DEFAULT: return prop_value return None @property def required(self): return self._required def _load_required_attr_from_schema(self): # IF 'required' keyname exists verify it's a boolean, # if so override default if self.PROPERTY_KEYNAME_REQUIRED in self.schema: value = self.schema[self.PROPERTY_KEYNAME_REQUIRED] if isinstance(value, bool): self._required = value else: valid_values = ', '.join(self.VALID_REQUIRED_VALUES) attr = self.PROPERTY_KEYNAME_REQUIRED TOSCAException.generate_inv_schema_property_error(self, attr, value, valid_values) @property def status(self): return self._status def _load_status_attr_from_schema(self): # IF 'status' keyname exists verify it's a valid value, # if so override default if self.PROPERTY_KEYNAME_STATUS in self.schema: value = self.schema[self.PROPERTY_KEYNAME_STATUS] if value in self.VALID_STATUS_VALUES: self._status = value else: valid_values = ', '.join(self.VALID_STATUS_VALUES) attr = self.PROPERTY_KEYNAME_STATUS TOSCAException.generate_inv_schema_property_error(self, attr, value, valid_values) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.808309 tosca_parser-2.15.0/toscaparser/elements/relationshiptype.py0000664000175000017500000000516115250006202023220 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import UnknownFieldError from toscaparser.elements.statefulentitytype import StatefulEntityType class RelationshipType(StatefulEntityType): '''TOSCA built-in relationship type.''' SECTIONS = (DERIVED_FROM, VALID_TARGET_TYPES, INTERFACES, ATTRIBUTES, PROPERTIES, DESCRIPTION, VERSION, CREDENTIAL) = ('derived_from', 'valid_target_types', 'interfaces', 'attributes', 'properties', 'description', 'version', 'credential') def __init__(self, type, capability_name=None, custom_def=None): super(RelationshipType, self).__init__(type, self.RELATIONSHIP_PREFIX, custom_def) self.capability_name = capability_name self.custom_def = custom_def self._validate_keys() @property def parent_type(self): '''Return a relationship this reletionship is derived from.''' prel = self.derived_from(self.defs) if prel: return RelationshipType(prel, custom_def=self.custom_def) @property def interfaces(self): interfaces = self.get_value(self.INTERFACES) if self.parent_type is not None: if self.parent_type.interfaces is not None: import copy parent_interfaces = copy.deepcopy(self.parent_type.interfaces) if parent_interfaces: if interfaces: parent_interfaces.update(interfaces) interfaces = parent_interfaces return interfaces @property def valid_target_types(self): return self.entity_value(self.defs, 'valid_target_types') def _validate_keys(self): for key in self.defs.keys(): if key not in self.SECTIONS: ExceptionCollector.appendException( UnknownFieldError(what='Relationshiptype "%s"' % self.type, field=key)) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.808309 tosca_parser-2.15.0/toscaparser/elements/scalarunit.py0000664000175000017500000001126415250006202021763 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging import re from toscaparser.common.exception import ExceptionCollector from toscaparser.utils.gettextutils import _ from toscaparser.utils import validateutils log = logging.getLogger('tosca') class ScalarUnit(object): '''Parent class for scalar-unit type.''' SCALAR_UNIT_TYPES = ( SCALAR_UNIT_SIZE, SCALAR_UNIT_FREQUENCY, SCALAR_UNIT_TIME ) = ( 'scalar-unit.size', 'scalar-unit.frequency', 'scalar-unit.time' ) def __init__(self, value): self.value = value def _check_unit_in_scalar_standard_units(self, input_unit): """Check whether the input unit is following specified standard If unit is not following specified standard, convert it to standard unit after displaying a warning message. """ if input_unit in self.SCALAR_UNIT_DICT.keys(): return input_unit else: for key in self.SCALAR_UNIT_DICT.keys(): if key.upper() == input_unit.upper(): log.warning('The unit "%(unit)s" does not follow ' 'scalar unit standards; using "%(key)s" ' 'instead.' % {'unit': input_unit, 'key': key}) return key msg = (_('The unit "%(unit)s" is not valid. Valid units are ' '"%(valid_units)s".') % {'unit': input_unit, 'valid_units': sorted(self.SCALAR_UNIT_DICT.keys())}) ExceptionCollector.appendException(ValueError(msg)) def validate_scalar_unit(self): regex = re.compile(r'([0-9.]+)\s*(\w+)') try: result = regex.match(str(self.value)).groups() validateutils.str_to_num(result[0]) scalar_unit = self._check_unit_in_scalar_standard_units(result[1]) self.value = ' '.join([result[0], scalar_unit]) return self.value except Exception: ExceptionCollector.appendException( ValueError(_('"%s" is not a valid scalar-unit.') % self.value)) def get_num_from_scalar_unit(self, unit=None): if unit: unit = self._check_unit_in_scalar_standard_units(unit) else: unit = self.SCALAR_UNIT_DEFAULT self.validate_scalar_unit() regex = re.compile(r'([0-9.]+)\s*(\w+)') if regex.match(str(self.value)): result = regex.match(str(self.value)).groups() converted = (float(validateutils.str_to_num(result[0])) * self.SCALAR_UNIT_DICT[result[1]] / self.SCALAR_UNIT_DICT[unit]) if converted - int(converted) < 0.0000000000001: converted = int(converted) return converted else: return None class ScalarUnit_Size(ScalarUnit): SCALAR_UNIT_DEFAULT = 'B' SCALAR_UNIT_DICT = {'B': 1, 'kB': 1000, 'KiB': 1024, 'MB': 1000000, 'MiB': 1048576, 'GB': 1000000000, 'GiB': 1073741824, 'TB': 1000000000000, 'TiB': 1099511627776} class ScalarUnit_Time(ScalarUnit): SCALAR_UNIT_DEFAULT = 'ms' SCALAR_UNIT_DICT = {'d': 86400, 'h': 3600, 'm': 60, 's': 1, 'ms': 0.001, 'us': 0.000001, 'ns': 0.000000001} class ScalarUnit_Frequency(ScalarUnit): SCALAR_UNIT_DEFAULT = 'GHz' SCALAR_UNIT_DICT = {'Hz': 1, 'kHz': 1000, 'MHz': 1000000, 'GHz': 1000000000} scalarunit_mapping = { ScalarUnit.SCALAR_UNIT_FREQUENCY: ScalarUnit_Frequency, ScalarUnit.SCALAR_UNIT_SIZE: ScalarUnit_Size, ScalarUnit.SCALAR_UNIT_TIME: ScalarUnit_Time, } def get_scalarunit_class(type): return scalarunit_mapping.get(type) def get_scalarunit_value(type, value, unit=None): if type in ScalarUnit.SCALAR_UNIT_TYPES: ScalarUnit_Class = get_scalarunit_class(type) return (ScalarUnit_Class(value). get_num_from_scalar_unit(unit)) else: ExceptionCollector.appendException( TypeError(_('"%s" is not a valid scalar-unit type.') % type)) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8093092 tosca_parser-2.15.0/toscaparser/elements/statefulentitytype.py0000664000175000017500000000771515250006202023612 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import InvalidTypeError from toscaparser.elements.attribute_definition import AttributeDef from toscaparser.elements.entity_type import EntityType from toscaparser.elements.property_definition import PropertyDef from toscaparser.unsupportedtype import UnsupportedType class StatefulEntityType(EntityType): '''Class representing TOSCA states.''' interfaces_node_lifecycle_operations = ['create', 'configure', 'start', 'stop', 'delete'] interfaces_relationship_configure_operations = ['post_configure_source', 'post_configure_target', 'add_target', 'remove_target'] def __init__(self, entitytype, prefix, custom_def=None): entire_entitytype = entitytype if UnsupportedType.validate_type(entire_entitytype): self.defs = None else: if entitytype.startswith(self.TOSCA + ":"): entitytype = entitytype[(len(self.TOSCA) + 1):] entire_entitytype = prefix + entitytype if not entitytype.startswith(self.TOSCA): entire_entitytype = prefix + entitytype if custom_def and entitytype in list(custom_def.keys()): self.defs = custom_def[entitytype] elif entire_entitytype in list(self.TOSCA_DEF.keys()): self.defs = self.TOSCA_DEF[entire_entitytype] entitytype = entire_entitytype else: self.defs = None ExceptionCollector.appendException( InvalidTypeError(what=entitytype)) self.type = entitytype def get_properties_def_objects(self): '''Return a list of property definition objects.''' properties = [] props = self.get_definition(self.PROPERTIES) if props: for prop, schema in props.items(): properties.append(PropertyDef(prop, None, schema)) return properties def get_properties_def(self): '''Return a dictionary of property definition name-object pairs.''' return {prop.name: prop for prop in self.get_properties_def_objects()} def get_property_def_value(self, name): '''Return the property definition associated with a given name.''' props_def = self.get_properties_def() if props_def and name in props_def.keys(): return props_def[name].value def get_attributes_def_objects(self): '''Return a list of attribute definition objects.''' attrs = self.get_value(self.ATTRIBUTES, parent=True) if attrs: return [AttributeDef(attr, None, schema) for attr, schema in attrs.items()] return [] def get_attributes_def(self): '''Return a dictionary of attribute definition name-object pairs.''' return {attr.name: attr for attr in self.get_attributes_def_objects()} def get_attribute_def_value(self, name): '''Return the attribute definition associated with a given name.''' attrs_def = self.get_attributes_def() if attrs_def and name in attrs_def.keys(): return attrs_def[name].value ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8093092 tosca_parser-2.15.0/toscaparser/elements/tosca_type_validation.py0000664000175000017500000000543515250006202024205 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import InvalidTemplateVersion from toscaparser.common.exception import UnknownFieldError from toscaparser.extensions.exttools import ExtTools class TypeValidation(object): ALLOWED_TYPE_SECTIONS = (DEFINITION_VERSION, DESCRIPTION, IMPORTS, DSL_DEFINITIONS, NODE_TYPES, REPOSITORIES, DATA_TYPES, ARTIFACT_TYPES, GROUP_TYPES, RELATIONSHIP_TYPES, CAPABILITY_TYPES, INTERFACE_TYPES, POLICY_TYPES, TOPOLOGY_TEMPLATE, METADATA) = \ ('tosca_definitions_version', 'description', 'imports', 'dsl_definitions', 'node_types', 'repositories', 'data_types', 'artifact_types', 'group_types', 'relationship_types', 'capability_types', 'interface_types', 'policy_types', 'topology_template', 'metadata') VALID_TEMPLATE_VERSIONS = ['tosca_simple_yaml_1_0', 'tosca_simple_yaml_1_2', 'tosca_simple_yaml_1_3'] exttools = ExtTools() VALID_TEMPLATE_VERSIONS.extend(exttools.get_versions()) def __init__(self, custom_types, import_def): self.import_def = import_def self._validate_type_keys(custom_types) def _validate_type_keys(self, custom_type): version = custom_type[self.DEFINITION_VERSION] \ if self.DEFINITION_VERSION in custom_type \ else None if version: self._validate_type_version(version) self.version = version for name in custom_type: if name not in self.ALLOWED_TYPE_SECTIONS: ExceptionCollector.appendException( UnknownFieldError(what='Template ' + str(self.import_def), field=name)) def _validate_type_version(self, version): if version not in self.VALID_TEMPLATE_VERSIONS: ExceptionCollector.appendException( InvalidTemplateVersion( what=version + ' in ' + str(self.import_def), valid_versions='", "'. join(self.VALID_TEMPLATE_VERSIONS))) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8093092 tosca_parser-2.15.0/toscaparser/entity_template.py0000664000175000017500000003752115250006202021215 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.capabilities import Capability from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import MissingRequiredFieldError from toscaparser.common.exception import UnknownFieldError from toscaparser.common.exception import ValidationError from toscaparser.elements.grouptype import GroupType from toscaparser.elements.interfaces import InterfacesDef from toscaparser.elements.nodetype import NodeType from toscaparser.elements.policytype import PolicyType from toscaparser.elements.relationshiptype import RelationshipType from toscaparser.properties import Property from toscaparser.unsupportedtype import UnsupportedType from toscaparser.utils.gettextutils import _ class EntityTemplate(object): '''Base class for TOSCA templates.''' SECTIONS = (DERIVED_FROM, PROPERTIES, REQUIREMENTS, INTERFACES, CAPABILITIES, TYPE, DESCRIPTION, DIRECTIVES, ATTRIBUTES, ARTIFACTS, NODE_FILTER, COPY) = \ ('derived_from', 'properties', 'requirements', 'interfaces', 'capabilities', 'type', 'description', 'directives', 'attributes', 'artifacts', 'node_filter', 'copy') REQUIREMENTS_SECTION = (NODE, CAPABILITY, RELATIONSHIP, OCCURRENCES, NODE_FILTER) = \ ('node', 'capability', 'relationship', 'occurrences', 'node_filter') # Special key names SPECIAL_SECTIONS = (METADATA) = ('metadata') def __init__(self, name, template, entity_name, custom_def=None): self.name = name self.entity_tpl = template self.custom_def = custom_def self._validate_field(self.entity_tpl) type = self.entity_tpl.get('type') UnsupportedType.validate_type(type) if entity_name == 'node_type': self.type_definition = NodeType(type, custom_def) \ if type is not None else None if entity_name == 'relationship_type': relationship = template.get('relationship') type = None if relationship and isinstance(relationship, dict): type = relationship.get('type') elif isinstance(relationship, str): type = self.entity_tpl['relationship'] else: type = self.entity_tpl['type'] UnsupportedType.validate_type(type) self.type_definition = RelationshipType(type, None, custom_def) if entity_name == 'policy_type': if not type: msg = (_('Policy definition of "%(pname)s" must have' ' a "type" ''attribute.') % dict(pname=name)) ExceptionCollector.appendException( ValidationError(msg)) self.type_definition = PolicyType(type, custom_def) if entity_name == 'group_type': self.type_definition = GroupType(type, custom_def) \ if type is not None else None self._properties = None self._interfaces = None self._requirements = None self._capabilities = None self._attributes = None @property def type(self): if self.type_definition: return self.type_definition.type @property def parent_type(self): if self.type_definition: return self.type_definition.parent_type @property def requirements(self): if self._requirements is None: self._requirements = self.type_definition.get_value( self.REQUIREMENTS, self.entity_tpl) or [] return self._requirements @property def attributes(self): if self._attributes is None: self._attributes = self.type_definition.get_value( self.ATTRIBUTES, self.entity_tpl) or [] return self._attributes def get_properties_objects(self): '''Return properties objects for this template.''' if self._properties is None: self._properties = self._create_properties() return self._properties def get_properties(self): '''Return a dictionary of property name-object pairs.''' return {prop.name: prop for prop in self.get_properties_objects()} def get_property_value(self, name): '''Return the value of a given property name.''' props = self.get_properties() if props and name in props.keys(): return props[name].value @property def interfaces(self): if self._interfaces is None: self._interfaces = self._create_interfaces() return self._interfaces def get_capabilities_objects(self): '''Return capabilities objects for this template.''' if not self._capabilities: self._capabilities = self._create_capabilities() return self._capabilities def get_capabilities(self): '''Return a dictionary of capability name-object pairs.''' return {cap.name: cap for cap in self.get_capabilities_objects()} def is_derived_from(self, type_str): '''Check if object inherits from the given type. Returns true if this object is derived from 'type_str'. False otherwise. ''' if not self.type: return False elif self.type == type_str: return True elif self.parent_type: return self.parent_type.is_derived_from(type_str) else: return False def _create_capabilities(self): capability = [] caps = self.type_definition.get_value(self.CAPABILITIES, self.entity_tpl, True) if caps: for name, props in caps.items(): capabilities = self.type_definition.get_capabilities() if name in capabilities.keys(): c = capabilities[name] properties = {} # first use the definition default value if c.properties: for property_name in c.properties.keys(): prop_def = c.properties[property_name] if 'default' in prop_def: properties[property_name] = prop_def['default'] # then update (if available) with the node properties if 'properties' in props and props['properties']: properties.update(props['properties']) cap = Capability(name, properties, c, self.custom_def) capability.append(cap) return capability def _validate_properties(self, template, entitytype): properties = entitytype.get_value(self.PROPERTIES, template) self._common_validate_properties(entitytype, properties) def _validate_capabilities(self): type_capabilities = self.type_definition.get_capabilities() allowed_caps = \ type_capabilities.keys() if type_capabilities else [] capabilities = self.type_definition.get_value(self.CAPABILITIES, self.entity_tpl) if capabilities: self._common_validate_field(capabilities, allowed_caps, 'capabilities') self._validate_capabilities_properties(capabilities) def _validate_capabilities_properties(self, capabilities): for cap, props in capabilities.items(): capability = self.get_capability(cap) if not capability: continue capabilitydef = capability.definition self._common_validate_properties(capabilitydef, props[self.PROPERTIES]) # validating capability properties values for prop in self.get_capability(cap).get_properties_objects(): prop.validate() # TODO(srinivas_tadepalli): temporary work around to validate # default_instances until standardized in specification if cap == "scalable" and prop.name == "default_instances": prop_dict = props[self.PROPERTIES] min_instances = prop_dict.get("min_instances") max_instances = prop_dict.get("max_instances") default_instances = prop_dict.get("default_instances") if not (min_instances <= default_instances <= max_instances): err_msg = ('"properties" of template "%s": ' '"default_instances" value is not between ' '"min_instances" and "max_instances".' % self.name) ExceptionCollector.appendException( ValidationError(message=err_msg)) def _common_validate_properties(self, entitytype, properties): allowed_props = [] required_props = [] for p in entitytype.get_properties_def_objects(): allowed_props.append(p.name) # If property is 'required' and has no 'default' value then record if p.required and p.default is None: required_props.append(p.name) # validate all required properties have values if properties: req_props_no_value_or_default = [] self._common_validate_field(properties, allowed_props, 'properties') # make sure it's not missing any property required by a tosca type for r in required_props: if r not in properties.keys(): req_props_no_value_or_default.append(r) # Required properties found without value or a default value if req_props_no_value_or_default: ExceptionCollector.appendException( MissingRequiredFieldError( what='"properties" of template "%s"' % self.name, required=req_props_no_value_or_default)) else: # Required properties in schema, but not in template if required_props: ExceptionCollector.appendException( MissingRequiredFieldError( what='"properties" of template "%s"' % self.name, required=required_props)) def _validate_field(self, template): if not isinstance(template, dict): ExceptionCollector.appendException( MissingRequiredFieldError( what='Template "%s"' % self.name, required=self.TYPE)) try: relationship = template.get('relationship') if relationship and not isinstance(relationship, str): relationship[self.TYPE] elif isinstance(relationship, str): template['relationship'] else: template[self.TYPE] except KeyError: ExceptionCollector.appendException( MissingRequiredFieldError( what='Template "%s"' % self.name, required=self.TYPE)) def _common_validate_field(self, schema, allowedlist, section): for name in schema: if name not in allowedlist: ExceptionCollector.appendException( UnknownFieldError( what=('"%(section)s" of template "%(nodename)s"' % {'section': section, 'nodename': self.name}), field=name)) def _create_properties(self): props = [] properties = self.type_definition.get_value(self.PROPERTIES, self.entity_tpl) or {} for name, value in properties.items(): props_def = self.type_definition.get_properties_def() if props_def and name in props_def: prop = Property(name, value, props_def[name].schema, self.custom_def) props.append(prop) for p in self.type_definition.get_properties_def_objects(): if p.default is not None and p.name not in properties.keys(): prop = Property(p.name, p.default, p.schema, self.custom_def) props.append(prop) return props def _create_interfaces(self): interfaces = [] type_interfaces = None if isinstance(self.type_definition, RelationshipType): if isinstance(self.entity_tpl, dict): if self.INTERFACES in self.entity_tpl: type_interfaces = self.entity_tpl[self.INTERFACES] else: for rel_def, value in self.entity_tpl.items(): if rel_def != 'type': rel_def = self.entity_tpl.get(rel_def) rel = None if isinstance(rel_def, dict): rel = rel_def.get('relationship') if rel: if self.INTERFACES in rel: type_interfaces = rel[self.INTERFACES] break else: type_interfaces = self.type_definition.get_value(self.INTERFACES, self.entity_tpl) if type_interfaces: for interface_type, value in type_interfaces.items(): # If there is 'notifications' as a key name in the Interface # definition, it will be determined that it is TOSCA1.3 and # will be processed. if 'notifications' in value: value_notifications = value['notifications'] for no, no_def in value_notifications.items(): iface = InterfacesDef(self.type_definition, interfacename=interface_type, node_template=self, name=no, value=no_def) interfaces.append(iface) # If there is 'operations' as a key name in the Interface # definition, it will be determined that it is TOSCA1.3 and # will be processed. As a result of this process, the # operation_name named 'operations' cannot be set in TOSCA1.2. if 'operations' in value: value = value['operations'] for op, op_def in value.items(): iface = InterfacesDef(self.type_definition, interfacename=interface_type, node_template=self, name=op, value=op_def) interfaces.append(iface) return interfaces def get_capability(self, name): """Provide named capability :param name: name of capability :return: capability object if found, None otherwise """ caps = self.get_capabilities() if caps and name in caps.keys(): return caps[name] ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5243993 tosca_parser-2.15.0/toscaparser/extensions/0000775000175000017500000000000015250006257017635 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8093092 tosca_parser-2.15.0/toscaparser/extensions/__init__.py0000664000175000017500000000000015250006202021722 0ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8093092 tosca_parser-2.15.0/toscaparser/extensions/exttools.py0000664000175000017500000000475115250006202022065 0ustar00zuulzuul# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import collections import importlib import logging import os from stevedore import extension from toscaparser.common.exception import ToscaExtAttributeError from toscaparser.common.exception import ToscaExtImportError log = logging.getLogger("tosca.model") REQUIRED_ATTRIBUTES = ['VERSION', 'DEFS_FILE'] class ExtTools(object): def __init__(self): self.EXTENSION_INFO = self._load_extensions() def _load_extensions(self): '''Dynamically load all the extensions .''' extensions = collections.OrderedDict() extns = extension.ExtensionManager(namespace='toscaparser.extensions', invoke_on_load=True).extensions for e in extns: try: extinfo = importlib.import_module(e.plugin.__module__) base_path = os.path.dirname(extinfo.__file__) version = e.plugin().VERSION defs_file = base_path + '/' + e.plugin().DEFS_FILE # Sections is an optional attribute sections = getattr(e.plugin(), 'SECTIONS', ()) extensions[version] = {'sections': sections, 'defs_file': defs_file} except ImportError: raise ToscaExtImportError(ext_name=e.name) except AttributeError: attrs = ', '.join(REQUIRED_ATTRIBUTES) raise ToscaExtAttributeError(ext_name=e.name, attrs=attrs) return extensions def get_versions(self): return sorted(self.EXTENSION_INFO.keys()) def get_sections(self): sections = {} for version in self.EXTENSION_INFO.keys(): sections[version] = self.EXTENSION_INFO[version]['sections'] return sections def get_defs_file(self, version): versiondata = self.EXTENSION_INFO.get(version) if versiondata: return versiondata.get('defs_file') else: return None ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5243993 tosca_parser-2.15.0/toscaparser/extensions/mec/0000775000175000017500000000000015250006257020401 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8103092 tosca_parser-2.15.0/toscaparser/extensions/mec/TOSCA_mec_definition_1_0_0.yaml0000664000175000017500000001330715250006202026042 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ########################################################################## # The content of this file reflects TOSCA NFV Profile in YAML version # 1.0.0. It describes the definition for TOSCA NFV types including Node Type, # Relationship Type, Capability Type and Interfaces. ########################################################################## tosca_definitions_version: tosca_simple_profile_for_mec_1_0_0 ########################################################################## # Node Type. # A Node Type is a reusable entity that defines the type of one or more # Node Templates. ########################################################################## node_types: tosca.nodes.mec.MEA: derived_from: tosca.nodes.Root # Or should this be its own top - level type? properties: id: type: string description: ID of this MEA vendor: type: string description: name of the vendor who generate this MEA version: type: version description: version of the software for this MEA requirements: - virtualLink: capability: tosca.capabilities.mec.VirtualLinkable relationship: tosca.relationships.mec.VirtualLinksTo node: tosca.nodes.mec.VL tosca.nodes.mec.VDU: derived_from: tosca.nodes.Compute capabilities: high_availability: type: tosca.capabilities.mec.HA virtualbinding: type: tosca.capabilities.mec.VirtualBindable monitoring_parameter: type: tosca.capabilities.mec.Metric requirements: - high_availability: capability: tosca.capabilities.mec.HA relationship: tosca.relationships.mec.HA node: tosca.nodes.mec.VDU occurrences: [ 0, 1 ] tosca.nodes.mec.CP: derived_from: tosca.nodes.network.Port properties: type: type: string required: false requirements: - virtualLink: capability: tosca.capabilities.mec.VirtualLinkable relationship: tosca.relationships.mec.VirtualLinksTo node: tosca.nodes.mec.VL - virtualBinding: capability: tosca.capabilities.mec.VirtualBindable relationship: tosca.relationships.mec.VirtualBindsTo node: tosca.nodes.mec.VDU attributes: address: type: string tosca.nodes.mec.VL: derived_from: tosca.nodes.network.Network properties: vendor: type: string required: true description: name of the vendor who generate this VL capabilities: virtual_linkable: type: tosca.capabilities.mec.VirtualLinkable tosca.nodes.mec.VL.ELine: derived_from: tosca.nodes.mec.VL capabilities: virtual_linkable: occurrences: 2 tosca.nodes.mec.VL.ELAN: derived_from: tosca.nodes.mec.VL tosca.nodes.mec.VL.ETree: derived_from: tosca.nodes.mec.VL tosca.nodes.mec.FP: derived_from: tosca.nodes.Root properties: policy: type: string required: false description: name of the vendor who generate this VL requirements: - forwarder: capability: tosca.capabilities.mec.Forwarder relationship: tosca.relationships.mec.ForwardsTo ########################################################################## # Relationship Type. # A Relationship Type is a reusable entity that defines the type of one # or more relationships between Node Types or Node Templates. ########################################################################## relationship_types: tosca.relationships.mec.VirtualLinksTo: derived_from: tosca.relationships.network.LinksTo valid_target_types: [ tosca.capabilities.mec.VirtualLinkable ] tosca.relationships.mec.VirtualBindsTo: derived_from: tosca.relationships.network.BindsTo valid_target_types: [ tosca.capabilities.mec.VirtualBindable ] tosca.relationships.mec.HA: derived_from: tosca.relationships.Root valid_target_types: [ tosca.capabilities.mec.HA ] tosca.relationships.mec.Monitor: derived_from: tosca.relationships.ConnectsTo valid_target_types: [ tosca.capabilities.mec.Metric ] tosca.relationships.mec.ForwardsTo: derived_from: tosca.relationships.root valid_target_types: [ tosca.capabilities.mec.Forwarder] ########################################################################## # Capability Type. # A Capability Type is a reusable entity that describes a kind of # capability that a Node Type can declare to expose. ########################################################################## capability_types: tosca.capabilities.mec.VirtualLinkable: derived_from: tosca.capabilities.network.Linkable tosca.capabilities.mec.VirtualBindable: derived_from: tosca.capabilities.network.Bindable tosca.capabilities.mec.HA: derived_from: tosca.capabilities.Root valid_source_types: [ tosca.nodes.mec.VDU ] tosca.capabilities.mec.HA.ActiveActive: derived_from: tosca.capabilities.mec.HA tosca.capabilities.mec.HA.ActivePassive: derived_from: tosca.capabilities.mec.HA tosca.capabilities.mec.Metric: derived_from: tosca.capabilities.Root tosca.capabilities.mec.Forwarder: derived_from: tosca.capabilities.Root././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8103092 tosca_parser-2.15.0/toscaparser/extensions/mec/__init__.py0000664000175000017500000000000015250006202022466 0ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8103092 tosca_parser-2.15.0/toscaparser/extensions/mec/tosca_simple_profile_for_mec_1_0_0.py0000664000175000017500000000143215250006202027513 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # VERSION and DEFS_FILE are required for all extensions class MecProfile_1_0_0(object): VERSION = 'tosca_simple_profile_for_mec_1_0_0' DEFS_FILE = "TOSCA_mec_definition_1_0_0.yaml" SECTIONS = ('metadata') ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5253994 tosca_parser-2.15.0/toscaparser/extensions/nfv/0000775000175000017500000000000015250006257020426 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8103092 tosca_parser-2.15.0/toscaparser/extensions/nfv/TOSCA_nfv_definition_1_0_0.yaml0000664000175000017500000002033715250006202026115 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ########################################################################## # The content of this file reflects TOSCA NFV Profile in YAML version # 1.0.0. It describes the definition for TOSCA NFV types including Node Type, # Relationship Type, Capability Type and Interfaces. ########################################################################## tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0 ########################################################################## # Node Type. # A Node Type is a reusable entity that defines the type of one or more # Node Templates. ########################################################################## node_types: tosca.nodes.nfv.VNF: derived_from: tosca.nodes.Root # Or should this be its own top - level type? properties: id: type: string description: ID of this VNF vendor: type: string description: name of the vendor who generate this VNF version: type: version description: version of the software for this VNF requirements: - virtualLink: capability: tosca.capabilities.nfv.VirtualLinkable relationship: tosca.relationships.nfv.VirtualLinksTo node: tosca.nodes.nfv.VL tosca.nodes.nfv.VDU: derived_from: tosca.nodes.Compute capabilities: high_availability: type: tosca.capabilities.nfv.HA virtualbinding: type: tosca.capabilities.nfv.VirtualBindable monitoring_parameter: type: tosca.capabilities.nfv.Metric requirements: - high_availability: capability: tosca.capabilities.nfv.HA relationship: tosca.relationships.nfv.HA node: tosca.nodes.nfv.VDU occurrences: [ 0, 1 ] tosca.nodes.nfv.CP: derived_from: tosca.nodes.network.Port properties: type: type: string required: false requirements: - virtualLink: capability: tosca.capabilities.nfv.VirtualLinkable relationship: tosca.relationships.nfv.VirtualLinksTo node: tosca.nodes.nfv.VL - virtualBinding: capability: tosca.capabilities.nfv.VirtualBindable relationship: tosca.relationships.nfv.VirtualBindsTo node: tosca.nodes.nfv.VDU attributes: address: type: string tosca.nodes.nfv.VL: derived_from: tosca.nodes.network.Network properties: vendor: type: string required: true description: name of the vendor who generate this VL capabilities: virtual_linkable: type: tosca.capabilities.nfv.VirtualLinkable tosca.nodes.nfv.VL.ELine: derived_from: tosca.nodes.nfv.VL capabilities: virtual_linkable: occurrences: 2 tosca.nodes.nfv.VL.ELAN: derived_from: tosca.nodes.nfv.VL tosca.nodes.nfv.VL.ETree: derived_from: tosca.nodes.nfv.VL tosca.nodes.nfv.FP: derived_from: tosca.nodes.Root properties: policy: type: string required: false description: name of the vendor who generate this VL requirements: - forwarder: capability: tosca.capabilities.nfv.Forwarder relationship: tosca.relationships.nfv.ForwardsTo ########################################################################## # Relationship Type. # A Relationship Type is a reusable entity that defines the type of one # or more relationships between Node Types or Node Templates. ########################################################################## relationship_types: tosca.relationships.nfv.VirtualLinksTo: derived_from: tosca.relationships.network.LinksTo valid_target_types: [ tosca.capabilities.nfv.VirtualLinkable ] tosca.relationships.nfv.VirtualBindsTo: derived_from: tosca.relationships.network.BindsTo valid_target_types: [ tosca.capabilities.nfv.VirtualBindable ] tosca.relationships.nfv.HA: derived_from: tosca.relationships.Root valid_target_types: [ tosca.capabilities.nfv.HA ] tosca.relationships.nfv.Monitor: derived_from: tosca.relationships.ConnectsTo valid_target_types: [ tosca.capabilities.nfv.Metric ] tosca.relationships.nfv.ForwardsTo: derived_from: tosca.relationships.root valid_target_types: [ tosca.capabilities.nfv.Forwarder] ########################################################################## # Capability Type. # A Capability Type is a reusable entity that describes a kind of # capability that a Node Type can declare to expose. ########################################################################## capability_types: tosca.capabilities.nfv.VirtualLinkable: derived_from: tosca.capabilities.network.Linkable tosca.capabilities.nfv.VirtualBindable: derived_from: tosca.capabilities.network.Bindable tosca.capabilities.nfv.HA: derived_from: tosca.capabilities.Root valid_source_types: [ tosca.nodes.nfv.VDU ] tosca.capabilities.nfv.HA.ActiveActive: derived_from: tosca.capabilities.nfv.HA tosca.capabilities.nfv.HA.ActivePassive: derived_from: tosca.capabilities.nfv.HA tosca.capabilities.nfv.Metric: derived_from: tosca.capabilities.Root tosca.capabilities.nfv.Forwarder: derived_from: tosca.capabilities.Root ########################################################################## # Interfaces Type. # The Interfaces element describes a list of one or more interface # definitions for a modelable entity (e.g., a Node or Relationship Type) # as defined within the TOSCA Simple Profile specification. ########################################################################## ########################################################################## # Data Type. # A Datatype is a complex data type declaration which contains other # complex or simple data types. ########################################################################## ########################################################################## # Artifact Type. # An Artifact Type is a reusable entity that defines the type of one or more # files which Node Types or Node Templates can have dependent relationships # and used during operations such as during installation or deployment. ########################################################################## ########################################################################## # Policy Type. # TOSCA Policy Types represent logical grouping of TOSCA nodes that have # an implied relationship and need to be orchestrated or managed together # to achieve some result. ########################################################################## ########################################################################## # Group Type # ########################################################################## group_types: tosca.groups.nfv.VNFFG: derived_from: tosca.groups.Root properties: vendor: type: string required: true description: name of the vendor who generate this VNFFG version: type: string required: true description: version of this VNFFG number_of_endpoints: type: integer required: true description: count of the external endpoints included in this VNFFG dependent_virtual_link: type: list entry_schema: type: string required: true description: Reference to a VLD used in this Forwarding Graph connection_point: type: list entry_schema: type: string required: true description: Reference to Connection Points forming the VNFFG constituent_vnfs: type: list entry_schema: type: string required: true description: Reference to a list of VNFD used in this VNF Forwarding Graph ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8103092 tosca_parser-2.15.0/toscaparser/extensions/nfv/__init__.py0000664000175000017500000000000015250006202022513 0ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8103092 tosca_parser-2.15.0/toscaparser/extensions/nfv/tosca_simple_profile_for_nfv_1_0_0.py0000664000175000017500000000143315250006202027566 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # # VERSION and DEFS_FILE are required for all extensions class NfvProfile_1_0_0(object): VERSION = 'tosca_simple_profile_for_nfv_1_0_0' DEFS_FILE = 'TOSCA_nfv_definition_1_0_0.yaml' SECTIONS = ('metadata') ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.811309 tosca_parser-2.15.0/toscaparser/functions.py0000664000175000017500000011302515250006202020010 0ustar00zuulzuul# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import UnknownInputError from toscaparser.dataentity import DataEntity from toscaparser.elements.constraints import Schema from toscaparser.elements.datatype import DataType from toscaparser.elements.entity_type import EntityType from toscaparser.elements.relationshiptype import RelationshipType from toscaparser.elements.statefulentitytype import StatefulEntityType from toscaparser.utils.gettextutils import _ GET_PROPERTY = 'get_property' GET_ATTRIBUTE = 'get_attribute' GET_INPUT = 'get_input' GET_OPERATION_OUTPUT = 'get_operation_output' CONCAT = 'concat' TOKEN = 'token' SELF = 'SELF' HOST = 'HOST' TARGET = 'TARGET' SOURCE = 'SOURCE' HOSTED_ON = 'tosca.relationships.HostedOn' class Function(object, metaclass=abc.ABCMeta): """An abstract type for representing a Tosca template function.""" def __init__(self, tosca_tpl, context, name, args): self.tosca_tpl = tosca_tpl self.context = context self.name = name self.args = args self.validate() @abc.abstractmethod def result(self): """Invokes the function and returns its result Some methods invocation may only be relevant on runtime (for example, getting runtime properties) and therefore its the responsibility of the orchestrator/translator to take care of such functions invocation. :return: Function invocation result. """ return {self.name: self.args} @abc.abstractmethod def validate(self): """Validates function arguments.""" pass class GetInput(Function): """Get a property value declared within the input of the service template. Arguments: * Input name. Example: * get_input: port """ def validate(self): if len(self.args) != 1: ExceptionCollector.appendException( ValueError(_( 'Expected one argument for function "get_input" but ' 'received "%s".') % self.args)) inputs = [input.name for input in self.tosca_tpl.inputs] if self.args[0] not in inputs: ExceptionCollector.appendException( UnknownInputError(input_name=self.args[0])) def result(self): if self.tosca_tpl.parsed_params and \ self.input_name in self.tosca_tpl.parsed_params: return DataEntity.validate_datatype( self.tosca_tpl.tpl['inputs'][self.input_name]['type'], self.tosca_tpl.parsed_params[self.input_name]) input = [input_def for input_def in self.tosca_tpl.inputs if self.input_name == input_def.name] if input: return input[0].default return None @property def input_name(self): return self.args[0] class GetAttribute(Function): """Get an attribute value of an entity defined in the service template Node template attributes values are set in runtime and therefore its the responsibility of the Tosca engine to implement the evaluation of get_attribute functions. Arguments: * Node template name | HOST. * Attribute name. If the HOST keyword is passed as the node template name argument the function will search each node template along the HostedOn relationship chain until a node which contains the attribute is found. Examples: * { get_attribute: [ server, private_address ] } * { get_attribute: [ HOST, private_address ] } * { get_attribute: [ HOST, private_address, 0 ] } * { get_attribute: [ HOST, private_address, 0, some_prop] } """ def validate(self): if len(self.args) < 2: ExceptionCollector.appendException( ValueError(_('Illegal arguments for function "{0}". Expected ' 'arguments: "node-template-name", "req-or-cap"' '(optional), "property name"' ).format(GET_ATTRIBUTE))) return elif len(self.args) == 2: self._find_node_template_containing_attribute() else: node_tpl = self._find_node_template(self.args[0]) if node_tpl is None: return index = 2 attrs = node_tpl.type_definition.get_attributes_def() found = [attrs[self.args[1]]] if self.args[1] in attrs else [] if found: attr = found[0] else: index = 3 # then check the req or caps attr = self._find_req_or_cap_attribute(self.args[1], self.args[2]) if not attr: return value_type = attr.schema['type'] value_schema = attr.schema if len(self.args) > index: for elem in self.args[index:]: if value_type == "list": if not isinstance(elem, int): ExceptionCollector.appendException( ValueError(_('Illegal arguments for function' ' "{0}". "{1}" Expected positive' ' integer argument' ).format(GET_ATTRIBUTE, elem))) value_type = value_schema['entry_schema']['type'] elif value_type == "map": value_type = value_schema['entry_schema']['type'] elif value_type in Schema.PROPERTY_TYPES: ExceptionCollector.appendException( ValueError(_('Illegal arguments for function' ' "{0}". Unexpected attribute/' 'index value "{1}"' ).format(GET_ATTRIBUTE, elem))) return else: # It is a complex type data_type = DataType(value_type, self.tosca_tpl.custom_defs) props = data_type.get_all_properties() found = [props[elem]] if elem in props else [] if found: prop = found[0] value_type = prop.schema['type'] value_schema = prop.schema else: ExceptionCollector.appendException( KeyError(_('Illegal arguments for function' ' "{0}". Attribute name "{1}" not' ' found in "{2}"' ).format(GET_ATTRIBUTE, elem, value_type))) def result(self): return self def get_referenced_node_template(self): """Gets the NodeTemplate instance the get_attribute function refers to. If HOST keyword was used as the node template argument, the node template which contains the attribute along the HostedOn relationship chain will be returned. """ return self._find_node_template_containing_attribute() # Attributes can be explicitly created as part of the type definition # or a property name can be implicitly used as an attribute name def _find_node_template_containing_attribute(self): node_tpl = self._find_node_template(self.args[0]) if node_tpl and \ not self._attribute_exists_in_type(node_tpl.type_definition) \ and self.attribute_name not in node_tpl.get_properties(): ExceptionCollector.appendException( KeyError(_('Attribute "%(att)s" was not found in node ' 'template "%(ntpl)s".') % {'att': self.attribute_name, 'ntpl': node_tpl.name})) return node_tpl def _attribute_exists_in_type(self, type_definition): attrs_def = type_definition.get_attributes_def() found = [attrs_def[self.attribute_name]] \ if self.attribute_name in attrs_def else [] return len(found) == 1 def _find_host_containing_attribute(self, node_template_name=SELF): node_template = self._find_node_template(node_template_name) if node_template: hosted_on_rel = EntityType.TOSCA_DEF[HOSTED_ON] for r in node_template.requirements: for requirement, target_name in r.items(): target_node = self._find_node_template(target_name) target_type = target_node.type_definition for capability in target_type.get_capabilities_objects(): if capability.inherits_from( hosted_on_rel['valid_target_types']): if self._attribute_exists_in_type(target_type): return target_node return self._find_host_containing_attribute( target_name) def _find_node_template(self, node_template_name): # if the node_template_name has the long format if isinstance(node_template_name, dict): # get only the node name if 'node' in node_template_name: node_template_name = node_template_name['node'] else: ExceptionCollector.appendException( ValueError(_(' No node name in the relationship.'))) return if node_template_name == HOST: # Currently this is the only way to tell whether the function # is used within the outputs section of the TOSCA template. if isinstance(self.context, list): ExceptionCollector.appendException( ValueError(_( '"get_attribute: [ HOST, ... ]" is not allowed in ' '"outputs" section of the TOSCA template.'))) return node_tpl = self._find_host_containing_attribute() if not node_tpl: ExceptionCollector.appendException( ValueError(_( '"get_attribute: [ HOST, ... ]" was used in node ' 'template "{0}" but "{1}" was not found in ' 'the relationship chain.').format(self.context.name, HOSTED_ON))) return return node_tpl if node_template_name == TARGET: if not isinstance(self.context.type_definition, RelationshipType): ExceptionCollector.appendException( KeyError(_('"TARGET" keyword can only be used in context' ' to "Relationships" target node'))) return return self.context.target if node_template_name == SOURCE: if not isinstance(self.context.type_definition, RelationshipType): ExceptionCollector.appendException( KeyError(_('"SOURCE" keyword can only be used in context' ' to "Relationships" source node'))) return return self.context.source name = self.context.name \ if node_template_name == SELF and \ not isinstance(self.context, list) \ else node_template_name for node_template in self.tosca_tpl.nodetemplates: if node_template.name == name: return node_template ExceptionCollector.appendException( KeyError(_( 'Node template "{0}" was not found.' ).format(node_template_name))) def _find_req_or_cap_attribute(self, req_or_cap, attr_name): node_tpl = self._find_node_template(self.args[0]) # Find attribute in node template's requirements for r in node_tpl.requirements: for req, node_name in r.items(): if req == req_or_cap: node_template = self._find_node_template(node_name) return self._get_capability_attribute( node_template, req, attr_name) # If requirement was not found, look in node template's capabilities return self._get_capability_attribute(node_tpl, req_or_cap, attr_name) def _get_capability_attribute(self, node_template, capability_name, attr_name): """Gets a node template capability attribute.""" caps = node_template.get_capabilities() if caps and capability_name in caps.keys(): cap = caps[capability_name] attribute = None attrs = cap.definition.get_attributes_def() if attrs and attr_name in attrs.keys(): attribute = attrs[attr_name] if not attribute: ExceptionCollector.appendException( KeyError(_('Attribute "%(attr)s" was not found in ' 'capability "%(cap)s" of node template ' '"%(ntpl1)s" referenced from node template ' '"%(ntpl2)s".') % {'attr': attr_name, 'cap': capability_name, 'ntpl1': node_template.name, 'ntpl2': self.context.name})) return attribute msg = _('Requirement/Capability "{0}" referenced from node template ' '"{1}" was not found in node template "{2}".').format( capability_name, self.context.name, node_template.name) ExceptionCollector.appendException(KeyError(msg)) @property def node_template_name(self): return self.args[0] @property def attribute_name(self): return self.args[1] class GetProperty(Function): """Get a property value of an entity defined in the same service template. Arguments: * Node template name | SELF | HOST | SOURCE | TARGET. * Requirement or capability name (optional). * Property name. If requirement or capability name is specified, the behavior is as follows: The req or cap name is first looked up in the specified node template's requirements. If found, it would search for a matching capability of an other node template and get its property as specified in function arguments. Otherwise, the req or cap name would be looked up in the specified node template's capabilities and if found, it would return the property of the capability as specified in function arguments. Examples: * { get_property: [ mysql_server, port ] } * { get_property: [ SELF, db_port ] } * { get_property: [ SELF, database_endpoint, port ] } * { get_property: [ SELF, database_endpoint, port, 1 ] } """ def validate(self): if len(self.args) < 2: ExceptionCollector.appendException( ValueError(_( 'Expected arguments: "node-template-name", "req-or-cap" ' '(optional), "property name".'))) return if len(self.args) == 2: found_prop = self._find_property(self.args[1]) if not found_prop: return prop = found_prop.value if not isinstance(prop, Function): get_function(self.tosca_tpl, self.context, prop) elif len(self.args) >= 3: # do not use _find_property to avoid raise KeyError # if the prop is not found # First check if there is property with this name node_tpl = self._find_node_template(self.args[0]) props = node_tpl.get_properties() if node_tpl else [] index = 2 found = [props[self.args[1]]] if self.args[1] in props else [] if found: property_value = found[0].value else: index = 3 # then check the req or caps property_value = self._find_req_or_cap_property(self.args[1], self.args[2]) if len(self.args) > index: for elem in self.args[index:]: if isinstance(property_value, list): int_elem = int(elem) property_value = self._get_index_value(property_value, int_elem) else: property_value = self._get_attribute_value( property_value, elem) def _find_req_or_cap_property(self, req_or_cap, property_name): node_tpl = self._find_node_template(self.args[0]) if node_tpl is None: return None # Find property in node template's requirements for r in node_tpl.requirements: for req, node_name in r.items(): if req == req_or_cap: node_template = self._find_node_template(node_name) return self._get_capability_property( node_template, req, property_name) # If requirement was not found, look in node template's capabilities return self._get_capability_property(node_tpl, req_or_cap, property_name) def _get_capability_property(self, node_template, capability_name, property_name, throw_errors=True): """Gets a node template capability property.""" caps = node_template.get_capabilities() if caps and capability_name in caps.keys(): cap = caps[capability_name] property = None props = cap.get_properties() if props and property_name in props.keys(): property = props[property_name].value if property is None and throw_errors: ExceptionCollector.appendException( KeyError(_('Property "%(prop)s" was not found in ' 'capability "%(cap)s" of node template ' '"%(ntpl1)s" referenced from node template ' '"%(ntpl2)s".') % {'prop': property_name, 'cap': capability_name, 'ntpl1': node_template.name, 'ntpl2': self.context.name})) return property if throw_errors: msg = _('Requirement/Capability "{0}" referenced from ' 'node template "{1}" was not found in node template' ' "{2}".').format(capability_name, self.context.name, node_template.name) ExceptionCollector.appendException(KeyError(msg)) else: return None def _find_property(self, property_name): node_tpl = self._find_node_template(self.args[0]) if not node_tpl: return props = node_tpl.get_properties() found = [props[property_name]] if property_name in props else [] if len(found) == 0: ExceptionCollector.appendException( KeyError(_('Property "%(prop)s" was not found in node ' 'template "%(ntpl)s".') % {'prop': property_name, 'ntpl': node_tpl.name})) return None return found[0] def _find_node_template(self, node_template_name): # if the node_template_name has the long format if isinstance(node_template_name, dict): # get only the node name if 'node' in node_template_name: node_template_name = node_template_name['node'] else: ExceptionCollector.appendException( ValueError(_(' No node name in the relationship.'))) return if node_template_name == SELF: return self.context # enable the HOST value in the function if node_template_name == HOST: node = self._find_host_containing_property() if node is None: ExceptionCollector.appendException( KeyError(_( "Property '{0}' not found in capability/requirement" " '{1}' referenced from node template {2}"). format(self.args[2], self.args[1], self.context.name))) return None else: return node if node_template_name == TARGET: if not isinstance(self.context.type_definition, RelationshipType): ExceptionCollector.appendException( KeyError(_('"TARGET" keyword can only be used in context' ' to "Relationships" target node'))) return return self.context.target if node_template_name == SOURCE: if not isinstance(self.context.type_definition, RelationshipType): ExceptionCollector.appendException( KeyError(_('"SOURCE" keyword can only be used in context' ' to "Relationships" source node'))) return return self.context.source if not hasattr(self.tosca_tpl, 'nodetemplates'): return for node_template in self.tosca_tpl.nodetemplates: if node_template.name == node_template_name: return node_template ExceptionCollector.appendException( KeyError(_( 'Node template "{0}" was not found.' ' referenced from node template {1}' ).format(node_template_name, self.context.name))) def _get_index_value(self, value, index): if isinstance(value, list): if index < len(value): return value[index] else: ExceptionCollector.appendException( KeyError(_( "Property '{0}' found in capability '{1}'" " referenced from node template {2}" " must have an element with index {3}."). format(self.args[2], self.args[1], self.context.name, index))) else: ExceptionCollector.appendException( KeyError(_( "Property '{0}' found in capability '{1}'" " referenced from node template {2}" " must be a list.").format(self.args[2], self.args[1], self.context.name))) def _get_attribute_value(self, value, attibute): if isinstance(value, dict): if attibute in value: return value[attibute] else: ExceptionCollector.appendException( KeyError(_( "Property '{0}' found in capability '{1}'" " referenced from node template {2}" " must have an attribute named {3}."). format(self.args[2], self.args[1], self.context.name, attibute))) else: ExceptionCollector.appendException( KeyError(_( "Property '{0}' found in capability '{1}'" " referenced from node template {2}" " must be a dict.").format(self.args[2], self.args[1], self.context.name))) # Add this functions similar to get_attribute case def _find_host_containing_property(self, node_template_name=SELF): node_template = self._find_node_template(node_template_name) hosted_on_rel = EntityType.TOSCA_DEF[HOSTED_ON] for r in node_template.requirements: for requirement, target_name in r.items(): target_node = self._find_node_template(target_name) target_type = target_node.type_definition for capability in target_type.get_capabilities_objects(): if capability.inherits_from( hosted_on_rel['valid_target_types']): if self._property_exists_in_type(target_type): return target_node # If requirement was not found, look in node # template's capabilities if (len(self.args) > 2 and self._get_capability_property(target_node, self.args[1], self.args[2], False) is not None): return target_node return self._find_host_containing_property( target_name) return None def _property_exists_in_type(self, type_definition): props_def = type_definition.get_properties_def() found = [props_def[self.args[1]]] \ if self.args[1] in props_def else [] return len(found) == 1 def result(self): if len(self.args) >= 3: # First check if there is property with this name node_tpl = self._find_node_template(self.args[0]) props = node_tpl.get_properties() if node_tpl else [] index = 2 found = [props[self.args[1]]] if self.args[1] in props else [] if found: property_value = found[0].value else: index = 3 # then check the req or caps property_value = self._find_req_or_cap_property(self.args[1], self.args[2]) if len(self.args) > index: for elem in self.args[index:]: if isinstance(property_value, list): int_elem = int(elem) property_value = self._get_index_value(property_value, int_elem) else: property_value = self._get_attribute_value( property_value, elem) else: property_value = self._find_property(self.args[1]).value if isinstance(property_value, Function): return property_value.result() return get_function(self.tosca_tpl, self.context, property_value) @property def node_template_name(self): return self.args[0] @property def property_name(self): if len(self.args) > 2: return self.args[2] return self.args[1] @property def req_or_cap(self): if len(self.args) > 2: return self.args[1] return None class GetOperationOutput(Function): def validate(self): if len(self.args) == 4: template_name = self.args[0] interface_name = self.args[1] operation_name = self.args[2] template = None node_template = self._find_node_template(template_name) if node_template: template = node_template else: relationship_template = \ self._find_relationship_template(template_name) if relationship_template: template = relationship_template if not template: ExceptionCollector.appendException( KeyError(_( 'Node or relationship template "{0}" was not found.' ).format(template_name))) return if hasattr(template, template.INTERFACES): operation = self._find_operation_name(interface_name, operation_name, template.interfaces) if operation: return ExceptionCollector.appendException( ValueError(_( 'Node or relationship template "{0}" has not ' 'interface "{1}" or operation "{2}".' ).format(template_name, interface_name, operation_name))) else: ExceptionCollector.appendException( ValueError(_('Illegal arguments for function "{0}". Expected ' 'arguments: "template_name","interface_name",' '"operation_name","output_variable_name"' ).format(GET_OPERATION_OUTPUT))) return def _find_operation_name(self, interface_name, operation_name, interfaces=None): if (interface_name == 'Configure' or interface_name == 'tosca.interfaces.node.relationship.Configure'): if (operation_name in StatefulEntityType. interfaces_relationship_configure_operations): return operation_name else: ExceptionCollector.appendException( ValueError(_('Enter an operation of Configure interface' ).format(GET_OPERATION_OUTPUT))) return elif (interface_name == 'Standard' or interface_name == 'tosca.interfaces.node.lifecycle.Standard'): if (operation_name in StatefulEntityType.interfaces_node_lifecycle_operations): return operation_name else: ExceptionCollector.appendException( ValueError(_('Enter an operation of Standard interface' ).format(GET_OPERATION_OUTPUT))) return elif interfaces: for interface_obj in interfaces: if interface_obj.name == operation_name and \ interface_obj.type == interface_name: return operation_name else: ExceptionCollector.appendException( ValueError(_('Enter a valid operation name' ).format(GET_OPERATION_OUTPUT))) return def _find_node_template(self, node_template_name): if node_template_name == TARGET: if not isinstance(self.context.type_definition, RelationshipType): ExceptionCollector.appendException( KeyError(_('"TARGET" keyword can only be used in context' ' to "Relationships" target node'))) return return self.context.target if node_template_name == SOURCE: if not isinstance(self.context.type_definition, RelationshipType): ExceptionCollector.appendException( KeyError(_('"SOURCE" keyword can only be used in context' ' to "Relationships" source node'))) return return self.context.source name = self.context.name \ if node_template_name == SELF and \ not isinstance(self.context, list) \ else node_template_name for node_template in self.tosca_tpl.nodetemplates: if node_template.name == name: return node_template def _find_relationship_template(self, relationship_template_name): for rel_template in self.tosca_tpl.relationship_templates: if rel_template.name == relationship_template_name: return rel_template def result(self): return self class Concat(Function): """Validate the function and provide an instance of the function Concatenation of values are supposed to be produced at runtime and therefore its the responsibility of the TOSCA engine to implement the evaluation of Concat functions. Arguments: * List of strings that needs to be concatenated Example: [ 'http://', get_attribute: [ server, public_address ], ':' , get_attribute: [ server, port ] ] """ def validate(self): if len(self.args) < 1: ExceptionCollector.appendException( ValueError(_('Invalid arguments for function "{0}". Expected ' 'at least one arguments.').format(CONCAT))) def result(self): return self class Token(Function): """Validate the function and provide an instance of the function The token function is used within a TOSCA service template on a string to parse out (tokenize) substrings separated by one or more token characters within a larger string. Arguments: * The composite string that contains one or more substrings separated by token characters. * The string that contains one or more token characters that separate substrings within the composite string. * The integer indicates the index of the substring to return from the composite string. Note that the first substring is denoted by using the '0' (zero) integer value. Example: [ get_attribute: [ my_server, data_endpoint, ip_address ], ':', 1 ] """ def validate(self): if len(self.args) < 3: ExceptionCollector.appendException( ValueError(_('Invalid arguments for function "{0}". Expected ' 'at least three arguments.').format(TOKEN))) else: if not isinstance(self.args[1], str) or len(self.args[1]) != 1: ExceptionCollector.appendException( ValueError(_('Invalid arguments for function "{0}". ' 'Expected single char value as second ' 'argument.').format(TOKEN))) if not isinstance(self.args[2], int): ExceptionCollector.appendException( ValueError(_('Invalid arguments for function "{0}". ' 'Expected integer value as third ' 'argument.').format(TOKEN))) def result(self): return self function_mappings = { GET_PROPERTY: GetProperty, GET_INPUT: GetInput, GET_ATTRIBUTE: GetAttribute, GET_OPERATION_OUTPUT: GetOperationOutput, CONCAT: Concat, TOKEN: Token } def is_function(function): """Returns True if the provided function is a Tosca intrinsic function. Examples: * "{ get_property: { SELF, port } }" * "{ get_input: db_name }" * Function instance :param function: Function as string or a Function instance. :return: True if function is a Tosca intrinsic function, otherwise False. """ if isinstance(function, dict) and len(function) == 1: func_name = list(function.keys())[0] return func_name in function_mappings return isinstance(function, Function) def get_function(tosca_tpl, node_template, raw_function): """Gets a Function instance representing the provided template function. If the format provided raw_function format is not relevant for template functions or if the function name doesn't exist in function mapping the method returns the provided raw_function. :param tosca_tpl: The tosca template. :param node_template: The node template the function is specified for. :param raw_function: The raw function as dict. :return: Template function as Function instance or the raw_function if parsing was unsuccessful. """ if is_function(raw_function): if isinstance(raw_function, dict): func_name = list(raw_function.keys())[0] if func_name in function_mappings: func = function_mappings[func_name] func_args = list(raw_function.values())[0] if not isinstance(func_args, list): func_args = [func_args] return func(tosca_tpl, node_template, func_name, func_args) return raw_function ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.811309 tosca_parser-2.15.0/toscaparser/groups.py0000664000175000017500000000435315250006202017322 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import UnknownFieldError from toscaparser.entity_template import EntityTemplate from toscaparser.utils import validateutils # In TOSCA1.3, the section name 'interfaces' is not defined for groups. # It will be ignored if the 'interfaces' is defined as TOSCA1.3. SECTIONS = (TYPE, METADATA, DESCRIPTION, PROPERTIES, MEMBERS, INTERFACES, ATTRIBUTES) = \ ('type', 'metadata', 'description', 'properties', 'members', 'interfaces', 'attributes') class Group(EntityTemplate): def __init__(self, name, group_templates, member_nodes, custom_defs=None): super(Group, self).__init__(name, group_templates, 'group_type', custom_defs) self.name = name self.tpl = group_templates self.meta_data = None if self.METADATA in self.tpl: self.meta_data = self.tpl.get(self.METADATA) validateutils.validate_map(self.meta_data) self.member_nodes = member_nodes self._validate_keys() @property def members(self): return self.entity_tpl.get('members') @property def description(self): return self.entity_tpl.get('description') def get_member_nodes(self): return self.member_nodes def _validate_keys(self): for key in self.entity_tpl.keys(): if key not in SECTIONS: ExceptionCollector.appendException( UnknownFieldError(what='Groups "%s"' % self.name, field=key)) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.811309 tosca_parser-2.15.0/toscaparser/imports.py0000664000175000017500000003365015250006202017502 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging import os from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import InvalidPropertyValueError from toscaparser.common.exception import MissingRequiredFieldError from toscaparser.common.exception import UnknownFieldError from toscaparser.common.exception import ValidationError from toscaparser.elements.tosca_type_validation import TypeValidation from toscaparser.utils.gettextutils import _ import toscaparser.utils.urlutils import toscaparser.utils.yamlparser YAML_LOADER = toscaparser.utils.yamlparser.load_yaml log = logging.getLogger("tosca") class ImportsLoader(object): IMPORTS_SECTION = (FILE, REPOSITORY, NAMESPACE_URI, NAMESPACE_PREFIX) = \ ('file', 'repository', 'namespace_uri', 'namespace_prefix') def __init__(self, importslist, path, type_definition_list=None, tpl=None, local_defs=None): self.importslist = importslist self.custom_defs = {} self.nested_tosca_tpls = [] self.nested_imports = {} self.local_defs = local_defs if not path and not tpl: msg = _('Input tosca template is not provided.') log.warning(msg) ExceptionCollector.appendException(ValidationError(message=msg)) self.path = path self.repositories = {} if tpl and tpl.get('repositories'): self.repositories = tpl.get('repositories') self.type_definition_list = [] if type_definition_list: if isinstance(type_definition_list, list): self.type_definition_list = type_definition_list else: self.type_definition_list.append(type_definition_list) self._validate_and_load_imports() def get_custom_defs(self): return self.custom_defs def get_nested_tosca_tpls(self): return self.nested_tosca_tpls def get_nested_imports(self): return self.nested_imports def _validate_and_load_imports(self): imports_names = set() if not self.importslist: msg = _('"imports" keyname is defined without including ' 'templates.') log.error(msg) ExceptionCollector.appendException(ValidationError(message=msg)) return for import_def in self.importslist: if isinstance(import_def, dict): for import_name, import_uri in import_def.items(): if import_name in imports_names: msg = (_('Duplicate import name "%s" was found.') % import_name) log.error(msg) ExceptionCollector.appendException( ValidationError(message=msg)) imports_names.add(import_name) full_file_name, custom_type = self._load_import_template( import_name, import_uri) namespace_prefix = None if isinstance(import_uri, dict): namespace_prefix = import_uri.get( self.NAMESPACE_PREFIX) if custom_type: TypeValidation(custom_type, import_def) self._update_custom_def(custom_type, namespace_prefix) else: # old style of imports full_file_name, custom_type = self._load_import_template( None, import_def) if custom_type: TypeValidation( custom_type, import_def) self._update_custom_def(custom_type, None) if custom_type and 'imports' in custom_type.keys(): self.nested_imports.update( {full_file_name: custom_type['imports']}) self._update_nested_tosca_tpls(full_file_name, custom_type) def _update_custom_def(self, custom_type, namespace_prefix): outer_custom_types = {} for type_def in self.type_definition_list: outer_custom_types = custom_type.get(type_def) if outer_custom_types: if type_def == "imports": for i in self.custom_defs.get('imports', []): if i not in outer_custom_types: outer_custom_types.append(i) self.custom_defs.update({'imports': outer_custom_types}) else: if namespace_prefix: prefix_custom_types = {} for type_def_key in outer_custom_types.keys(): namespace_prefix_to_key = (namespace_prefix + "." + type_def_key) prefix_custom_types[namespace_prefix_to_key] = \ outer_custom_types[type_def_key] self.custom_defs.update(prefix_custom_types) else: self.custom_defs.update(outer_custom_types) def _update_nested_tosca_tpls(self, full_file_name, custom_tpl): if full_file_name and custom_tpl: topo_tpl = {full_file_name: custom_tpl} self.nested_tosca_tpls.append(topo_tpl) def _validate_import_keys(self, import_name, import_uri_def): if self.FILE not in import_uri_def.keys(): log.warning('Missing keyname "file" in import "%(name)s".' % {'name': import_name}) ExceptionCollector.appendException( MissingRequiredFieldError( what='Import of template "%s"' % import_name, required=self.FILE)) for key in import_uri_def.keys(): if key not in self.IMPORTS_SECTION: log.warning('Unknown keyname "%(key)s" error in ' 'imported definition "%(def)s".' % {'key': key, 'def': import_name}) ExceptionCollector.appendException( UnknownFieldError( what='Import of template "%s"' % import_name, field=key)) def _load_import_template(self, import_name, import_uri_def): """Handle custom types defined in imported template files This method loads the custom type definitions referenced in "imports" section of the TOSCA YAML template by determining whether each import is specified via a file reference (by relative or absolute path) or a URL reference. Possibilities: +----------+--------+------------------------------+ | template | import | comment | +----------+--------+------------------------------+ | file | file | OK | | file | URL | OK | | preparsed| file | file must be a full path | | preparsed| URL | OK | | URL | file | file must be a relative path | | URL | URL | OK | +----------+--------+------------------------------+ """ short_import_notation = False if isinstance(import_uri_def, dict): self._validate_import_keys(import_name, import_uri_def) file_name = import_uri_def.get(self.FILE) repository = import_uri_def.get(self.REPOSITORY) repos = self.repositories.keys() if repository is not None: if repository not in repos: ExceptionCollector.appendException( InvalidPropertyValueError( what=_('Repository is not found in "%s"') % repos)) else: file_name = import_uri_def repository = None short_import_notation = True if not file_name: msg = (_('A template file name is not provided with import ' 'definition "%(import_name)s".') % {'import_name': import_name}) log.error(msg) ExceptionCollector.appendException(ValidationError(message=msg)) return None, None if toscaparser.utils.urlutils.UrlUtils.validate_url(file_name): has_file = False if self.local_defs is not None: for k in self.local_defs.keys(): if k == file_name: file_name = self.local_defs[k] has_file = True return file_name, YAML_LOADER(file_name, a_file=has_file) elif not repository: import_template = None if self.path: if toscaparser.utils.urlutils.UrlUtils.validate_url(self.path): if os.path.isabs(file_name): msg = (_('Absolute file name "%(name)s" cannot be ' 'used in a URL-based input template ' '"%(template)s".') % {'name': file_name, 'template': self.path}) log.error(msg) ExceptionCollector.appendException(ImportError(msg)) return None, None import_template = toscaparser.utils.urlutils.UrlUtils.\ join_url(self.path, file_name) a_file = False else: a_file = True main_a_file = os.path.isfile(self.path) if main_a_file: if os.path.isfile(file_name): import_template = file_name else: full_path = os.path.join( os.path.dirname(os.path.abspath(self.path)), file_name) if os.path.isfile(full_path): import_template = full_path else: file_path = file_name.rpartition("/") dir_path = os.path.dirname(os.path.abspath( self.path)) if file_path[0] != '' and dir_path.endswith( file_path[0]): import_template = dir_path + "/" +\ file_path[2] if not os.path.isfile(import_template): msg = (_('"%(import_template)s" is ' 'not a valid file') % {'import_template': import_template}) log.error(msg) ExceptionCollector.appendException (ValueError(msg)) else: # template is pre-parsed if os.path.isabs(file_name) and os.path.isfile(file_name): a_file = True import_template = file_name else: msg = (_('Relative file name "%(name)s" cannot be used ' 'in a pre-parsed input template.') % {'name': file_name}) log.error(msg) ExceptionCollector.appendException(ImportError(msg)) return None, None if not import_template: log.error('Import "%(name)s" is not valid.' % {'name': import_uri_def}) ExceptionCollector.appendException( ImportError(_('Import "%s" is not valid.') % import_uri_def)) return None, None return import_template, YAML_LOADER(import_template, a_file) if short_import_notation: log.error('Import "%(name)s" is not valid.' % import_uri_def) ExceptionCollector.appendException( ImportError(_('Import "%s" is not valid.') % import_uri_def)) return None, None full_url = "" if repository: if self.repositories: for repo_name, repo_def in self.repositories.items(): if repo_name == repository: # Remove leading, ending spaces and strip # the last character if "/" repo_url = ((repo_def['url']).strip()).rstrip("//") full_url = repo_url + "/" + file_name if not full_url: msg = (_('referenced repository "%(n_uri)s" in import ' 'definition "%(tpl)s" not found.') % {'n_uri': repository, 'tpl': import_name}) log.error(msg) ExceptionCollector.appendException(ImportError(msg)) return None, None if toscaparser.utils.urlutils.UrlUtils.validate_url(full_url): return full_url, YAML_LOADER(full_url, False) else: msg = (_('repository url "%(n_uri)s" is not valid in import ' 'definition "%(tpl)s".') % {'n_uri': repo_url, 'tpl': import_name}) log.error(msg) ExceptionCollector.appendException(ImportError(msg)) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.811309 tosca_parser-2.15.0/toscaparser/nodetemplate.py0000664000175000017500000004367615250006202020477 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import InvalidPropertyValueError from toscaparser.common.exception import MissingRequiredFieldError from toscaparser.common.exception import TypeMismatchError from toscaparser.common.exception import UnknownFieldError from toscaparser.common.exception import ValidationError from toscaparser.dataentity import DataEntity from toscaparser.elements.interfaces import CONFIGURE from toscaparser.elements.interfaces import CONFIGURE_SHORTNAME from toscaparser.elements.interfaces import INTERFACE_DEF_RESERVED_WORDS from toscaparser.elements.interfaces import InterfacesDef from toscaparser.elements.interfaces import LIFECYCLE from toscaparser.elements.interfaces import LIFECYCLE_SHORTNAME from toscaparser.elements.relationshiptype import RelationshipType from toscaparser.entity_template import EntityTemplate from toscaparser.relationship_template import RelationshipTemplate from toscaparser.utils.gettextutils import _ log = logging.getLogger('tosca') class NodeTemplate(EntityTemplate): '''Node template from a Tosca profile.''' def __init__(self, name, node_templates, custom_def=None, available_rel_tpls=None, available_rel_types=None): super(NodeTemplate, self).__init__(name, node_templates[name], 'node_type', custom_def) self.templates = node_templates self._validate_fields(node_templates[name]) self.custom_def = custom_def self.related = {} self.relationship_tpl = [] self.available_rel_tpls = available_rel_tpls self.available_rel_types = available_rel_types self._relationships = {} self.sub_mapping_tosca_template = None @property def relationships(self): if not self._relationships: requires = self.requirements if requires and isinstance(requires, list): for r in requires: for r1, value in r.items(): explicit = self._get_explicit_relationship(r, value) if explicit: for key, value in explicit.items(): self._relationships[key] = value return self._relationships def _get_explicit_relationship(self, req, value): """Handle explicit relationship For example, - req: node: DBMS relationship: tosca.relationships.HostedOn """ explicit_relation = {} node = value.get('node') if isinstance(value, dict) else value if node: # TODO(spzala) implement look up once Glance meta data is available # to find a matching TOSCA node using the TOSCA types msg = _('Lookup by TOSCA types is not supported. ' 'Requirement node "%(node)s" for "%(name)s"' ' can not be full-filled.') \ % {'node': node, 'name': self.name} if (node in list(self.type_definition.TOSCA_DEF.keys()) or (self.custom_def and node in self.custom_def)): ExceptionCollector.appendException(NotImplementedError(msg)) return if node not in self.templates: ExceptionCollector.appendException( KeyError(_('Node template "%(node)s" was not found' ' in "%(name)s".') % {'node': node, 'name': self.name})) return related_tpl = NodeTemplate(node, self.templates, self.custom_def) relationship = value.get('relationship') \ if isinstance(value, dict) else None # check if it's type has relationship defined if not relationship: parent_reqs = self.type_definition.get_all_requirements() if parent_reqs is None: ExceptionCollector.appendException( ValidationError(message='parent_req is ' + str(parent_reqs))) else: for key in req.keys(): for req_dict in parent_reqs: if key in req_dict.keys(): relationship = (req_dict.get(key). get('relationship')) break if relationship: found_relationship_tpl = False # apply available relationship templates if found if self.available_rel_tpls: for tpl in self.available_rel_tpls: if tpl.name == relationship: rtype = RelationshipType(tpl.type, None, self.custom_def) explicit_relation[rtype] = related_tpl tpl.target = related_tpl tpl.source = self self.relationship_tpl.append(tpl) found_relationship_tpl = True # create relationship template object. rel_prfx = self.type_definition.RELATIONSHIP_PREFIX if not found_relationship_tpl: if isinstance(relationship, dict): relationship = relationship.get('type') if relationship: if self.available_rel_types and \ relationship in self.available_rel_types.keys(): pass elif not relationship.startswith(rel_prfx): relationship = rel_prfx + relationship else: ExceptionCollector.appendException( MissingRequiredFieldError( what=_('"relationship" used in template ' '"%s"') % related_tpl.name, required=self.TYPE)) for rtype in self.type_definition.relationship.keys(): if rtype.type == relationship: explicit_relation[rtype] = related_tpl related_tpl._add_relationship_template(req, rtype.type, self) elif self.available_rel_types: if relationship in self.available_rel_types.keys(): rel_type_def = self.available_rel_types.\ get(relationship) if 'derived_from' in rel_type_def: super_type = \ rel_type_def.get('derived_from') if not super_type.startswith(rel_prfx): super_type = rel_prfx + super_type if rtype.type == super_type: explicit_relation[rtype] = related_tpl related_tpl.\ _add_relationship_template( req, relationship, self) return explicit_relation def _add_relationship_template(self, requirement, rtype, source): req = requirement.copy() req['type'] = rtype tpl = RelationshipTemplate(req, rtype, self.custom_def, self, source) self.relationship_tpl.append(tpl) def get_relationship_template(self): return self.relationship_tpl def _add_next(self, nodetpl, relationship): self.related[nodetpl] = relationship @property def related_nodes(self): if not self.related: for relation, node in self.type_definition.relationship.items(): for tpl in self.templates: if tpl == node.type: self.related[NodeTemplate(tpl)] = relation return self.related.keys() def validate(self, tosca_tpl=None): self._validate_capabilities() self._validate_requirements() self._validate_properties(self.entity_tpl, self.type_definition) self._validate_interfaces() for prop in self.get_properties_objects(): prop.validate() def _validate_requirements(self): type_requires = self.type_definition.get_all_requirements() allowed_reqs = ["template"] if type_requires: for treq in type_requires: for key, value in treq.items(): allowed_reqs.append(key) if isinstance(value, dict): for key in value: allowed_reqs.append(key) requires = self.type_definition.get_value(self.REQUIREMENTS, self.entity_tpl) if requires: if not isinstance(requires, list): ExceptionCollector.appendException( TypeMismatchError( what='"requirements" of template "%s"' % self.name, type='list')) else: for req in requires: for r1, value in req.items(): if isinstance(value, dict): self._validate_requirements_keys(value) self._validate_requirements_properties(value) allowed_reqs.append(r1) self._common_validate_field(req, allowed_reqs, 'requirements') def _validate_relationship_occurrences(self): type_requires = self.type_definition.get_all_requirements() requires = self.type_definition.get_value(self.REQUIREMENTS, self.entity_tpl) if requires is None: requires = [] # in case of substitution mapping, we need to get also the substitution if self.sub_mapping_tosca_template: mapping_reqs = self.sub_mapping_tosca_template.requirements if mapping_reqs: if isinstance(mapping_reqs, list): requires.extend(mapping_reqs) else: requires.append(mapping_reqs) for tpl in self.sub_mapping_tosca_template.nodetemplates: if tpl.type == self.type: if tpl.requirements: if isinstance(tpl.requirements, list): requires.extend(tpl.requirements) else: requires.append(tpl.requirements) break if type_requires: for treq in type_requires: for key, value in treq.items(): occurrences = value.get('occurrences', [1, 'UNBOUNDED']) min_occurrences = occurrences[0] max_occurrences = occurrences[1] if max_occurrences == "UNBOUNDED": max_occurrences = 9999999999 count = 0 for req in requires: for req_name in list(req.keys()): if req_name == key: count += 1 if count < min_occurrences or count > max_occurrences: ExceptionCollector.appendException( ValidationError( message='Relationship "%s" in template "%s"' ' has a wrong number of ' 'occurrences' % (key, self.name))) def _validate_requirements_properties(self, requirements): # TODO(anyone): Only occurrences property of the requirements is # validated here. Validation of other requirement properties are being # validated in different files. Better to keep all the requirements # properties validation here. for key, value in requirements.items(): if key == 'occurrences': self._validate_occurrences(value) break def _validate_occurrences(self, occurrences): DataEntity.validate_datatype('list', occurrences) for value in occurrences: DataEntity.validate_datatype('integer', value) if (len(occurrences) != 2 or not (0 <= occurrences[0] <= occurrences[1]) or occurrences[1] == 0): ExceptionCollector.appendException( InvalidPropertyValueError(what=(occurrences))) def _validate_requirements_keys(self, requirement): for key in requirement.keys(): if key not in self.REQUIREMENTS_SECTION: ExceptionCollector.appendException( UnknownFieldError( what='"requirements" of template "%s"' % self.name, field=key)) def _validate_interfaces(self): ifaces = self.type_definition.get_value(self.INTERFACES, self.entity_tpl) if ifaces: for name, value in ifaces.items(): # Corresponding to 'notifications' Keyname addition in TOSCA1.3 if 'notifications' in value: value_notifications = value['notifications'] self._common_validate_field( value_notifications, self._collect_custom_iface_notifications(name), 'interfaces') # Corresponding to 'operations' Keyname addition in TOSCA1.3 if 'operations' in value: value = value['operations'] if name in (LIFECYCLE, LIFECYCLE_SHORTNAME): self._common_validate_field( value, InterfacesDef. interfaces_node_lifecycle_operations, 'interfaces') elif name in (CONFIGURE, CONFIGURE_SHORTNAME): self._common_validate_field( value, InterfacesDef. interfaces_relationship_configure_operations, 'interfaces') else: interfaces = self.type_definition.interfaces if interfaces is None: interfaces = dict() if name in interfaces.keys(): self._common_validate_field( value, self._collect_custom_iface_operations(name), 'interfaces') else: ExceptionCollector.appendException( UnknownFieldError( what='"interfaces" of template "%s"' % self.name, field=name)) def _collect_custom_iface_operations(self, name): allowed_operations = [] nodetype_iface_def = self.type_definition.interfaces[name] allowed_operations.extend(nodetype_iface_def.keys()) if 'type' in nodetype_iface_def: iface_type = nodetype_iface_def['type'] if iface_type in self.type_definition.custom_def: # Corresponding to 'operations' Keyname addition in TOSCA1.3 operations = self.type_definition.custom_def[iface_type].get( 'operations', {}) if operations: iface_type_def = operations else: iface_type_def = self.type_definition.custom_def[ iface_type] else: iface_type_def = self.type_definition.TOSCA_DEF[iface_type] allowed_operations.extend(iface_type_def.keys()) allowed_operations = [op for op in allowed_operations if op not in INTERFACE_DEF_RESERVED_WORDS] return allowed_operations def _collect_custom_iface_notifications(self, name): allowed_notifications = [] nodetype_iface_def = self.type_definition.interfaces[name] allowed_notifications.extend(nodetype_iface_def.keys()) if 'type' in nodetype_iface_def: iface_type = nodetype_iface_def['type'] if iface_type in self.type_definition.custom_def: iface_type_def = self.type_definition.custom_def[ iface_type]['notifications'] else: iface_type_def = self.type_definition.TOSCA_DEF[iface_type] allowed_notifications.extend(iface_type_def.keys()) allowed_notifications = [no for no in allowed_notifications if no not in INTERFACE_DEF_RESERVED_WORDS] return allowed_notifications def _validate_fields(self, nodetemplate): for name in nodetemplate.keys(): if name not in self.SECTIONS and name not in self.SPECIAL_SECTIONS: ExceptionCollector.appendException( UnknownFieldError(what='Node template "%s"' % self.name, field=name)) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1788873857.811309 tosca_parser-2.15.0/toscaparser/parameters.py0000664000175000017500000001042015250006202020136 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import MissingRequiredFieldError from toscaparser.common.exception import UnknownFieldError from toscaparser.dataentity import DataEntity from toscaparser.elements.constraints import Schema from toscaparser.elements.entity_type import EntityType from toscaparser.utils.gettextutils import _ log = logging.getLogger('tosca') class Input(object): INPUTFIELD = (TYPE, DESCRIPTION, DEFAULT, CONSTRAINTS, REQUIRED, STATUS, KEY_SCHEMA, ENTRY_SCHEMA) = ('type', 'description', 'default', 'constraints', 'required', 'status', 'key_schema', 'entry_schema') def __init__(self, name, schema_dict): self.name = name self.schema = Schema(name, schema_dict) self._validate_field() self.validate_type(self.type) @property def type(self): return self.schema.type @property def required(self): return self.schema.required @property def description(self): return self.schema.description @property def default(self): return self.schema.default @property def constraints(self): return self.schema.constraints @property def status(self): return self.schema.status def validate(self, value=None): if value is not None: self._validate_value(value) def _validate_field(self): for name in self.schema.schema: if name not in self.INPUTFIELD: ExceptionCollector.appendException( UnknownFieldError(what='Input "%s"' % self.name, field=name)) def validate_type(self, input_type): if input_type not in Schema.PROPERTY_TYPES: ExceptionCollector.appendException( ValueError(_('Invalid type "%s".') % type)) # TODO(anyone) Need to test for any built-in datatype not just network # that is, tosca.datatypes.* and not assume tosca.datatypes.network.* # TODO(anyone) Add support for tosca.datatypes.Credential def _validate_value(self, value): tosca = EntityType.TOSCA_DEF datatype = None if self.type in tosca: datatype = tosca[self.type] elif EntityType.DATATYPE_NETWORK_PREFIX + self.type in tosca: datatype = tosca[EntityType.DATATYPE_NETWORK_PREFIX + self.type] DataEntity.validate_datatype(self.type, value, None, datatype) class Output(object): OUTPUTFIELD = (DESCRIPTION, VALUE) = ('description', 'value') def __init__(self, name, attrs): self.name = name self.attrs = attrs @property def description(self): return self.attrs.get(self.DESCRIPTION) @property def value(self): return self.attrs.get(self.VALUE) def validate(self): self._validate_field() def _validate_field(self): if not isinstance(self.attrs, dict): ExceptionCollector.appendException( MissingRequiredFieldError(what='Output "%s"' % self.name, required=self.VALUE)) if self.value is None: ExceptionCollector.appendException( MissingRequiredFieldError(what='Output "%s"' % self.name, required=self.VALUE)) for name in self.attrs: if name not in self.OUTPUTFIELD: ExceptionCollector.appendException( UnknownFieldError(what='Output "%s"' % self.name, field=name)) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8123093 tosca_parser-2.15.0/toscaparser/policy.py0000664000175000017500000000651615250006202017305 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import UnknownFieldError from toscaparser.entity_template import EntityTemplate from toscaparser.reservation import Reservation from toscaparser.triggers import Triggers from toscaparser.utils import validateutils SECTIONS = (TYPE, METADATA, DESCRIPTION, PROPERTIES, TARGETS, TRIGGERS, RESERVATION) = \ ('type', 'metadata', 'description', 'properties', 'targets', 'triggers', 'reservation') log = logging.getLogger('tosca') class Policy(EntityTemplate): '''Policies defined in Topology template.''' def __init__(self, name, policy, targets=None, targets_type=None, custom_def=None): super(Policy, self).__init__(name, policy, 'policy_type', custom_def) self.meta_data = None if self.METADATA in policy: self.meta_data = policy.get(self.METADATA) validateutils.validate_map(self.meta_data) self.targets_list = targets self.targets_type = targets_type self.triggers = self._triggers(policy.get(TRIGGERS)) self.reservation = self._reservation(policy.get(RESERVATION)) self.properties = None if 'properties' in policy: self.properties = policy['properties'] self._validate_keys() @property def targets(self): return self.entity_tpl.get('targets') @property def description(self): return self.entity_tpl.get('description') @property def metadata(self): return self.entity_tpl.get('metadata') def get_targets_type(self): return self.targets_type def get_targets_list(self): return self.targets_list def _triggers(self, triggers): triggerObjs = [] if triggers: for name, trigger_tpl in triggers.items(): triggersObj = Triggers(name, trigger_tpl) triggerObjs.append(triggersObj) return triggerObjs def _reservation(self, reservation): reservationObjs = [] if reservation: reservationObj = Reservation(reservation) reservationObjs.append(reservationObj) return reservationObjs def _validate_keys(self): for key in self.entity_tpl.keys(): if key not in SECTIONS: ExceptionCollector.appendException( UnknownFieldError(what='Policy "%s"' % self.name, field=key)) def validate(self): self._validate_properties(self.entity_tpl, self.type_definition) for prop in self.get_properties_objects(): prop.validate() ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873902.5253994 tosca_parser-2.15.0/toscaparser/prereq/0000775000175000017500000000000015250006257016734 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8123093 tosca_parser-2.15.0/toscaparser/prereq/__init__.py0000664000175000017500000000000015250006202021021 0ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8123093 tosca_parser-2.15.0/toscaparser/prereq/csar.py0000664000175000017500000004145615250006202020236 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os.path import requests import shutil import tempfile import yaml import zipfile from io import BytesIO from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import URLException from toscaparser.common.exception import ValidationError from toscaparser.imports import ImportsLoader from toscaparser.utils.gettextutils import _ from toscaparser.utils.urlutils import UrlUtils from toscaparser.utils import yamlparser TOSCA_META = 'TOSCA-Metadata/TOSCA.meta' YAML_LOADER = yamlparser.load_yaml class CSAR(object): def __init__(self, csar_file, a_file=True): self.path = csar_file self.a_file = a_file self.is_validated = False self.csar = None self.temp_dir = None self.is_tosca_metadata = False self.main_template_file_name = None self.zfile = None def validate(self): """Validate the provided CSAR file.""" self.is_validated = True # validate that the file or URL exists missing_err_msg = (_('"%s" does not exist.') % self.path) if self.a_file: if not os.path.isfile(self.path): ExceptionCollector.appendException( ValidationError(message=missing_err_msg)) return False else: self.csar = self.path else: # a URL if not UrlUtils.validate_url(self.path): ExceptionCollector.appendException( ValidationError(message=missing_err_msg)) return False else: response = requests.get(self.path) self.csar = BytesIO(response.content) # validate that it is a valid zip file if not zipfile.is_zipfile(self.csar): err_msg = (_('"%s" is not a valid zip file.') % self.path) ExceptionCollector.appendException( ValidationError(message=err_msg)) return False # validate that it contains the metadata file in the correct location self.zfile = zipfile.ZipFile(self.csar, 'r') filelist = self.zfile.namelist() if TOSCA_META in filelist: self.is_tosca_metadata = True # validate that 'Entry-Definitions' property exists in TOSCA.meta is_validated = self._validate_tosca_meta(filelist) else: self.is_tosca_metadata = False is_validated = self._validate_root_level_yaml(filelist) if is_validated: # validate that external references and imports in the main # template actually exist and are accessible main_tpl = self._read_template_yaml(self.main_template_file_name) self._validate_external_references(main_tpl) return not ExceptionCollector.exceptionsCaught() def get_metadata(self): """Return the metadata dictionary.""" # validate the csar if not already validated if not self.is_validated: self.validate() # return a copy to avoid changes overwrite the original return dict(self.metadata) if self.metadata else None def _get_metadata(self, key): if not self.is_validated: self.validate() return self.metadata.get(key) def get_author(self): if self.is_tosca_metadata: return self._get_metadata('Created-By') else: # In case CSAR zip doesn't contain TOSCA.Metadata directory, # Created-By is defined by the template_author metadata return self._get_metadata('template_author') def get_version(self): if self.is_tosca_metadata: return self._get_metadata('CSAR-Version') else: # In case CSAR zip doesn't contain TOSCA.Metadata directory, # CSAR-Version is defined by the template_version metadata return self._get_metadata('template_version') def get_main_template(self): if not self.is_validated: self.validate() return self.main_template_file_name def get_main_template_yaml(self): main_template = self.get_main_template() if main_template: data = self.zfile.read(main_template) invalid_tosca_yaml_err_msg = ( _('The file "%(template)s" in the CSAR "%(csar)s" does not ' 'contain valid TOSCA YAML content.') % {'template': main_template, 'csar': self.path}) try: tosca_yaml = yaml.safe_load(data) if type(tosca_yaml) is not dict: ExceptionCollector.appendException( ValidationError(message=invalid_tosca_yaml_err_msg)) return tosca_yaml except Exception: ExceptionCollector.appendException( ValidationError(message=invalid_tosca_yaml_err_msg)) def get_description(self): desc = self._get_metadata('Description') if desc is not None: return desc self.metadata['Description'] = \ self.get_main_template_yaml().get('description') return self.metadata['Description'] def decompress(self): if not self.is_validated: self.validate() self.temp_dir = tempfile.NamedTemporaryFile().name with zipfile.ZipFile(self.csar, "r") as zf: zf.extractall(self.temp_dir) def _validate_external_artifact_imports(self, main_tpl, tpl_filename): """validate the imports and artifacts""" self._validate_template(main_tpl, tpl_filename) if main_tpl: if 'imports' in main_tpl: custom_service = ImportsLoader( main_tpl['imports'], os.path.join(self.temp_dir, tpl_filename)) # Get list of nested templates nested_tosca_tpls = custom_service.get_nested_tosca_tpls() # Validate external references of each nested template. if nested_tosca_tpls: for tosca_tpl in nested_tosca_tpls: for filename, tpl in tosca_tpl.items(): self._validate_external_artifact_imports( tpl, filename) def _validate_external_references(self, main_tpl): """Extracts files referenced in the main template These references are currently supported: * imports * interface implementations * artifacts """ try: self.decompress() self._validate_external_artifact_imports( main_tpl, self.main_template_file_name) finally: if self.temp_dir: shutil.rmtree(self.temp_dir) def _validate_template(self, template_data, template): if 'topology_template' in template_data: topology_template = template_data['topology_template'] if 'node_templates' in topology_template: node_templates = topology_template['node_templates'] for node_template_key in node_templates: node_template = node_templates[node_template_key] if 'artifacts' in node_template: self._validate_artifacts( node_template, node_templates, template) if 'interfaces' in node_template: self._validate_interfaces( node_template, node_templates, template) def _validate_artifacts(self, node_template, node_templates, template): artifacts = node_template['artifacts'] for artifact_key in artifacts: artifact = artifacts[artifact_key] if isinstance(artifact, str): self._validate_external_reference( node_templates, template, artifact) elif isinstance(artifact, dict): if 'file' in artifact: self._validate_external_reference( node_templates, template, artifact['file']) else: ExceptionCollector.appendException( ValueError(_('Unexpected artifact definition for "%s".') % artifact_key)) def _validate_interfaces(self, node_template, node_templates, template): interfaces = node_template['interfaces'] for interface_key in interfaces: interface = interfaces[interface_key] for operation_key in interface: operation = interface[operation_key] if isinstance(operation, str): self._validate_external_reference( node_templates, template, operation, False) elif isinstance(operation, dict): if 'implementation' in operation: if isinstance(operation['implementation'], dict): implement = operation['implementation'] if 'primary' in implement: self._validate_external_reference( node_templates, template, implement['primary'], False) elif 'dependencies' in implement: self._validate_external_reference( node_templates, template, implement['dependencies'], False) else: self._validate_external_reference( node_templates, template, operation['implementation'], False) def _validate_external_reference(self, node_templates, tpl_file, resource_file, raise_exc=True): """Verify that the external resource exists If resource_file is a URL verify that the URL is valid. If resource_file is a relative path verify that the path is valid considering base folder (self.temp_dir) and tpl_file. If resource_file is not a path verify that it is a valid implementation name by matching the artifact name. Note that in a CSAR resource_file cannot be an absolute path. """ if UrlUtils.validate_url(resource_file): msg = (_('The resource at "%s" cannot be accessed.') % resource_file) try: if UrlUtils.url_accessible(resource_file): return else: ExceptionCollector.appendException( URLException(what=msg)) except Exception: ExceptionCollector.appendException( URLException(what=msg)) if os.path.isfile(os.path.join(self.temp_dir, os.path.dirname(tpl_file), resource_file)): return elif self._validate_artifact_name(node_templates): return else: raise_exc = True if raise_exc: ExceptionCollector.appendException( ValueError(_('The resource "%s" does not exist.') % resource_file)) def _read_template_yaml(self, template): data = self.zfile.read(template) invalid_tosca_yaml_err_msg = ( _('The file "%(template)s" in the CSAR "%(csar)s" does not ' 'contain valid YAML content.') % {'template': template, 'csar': self.path}) try: tosca_yaml = yaml.safe_load(data) if type(tosca_yaml) is not dict: ExceptionCollector.appendException( ValidationError(message=invalid_tosca_yaml_err_msg)) return None return tosca_yaml except Exception: ExceptionCollector.appendException( ValidationError(message=invalid_tosca_yaml_err_msg)) return None def _validate_tosca_meta(self, filelist): tosca = self._read_template_yaml(TOSCA_META) if tosca is None: return False self.metadata = tosca if 'Entry-Definitions' not in self.metadata: err_msg = (_('The CSAR "%s" is missing the required metadata ' '"Entry-Definitions" in ' '"TOSCA-Metadata/TOSCA.meta".') % self.path) ExceptionCollector.appendException( ValidationError(message=err_msg)) return False # validate that 'Entry-Definitions' metadata value points to an # existing file in the CSAR entry = self.metadata.get('Entry-Definitions') if entry and entry not in filelist: err_msg = (_('The "Entry-Definitions" file defined in the ' 'CSAR "%s" does not exist.') % self.path) ExceptionCollector.appendException( ValidationError(message=err_msg)) return False self.main_template_file_name = entry return True def _validate_root_level_yaml(self, filelist): root_files = [] for file in filelist: if '/' not in file: __, file_extension = os.path.splitext(file) if file_extension in ['.yaml', '.yml']: root_files.append(file) if not len(root_files) == 1: err_msg = (_('CSAR file should contain only one root level yaml' ' file. Found "%d" yaml file(s).') % len(root_files)) ExceptionCollector.appendException( ValidationError(message=err_msg)) return False template_data = self._read_template_yaml(root_files[0]) if template_data is None: return False tosca_version = template_data.get('tosca_definitions_version') if tosca_version == 'tosca_simple_yaml_1_0': err_msg = (_('"%s" is not a valid CSAR as it does not contain' ' the required file "TOSCA.meta" in the' ' folder "TOSCA-Metadata".') % self.path) ExceptionCollector.appendException( ValidationError(message=err_msg)) return False self.metadata = template_data.get('metadata') self.main_template_file_name = root_files[0] return True def _validate_artifact_name(self, node_templates): artifact_name = [] for node_template_key in node_templates: node_template = node_templates[node_template_key] if 'artifacts' in node_template: artifacts = node_template['artifacts'] for artifact_key in artifacts: artifact_name.append(artifact_key) if 'interfaces' in node_template: interfaces = node_template['interfaces'] for interface_key in interfaces: interface = interfaces[interface_key] for operation_key in interface: operation = interface[operation_key] if isinstance(operation, str): if operation in artifact_name: return True elif isinstance(operation, dict): if 'implementation' in operation: if isinstance(operation['implementation'], dict): implement = operation['implementation'] if 'primary' in implement: if (implement['primary'] in artifact_name): return True elif 'dependencies' in implement: if (implement['dependencies'] in artifact_name): return True else: if (operation['implementation'] in artifact_name): return True return False ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8123093 tosca_parser-2.15.0/toscaparser/properties.py0000664000175000017500000000504015250006202020171 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.dataentity import DataEntity from toscaparser.elements.constraints import Schema from toscaparser.functions import is_function class Property(object): '''TOSCA built-in Property type.''' PROPERTY_KEYS = ( TYPE, REQUIRED, DESCRIPTION, DEFAULT, CONSTRAINTS ) = ( 'type', 'required', 'description', 'default', 'constraints' ) ENTRY_SCHEMA_KEYS = ( ENTRYTYPE, ENTRYPROPERTIES ) = ( 'type', 'properties' ) def __init__(self, property_name, value, schema_dict, custom_def=None): self.name = property_name self.value = value self.custom_def = custom_def self.schema = Schema(property_name, schema_dict) @property def type(self): return self.schema.type @property def required(self): return self.schema.required @property def description(self): return self.schema.description @property def default(self): return self.schema.default @property def constraints(self): return self.schema.constraints @property def key_schema(self): return self.schema.key_schema @property def entry_schema(self): return self.schema.entry_schema def validate(self): '''Validate if not a reference property.''' if not is_function(self.value): if self.type == Schema.STRING: self.value = str(self.value) self.value = DataEntity.validate_datatype(self.type, self.value, self.entry_schema, self.custom_def, self.name, self.key_schema) self._validate_constraints() def _validate_constraints(self): if self.constraints: for constraint in self.constraints: constraint.validate(self.value) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8123093 tosca_parser-2.15.0/toscaparser/relationship_template.py0000664000175000017500000000616515250006202022402 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging from toscaparser.entity_template import EntityTemplate from toscaparser.properties import Property SECTIONS = (DERIVED_FROM, PROPERTIES, REQUIREMENTS, INTERFACES, CAPABILITIES, TYPE) = \ ('derived_from', 'properties', 'requirements', 'interfaces', 'capabilities', 'type') log = logging.getLogger('tosca') class RelationshipTemplate(EntityTemplate): '''Relationship template.''' def __init__(self, relationship_template, name, custom_def=None, target=None, source=None): super(RelationshipTemplate, self).__init__(name, relationship_template, 'relationship_type', custom_def) self.name = name.lower() self.target = target self.source = source def get_properties_objects(self): '''Return properties objects for this template.''' if self._properties is None: self._properties = self._create_relationship_properties() return self._properties def _create_relationship_properties(self): props = [] properties = {} relationship = self.entity_tpl.get('relationship') if not relationship: for value in self.entity_tpl.values(): if isinstance(value, dict): relationship = value.get('relationship') break if relationship: properties = self.type_definition.get_value(self.PROPERTIES, relationship) or {} if not properties: properties = self.entity_tpl.get(self.PROPERTIES) or {} if properties: for name, value in properties.items(): props_def = self.type_definition.get_properties_def() if props_def and name in props_def: if name in properties.keys(): value = properties.get(name) prop = Property(name, value, props_def[name].schema, self.custom_def) props.append(prop) for p in self.type_definition.get_properties_def_objects(): if p.default is not None and p.name not in properties.keys(): prop = Property(p.name, p.default, p.schema, self.custom_def) props.append(prop) return props def validate(self): self._validate_properties(self.entity_tpl, self.type_definition) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8123093 tosca_parser-2.15.0/toscaparser/repositories.py0000664000175000017500000000445315250006202020533 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import MissingRequiredFieldError from toscaparser.common.exception import UnknownFieldError from toscaparser.common.exception import URLException from toscaparser.utils.gettextutils import _ import toscaparser.utils.urlutils SECTIONS = (DESCRIPTION, URL, CREDENTIAL) = \ ('description', 'url', 'credential') class Repository(object): def __init__(self, repositories, values): self.name = repositories self.reposit = values if isinstance(self.reposit, dict): if 'url' not in self.reposit.keys(): ExceptionCollector.appendException( MissingRequiredFieldError(what=_('Repository "%s"') % self.name, required='url')) self.url = self.reposit['url'] self.load_and_validate(self.name, self.reposit) def load_and_validate(self, val, reposit_def): self.keyname = val if isinstance(reposit_def, dict): for key in reposit_def.keys(): if key not in SECTIONS: ExceptionCollector.appendException( UnknownFieldError(what=_('repositories "%s"') % self.keyname, field=key)) if URL in reposit_def.keys(): reposit_url = reposit_def.get(URL) url_val = toscaparser.utils.urlutils.UrlUtils.\ validate_url(reposit_url) if url_val is not True: ExceptionCollector.appendException( URLException(what=_('repsositories "%s" Invalid Url') % self.keyname)) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8123093 tosca_parser-2.15.0/toscaparser/reservation.py0000664000175000017500000000326315250006202020343 0ustar00zuulzuul# Copyright (C) 2018 NTT DATA # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging from toscaparser.common.exception import UnknownFieldError from toscaparser.entity_template import EntityTemplate from toscaparser.entity_template import MissingRequiredFieldError SECTIONS = (START_ACTIONS, BEFORE_END_ACTIONS, END_ACTIONS, PROPERTIES) = \ ('start_actions', 'before_end_actions', 'end_actions', 'properties') log = logging.getLogger('tosca') class Reservation(EntityTemplate): '''Reservation defined in policies of topology template''' def __init__(self, reservation_tpl): self.reservation_tpl = reservation_tpl self._validate_keys() self._validate_missing_field() def _validate_keys(self): for key in self.reservation_tpl.keys(): if key not in SECTIONS: raise UnknownFieldError(what='Reservation', field=key) def _validate_missing_field(self): for key in SECTIONS: if key not in self.reservation_tpl.keys(): raise MissingRequiredFieldError(what='Reservation', required=key) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8123093 tosca_parser-2.15.0/toscaparser/shell.py0000664000175000017500000000744215250006202017114 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import argparse import os import sys from toscaparser.tosca_template import ToscaTemplate from toscaparser.utils.gettextutils import _ import toscaparser.utils.urlutils """ CLI entry point to show how TOSCA Parser can be used programmatically This is a basic command line utility showing the entry point in the TOSCA Parser and how to iterate over parsed template. It can be extended or modified to fit an individual need. It can be used as, #tosca-parser --template-file= #tosca-parser --template-file= #tosca-parser --template-file= e.g. #tosca-parser --template-file=toscaparser/tests/data/tosca_helloworld.yaml #tosca-parser --template-file=toscaparser/tests/data/CSAR/csar_hello_world.zip """ class ParserShell(object): def get_parser(self, argv): parser = argparse.ArgumentParser(prog="tosca-parser") parser.add_argument('--template-file', metavar='', required=True, help=_('YAML template or CSAR file to parse.')) return parser def main(self, argv): parser = self.get_parser(argv) (args, extra_args) = parser.parse_known_args(argv) path = args.template_file if os.path.isfile(path): self.parse(path) elif toscaparser.utils.urlutils.UrlUtils.validate_url(path): self.parse(path, False) else: raise ValueError(_('"%(path)s" is not a valid file.') % {'path': path}) def parse(self, path, a_file=True): output = None tosca = ToscaTemplate(path, None, a_file) version = tosca.version if tosca.version: print("\nversion: " + version) if hasattr(tosca, 'description'): description = tosca.description if description: print("\ndescription: " + description) if hasattr(tosca, 'inputs'): inputs = tosca.inputs if inputs: print("\ninputs:") for input in inputs: print("\t" + input.name) if hasattr(tosca, 'nodetemplates'): nodetemplates = tosca.nodetemplates if nodetemplates: print("\nnodetemplates:") for node in nodetemplates: print("\t" + node.name) # example of retrieving policy object '''if hasattr(tosca, 'policies'): policies = tosca.policies if policies: print("policies:") for policy in policies: print("\t" + policy.name) if policy.triggers: print("\ttriggers:") for trigger in policy.triggers: print("\ttrigger name:" + trigger.name)''' if hasattr(tosca, 'outputs'): outputs = tosca.outputs if outputs: print("\noutputs:") for output in outputs: print("\t" + output.name) def main(args=None): if args is None: args = sys.argv[1:] ParserShell().main(args) if __name__ == '__main__': main() ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8133092 tosca_parser-2.15.0/toscaparser/substitution_mappings.py0000664000175000017500000003306215250006202022454 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import InvalidNodeTypeError from toscaparser.common.exception import MissingDefaultValueError from toscaparser.common.exception import MissingRequiredFieldError from toscaparser.common.exception import MissingRequiredInputError from toscaparser.common.exception import TypeMismatchError from toscaparser.common.exception import UnknownFieldError from toscaparser.common.exception import UnknownOutputError from toscaparser.elements.nodetype import NodeType from toscaparser.utils.gettextutils import _ log = logging.getLogger('tosca') class SubstitutionMappings(object): '''SubstitutionMappings class declaration SubstitutionMappings exports the topology template as an implementation of a Node type. ''' SECTIONS = (NODE_TYPE, REQUIREMENTS, CAPABILITIES, PROPERTIES, ATTRIBUTES, INTERFACES, SUBSTITUTION_FILTER) = \ ('node_type', 'requirements', 'capabilities', 'properties', 'attributes', 'interfaces', 'substitution_filter') OPTIONAL_OUTPUTS = ['tosca_id', 'tosca_name', 'state'] def __init__(self, sub_mapping_def, nodetemplates, inputs, outputs, sub_mapped_node_template, custom_defs): self.nodetemplates = nodetemplates self.sub_mapping_def = sub_mapping_def self.inputs = inputs or [] self.outputs = outputs or [] self.sub_mapped_node_template = sub_mapped_node_template self.custom_defs = custom_defs or {} self._validate() self._capabilities = None self._requirements = None self._properties = None @property def type(self): if self.sub_mapping_def: return self.sub_mapping_def.get(self.NODE_TYPE) @classmethod def get_node_type(cls, sub_mapping_def): if isinstance(sub_mapping_def, dict): return sub_mapping_def.get(cls.NODE_TYPE) @property def node_type(self): return self.sub_mapping_def.get(self.NODE_TYPE) @property def capabilities(self): return self.sub_mapping_def.get(self.CAPABILITIES) @property def requirements(self): return self.sub_mapping_def.get(self.REQUIREMENTS) @property def properties(self): return self.sub_mapping_def.get(self.PROPERTIES) @property def attributes(self): return self.sub_mapping_def.get(self.ATTRIBUTES) @property def interfaces(self): return self.sub_mapping_def.get(self.INTERFACES) @property def substitution_filter(self): return self.sub_mapping_def.get(self.SUBSTITUTION_FILTER) @property def node_definition(self): return NodeType(self.node_type, self.custom_defs) def _validate(self): # Basic validation self._validate_keys() self._validate_type() # SubstitutionMapping class syntax validation self._validate_inputs() self._validate_capabilities() self._validate_requirements() self._validate_properties() self._validate_outputs() self._validate_attributes() self._validate_interfaces() self._validate_substitution_filter() def _validate_keys(self): """validate the keys of substitution mappings.""" for key in self.sub_mapping_def.keys(): if key not in self.SECTIONS: ExceptionCollector.appendException( UnknownFieldError(what=_('SubstitutionMappings'), field=key)) def _validate_type(self): """validate the node_type of substitution mappings.""" node_type = self.sub_mapping_def.get(self.NODE_TYPE) if not node_type: ExceptionCollector.appendException( MissingRequiredFieldError( what=_('SubstitutionMappings used in topology_template'), required=self.NODE_TYPE)) node_type_def = self.custom_defs.get(node_type) if not node_type_def: ExceptionCollector.appendException( InvalidNodeTypeError(what=node_type)) def _validate_inputs(self): """validate the inputs of substitution mappings. The inputs defined by the topology template have to match the properties of the node type or the substituted node. If there are more inputs than the substituted node has properties, default values must be defined for those inputs. """ all_inputs = set([input.name for input in self.inputs]) required_properties = set([p.name for p in self.node_definition. get_properties_def_objects() if p.required and p.default is None]) # Must provide inputs for required properties of node type. for property in required_properties: # Check property which is 'required' and has no 'default' value if property not in all_inputs: ExceptionCollector.appendException( MissingRequiredInputError( what=_('SubstitutionMappings with node_type ') + self.node_type, input_name=property)) # If the optional properties of node type need to be customized by # substituted node, it also is necessary to define inputs for them, # otherwise they are not mandatory to be defined. customized_parameters = set(self.sub_mapped_node_template .get_properties().keys() if self.sub_mapped_node_template else []) all_properties = set(self.node_definition.get_properties_def()) for parameter in customized_parameters - all_inputs: if parameter in all_properties: ExceptionCollector.appendException( MissingRequiredInputError( what=_('SubstitutionMappings with node_type ') + self.node_type, input_name=parameter)) # Additional inputs are not in the properties of node type must # provide default values. Currently the scenario may not happen # because of parameters validation in nodetemplate, here is a # guarantee. for input in self.inputs: if input.name in all_inputs - all_properties \ and input.default is None: ExceptionCollector.appendException( MissingDefaultValueError( what=_('SubstitutionMappings with node_type ') + self.node_type, input_name=input.name)) def _validate_capabilities(self): """validate the capabilities of substitution mappings.""" # The capabilites must be in node template wchich be mapped. tpls_capabilities = self.sub_mapping_def.get(self.CAPABILITIES) node_capabiliteys = self.sub_mapped_node_template.get_capabilities() \ if self.sub_mapped_node_template else None for cap in node_capabiliteys.keys() if node_capabiliteys else []: if (tpls_capabilities and cap not in list(tpls_capabilities.keys())): pass # ExceptionCollector.appendException( # UnknownFieldError(what='SubstitutionMappings', # field=cap)) def _validate_requirements(self): """validate the requirements of substitution mappings.""" # The requirements must be in node template wchich be mapped. tpls_requirements = self.sub_mapping_def.get(self.REQUIREMENTS) node_requirements = self.sub_mapped_node_template.requirements \ if self.sub_mapped_node_template else None for req in node_requirements if node_requirements else []: if (tpls_requirements and req not in list(tpls_requirements.keys())): pass # ExceptionCollector.appendException( # UnknownFieldError(what='SubstitutionMappings', # field=req)) def _validate_properties(self): """validate the properties of substitution mappings.""" # The properties in the substitution_mappings must be present # in the node template properties. tpls_properties = self.sub_mapping_def.get(self.PROPERTIES) node_properties = \ self.sub_mapped_node_template.get_properties_objects() \ if self.sub_mapped_node_template else None for req in node_properties if node_properties else []: if (tpls_properties and req not in list(tpls_properties.keys())): pass # ExceptionCollector.appendException( # UnknownFieldError(what='SubstitutionMappings', # field=req)) def _validate_outputs(self): """validate the outputs of substitution mappings. The outputs defined by the topology template have to match the attributes of the node type or the substituted node template, and the observable attributes of the substituted node template have to be defined as attributes of the node type or outputs in the topology template. """ # The outputs defined by the topology template have to match the # attributes of the node type according to the specification, but # it's reasonable that there are more inputs than the node type # has properties, the specification will be amended? for output in self.outputs: if output.name not in self.node_definition.get_attributes_def(): ExceptionCollector.appendException( UnknownOutputError( where=_('SubstitutionMappings with node_type ') + self.node_type, output_name=output.name)) def _validate_attributes(self): """validate the attributes of substitution mappings.""" # The attributes must be in node template wchich be mapped. tpls_attributes = self.sub_mapping_def.get(self.ATTRIBUTES) node_attributes = self.sub_mapped_node_template.attributes \ if self.sub_mapped_node_template else None for req in node_attributes if node_attributes else []: if (tpls_attributes and req not in list(tpls_attributes.keys())): pass # ExceptionCollector.appendException( # UnknownFieldError(what='SubstitutionMappings', # field=req)) def _validate_interfaces(self): """validate the interfaces of substitution mappings.""" # The interfaces must be in node template wchich be mapped. tpls_interfaces = self.sub_mapping_def.get(self.INTERFACES) node_interfaces = self.sub_mapped_node_template.interfaces \ if self.sub_mapped_node_template else None for req in node_interfaces if node_interfaces else []: if (tpls_interfaces and req not in list(tpls_interfaces.keys())): pass # ExceptionCollector.appendException( # UnknownFieldError(what='SubstitutionMappings', # field=req)) def _validate_substitution_filter(self): tpls_filter = self.sub_mapping_def.get( self.SUBSTITUTION_FILTER) if tpls_filter: for key, value in tpls_filter.items(): if key != 'node_filter': ExceptionCollector.appendException( UnknownFieldError(what=_('SubstitutionMappings'), field='substitution_filter')) if any( key not in { 'properties', 'capabilities'} for key in value.keys()): ExceptionCollector.appendException( UnknownFieldError(what=_('SubstitutionMappings'), field=key)) if 'properties' in value.keys(): if not isinstance(tpls_filter[key]['properties'], list): ExceptionCollector.appendException( TypeMismatchError( what=_( 'properties of the Node Filter ' 'definition Keyname'), type='list')) if 'capabilities' in value.keys(): if not isinstance(tpls_filter[key]['capabilities'], list): ExceptionCollector.appendException( TypeMismatchError( what=_( 'capabilities of the Node Filter ' 'definition Keyname'), type='list')) ././@PaxHeader0000000000000000000000000000003100000000000010207 xustar0025 mtime=1788873902.5284 tosca_parser-2.15.0/toscaparser/tests/0000775000175000017500000000000015250006257016600 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8133092 tosca_parser-2.15.0/toscaparser/tests/__init__.py0000664000175000017500000000000015250006202020665 0ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8133092 tosca_parser-2.15.0/toscaparser/tests/base.py0000664000175000017500000000601015250006202020047 0ustar00zuulzuul# Copyright 2010-2011 OpenStack Foundation # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import codecs import os import fixtures import testscenarios import testtools from toscaparser.tests import utils from toscaparser.tosca_template import ToscaTemplate _TRUE_VALUES = ('True', 'true', '1', 'yes') class TestCase(testscenarios.TestWithScenarios, testtools.TestCase): """Test case base class for all unit tests.""" def setUp(self): """Run before each test method to initialize test environment.""" super(TestCase, self).setUp() test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0) try: test_timeout = int(test_timeout) except ValueError: # If timeout value is invalid do not set a timeout. test_timeout = 0 if test_timeout > 0: self.useFixture(fixtures.Timeout(test_timeout, gentle=True)) self.useFixture(fixtures.NestedTempfile()) self.useFixture(fixtures.TempHomeDir()) if os.environ.get('OS_STDOUT_CAPTURE') in _TRUE_VALUES: stdout = self.useFixture(fixtures.StringStream('stdout')).stream self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout)) if os.environ.get('OS_STDERR_CAPTURE') in _TRUE_VALUES: stderr = self.useFixture(fixtures.StringStream('stderr')).stream self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr)) self.log_fixture = self.useFixture(fixtures.FakeLogger()) def _load_template(self, filename): """Load a Tosca template from tests data folder. :param filename: Tosca template file name to load. :return: ToscaTemplate """ return ToscaTemplate(os.path.join( utils.get_sample_test_path('data'), filename)) class MockTestClass(): comp_urldict = {} def mock_urlopen_method(self, path: str): """Open local file instead of opening file at external URL. When using this method, you need to set the URL to be replaced and the file path to open instead in "comp_urldict". This method checks whether the URL passed as an argument exists in the key of "comp_urldict", and if it exists, opens the file with the path set in the value of "comp_urldict". """ if self.comp_urldict.get(path): file_path = self.comp_urldict.get(path) else: file_path = path return codecs.open(file_path, encoding='utf-8', errors='strict') ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8133092 tosca_parser-2.15.0/toscaparser/tests/test_constraints.py0000664000175000017500000004122015250006202022545 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import datetime import yaml from toscaparser.common import exception from toscaparser.elements.constraints import Constraint from toscaparser.elements.constraints import Schema from toscaparser.tests.base import TestCase from toscaparser.utils.gettextutils import _ from toscaparser.utils import yamlparser class ConstraintTest(TestCase): def test_schema_dict(self): tpl_snippet = ''' cpus: type: integer description: Number of CPUs for the server. ''' schema = yamlparser.simple_parse(tpl_snippet) cpus_schema = Schema('cpus', schema['cpus']) self.assertEqual(len(cpus_schema), 2) self.assertEqual('integer', cpus_schema.type) self.assertEqual('Number of CPUs for the server.', cpus_schema.description) self.assertEqual(True, cpus_schema.required) self.assertIsNone(cpus_schema.default) def test_schema_not_dict(self): tpl_snippet = ''' cpus: - type: integer - description: Number of CPUs for the server. ''' schema = yamlparser.simple_parse(tpl_snippet) error = self.assertRaises(exception.InvalidSchemaError, Schema, 'cpus', schema['cpus']) self.assertEqual(_('Schema definition of "cpus" must be a dict.'), str(error)) def test_schema_miss_type(self): tpl_snippet = ''' cpus: description: Number of CPUs for the server. ''' schema = yamlparser.simple_parse(tpl_snippet) error = self.assertRaises(exception.InvalidSchemaError, Schema, 'cpus', schema['cpus']) self.assertEqual(_('Schema definition of "cpus" must have a "type" ' 'attribute.'), str(error)) def test_schema_none_description(self): tpl_snippet = ''' cpus: type: integer ''' schema = yamlparser.simple_parse(tpl_snippet) cpus_schema = Schema('cpus', schema['cpus']) self.assertEqual('', cpus_schema.description) def test_invalid_constraint_type(self): schema = {'invalid_type': 2} error = self.assertRaises(exception.InvalidSchemaError, Constraint, 'prop', Schema.INTEGER, schema) self.assertEqual(_('Invalid property "invalid_type".'), str(error)) def test_invalid_prop_type(self): schema = {'length': 5} error = self.assertRaises(exception.InvalidSchemaError, Constraint, 'prop', Schema.INTEGER, schema) self.assertEqual(_('Property "length" is not valid for data type ' '"integer".'), str(error)) def test_invalid_validvalues(self): schema = {'valid_values': 2} error = self.assertRaises(exception.InvalidSchemaError, Constraint, 'prop', Schema.INTEGER, schema) self.assertEqual(_('The property "valid_values" expects a list.'), str(error)) def test_validvalues_validate(self): schema = {'valid_values': [2, 4, 6, 8]} constraint = Constraint('prop', Schema.INTEGER, schema) self.assertIsNone(constraint.validate(4)) def test_validvalues_validate_fail(self): schema = {'valid_values': [2, 4, 6, 8]} constraint = Constraint('prop', Schema.INTEGER, schema) error = self.assertRaises(exception.ValidationError, constraint.validate, 5) self.assertEqual(_('The value "5" of property "prop" is not valid. ' 'Expected a value from "[2, 4, 6, 8]".'), str(error)) def test_invalid_in_range(self): snippet = 'in_range: {2, 6}' schema = yaml.safe_load(snippet) error = self.assertRaises(exception.InvalidSchemaError, Constraint, 'prop', Schema.INTEGER, schema) self.assertEqual(_('The property "in_range" expects a list.'), str(error)) def test_in_range_min_max(self): schema = {'in_range': [2, 6]} constraint = Constraint('prop', Schema.INTEGER, schema) self.assertEqual(2, constraint.min) self.assertEqual(6, constraint.max) def test_in_range_validate(self): schema = {'in_range': [2, 6]} constraint = Constraint('prop', Schema.INTEGER, schema) self.assertIsNone(constraint.validate(2)) self.assertIsNone(constraint.validate(4)) self.assertIsNone(constraint.validate(6)) def test_in_range_validate_fail(self): schema = {'in_range': [2, 6]} constraint = Constraint('prop', Schema.INTEGER, schema) error = self.assertRaises(exception.ValidationError, constraint.validate, 8) self.assertEqual(_('The value "8" of property "prop" is out of range ' '"(min:2, max:6)".'), str(error)) def test_equal_validate(self): schema = {'equal': 4} constraint = Constraint('prop', Schema.INTEGER, schema) self.assertIsNone(constraint.validate(4)) def test_equal_validate_fail(self): schema = {'equal': 4} constraint = Constraint('prop', Schema.INTEGER, schema) error = self.assertRaises(exception.ValidationError, constraint.validate, 8) self.assertEqual('The value "8" of property "prop" is not equal to ' '"4".', str(error)) def test_greater_than_validate(self): schema = {'greater_than': 4} constraint = Constraint('prop', Schema.INTEGER, schema) self.assertIsNone(constraint.validate(6)) def test_greater_than_validate_fail(self): schema = {'greater_than': 4} constraint = Constraint('prop', Schema.INTEGER, schema) error = self.assertRaises(exception.ValidationError, constraint.validate, 3) self.assertEqual(_('The value "3" of property "prop" must be greater ' 'than "4".'), str(error)) error = self.assertRaises(exception.ValidationError, constraint.validate, 4) self.assertEqual(_('The value "4" of property "prop" must be greater ' 'than "4".'), str(error)) def test_greater_than_invalid(self): snippet = 'greater_than: {4}' schema = yaml.safe_load(snippet) error = self.assertRaises(exception.InvalidSchemaError, Constraint, 'prop', Schema.INTEGER, schema) self.assertEqual(_('The property "greater_than" expects comparable ' 'values.'), str(error)) def test_greater_or_equal_validate(self): schema = {'greater_or_equal': 3.9} constraint = Constraint('prop', Schema.FLOAT, schema) self.assertIsNone(constraint.validate(3.9)) self.assertIsNone(constraint.validate(4.0)) def test_greater_or_equal_validate_fail(self): schema = {'greater_or_equal': 3.9} constraint = Constraint('prop', Schema.FLOAT, schema) error = self.assertRaises(exception.ValidationError, constraint.validate, 3.0) self.assertEqual(_('The value "3.0" of property "prop" must be ' 'greater than or equal to "3.9".'), str(error)) error = self.assertRaises(exception.ValidationError, constraint.validate, 3.8) self.assertEqual(_('The value "3.8" of property "prop" must be ' 'greater than or equal to "3.9".'), str(error)) def test_greater_or_equal_invalid(self): snippet = 'greater_or_equal: {3.9}' schema = yaml.safe_load(snippet) error = self.assertRaises(exception.InvalidSchemaError, Constraint, 'prop', Schema.INTEGER, schema) self.assertEqual(_('The property "greater_or_equal" expects ' 'comparable values.'), str(error)) def test_less_than_validate(self): schema = {'less_than': datetime.date(2014, 0o7, 25)} constraint = Constraint('prop', Schema.TIMESTAMP, schema) self.assertIsNone(constraint.validate(datetime.date(2014, 0o7, 20))) self.assertIsNone(constraint.validate(datetime.date(2014, 0o7, 24))) def test_less_than_validate_fail(self): schema = {'less_than': datetime.date(2014, 0o7, 25)} constraint = Constraint('prop', Schema.TIMESTAMP, schema) error = self.assertRaises(exception.ValidationError, constraint.validate, datetime.date(2014, 0o7, 25)) self.assertEqual(_('The value "2014-07-25" of property "prop" must be ' 'less than "2014-07-25".'), str(error)) error = self.assertRaises(exception.ValidationError, constraint.validate, datetime.date(2014, 0o7, 27)) self.assertEqual(_('The value "2014-07-27" of property "prop" must be ' 'less than "2014-07-25".'), str(error)) def test_less_than_invalid(self): snippet = 'less_than: {3.9}' schema = yaml.safe_load(snippet) error = self.assertRaises(exception.InvalidSchemaError, Constraint, 'prop', Schema.INTEGER, schema) self.assertEqual(_('The property "less_than" expects comparable ' 'values.'), str(error)) def test_less_or_equal_validate(self): schema = {'less_or_equal': 4} constraint = Constraint('prop', Schema.INTEGER, schema) self.assertIsNone(constraint.validate(4)) self.assertIsNone(constraint.validate(3)) def test_less_or_equal_validate_fail(self): schema = {'less_or_equal': 4} constraint = Constraint('prop', Schema.INTEGER, schema) error = self.assertRaises(exception.ValidationError, constraint.validate, 5) self.assertEqual(_('The value "5" of property "prop" must be less ' 'than or equal to "4".'), str(error)) def test_less_or_equal_invalid(self): snippet = 'less_or_equal: {3.9}' schema = yaml.safe_load(snippet) error = self.assertRaises(exception.InvalidSchemaError, Constraint, 'prop', Schema.INTEGER, schema) self.assertEqual(_('The property "less_or_equal" expects comparable ' 'values.'), str(error)) def test_invalid_length(self): schema = {'length': 'four'} error = self.assertRaises(exception.InvalidSchemaError, Constraint, 'prop', Schema.STRING, schema) self.assertEqual(_('The property "length" expects an integer.'), str(error)) schema = {'length': 4.5} error = self.assertRaises(exception.InvalidSchemaError, Constraint, 'prop', Schema.STRING, schema) self.assertEqual(_('The property "length" expects an integer.'), str(error)) def test_length_validate(self): schema = {'length': 4} constraint = Constraint('prop', Schema.STRING, schema) self.assertIsNone(constraint.validate('abcd')) def test_length_validate_fail(self): schema = {'length': 4} constraint = Constraint('prop', Schema.STRING, schema) error = self.assertRaises(exception.ValidationError, constraint.validate, 'abc') self.assertEqual(_('Length of value "abc" of property "prop" must ' 'be equal to "4".'), str(error)) error = self.assertRaises(exception.ValidationError, constraint.validate, 'abcde') self.assertEqual(_('Length of value "abcde" of property "prop" must ' 'be equal to "4".'), str(error)) def test_invalid_min_length(self): schema = {'min_length': 'four'} error = self.assertRaises(exception.InvalidSchemaError, Constraint, 'prop', Schema.STRING, schema) self.assertEqual(_('The property "min_length" expects an integer.'), str(error)) def test_min_length_validate(self): schema = {'min_length': 4} constraint = Constraint('prop', Schema.STRING, schema) self.assertIsNone(constraint.validate('abcd')) self.assertIsNone(constraint.validate('abcde')) def test_min_length_validate_fail(self): schema = {'min_length': 4} constraint = Constraint('prop', Schema.STRING, schema) error = self.assertRaises(exception.ValidationError, constraint.validate, 'abc') self.assertEqual(_('Length of value "abc" of property "prop" must ' 'be at least "4".'), str(error)) def test_invalid_max_length(self): schema = {'max_length': 'four'} error = self.assertRaises(exception.InvalidSchemaError, Constraint, 'prop', Schema.STRING, schema) self.assertEqual(_('The property "max_length" expects an integer.'), str(error)) def test_max_length_validate(self): schema = {'max_length': 4} constraint = Constraint('prop', Schema.STRING, schema) self.assertIsNone(constraint.validate('abcd')) self.assertIsNone(constraint.validate('abc')) def test_max_length_validate_fail(self): schema = {'max_length': 4} constraint = Constraint('prop', Schema.STRING, schema) error = self.assertRaises(exception.ValidationError, constraint.validate, 'abcde') self.assertEqual(_('Length of value "abcde" of property "prop" ' 'must be no greater than "4".'), str(error)) def test_pattern_validate(self): schema = {'pattern': '[0-9]*'} constraint = Constraint('prop', Schema.STRING, schema) self.assertIsNone(constraint.validate('123')) def test_pattern_validate_fail(self): schema = {'pattern': '[0-9]*'} constraint = Constraint('prop', Schema.STRING, schema) error = self.assertRaises(exception.ValidationError, constraint.validate, 'abc') self.assertEqual(_('The value "abc" of property "prop" does not ' 'match pattern "[0-9]*".'), str(error)) def test_min_length_with_map(self): schema = {'min_length': 1} constraint = Constraint('prop', Schema.MAP, schema) try: constraint.validate({"k": "v"}) except Exception as ex: self.fail(ex) def test_max_length_with_map(self): schema = {'max_length': 1} constraint = Constraint('prop', Schema.MAP, schema) try: constraint.validate({"k": "v"}) except Exception as ex: self.fail(ex) def test_min_length_with_list(self): schema = {'min_length': 1} constraint = Constraint('prop', Schema.LIST, schema) try: constraint.validate(["1", "2"]) except Exception as ex: self.fail(ex) def test_max_length_with_list(self): schema = {'max_length': 2} constraint = Constraint('prop', Schema.LIST, schema) try: constraint.validate(["1", "2"]) except Exception as ex: self.fail(ex) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8133092 tosca_parser-2.15.0/toscaparser/tests/test_custom_relationships.py0000664000175000017500000000252015250006202024454 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.tests.base import TestCase from toscaparser.tests import utils from toscaparser.tosca_template import ToscaTemplate class CustomRelationshipTypesTest(TestCase): '''TOSCA template.''' tosca_tpl = utils.get_sample_test_path( "data/relationship/test_custom_relationship.yaml") tosca = ToscaTemplate(tosca_tpl) def test_version(self): self.assertEqual(self.tosca.version, "tosca_simple_yaml_1_0") def test_custom_types(self): expected_custom_types = ['tosca.capabilities.HA', 'tosca.nodes.HACompute', 'tosca.relationships.HA'] self.assertCountEqual(self.tosca.topology_template.custom_defs.keys(), expected_custom_types) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8133092 tosca_parser-2.15.0/toscaparser/tests/test_datatypes.py0000664000175000017500000004647015250006202022210 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from testtools.testcase import skip from toscaparser.common import exception from toscaparser.dataentity import DataEntity from toscaparser.elements.datatype import DataType from toscaparser.parameters import Input from toscaparser.tests.base import TestCase from toscaparser.tests import utils from toscaparser.tosca_template import ToscaTemplate from toscaparser.utils.gettextutils import _ from toscaparser.utils import yamlparser class DataTypeTest(TestCase): custom_type_schema = ''' tosca.my.datatypes.PeopleBase: properties: name: type: string required: true constraints: - min_length: 2 gender: type: string default: unknown tosca.my.datatypes.People: derived_from: tosca.my.datatypes.PeopleBase properties: addresses: type: map required: false entry_schema: type: string contacts: type: list required: false entry_schema: type: tosca.my.datatypes.ContactInfo tosca.my.datatypes.ContactInfo: description: simple contact information properties: contact_name: type: string required: true constraints: - min_length: 2 contact_email: type: string contact_phone: type: string tosca.my.datatypes.TestLab: properties: humidity: type: range required: false constraints: - in_range: [-256, INFINITY] temperature1: type: range required: false constraints: - in_range: [-256, UNBOUNDED] temperature2: type: range required: false constraints: - in_range: [UNBOUNDED, 256] ''' custom_type_def = yamlparser.simple_parse(custom_type_schema) def test_empty_template(self): value_snippet = '' value = yamlparser.simple_parse(value_snippet) self.assertEqual(value, {}) def test_built_in_datatype(self): value_snippet = ''' private_network: network_name: private network_id: 3e54214f-5c09-1bc9-9999-44100326da1b addresses: [ 10.111.128.10 ] ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.datatypes.network.NetworkInfo', value.get('private_network')) self.assertIsNotNone(data.validate()) value_snippet = ''' portspec_valid: protocol: tcp ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.datatypes.network.PortSpec', value.get('portspec_valid')) self.assertIsNotNone(data.validate()) value_snippet = ''' portspec_invalid: protocol: xyz ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.datatypes.network.PortSpec', value.get('portspec_invalid')) err = self.assertRaises(exception.ValidationError, data.validate) self.assertEqual(_('The value "xyz" of property "protocol" is not ' 'valid. Expected a value from "[udp, tcp, igmp]".' ), err.__str__()) def test_built_in_datatype_with_short_name(self): value_snippet = ''' ethernet_port: port_name: port1 port_id: 2c0c7a37-691a-23a6-7709-2d10ad041467 network_id: 3e54214f-5c09-1bc9-9999-44100326da1b mac_address: f1:18:3b:41:92:1e addresses: [ 172.24.9.102 ] ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('PortInfo', value.get('ethernet_port')) self.assertIsNotNone(data.validate()) # Test normative PortSpec datatype's additional requirements # TODO(Matt) - opened as bug 1555300 # Need a test for PortSpec normative data type # that tests the spec. requirement: "A valid PortSpec # must have at least one of the following properties: # target, target_range, source or source_range." # TODO(Matt) - opened as bug 1555310 # test PortSpec value for source and target # against the source_range and target_range # when specified. def test_port_spec_addl_reqs(self): value_snippet = ''' test_port: protocol: tcp target: 65535 target_range: [ 1, 65535 ] source: 1 source_range: [ 1, 65535 ] ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.datatypes.network.PortSpec', value.get('test_port')) self.assertIsNotNone(data.validate()) def test_built_in_datatype_without_properties(self): value_snippet = ''' 2 ''' value = yamlparser.simple_parse(value_snippet) datatype = DataType('PortDef') self.assertEqual('integer', datatype.value_type) data = DataEntity('PortDef', value) self.assertIsNotNone(data.validate()) @skip('The example in TOSCA spec may have some problem.') def test_built_in_nested_datatype(self): value_snippet = ''' user_port: protocol: tcp target: [50000] source: [9000] ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('PortSpec', value.get('user_port')) self.assertIsNotNone(data.validate()) def test_built_in_nested_datatype_portdef(self): tpl_snippet = ''' inputs: db_port: type: PortDef description: Port for the MySQL database ''' inputs = yamlparser.simple_parse(tpl_snippet)['inputs'] name, attrs = list(inputs.items())[0] input = Input(name, attrs) self.assertIsNone(input.validate(3360)) err = self.assertRaises(exception.ValidationError, input.validate, 336000) self.assertEqual(_('The value "336000" of property "None" is out of ' 'range "(min:1, max:65535)".'), err.__str__()) def test_custom_datatype(self): value_snippet = ''' name: Mike gender: male ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.PeopleBase', value, DataTypeTest.custom_type_def) self.assertIsNotNone(data.validate()) def test_custom_datatype_with_parent(self): value_snippet = ''' name: Mike gender: male contacts: - {contact_name: Tom, contact_email: tom@email.com, contact_phone: '123456789'} - {contact_name: Jerry, contact_email: jerry@email.com, contact_phone: '321654987'} ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.People', value, DataTypeTest.custom_type_def) self.assertIsNotNone(data.validate()) # [Tom, Jerry] is not a dict, it can't be a value of datatype PeopleBase def test_non_dict_value_for_datatype(self): value_snippet = ''' [Tom, Jerry] ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.PeopleBase', value, DataTypeTest.custom_type_def) error = self.assertRaises(exception.TypeMismatchError, data.validate) self.assertEqual(_('[\'Tom\', \'Jerry\'] must be of type ' '"tosca.my.datatypes.PeopleBase".'), error.__str__()) # 'nema' is an invalid field name def test_field_error_in_dataentity(self): value_snippet = ''' nema: Mike gender: male ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.PeopleBase', value, DataTypeTest.custom_type_def) error = self.assertRaises(exception.UnknownFieldError, data.validate) self.assertEqual(_('Data value of type ' '"tosca.my.datatypes.PeopleBase" contains unknown ' 'field "nema". Refer to the definition to verify ' 'valid values.'), error.__str__()) def test_default_field_in_dataentity(self): value_snippet = ''' name: Mike ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.PeopleBase', value, DataTypeTest.custom_type_def) data = data.validate() self.assertEqual('unknown', data.get('gender')) # required field 'name' is missing def test_missing_field_in_dataentity(self): value_snippet = ''' gender: male ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.PeopleBase', value, DataTypeTest.custom_type_def) error = self.assertRaises(exception.MissingRequiredFieldError, data.validate) self.assertEqual(_('Data value of type ' '"tosca.my.datatypes.PeopleBase" is missing ' 'required field "[\'name\']".'), error.__str__()) # the value of name field is not a string def test_type_error_in_dataentity(self): value_snippet = ''' name: 123 gender: male ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.PeopleBase', value, DataTypeTest.custom_type_def) error = self.assertRaises(ValueError, data.validate) self.assertEqual(_('"123" is not a string.'), error.__str__()) # the value of name doesn't meet the defined constraint def test_value_error_in_dataentity(self): value_snippet = ''' name: M gender: male ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.PeopleBase', value, DataTypeTest.custom_type_def) error = self.assertRaises(exception.ValidationError, data.validate) self.assertEqual(_('Length of value "M" of property "name" must be ' 'at least "2".'), error.__str__()) # value of addresses doesn't fit the entry_schema def test_validation_in_collection_entry(self): value_snippet = ''' name: Mike gender: male addresses: {Home: 1, Office: 9 bar avenue} ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.People', value, DataTypeTest.custom_type_def) error = self.assertRaises(ValueError, data.validate) self.assertEqual(_('"1" is not a string.'), error.__str__()) # 'contact_pone' is an invalid attribute name in nested datatype below def test_validation_in_nested_datatype(self): value_snippet = ''' name: Mike gender: male contacts: - {contact_name: Tom, contact_email: tom@email.com, contact_pone: '123456789'} - {contact_name: Jerry, contact_email: jerry@email.com, contact_phone: '321654987'} ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.People', value, DataTypeTest.custom_type_def) error = self.assertRaises(exception.UnknownFieldError, data.validate) self.assertEqual(_('Data value of type ' '"tosca.my.datatypes.ContactInfo" contains unknown ' 'field "contact_pone". Refer to the definition to ' 'verify valid values.'), error.__str__()) def test_datatype_in_current_template(self): tpl_path = utils.get_sample_test_path( "data/datatypes/test_custom_datatypes_in_current_template.yaml") self.assertIsNotNone(ToscaTemplate(tpl_path)) def test_datatype_in_template_positive(self): tpl_path = utils.get_sample_test_path( "data/datatypes/test_custom_datatypes_positive.yaml") self.assertIsNotNone(ToscaTemplate(tpl_path)) def test_datatype_in_template_invalid_value(self): tpl_path = utils.get_sample_test_path( "data/datatypes/test_custom_datatypes_value_error.yaml") self.assertRaises(exception.ValidationError, ToscaTemplate, tpl_path) exception.ExceptionCollector.assertExceptionMessage( ValueError, _('"[\'1 foo street\', \'9 bar avenue\']" is not a map.')) def test_datatype_in_template_nested_datatype_error(self): tpl_path = utils.get_sample_test_path( "data/datatypes/test_custom_datatypes_nested_datatype_error.yaml") self.assertRaises(exception.ValidationError, ToscaTemplate, tpl_path) exception.ExceptionCollector.assertExceptionMessage( ValueError, _('"123456789" is not a string.')) def test_valid_range_type(self): value_snippet = ''' user_port: protocol: tcp target_range: [20000, 60000] source_range: [1000, 3000] ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('PortSpec', value.get('user_port')) self.assertIsNotNone(data.validate()) def test_invalid_range_datatype(self): value_snippet = ''' user_port: protocol: tcp target: 1 target_range: [20000] ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('PortSpec', value.get('user_port')) err = self.assertRaises(ValueError, data.validate) self.assertEqual(_('"[20000]" is not a valid range.' ), err.__str__()) value_snippet = ''' user_port: protocol: tcp target: 1 target_range: [20000, 3000] ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('PortSpec', value.get('user_port')) err = self.assertRaises(ValueError, data.validate) self.assertEqual(_('"[20000, 3000]" is not a valid range.' ), err.__str__()) value_snippet = ''' humidity: [-100, 100] ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.TestLab', value, DataTypeTest.custom_type_def) err = self.assertRaises(exception.InvalidSchemaError, lambda: data.validate()) self.assertEqual(_('The property "in_range" expects comparable values.' ), err.__str__()) def test_range_unbounded(self): value_snippet = ''' humidity: [-100, 100] ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.TestLab', value, DataTypeTest.custom_type_def) err = self.assertRaises(exception.InvalidSchemaError, lambda: data.validate()) self.assertEqual(_('The property "in_range" expects comparable values.' ), err.__str__()) def test_invalid_ranges_against_constraints(self): # The TestLab range type has min=-256, max=UNBOUNDED value_snippet = ''' temperature1: [-257, 999999] ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.TestLab', value, DataTypeTest.custom_type_def) err = self.assertRaises(exception.ValidationError, data.validate) self.assertEqual(_('The value "-257" of property "temperature1" is ' 'out of range "(min:-256, max:UNBOUNDED)".'), err.__str__()) value_snippet = ''' temperature2: [-999999, 257] ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.TestLab', value, DataTypeTest.custom_type_def) err = self.assertRaises(exception.ValidationError, data.validate) self.assertEqual(_('The value "257" of property "temperature2" is ' 'out of range "(min:UNBOUNDED, max:256)".'), err.__str__()) def test_valid_ranges_against_constraints(self): # The TestLab range type has max=UNBOUNDED value_snippet = ''' temperature1: [-255, 999999] ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.TestLab', value, DataTypeTest.custom_type_def) self.assertIsNotNone(data.validate()) # The TestLab range type has min=UNBOUNDED value_snippet = ''' temperature2: [-999999, 255] ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.my.datatypes.TestLab', value, DataTypeTest.custom_type_def) self.assertIsNotNone(data.validate()) def test_incorrect_field_in_datatype(self): tpl_snippet = ''' tosca_definitions_version: tosca_simple_yaml_1_0 topology_template: node_templates: server: type: tosca.nodes.Compute webserver: type: tosca.nodes.WebServer properties: admin_credential: user: username token: some_pass some_field: value requirements: - host: server ''' tpl = yamlparser.simple_parse(tpl_snippet) err = self.assertRaises(exception.ValidationError, ToscaTemplate, None, None, None, tpl) self.assertIn(_('The pre-parsed input failed validation with the ' 'following error(s): \n\n\tUnknownFieldError: Data ' 'value of type "tosca.datatypes.Credential" contains' ' unknown field "some_field". Refer to the definition' ' to verify valid values'), err.__str__()) def test_functions_datatype(self): value_snippet = ''' admin_credential: user: username token: { get_input: password } ''' value = yamlparser.simple_parse(value_snippet) data = DataEntity('tosca.datatypes.Credential', value.get('admin_credential')) self.assertIsNotNone(data.validate()) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8133092 tosca_parser-2.15.0/toscaparser/tests/test_exception.py0000664000175000017500000000327315250006202022202 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common import exception from toscaparser.tests.base import TestCase from toscaparser.utils.gettextutils import _ class ExceptionTest(TestCase): def setUp(self): super(TestCase, self).setUp() exception.TOSCAException.set_fatal_format_exception(False) def test_message(self): ex = exception.MissingRequiredFieldError(what='Template', required='type') self.assertEqual(_('Template is missing required field "type".'), ex.__str__()) def test_set_flag(self): exception.TOSCAException.set_fatal_format_exception('True') self.assertFalse( exception.TOSCAException._FATAL_EXCEPTION_FORMAT_ERRORS) def test_format_error(self): ex = exception.UnknownFieldError(what='Template') self.assertEqual(_('An unknown exception occurred.'), ex.__str__(),) self.assertRaises(KeyError, self._formate_exception) def _formate_exception(self): exception.UnknownFieldError.set_fatal_format_exception(True) raise exception.UnknownFieldError(what='Template') ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8143091 tosca_parser-2.15.0/toscaparser/tests/test_functions.py0000664000175000017500000004320215250006202022210 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os from toscaparser.common import exception from toscaparser import functions from toscaparser.tests.base import TestCase from toscaparser.tests import utils from toscaparser.tosca_template import ToscaTemplate from toscaparser.utils.gettextutils import _ class IntrinsicFunctionsTest(TestCase): tosca_tpl = utils.get_sample_test_path( "data/tosca_single_instance_wordpress.yaml") params = {'db_name': 'my_wordpress', 'db_user': 'my_db_user', 'db_root_pwd': '12345678'} tosca = ToscaTemplate(tosca_tpl, parsed_params=params) def _get_node(self, node_name, tosca=None): if tosca is None: tosca = self.tosca return [ node for node in tosca.nodetemplates if node.name == node_name][0] def _get_operation(self, interfaces, operation): return [ interface for interface in interfaces if interface.name == operation][0] def _get_property(self, node_template, property_name): return [prop.value for prop in node_template.get_properties_objects() if prop.name == property_name][0] def _get_inputs_dict(self): inputs = {} for input in self.tosca.inputs: inputs[input.name] = input.default return inputs def _get_input(self, name): self._get_inputs_dict()[name] def test_get_property(self): wordpress = self._get_node('wordpress') operation = self._get_operation(wordpress.interfaces, 'configure') wp_db_password = operation.inputs['wp_db_password'] self.assertIsInstance(wp_db_password, functions.GetProperty) result = wp_db_password.result() self.assertEqual('wp_pass', result) def test_get_property_with_input_param(self): wordpress = self._get_node('wordpress') operation = self._get_operation(wordpress.interfaces, 'configure') wp_db_user = operation.inputs['wp_db_user'] self.assertIsInstance(wp_db_user, functions.GetProperty) result = wp_db_user.result() self.assertEqual('my_db_user', result) def test_unknown_capability_property(self): self.assertRaises(exception.ValidationError, self._load_template, 'functions/test_unknown_capability_property.yaml') exception.ExceptionCollector.assertExceptionMessage( KeyError, _('\'Property "unknown" was not found in capability ' '"database_endpoint" of node template "database" referenced ' 'from node template "database".\'')) def test_get_input_in_properties(self): mysql_dbms = self._get_node('mysql_dbms') expected_inputs = ['db_root_pwd', 'db_port'] props = mysql_dbms.get_properties() for key in props.keys(): prop = props[key] self.assertIsInstance(prop.value, functions.GetInput) expected_inputs.remove(prop.value.input_name) self.assertListEqual(expected_inputs, []) def test_get_input_validation(self): self.assertRaises( exception.ValidationError, self._load_template, 'functions/test_unknown_input_in_property.yaml') exception.ExceptionCollector.assertExceptionMessage( exception.UnknownInputError, _('Unknown input "objectstore_name".')) self.assertRaises( exception.ValidationError, self._load_template, 'functions/test_unknown_input_in_interface.yaml') exception.ExceptionCollector.assertExceptionMessage( exception.UnknownInputError, _('Unknown input "image_id".')) self.assertRaises( exception.ValidationError, self._load_template, 'functions/test_invalid_function_signature.yaml') exception.ExceptionCollector.assertExceptionMessage( ValueError, _('Expected one argument for function "get_input" but received ' '"[\'cpus\', \'cpus\']".')) def test_get_input_default_value_result(self): mysql_dbms = self._get_node('mysql_dbms') dbms_port = self._get_property(mysql_dbms, 'port') self.assertEqual(3306, dbms_port.result()) dbms_root_password = self._get_property(mysql_dbms, 'root_password') self.assertEqual(dbms_root_password.result(), '12345678') def test_get_property_with_host(self): tosca_tpl = utils.get_sample_test_path( "data/functions/test_get_property_with_host.yaml") mysql_database = self._get_node('mysql_database', ToscaTemplate(tosca_tpl, parsed_params={ 'db_root_pwd': '123' })) operation = self._get_operation(mysql_database.interfaces, 'configure') db_port = operation.inputs['db_port'] self.assertIsInstance(db_port, functions.GetProperty) result = db_port.result() self.assertEqual(3306, result) test = operation.inputs['test'] self.assertIsInstance(test, functions.GetProperty) result = test.result() self.assertEqual(1, result) def test_get_property_with_nested_params(self): tosca_tpl = utils.get_sample_test_path( "data/functions/tosca_nested_property_names_indexes.yaml") webserver = self._get_node('wordpress', ToscaTemplate(tosca_tpl, parsed_params={ 'db_root_pwd': '1234'})) operation = self._get_operation(webserver.interfaces, 'configure') wp_endpoint_prot = operation.inputs['wp_endpoint_protocol'] self.assertIsInstance(wp_endpoint_prot, functions.GetProperty) self.assertEqual('tcp', wp_endpoint_prot.result()) wp_list_prop = operation.inputs['wp_list_prop'] self.assertIsInstance(wp_list_prop, functions.GetProperty) self.assertEqual(3, wp_list_prop.result()) def test_get_property_with_capabilties_inheritance(self): tosca_tpl = utils.get_sample_test_path( "data/functions/test_capabilties_inheritance.yaml") some_node = self._get_node('some_node', ToscaTemplate(tosca_tpl, parsed_params={ 'db_root_pwd': '1234'})) operation = self._get_operation(some_node.interfaces, 'configure') some_input = operation.inputs['some_input'] self.assertIsInstance(some_input, functions.GetProperty) self.assertEqual('someval', some_input.result()) def test_get_property_source_target_keywords(self): tosca_tpl = utils.get_sample_test_path( "data/functions/test_get_property_source_target_keywords.yaml") tosca = ToscaTemplate(tosca_tpl, parsed_params={'db_root_pwd': '1234'}) for node in tosca.nodetemplates: for relationship, trgt in node.relationships.items(): rel_template = trgt.get_relationship_template()[0] break operation = self._get_operation(rel_template.interfaces, 'pre_configure_source') target_test = operation.inputs['target_test'] self.assertIsInstance(target_test, functions.GetProperty) self.assertEqual(1, target_test.result()) source_port = operation.inputs['source_port'] self.assertIsInstance(source_port, functions.GetProperty) self.assertEqual(3306, source_port.result()) def test_get_prop_cap_host(self): tosca_tpl = utils.get_sample_test_path( "data/functions/test_get_prop_cap_host.yaml") some_node = self._get_node('some_node', ToscaTemplate(tosca_tpl)) some_prop = some_node.get_properties()['some_prop'] self.assertIsInstance(some_prop.value, functions.GetProperty) self.assertEqual('someval', some_prop.value.result()) def test_get_prop_cap_bool(self): tosca_tpl = utils.get_sample_test_path( "data/functions/test_get_prop_cap_bool.yaml") some_node = self._get_node('software', ToscaTemplate(tosca_tpl)) some_prop = some_node.get_properties()['some_prop'] self.assertIsInstance(some_prop.value, functions.GetProperty) self.assertEqual(False, some_prop.value.result()) def test_check_invalid_input(self): self.assertRaises( exception.ValidationError, self._load_template, 'functions/test_invalid_input.yaml') exception.ExceptionCollector.assertExceptionMessage( exception.UnknownInputError, _('Unknown input "non_existent_input".')) class GetAttributeTest(TestCase): def _load_template(self, filename): return ToscaTemplate(os.path.join( utils.get_sample_test_path('data'), filename), parsed_params={'db_root_pwd': '1234'}) def _get_operation(self, interfaces, operation): return [ interface for interface in interfaces if interface.name == operation][0] def test_get_attribute_in_outputs(self): tpl = self._load_template('tosca_single_instance_wordpress.yaml') website_url_output = [ x for x in tpl.outputs if x.name == 'website_url'][0] self.assertIsInstance(website_url_output.value, functions.GetAttribute) self.assertEqual('server', website_url_output.value.node_template_name) self.assertEqual('private_address', website_url_output.value.attribute_name) def test_get_attribute_invalid_args(self): expected_msg = _('Illegal arguments for function "get_attribute".' ' Expected arguments: "node-template-name", ' '"req-or-cap"(optional), "property name"') err = self.assertRaises(ValueError, functions.get_function, None, None, {'get_attribute': []}) self.assertIn(expected_msg, str(err)) err = self.assertRaises(ValueError, functions.get_function, None, None, {'get_attribute': ['x']}) self.assertIn(expected_msg, str(err)) def test_get_attribute_unknown_node_template_name(self): self.assertRaises( exception.ValidationError, self._load_template, 'functions/test_get_attribute_unknown_node_template_name.yaml') exception.ExceptionCollector.assertExceptionMessage( KeyError, _('\'Node template "unknown_node_template" was not found.\'')) def test_get_attribute_unknown_attribute(self): self.assertRaises( exception.ValidationError, self._load_template, 'functions/test_get_attribute_unknown_attribute_name.yaml') exception.ExceptionCollector.assertExceptionMessage( KeyError, _('\'Attribute "unknown_attribute" was not found in node template ' '"server".\'')) def test_get_attribute_host_keyword(self): tpl = self._load_template( 'functions/test_get_attribute_host_keyword.yaml') def assert_get_attribute_host_functionality(node_template_name): node = [x for x in tpl.nodetemplates if x.name == node_template_name][0] configure_op = [ x for x in node.interfaces if x.name == 'configure'][0] ip_addr_input = configure_op.inputs['ip_address'] self.assertIsInstance(ip_addr_input, functions.GetAttribute) self.assertEqual('server', ip_addr_input.get_referenced_node_template().name) assert_get_attribute_host_functionality('dbms') assert_get_attribute_host_functionality('database') def test_get_attribute_host_not_found(self): self.assertRaises( exception.ValidationError, self._load_template, 'functions/test_get_attribute_host_not_found.yaml') exception.ExceptionCollector.assertExceptionMessage( ValueError, _('"get_attribute: [ HOST, ... ]" was used in node template ' '"server" but "tosca.relationships.HostedOn" was not found in ' 'the relationship chain.')) def test_get_attribute_illegal_host_in_outputs(self): self.assertRaises( exception.ValidationError, self._load_template, 'functions/test_get_attribute_illegal_host_in_outputs.yaml') exception.ExceptionCollector.assertExceptionMessage( ValueError, _('"get_attribute: [ HOST, ... ]" is not allowed in "outputs" ' 'section of the TOSCA template.')) def test_get_attribute_with_index(self): self._load_template( 'functions/test_get_attribute_with_index.yaml') def test_get_attribute_with_index_error(self): self.assertRaises( exception.ValidationError, self._load_template, 'functions/test_get_attribute_with_index_error.yaml') exception.ExceptionCollector.assertExceptionMessage( ValueError, _('Illegal arguments for function "get_attribute". ' 'Unexpected attribute/index value "0"')) def test_get_attribute_source_target_keywords(self): tosca_tpl = utils.get_sample_test_path( "data/functions/test_get_attribute_source_target_keywords.yaml") tosca = ToscaTemplate(tosca_tpl, parsed_params={'db_root_pwd': '12345678'}) for node in tosca.nodetemplates: for relationship, trgt in node.relationships.items(): rel_template = trgt.get_relationship_template()[0] break operation = self._get_operation(rel_template.interfaces, 'pre_configure_source') target_test = operation.inputs['target_test'] self.assertIsInstance(target_test, functions.GetAttribute) source_port = operation.inputs['source_port'] self.assertIsInstance(source_port, functions.GetAttribute) def test_get_attribute_with_nested_params(self): self._load_template( 'functions/test_get_attribute_with_nested_params.yaml') def test_implicit_attribute(self): self.assertIsNotNone(self._load_template( 'functions/test_get_implicit_attribute.yaml')) def test_get_attribute_capability_inheritance(self): self.assertIsNotNone(self._load_template( 'functions/test_container_cap_child.yaml')) def test_get_attribute_custom_data_type(self): self.assertIsNotNone(self._load_template( 'functions/test_get_attribute_custom_data_type.yaml')) def test_get_attribute_neste_data_types(self): self.assertIsNotNone(self._load_template( 'functions/test_get_attribute_nested_data_types.yaml')) class ConcatTest(TestCase): def _load_template(self, filename): return ToscaTemplate(utils.get_sample_test_path(filename)) def test_validate_concat(self): tosca = self._load_template("data/functions/test_concat.yaml") server_url_output = [ output for output in tosca.outputs if output.name == 'url'][0] func = functions.get_function(self, tosca.outputs, server_url_output.value) self.assertIsInstance(func, functions.Concat) self.assertRaises(exception.ValidationError, self._load_template, 'data/functions/test_concat_invalid.yaml') exception.ExceptionCollector.assertExceptionMessage( ValueError, _('Invalid arguments for function "concat". Expected at least ' 'one arguments.')) class TokenTest(TestCase): def _load_template(self, filename): return ToscaTemplate(utils.get_sample_test_path(filename)) def test_validate_token(self): tosca = self._load_template("data/functions/test_token.yaml") server_url_output = [ output for output in tosca.outputs if output.name == 'url'][0] func = functions.get_function(self, tosca.outputs, server_url_output.value) self.assertIsInstance(func, functions.Token) self.assertRaises(exception.ValidationError, self._load_template, 'data/functions/test_token_invalid.yaml') exception.ExceptionCollector.assertExceptionMessage( ValueError, _('Invalid arguments for function "token". Expected at least ' 'three arguments.')) exception.ExceptionCollector.assertExceptionMessage( ValueError, _('Invalid arguments for function "token". Expected ' 'integer value as third argument.')) exception.ExceptionCollector.assertExceptionMessage( ValueError, _('Invalid arguments for function "token". Expected ' 'single char value as second argument.')) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8143091 tosca_parser-2.15.0/toscaparser/tests/test_prereq.py0000664000175000017500000004174615250006202021511 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os import requests import shutil from unittest import mock import urllib import zipfile from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import URLException from toscaparser.common.exception import ValidationError from toscaparser.prereq.csar import CSAR from toscaparser.tests.base import MockTestClass from toscaparser.tests.base import TestCase from toscaparser.tests import utils import toscaparser.utils from toscaparser.utils.gettextutils import _ from toscaparser.utils.urlutils import UrlUtils class CSARPrereqTest(TestCase): base_path = utils.get_sample_test_dir() def setUp(self): super(CSARPrereqTest, self).setUp() ExceptionCollector.clear() ExceptionCollector.stop() def test_file_exists(self): path = os.path.join(self.base_path, "data/CSAR/csar_not_there.zip") csar = CSAR(path) error = self.assertRaises(ValidationError, csar.validate) self.assertEqual(_('"%s" does not exist.') % path, str(error)) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_file_is_zip(self): path = os.path.join(self.base_path, "data/CSAR/csar_not_zip.zip") csar = CSAR(path) error = self.assertRaises(ValidationError, csar.validate) self.assertEqual(_('"%s" is not a valid zip file.') % path, str(error)) @mock.patch.object(requests, 'get') def test_url_is_zip(self, mock_requests_get): path = "https://example.com/csar_not_zip.zip" class TestResponse: content: bytes response = TestResponse() file_path = utils.get_sample_test_path("data/CSAR/csar_not_zip.zip") with open(file_path, 'br') as f: response.content = f.read() mock_requests_get.return_value = response csar = CSAR(path, False) error = self.assertRaises(ValidationError, csar.validate) self.assertEqual(_('"%s" is not a valid zip file.') % path, str(error)) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_metadata_file_exists(self): path = os.path.join(self.base_path, "data/CSAR/csar_no_metadata_file.zip") csar = CSAR(path) error = self.assertRaises(ValidationError, csar.validate) self.assertEqual(_('"%s" is not a valid CSAR as it does not contain ' 'the required file "TOSCA.meta" in the folder ' '"TOSCA-Metadata".') % path, str(error)) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_valid_metadata_file_exists(self): path = os.path.join(self.base_path, "data/CSAR/csar_wrong_metadata_file.zip") csar = CSAR(path) error = self.assertRaises(ValidationError, csar.validate) self.assertEqual(_('"%s" is not a valid CSAR as it does not contain ' 'the required file "TOSCA.meta" in the folder ' '"TOSCA-Metadata".') % path, str(error)) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_metadata_is_yaml(self): path = os.path.join(self.base_path, "data/CSAR/csar_metadata_not_yaml.zip") csar = CSAR(path) error = self.assertRaises(ValidationError, csar.validate) self.assertEqual(_('The file "TOSCA-Metadata/TOSCA.meta" in the CSAR ' '"%s" does not contain valid YAML content.') % path, str(error)) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_metadata_exists(self): path = os.path.join(self.base_path, "data/CSAR/csar_missing_metadata.zip") csar = CSAR(path) error = self.assertRaises(ValidationError, csar.validate) self.assertEqual(_('The CSAR "%s" is missing the required metadata ' '"Entry-Definitions" in ' '"TOSCA-Metadata/TOSCA.meta".') % path, str(error)) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_entry_def_exists(self): path = os.path.join(self.base_path, "data/CSAR/csar_invalid_entry_def.zip") csar = CSAR(path) error = self.assertRaises(ValidationError, csar.validate) self.assertEqual(_('The "Entry-Definitions" file defined in the CSAR ' '"%s" does not exist.') % path, str(error)) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_csar_invalid_import_path(self): path = os.path.join(self.base_path, "data/CSAR/csar_wordpress_invalid_import_path.zip") csar = CSAR(path) error = self.assertRaises(ImportError, csar.validate) self.assertEqual(_('Import "Invalid_import_path/wordpress.yaml" is' ' not valid.'), str(error)) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_csar_invalid_import_url(self): path = os.path.join(self.base_path, "data/CSAR/csar_wordpress_invalid_import_url.zip") csar = CSAR(path) error = self.assertRaises(URLException, csar.validate) self.assertEqual(_('Failed to reach server ' '"https://raw.githubusercontent.com/openstack/' 'tosca-parser/master/toscaparser/tests/data/CSAR/' 'tosca_single_instance_wordpress/Definitions/' 'wordpress1.yaml". Reason is: Not Found.'), str(error)) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_csar_invalid_script_path(self): path = os.path.join(self.base_path, "data/CSAR/csar_wordpress_invalid_script_path.zip") csar = CSAR(path) error = self.assertRaises(ValueError, csar.validate) self.assertTrue( str(error) == _('The resource "Scripts/WordPress/install.sh" does ' 'not exist.') or str(error) == _('The resource "Scripts/WordPress/configure.sh" ' 'does not exist.')) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_csar_invalid_script_url(self): path = os.path.join(self.base_path, "data/CSAR/csar_wordpress_invalid_script_url.zip") csar = CSAR(path) error = self.assertRaises(URLException, csar.validate) self.assertEqual(_('The resource at ' '"https://raw.githubusercontent.com/openstack/' 'tosca-parser/master/toscaparser/tests/data/CSAR/' 'tosca_single_instance_wordpress/Scripts/WordPress/' 'install1.sh" cannot be accessed.'), str(error)) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_valid_csar(self): path = os.path.join(self.base_path, "data/CSAR/csar_hello_world.zip") csar = CSAR(path) self.assertTrue(csar.validate()) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) @mock.patch.object(urllib.request, 'urlopen') @mock.patch.object(UrlUtils, 'url_accessible') def test_valid_csar_with_url_import_and_script( self, mock_url_accessible, mock_urlopen): path = os.path.join(self.base_path, "data/CSAR/csar_wordpress_with_url" "_import_and_script.zip") mock_path = "https://example.com/wordpress.yaml" mockclass = MockTestClass() mockclass.comp_urldict = {mock_path: utils.get_sample_test_path( "data/custom_types/wordpress.yaml")} mock_urlopen.side_effect = mockclass.mock_urlopen_method mock_url_accessible.return_value = True csar = CSAR(path) self.assertTrue(csar.validate()) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_metadata_invalid_csar(self): path = os.path.join(self.base_path, "data/CSAR/csar_metadata_not_yaml.zip") csar = CSAR(path) error = self.assertRaises(ValidationError, csar.get_author) self.assertEqual(_('The file "TOSCA-Metadata/TOSCA.meta" in the CSAR ' '"%s" does not contain valid YAML content.') % path, str(error)) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_metadata_valid_csar(self): path = os.path.join(self.base_path, "data/CSAR/csar_hello_world.zip") csar = CSAR(path) expected_meta = {'TOSCA-Meta-File-Version': 1.0, 'CSAR-Version': 1.1, 'Created-By': 'OASIS TOSCA TC', 'Entry-Definitions': 'tosca_helloworld.yaml'} self.assertEqual(expected_meta, csar.get_metadata(), 'The extracted metadata of the CSAR %(csar)s does ' 'not match the expected metadata %(meta)s' % {'csar': path, 'meta': expected_meta.__str__()}) self.assertEqual(1.1, csar.get_version()) self.assertEqual('OASIS TOSCA TC', csar.get_author()) self.assertEqual('tosca_helloworld.yaml', csar.get_main_template()) self.assertEqual('Template for deploying a single server with ' 'predefined properties.', csar.get_description()) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_csar_main_template(self): path = os.path.join(self.base_path, "data/CSAR/csar_hello_world.zip") csar = CSAR(path) yaml_file = utils.get_sample_test_path("data/tosca_helloworld.yaml") expected_yaml = toscaparser.utils.yamlparser.load_yaml(yaml_file) self.assertEqual(expected_yaml, csar.get_main_template_yaml()) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_decompress(self): path = os.path.join(self.base_path, "data/CSAR/csar_hello_world.zip") csar = CSAR(path) csar.decompress() zf = zipfile.ZipFile(path) for name in zf.namelist(): tmp_path = os.path.join(csar.temp_dir, name) self.assertTrue(os.path.isdir(tmp_path) or os.path.isfile(tmp_path)) shutil.rmtree(csar.temp_dir) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_alternate_csar_extension(self): path = os.path.join(self.base_path, "data/CSAR/csar_elk.csar") csar = CSAR(path) self.assertTrue(csar.validate()) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_csar_with_root_level_yaml(self): path = os.path.join(self.base_path, "data/CSAR/csar_root_level_yaml.zip") csar = CSAR(path) yaml_file = utils.get_sample_test_path( "data/CSAR/root_level_file.yaml") expected_yaml = toscaparser.utils.yamlparser.load_yaml(yaml_file) self.assertEqual(expected_yaml, csar.get_main_template_yaml()) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_csar_with_multiple_root_level_yaml_files_error(self): path = os.path.join(self.base_path, "data/CSAR/csar_two_root_level_yaml.zip") csar = CSAR(path) error = self.assertRaises(ValidationError, csar.validate) self.assertEqual(_('CSAR file should contain only one root level' ' yaml file. Found "2" yaml file(s).'), str(error)) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_csar_with_root_level_yaml_and_tosca_metadata(self): path = os.path.join(self.base_path, "data/CSAR/csar_root_level_" "yaml_and_tosca_metadata.zip") csar = CSAR(path) yaml_file = utils.get_sample_test_path( "data/CSAR/tosca_meta_file.yaml") expected_yaml = toscaparser.utils.yamlparser.load_yaml(yaml_file) self.assertEqual(expected_yaml, csar.get_main_template_yaml()) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_csar_root_yaml_with_tosca_definition_1_0_error(self): path = os.path.join(self.base_path, "data/CSAR/csar_root_yaml" "_with_tosca_definition1_0.zip") csar = CSAR(path) error = self.assertRaises(ValidationError, csar.validate) self.assertEqual(_('"%s" is not a valid CSAR as it does not contain' ' the required file "TOSCA.meta" in the folder ' '"TOSCA-Metadata".') % path, str(error)) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_csar_with_multilevel_imports_valid(self): path = os.path.join( self.base_path, "data/CSAR/csar_valid_multilevel_imports_validation.zip") csar = CSAR(path) yaml_file = utils.get_sample_test_path( "data/CSAR/multi_level_imports_response.yaml") expected_yaml = toscaparser.utils.yamlparser.load_yaml(yaml_file) self.assertEqual(expected_yaml, csar.get_main_template_yaml()) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_csar_with_multilevel_imports_invalid(self): path = os.path.join(self.base_path, "data/CSAR/csar_invalid_multilevel" "_imports_validation.zip") csar = CSAR(path) error = self.assertRaises(ValueError, csar.validate) self.assertEqual(_( 'The resource "%s" does ' 'not exist.') % 'Files/images/' 'cirros-0.4.0-x86_64-disk.img', str(error)) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_csar_valid_artifact(self): path = os.path.join(self.base_path, "data/CSAR/csar_wordpress_valid_artifact.zip") csar = CSAR(path) self.assertTrue(csar.validate()) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_csar_invalid_artifact(self): path = os.path.join(self.base_path, "data/CSAR/csar_wordpress_invalid_artifact.zip") csar = CSAR(path) error = self.assertRaises(ValueError, csar.validate) self.assertTrue( str(error) == _('The resource "Scripts/WordPress/configure.sh" ' 'does not exist.')) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_csar_valid_artifact_multi(self): path = os.path.join( self.base_path, "data/CSAR/csar_wordpress_valid_artifact_multi.zip") csar = CSAR(path) self.assertTrue(csar.validate()) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) def test_csar_invalid_artifact_multi(self): path = os.path.join( self.base_path, "data/CSAR/csar_wordpress_invalid_artifact_multi.zip") csar = CSAR(path) error = self.assertRaises(ValueError, csar.validate) self.assertTrue( str(error) == _('The resource "dummy-wordpress" ' 'does not exist.')) self.assertTrue(csar.temp_dir is None or not os.path.exists(csar.temp_dir)) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8143091 tosca_parser-2.15.0/toscaparser/tests/test_properties.py0000664000175000017500000003565115250006202022405 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from testtools import matchers from toscaparser.common import exception from toscaparser.elements.property_definition import PropertyDef from toscaparser.nodetemplate import NodeTemplate from toscaparser.properties import Property from toscaparser.tests.base import TestCase from toscaparser.utils.gettextutils import _ from toscaparser.utils import yamlparser class PropertyTest(TestCase): def test_type(self): test_property_schema = {'type': 'string'} propertyInstance = Property('test_property', 'Hughes', test_property_schema) self.assertEqual('string', propertyInstance.type) def test_type_invalid(self): test_property_schema = {'type': 'Fish'} propertyInstance = Property('test_property', 'Hughes', test_property_schema) error = self.assertRaises(exception.InvalidTypeError, propertyInstance.validate) self.assertEqual(_('Type "Fish" is not a valid type.'), str(error)) def test_list(self): test_property_schema = {'type': 'list'} propertyInstance = Property('test_property', ['a', 'b'], test_property_schema) self.assertIsNone(propertyInstance.validate()) self.assertEqual(['a', 'b'], propertyInstance.value) def test_list_invalid(self): test_property_schema = {'type': 'list'} propertyInstance = Property('test_property', 'a', test_property_schema) error = self.assertRaises(ValueError, propertyInstance.validate) self.assertEqual(_('"a" is not a list.'), str(error)) def test_list_entry_schema(self): test_property_schema = {'type': 'list', 'entry_schema': {'type': 'string'}} propertyInstance = Property('test_property', ['a', 'b'], test_property_schema) self.assertIsNone(propertyInstance.validate()) self.assertEqual(['a', 'b'], propertyInstance.value) schema_snippet = ''' type: list entry_schema: type: string constraints: - min_length: 2 ''' test_property_schema = yamlparser.simple_parse(schema_snippet) propertyInstance = Property('test_property', ['ab', 'cd'], test_property_schema) self.assertIsNone(propertyInstance.validate()) self.assertEqual(['ab', 'cd'], propertyInstance.value) def test_list_entry_schema_invalid(self): test_property_schema = {'type': 'list', 'entry_schema': {'type': 'integer'}} propertyInstance = Property('test_property', [1, 'b'], test_property_schema) error = self.assertRaises(ValueError, propertyInstance.validate) self.assertEqual(_('"b" is not an integer.'), str(error)) def test_map(self): test_property_schema = {'type': 'map'} propertyInstance = Property('test_property', {'a': 'b'}, test_property_schema) self.assertIsNone(propertyInstance.validate()) self.assertEqual({'a': 'b'}, propertyInstance.value) def test_map_invalid(self): test_property_schema = {'type': 'map'} propertyInstance = Property('test_property', 12, test_property_schema) error = self.assertRaises(ValueError, propertyInstance.validate) self.assertEqual(_('"12" is not a map.'), str(error)) def test_map_entry_schema(self): test_property_schema = {'type': 'map', 'entry_schema': {'type': 'boolean'}} propertyInstance = Property('test_property', {'valid': True, 'required': True}, test_property_schema) self.assertIsNone(propertyInstance.validate()) self.assertEqual({'valid': True, 'required': True}, propertyInstance.value) def test_map_entry_schema_invalid(self): test_property_schema = {'type': 'map', 'entry_schema': {'type': 'boolean'}} propertyInstance = Property('test_property', {'valid': True, 'contact_name': 123}, test_property_schema) error = self.assertRaises(ValueError, propertyInstance.validate) self.assertEqual(_('"123" is not a boolean.'), str(error)) def test_boolean(self): test_property_schema = {'type': 'boolean'} propertyInstance = Property('test_property', 'true', test_property_schema) self.assertIsNone(propertyInstance.validate()) propertyInstance = Property('test_property', True, test_property_schema) self.assertIsNone(propertyInstance.validate()) self.assertEqual(True, propertyInstance.value) def test_boolean_invalid(self): test_property_schema = {'type': 'boolean'} propertyInstance = Property('test_property', 12, test_property_schema) error = self.assertRaises(ValueError, propertyInstance.validate) self.assertEqual(_('"12" is not a boolean.'), str(error)) def test_float(self): test_property_schema = {'type': 'float'} propertyInstance = Property('test_property', 0.1, test_property_schema) self.assertIsNone(propertyInstance.validate()) self.assertEqual(0.1, propertyInstance.value) def test_float_invalid(self): test_property_schema = {'type': 'float'} propertyInstance = Property('test_property', 12, test_property_schema) error = self.assertRaises(ValueError, propertyInstance.validate) self.assertEqual(_('"12" is not a float.'), str(error)) def test_timestamp(self): test_property_schema = {'type': 'timestamp'} # canonical timestamp propertyInstance = Property('test_property', '2015-04-01T02:59:43.1Z', test_property_schema) self.assertIsNone(propertyInstance.validate()) self.assertEqual("2015-04-01T02:59:43.1Z", propertyInstance.value) # iso8601 timestamp propertyInstance = Property('test_property', '2015-04-01t21:59:43.10-05:00', test_property_schema) self.assertIsNone(propertyInstance.validate()) self.assertEqual("2015-04-01t21:59:43.10-05:00", propertyInstance.value) # space separated timestamp propertyInstance = Property('test_property', '2015-04-01 21:59:43.10 -5', test_property_schema) self.assertIsNone(propertyInstance.validate()) self.assertEqual("2015-04-01 21:59:43.10 -5", propertyInstance.value) # no time zone timestamp propertyInstance = Property('test_property', '2015-04-01 21:59:43.10', test_property_schema) self.assertIsNone(propertyInstance.validate()) self.assertEqual("2015-04-01 21:59:43.10", propertyInstance.value) # date (00:00:00Z) propertyInstance = Property('test_property', '2015-04-01', test_property_schema) self.assertIsNone(propertyInstance.validate()) self.assertEqual("2015-04-01", propertyInstance.value) def test_timestamp_invalid(self): test_property_schema = {'type': 'timestamp'} # invalid timestamp - day out of range value = '2015-04-115T02:59:43.1Z' propertyInstance = Property('test_property', value, test_property_schema) error = self.assertRaises(ValueError, propertyInstance.validate) expected_message = (_('"%s" is not a valid timestamp.') % value) self.assertThat(str(error), matchers.StartsWith(expected_message)) def test_required(self): test_property_schema = {'type': 'string'} propertyInstance = Property('test_property', 'Foo', test_property_schema) self.assertEqual(True, propertyInstance.required) def test_proprety_inheritance(self): tosca_custom_def = ''' tosca.nodes.SoftwareComponent.MySoftware: derived_from: SoftwareComponent properties: install_path: required: false type: string default: /opt/mysoftware ''' tosca_node_template = ''' node_templates: mysoftware_instance: type: tosca.nodes.SoftwareComponent.MySoftware properties: component_version: 3.1 requirements: - host: my_server_host my_server_host: type: tosca.nodes.Compute ''' expected_properties = ['component_version', 'install_path'] tpl = self._get_nodetemplate(tosca_node_template, tosca_custom_def) self.assertIsNone(tpl.validate()) self.assertEqual(expected_properties, sorted(tpl.get_properties().keys())) def test_missing_property_type(self): tpl_snippet = ''' properties: prop: typo: tosca.mytesttype.Test ''' schema = yamlparser.simple_parse(tpl_snippet) error = self.assertRaises(exception.InvalidSchemaError, PropertyDef, 'prop', None, schema['properties']['prop']) self.assertEqual(_('Schema definition of "prop" must have a "type" ' 'attribute.'), str(error)) def test_invalid_required_value(self): tpl_snippet = ''' properties: prop: type: tosca.mytesttype.Test required: dunno ''' schema = yamlparser.simple_parse(tpl_snippet) error = self.assertRaises(exception.InvalidSchemaError, PropertyDef, 'prop', None, schema['properties']['prop']) valid_values = ', '.join(PropertyDef.VALID_REQUIRED_VALUES) expected_message = (_('Schema definition of "prop" has "required" ' 'attribute with invalid value "dunno". The ' 'value must be one of "%s".') % valid_values) self.assertEqual(expected_message, str(error)) def test_invalid_property_status(self): tpl_snippet = ''' properties: prop: type: string status: unknown ''' schema = yamlparser.simple_parse(tpl_snippet) error = self.assertRaises(exception.InvalidSchemaError, PropertyDef, 'prop', None, schema['properties']['prop']) valid_values = ', '.join(PropertyDef.VALID_STATUS_VALUES) expected_message = (_('Schema definition of "prop" has "status" ' 'attribute with invalid value "unknown". The ' 'value must be one of "%s".') % valid_values) self.assertEqual(expected_message, str(error)) def test_capability_proprety_inheritance(self): tosca_custom_def_example1 = ''' tosca.capabilities.ScalableNew: derived_from: tosca.capabilities.Scalable properties: max_instances: type: integer default: 0 required: no tosca.nodes.ComputeNew: derived_from: tosca.nodes.Compute capabilities: scalable: type: tosca.capabilities.ScalableNew ''' tosca_node_template_example1 = ''' node_templates: compute_instance: type: tosca.nodes.ComputeNew capabilities: scalable: properties: min_instances: 1 ''' tosca_custom_def_example2 = ''' tosca.nodes.ComputeNew: derived_from: tosca.nodes.Compute capabilities: new_cap: type: tosca.capabilities.Scalable ''' tosca_node_template_example2 = ''' node_templates: db_server: type: tosca.nodes.ComputeNew capabilities: host: properties: num_cpus: 1 ''' tpl1 = self._get_nodetemplate(tosca_node_template_example1, tosca_custom_def_example1) self.assertIsNone(tpl1.validate()) tpl2 = self._get_nodetemplate(tosca_node_template_example2, tosca_custom_def_example2) self.assertIsNone(tpl2.validate()) def _get_nodetemplate(self, tpl_snippet, custom_def_snippet=None): nodetemplates = yamlparser.\ simple_parse(tpl_snippet)['node_templates'] custom_def = [] if custom_def_snippet: custom_def = yamlparser.simple_parse(custom_def_snippet) name = list(nodetemplates.keys())[0] tpl = NodeTemplate(name, nodetemplates, custom_def) return tpl def test_explicit_relationship_proprety(self): tosca_node_template = ''' node_templates: client_node: type: tosca.nodes.Compute requirements: - local_storage: node: my_storage relationship: type: AttachesTo properties: location: /mnt/disk my_storage: type: tosca.nodes.BlockStorage properties: size: 1 GB ''' expected_properties = ['location'] nodetemplates = yamlparser.\ simple_parse(tosca_node_template)['node_templates'] tpl = NodeTemplate('client_node', nodetemplates, []) self.assertIsNone(tpl.validate()) rel_tpls = [] for relationship, trgt in tpl.relationships.items(): rel_tpls.extend(trgt.get_relationship_template()) self.assertEqual(expected_properties, sorted(rel_tpls[0].get_properties().keys())) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8143091 tosca_parser-2.15.0/toscaparser/tests/test_scalarunit.py0000664000175000017500000003043015250006202022344 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common import exception from toscaparser.elements.scalarunit import ScalarUnit_Frequency from toscaparser.elements.scalarunit import ScalarUnit_Size from toscaparser.elements.scalarunit import ScalarUnit_Time from toscaparser.nodetemplate import NodeTemplate from toscaparser.tests.base import TestCase from toscaparser.utils.gettextutils import _ from toscaparser.utils import yamlparser class ScalarUnitPositiveTest(TestCase): scenarios = [ ( # tpl_snippet with mem_size given as number+space+MB 'mem_size_is_number_Space_MB', dict(tpl_snippet=''' server: type: tosca.nodes.Compute capabilities: host: properties: mem_size: 1024 MB ''', property='mem_size', expected='1024 MB') ), ( # tpl_snippet with mem_size given as number+spaces+GB 'mem_size_is_number_Space_GB', dict(tpl_snippet=''' server: type: tosca.nodes.Compute capabilities: host: properties: mem_size: 1 GB ''', property='mem_size', expected='1 GB') ), ( # tpl_snippet with mem_size given as number+tiB 'mem_size_is_number_NoSpace_GB', dict(tpl_snippet=''' server: type: tosca.nodes.Compute capabilities: host: properties: mem_size: 1tiB ''', property='mem_size', expected='1 TiB') ), ( # tpl_snippet with mem_size given as number+Spaces+GIB 'mem_size_is_number_Spaces_GB', dict(tpl_snippet=''' server: type: tosca.nodes.Compute capabilities: host: properties: mem_size: 1 GIB ''', property='mem_size', expected='1 GiB') ), ( # tpl_snippet with mem_size given as number+Space+tib 'mem_size_is_number_Spaces_GB', dict(tpl_snippet=''' server: type: tosca.nodes.Compute capabilities: host: properties: mem_size: 1 tib ''', property='mem_size', expected='1 TiB') ), ( 'cpu_frequency_is_float_Space_GHz', dict(tpl_snippet=''' server: type: tosca.nodes.Compute capabilities: host: properties: cpu_frequency: 2.5 GHz ''', property='cpu_frequency', expected='2.5 GHz') ), ( 'cpu_frequency_is_float_Space_MHz', dict(tpl_snippet=''' server: type: tosca.nodes.Compute capabilities: host: properties: cpu_frequency: 800 MHz ''', property='cpu_frequency', expected='800 MHz') ), ] def test_scenario_scalar_unit_positive(self): tpl = self.tpl_snippet nodetemplates = yamlparser.simple_parse(tpl) nodetemplate = NodeTemplate('server', nodetemplates) props = nodetemplate.get_capability('host').get_properties() prop_name = self.property if props and prop_name in props.keys(): prop = props[prop_name] self.assertIsNone(prop.validate()) resolved = prop.value self.assertEqual(resolved, self.expected) class GetNumFromScalarUnitSizePositive(TestCase): scenarios = [ ( # Note that (1 TB) / (1 GB) = 1000 'Input is TB, user input is GB', dict(InputMemSize='1 TB', UserInputUnit='gB', expected=1000) ), ( # Note that (1 Tib)/ (1 GB) = 1099 'Input is TiB, user input is GB', dict(InputMemSize='1 TiB', UserInputUnit='gB', expected=1099.511627776) ), ] def test_scenario_get_num_from_scalar_unit_size(self): resolved = (ScalarUnit_Size(self.InputMemSize). get_num_from_scalar_unit(self.UserInputUnit)) self.assertEqual(resolved, self.expected) class GetNumFromScalarUnitFrequencyPositive(TestCase): scenarios = [ ( # Note that (1 GHz) / (1 Hz) = 1000000000 'Input is GHz, user input is Hz', dict(InputMemSize='1 GHz', UserInputUnit='Hz', expected=1000000000) ), ( 'Input is GHz, user input is Hz', dict(InputMemSize='2.4 GHz', UserInputUnit='Hz', expected=2400000000) ), ( # Note that (1 GHz)/ (1 MHz) = 1000 'Input is MHz, user input is GHz', dict(InputMemSize='800 MHz', UserInputUnit='GHz', expected=0.8) ), ( 'Input is GHz, user input is Hz', dict(InputMemSize='0.9 GHz', UserInputUnit='MHz', expected=900) ), ( 'Input is GHz, user input is Hz', dict(InputMemSize='2.7GHz', UserInputUnit='MHz', expected=2700) ), ] def test_scenario_get_num_from_scalar_unit_frequency(self): resolved = (ScalarUnit_Frequency(self.InputMemSize). get_num_from_scalar_unit(self.UserInputUnit)) self.assertEqual(resolved, self.expected) class GetNumFromScalarUnitTimePositive(TestCase): scenarios = [ ( # Note that (1 s) / (1 ms) = 1000 'Input is 500ms, user input is s', dict(InputMemSize='500 ms', UserInputUnit='s', expected=0.5) ), ( # Note that (1 h)/ (1 s) = 3600 'Input is h, user input is s', dict(InputMemSize='1 h', UserInputUnit='s', expected=3600) ), ( # Note that (1 m)/ (1 s) = 60 'Input is m, user input is s', dict(InputMemSize='0.5 m', UserInputUnit='s', expected=30) ), ( # Note that (1 d)/ (1 h) = 24 'Input is d, user input is h', dict(InputMemSize='1 d', UserInputUnit='h', expected=24) ), ] def test_scenario_get_num_from_scalar_unit_time(self): resolved = (ScalarUnit_Time(self.InputMemSize). get_num_from_scalar_unit(self.UserInputUnit)) self.assertEqual(resolved, self.expected) class GetNumFromScalarUnitSizeNegative(TestCase): InputMemSize = '1 GB' UserInputUnit = 'qB' def test_get_num_from_scalar_unit_size_negative(self): try: (ScalarUnit_Size(self.InputMemSize). get_num_from_scalar_unit(self.UserInputUnit)) except Exception as error: self.assertIsInstance(error, ValueError) self.assertEqual(_('The unit "qB" is not valid. Valid units are ' '"[\'B\', \'GB\', \'GiB\', \'KiB\', \'MB\', ' '\'MiB\', \'TB\', \'TiB\', \'kB\']".'), error.__str__()) class GetNumFromScalarUnitFrequencyNegative(TestCase): InputFrequency = '2.7 GHz' UserInputUnit = 'Jz' def test_get_num_from_scalar_unit_frequency_negative(self): try: (ScalarUnit_Frequency(self.InputFrequency). get_num_from_scalar_unit(self.UserInputUnit)) except Exception as error: self.assertIsInstance(error, ValueError) self.assertEqual(_('The unit "Jz" is not valid. Valid units are ' '"[\'GHz\', \'Hz\', \'MHz\', \'kHz\']".'), error.__str__()) class GetNumFromScalarUnitTimeNegative(TestCase): InputTime = '5 ms' UserInputUnit = 'D' def test_get_num_from_scalar_unit_frequency_negative(self): try: (ScalarUnit_Time(self.InputTime). get_num_from_scalar_unit(self.UserInputUnit)) except Exception as error: self.assertIsInstance(error, ValueError) self.assertEqual(_('"Jz" is not a valid scalar-unit.'), error.__str__()) class ScalarUnitNegativeTest(TestCase): custom_def_snippet = ''' tosca.my.nodes.Compute: derived_from: tosca.nodes.Root properties: cpu_frequency: required: false type: scalar-unit.frequency constraints: - greater_or_equal: 0.1 GHz disk_size: required: false type: scalar-unit.size constraints: - greater_or_equal: 1 GB mem_size: required: false type: scalar-unit.size constraints: - in_range: [1 MiB, 1 GiB] ''' custom_def = yamlparser.simple_parse(custom_def_snippet) # disk_size doesn't provide a value, mem_size uses an invalid unit. def test_invalid_scalar_unit(self): tpl_snippet = ''' server: type: tosca.my.nodes.Compute properties: cpu_frequency: 50.3.6 GHZ disk_size: MB mem_size: 1 QB ''' nodetemplates = yamlparser.simple_parse(tpl_snippet) nodetemplate = NodeTemplate('server', nodetemplates, self.custom_def) for p in nodetemplate.get_properties_objects(): self.assertRaises(ValueError, p.validate) # disk_size is less than 1 GB, mem_size is not in the required range. # Note: in the spec, the minimum value of mem_size is 1 MiB (> 1 MB) def test_constraint_for_scalar_unit(self): tpl_snippet = ''' server: type: tosca.my.nodes.Compute properties: cpu_frequency: 0.05 GHz disk_size: 500 MB mem_size: 1 MB ''' nodetemplates = yamlparser.simple_parse(tpl_snippet) nodetemplate = NodeTemplate('server', nodetemplates, self.custom_def) props = nodetemplate.get_properties() if 'cpu_frequency' in props.keys(): error = self.assertRaises(exception.ValidationError, props['cpu_frequency'].validate) self.assertEqual(_('The value "0.05 GHz" of property ' '"cpu_frequency" must be greater than or equal ' 'to "0.1 GHz".'), error.__str__()) if 'disk_size' in props.keys(): error = self.assertRaises(exception.ValidationError, props['disk_size'].validate) self.assertEqual(_('The value "500 MB" of property "disk_size" ' 'must be greater than or equal to "1 GB".'), error.__str__()) if 'mem_size' in props.keys(): error = self.assertRaises(exception.ValidationError, props['mem_size'].validate) self.assertEqual(_('The value "1 MB" of property "mem_size" is ' 'out of range "(min:1 MiB, max:1 GiB)".'), error.__str__()) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8153093 tosca_parser-2.15.0/toscaparser/tests/test_shell.py0000664000175000017500000000341115250006202021305 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common import exception import toscaparser.shell as shell from toscaparser.tests.base import TestCase from toscaparser.tests import utils from toscaparser.utils.gettextutils import _ class ShellTest(TestCase): tosca_helloworld = utils.get_sample_test_path("data/tosca_helloworld.yaml") errornous_template = utils.get_sample_test_path( "data/test_multiple_validation_errors.yaml") def test_missing_arg(self): self.assertRaises(SystemExit, shell.main, '') def test_invalid_arg(self): self.assertRaises(SystemExit, shell.main, 'parse me') def test_template_not_exist(self): error = self.assertRaises( ValueError, shell.main, ['--template-file=template.txt']) self.assertEqual(_('"template.txt" is not a valid file.'), str(error)) def test_template_invalid(self): arg = '--template-file=' + self.errornous_template self.assertRaises(exception.ValidationError, shell.main, [arg]) def test_template_valid(self): arg = '--template-file=' + self.tosca_helloworld try: shell.main([arg]) except Exception: self.fail(_('The program raised an exception unexpectedly.')) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8153093 tosca_parser-2.15.0/toscaparser/tests/test_topology_template.py0000664000175000017500000005026515250006202023756 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os from toscaparser.common import exception from toscaparser.substitution_mappings import SubstitutionMappings from toscaparser.tests.base import TestCase from toscaparser.tests import utils from toscaparser.topology_template import TopologyTemplate from toscaparser.tosca_template import ToscaTemplate from toscaparser.utils.gettextutils import _ import toscaparser.utils.yamlparser YAML_LOADER = toscaparser.utils.yamlparser.load_yaml class TopologyTemplateTest(TestCase): def setUp(self): TestCase.setUp(self) '''TOSCA template.''' self.tosca_tpl_path = utils.get_sample_test_path( "data/topology_template/transactionsubsystem.yaml") self.tpl = YAML_LOADER(self.tosca_tpl_path) self.topo_tpl = self.tpl.get('topology_template') self.imports = self.tpl.get('imports') self.topo = TopologyTemplate(self.topo_tpl, self._get_all_custom_def()) def _get_custom_def(self, type_definition): custom_defs = {} for definition in self.imports: if os.path.isabs(definition): def_file = definition else: tpl_dir = os.path.dirname(os.path.abspath(self.tosca_tpl_path)) def_file = os.path.join(tpl_dir, definition) custom_type = YAML_LOADER(def_file) custom_defs.update(custom_type.get(type_definition)) return custom_defs def _get_all_custom_def(self): custom_defs = {} custom_defs.update(self._get_custom_def('node_types')) custom_defs.update(self._get_custom_def('capability_types')) return custom_defs def _get_custom_types(self): custom_types = {} def_file = utils.get_sample_test_path( "data/topology_template/definitions.yaml") custom_type = YAML_LOADER(def_file) node_types = custom_type['node_types'] for name in node_types: defintion = node_types[name] custom_types[name] = defintion return custom_types def test_description(self): expected_desc = 'Template of a database including its hosting stack.' self.assertEqual(expected_desc, self.topo.description) def test_inputs(self): self.assertEqual( ['mq_server_ip', 'my_cpus', 'receiver_port'], sorted([input.name for input in self.topo.inputs])) input_name = "receiver_port" expected_description = "Port to be used for receiving messages." for input in self.topo.inputs: if input.name == input_name: self.assertEqual(expected_description, input.description) def test_node_tpls(self): '''Test nodetemplate names.''' self.assertEqual( ['app', 'db', 'server', 'websrv'], sorted([tpl.name for tpl in self.topo.nodetemplates])) tpl_name = "app" expected_type = "example.SomeApp" expected_properties = ['admin_user', 'pool_size'] expected_capabilities = ['app_endpoint', 'feature', 'message_receiver'] expected_requirements = [{'host': {'node': 'websrv'}}, {'database': {'node': 'db'}}] expected_relationshp = ['tosca.relationships.HostedOn', 'tosca.relationships.ConnectsTo'] expected_host = ['websrv', 'db'] for tpl in self.topo.nodetemplates: if tpl_name == tpl.name: '''Test node type.''' self.assertEqual(tpl.type, expected_type) '''Test properties.''' self.assertEqual( expected_properties, sorted(tpl.get_properties().keys())) '''Test capabilities.''' self.assertEqual( expected_capabilities, sorted(tpl.get_capabilities().keys())) '''Test requirements.''' self.assertEqual( expected_requirements, tpl.requirements) '''Test relationship.''' ''' TODO : skip tempororily. need to fix it ''' self.assertEqual( expected_relationshp, [x.type for x in tpl.relationships.keys()]) self.assertEqual( expected_host, [y.name for y in tpl.relationships.values()]) '''Test interfaces.''' # TODO(hurf) add interface test when new template is available if tpl.name == 'server': '''Test property value''' props = tpl.get_properties() if props and 'mem_size' in props.keys(): self.assertEqual(props['mem_size'].value, '4096 MB') '''Test capability''' caps = tpl.get_capabilities() self.assertIn('os', caps.keys()) os_props_objs = None os_props = None os_type_prop = None if caps and 'os' in caps.keys(): capability = caps['os'] os_props_objs = capability.get_properties_objects() os_props = capability.get_properties() os_type_prop = capability.get_property_value('type') break self.assertEqual( ['Linux'], [p.value for p in os_props_objs if p.name == 'type']) self.assertEqual( 'Linux', os_props['type'].value if 'type' in os_props else '') self.assertEqual('Linux', os_props['type'].value) self.assertEqual('Linux', os_type_prop) def test_outputs(self): self.assertEqual( sorted(['receiver_ip', 'receiver_port']), sorted([output.name for output in self.topo.outputs])) def test_groups(self): group = self.topo.groups[0] self.assertEqual('webserver_group', group.name) self.assertEqual(['websrv', 'server'], group.members) for node in group.get_member_nodes(): if node.name == 'server': '''Test property value''' props = node.get_properties() if props and 'mem_size' in props.keys(): self.assertEqual(props['mem_size'].value, '4096 MB') def test_system_template(self): tpl_path = utils.get_sample_test_path( "data/topology_template/system.yaml") system_tosca_template = ToscaTemplate(tpl_path) self.assertIsNotNone(system_tosca_template) self.assertEqual( len(system_tosca_template. nested_tosca_templates_with_topology), 4) self.assertTrue(system_tosca_template.has_nested_templates()) def test_invalid_keyname(self): tpl_snippet = ''' substitution_mappings: node_type: example.DatabaseSubsystem capabilities: database_endpoint: [ db_app, database_endpoint ] requirements: receiver1: [ tran_app, receiver1 ] invalid_key: 123 ''' sub_mappings = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet))['substitution_mappings'] expected_message = _( 'SubstitutionMappings contains unknown field ' '"invalid_key". Refer to the definition ' 'to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: SubstitutionMappings(sub_mappings, None, None, None, None, None)) self.assertEqual(expected_message, err.__str__()) def test_missing_required_keyname(self): tpl_snippet = ''' substitution_mappings: capabilities: database_endpoint: [ db_app, database_endpoint ] requirements: receiver1: [ tran_app, receiver1 ] ''' sub_mappings = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet))['substitution_mappings'] expected_message = _('SubstitutionMappings used in topology_template ' 'is missing required field "node_type".') err = self.assertRaises( exception.MissingRequiredFieldError, lambda: SubstitutionMappings(sub_mappings, None, None, None, None, None)) self.assertEqual(expected_message, err.__str__()) def test_invalid_nodetype(self): tpl_snippet = ''' substitution_mappings: node_type: example.DatabaseSubsystem1 capabilities: database_endpoint: [ db_app, database_endpoint ] requirements: receiver1: [ tran_app, receiver1 ] ''' sub_mappings = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet))['substitution_mappings'] custom_defs = self._get_custom_types() expected_message = _('Node type "example.DatabaseSubsystem1" ' 'is not a valid type.') err = self.assertRaises( exception.InvalidNodeTypeError, lambda: SubstitutionMappings(sub_mappings, None, None, None, None, custom_defs)) self.assertEqual(expected_message, err.__str__()) def test_system_with_input_validation(self): tpl_path0 = utils.get_sample_test_path( "data/topology_template/validate/system_invalid_input.yaml") tpl_path1 = utils.get_sample_test_path( "data/topology_template/validate/" "queuingsubsystem_invalid_input.yaml") errormsg = _('SubstitutionMappings with node_type ' 'example.QueuingSubsystem is missing ' 'required input definition of input "server_port".') # It's invalid in nested template. self.assertRaises(exception.ValidationError, lambda: ToscaTemplate(tpl_path0)) exception.ExceptionCollector.assertExceptionMessage( exception.MissingRequiredInputError, errormsg) # Subtemplate deploy standaolone is also invalid. self.assertRaises(exception.ValidationError, lambda: ToscaTemplate(tpl_path1)) exception.ExceptionCollector.assertExceptionMessage( exception.MissingRequiredInputError, errormsg) def test_substitution_mappings_valid_output(self): tpl_path = utils.get_sample_test_path( "data/topology_template/validate/" "test_substitution_mappings_valid_output.yaml") self.assertIsNotNone(ToscaTemplate(tpl_path)) def test_system_with_unknown_output_validation(self): tpl_path = utils.get_sample_test_path( "data/topology_template/validate/" "test_substitution_mappings_invalid_output.yaml") errormsg = _('\'Attribute "my_cpu_output" was not found in node ' 'template "substitute_app".\'') self.assertRaises(exception.ValidationError, lambda: ToscaTemplate(tpl_path)) exception.ExceptionCollector.assertExceptionMessage( KeyError, errormsg) def test_substitution_mappings_with_substitution_filter(self): tpl_path = utils.get_sample_test_path( "data/topology_template/validate/" "test_substitution_mappings_section.yaml") tosca = ToscaTemplate(tpl_path) filter_name = tosca.tpl['topology_template'][ 'substitution_mappings']['substitution_filter'].keys() self.assertEqual('node_filter', list(filter_name)[0]) n_f = tosca.topology_template.substitution_mappings.sub_mapping_def[ 'substitution_filter'].keys() self.assertEqual('node_filter', list(n_f)[0]) p_v = tosca.topology_template.substitution_mappings.sub_mapping_def[ 'substitution_filter'].values() self.assertEqual('property_value', list(p_v)[0]['properties'][0]['my_property']) def test_substitution_mappings_error_substitution_filter(self): tpl_path = utils.get_sample_test_path( "data/topology_template/validate/" "test_substitution_mappings_error_node_filter.yaml") errormsg = _('SubstitutionMappings contains unknown field ' '"substitution_filter". Refer to the definition ' 'to verify valid values.') err = self.assertRaises( exception.ValidationError, ToscaTemplate, tpl_path) self.assertIn(errormsg, str(err)) def test_substitution_mappings_error_node_filter(self): tpl_path = utils.get_sample_test_path( "data/topology_template/validate/" "test_substitution_mappings_error_node_filter_key.yaml") errormsg = _('SubstitutionMappings contains unknown field ' '"node_filter". Refer to the definition ' 'to verify valid values.') err = self.assertRaises( exception.ValidationError, ToscaTemplate, tpl_path) self.assertIn(errormsg, str(err)) def test_substitution_mappings_error_properties(self): tpl_path = utils.get_sample_test_path( "data/topology_template/validate/" "test_substitution_mappings_error_property_type.yaml") errormsg = _('properties of the Node Filter definition ' 'Keyname must be of type "list".') err = self.assertRaises( exception.ValidationError, ToscaTemplate, tpl_path) self.assertIn(errormsg, str(err)) def test_substitution_mappings_error_capabilities(self): tpl_path = utils.get_sample_test_path( "data/topology_template/validate/" "test_substitution_mappings_error_capability_type.yaml") errormsg = _('capabilities of the Node Filter definition ' 'Keyname must be of type "list".') err = self.assertRaises( exception.ValidationError, ToscaTemplate, tpl_path) self.assertIn(errormsg, str(err)) def test_substitution_mappings_with_attributes(self): tpl_path = utils.get_sample_test_path( "data/topology_template/validate/" "test_substitution_mappings_section.yaml") tosca = ToscaTemplate(tpl_path) attribute_name = tosca.tpl['topology_template'][ 'substitution_mappings']['attributes'].keys() self.assertEqual('receiver_ip', list(attribute_name)[0]) a_n = tosca.topology_template.substitution_mappings.sub_mapping_def[ 'attributes'].keys() self.assertEqual('receiver_ip', list(a_n)[0]) a_v = tosca.topology_template.substitution_mappings.sub_mapping_def[ 'attributes'].values() self.assertEqual('my_property', list(a_v)[0]) def test_substitution_mappings_with_interfaces(self): tpl_path = utils.get_sample_test_path( "data/topology_template/validate/" "test_substitution_mappings_section.yaml") tosca = ToscaTemplate(tpl_path) interface_name = tosca.tpl['topology_template'][ 'substitution_mappings']['interfaces'].keys() self.assertEqual('Standard', list(interface_name)[0]) i_n = tosca.topology_template.substitution_mappings.sub_mapping_def[ 'interfaces'].keys() self.assertEqual('Standard', list(i_n)[0]) i_v = tosca.topology_template.substitution_mappings.sub_mapping_def[ 'interfaces'].values() self.assertEqual('my_start_node.start', list(i_v)[0]['start']) def test_invalid_type_policies(self): tpl_snippet = ''' policies: some_policy: type: tosca.policies.Placement ''' policies = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) custom_defs = self._get_custom_types() err = self.assertRaises(exception.TypeMismatchError, lambda: TopologyTemplate(policies, custom_defs)) errormsg = _('policies must be of type "list".') self.assertEqual(errormsg, err.__str__()) def test_invalid_type_groups(self): tpl_snippet = ''' groups: - some_group: type: tosca.groups.Root ''' policies = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) custom_defs = self._get_custom_types() err = self.assertRaises(exception.TypeMismatchError, lambda: TopologyTemplate(policies, custom_defs)) errormsg = _('groups must be of type "dict".') self.assertEqual(errormsg, err.__str__()) def test_invalid_type_substitution_mappings(self): tpl_snippet = ''' substitution_mappings: - node_type: MyService properties: num_cpus: cpus ''' policies = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) custom_defs = self._get_custom_types() err = self.assertRaises(exception.TypeMismatchError, lambda: TopologyTemplate(policies, custom_defs)) errormsg = _('substitution_mappings must be of type "dict".') self.assertEqual(errormsg, err.__str__()) def test_invalid_type_outputs(self): tpl_snippet = ''' outputs: - some_output: value: some_value ''' policies = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) custom_defs = self._get_custom_types() err = self.assertRaises(exception.TypeMismatchError, lambda: TopologyTemplate(policies, custom_defs)) errormsg = _('outputs must be of type "dict".') self.assertEqual(errormsg, err.__str__()) def test_invalid_type_relationship_templates(self): tpl_snippet = ''' relationship_templates: - my_connection: type: ConnectsTo ''' policies = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) custom_defs = self._get_custom_types() err = self.assertRaises(exception.TypeMismatchError, lambda: TopologyTemplate(policies, custom_defs)) errormsg = _('relationship_templates must be of type "dict".') self.assertEqual(errormsg, err.__str__()) def test_invalid_type_nodetemplates(self): tpl_snippet = ''' node_templates: - some_node: type: tosca.nodes.Compute ''' policies = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) custom_defs = self._get_custom_types() err = self.assertRaises(exception.TypeMismatchError, lambda: TopologyTemplate(policies, custom_defs)) errormsg = _('node_templates must be of type "dict".') self.assertEqual(errormsg, err.__str__()) def test_invalid_type_inputs(self): tpl_snippet = ''' inputs: - some_input: type: integer value: 1 ''' policies = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) custom_defs = self._get_custom_types() err = self.assertRaises(exception.TypeMismatchError, lambda: TopologyTemplate(policies, custom_defs)) errormsg = _('inputs must be of type "dict".') self.assertEqual(errormsg, err.__str__()) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8153093 tosca_parser-2.15.0/toscaparser/tests/test_tosca_nfv_tpl.py0000664000175000017500000000203015250006202023033 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.tests.base import TestCase from toscaparser.tests import utils from toscaparser.tosca_template import ToscaTemplate class ToscaNFVTemplateTest(TestCase): '''TOSCA NFV template.''' tosca_tpl = utils.get_sample_test_path( "data/extensions/tosca_helloworld_nfv.yaml") tosca = ToscaTemplate(tosca_tpl) def test_version(self): self.assertEqual(self.tosca.version, "tosca_simple_profile_for_nfv_1_0_0") ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8163092 tosca_parser-2.15.0/toscaparser/tests/test_toscadef.py0000664000175000017500000005144515250006202022000 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common import exception from toscaparser.elements.artifacttype import ArtifactTypeDef from toscaparser.elements.entity_type import EntityType from toscaparser.elements.grouptype import GroupType import toscaparser.elements.interfaces as ifaces from toscaparser.elements.nodetype import NodeType from toscaparser.elements.policytype import PolicyType from toscaparser.tests.base import TestCase compute_type = NodeType('tosca.nodes.Compute') component_type = NodeType('tosca.nodes.SoftwareComponent') network_type = NodeType('tosca.nodes.network.Network') network_port_type = NodeType('tosca.nodes.network.Port') webserver_type = NodeType('tosca.nodes.WebServer') database_type = NodeType('tosca.nodes.Database') artif_root_type = ArtifactTypeDef('tosca.artifacts.Root') artif_file_type = ArtifactTypeDef('tosca.artifacts.File') artif_bash_type = ArtifactTypeDef('tosca.artifacts.Implementation.Bash') artif_python_type = ArtifactTypeDef('tosca.artifacts.Implementation.Python') artif_container_docker_type = ArtifactTypeDef('tosca.artifacts.' 'Deployment.Image.' 'Container.Docker') artif_vm_iso_type = ArtifactTypeDef('tosca.artifacts.' 'Deployment.Image.VM.ISO') artif_vm_qcow2_type = ArtifactTypeDef('tosca.artifacts.' 'Deployment.Image.VM.QCOW2') artif_tpl_type = ArtifactTypeDef('tosca.artifacts.template') artif_Jinja2_type = ArtifactTypeDef('tosca.artifacts.' 'template.Jinja2') artif_Twig_type = ArtifactTypeDef('tosca.artifacts.' 'template.Twig') policy_root_type = PolicyType('tosca.policies.Root') policy_placement_type = PolicyType('tosca.policies.Placement') policy_scaling_type = PolicyType('tosca.policies.Scaling') policy_reservation_type = PolicyType('tosca.policies.Reservation') policy_update_type = PolicyType('tosca.policies.Update') policy_performance_type = PolicyType('tosca.policies.Performance') group_type = GroupType('tosca.groups.Root') class ToscaDefTest(TestCase): def test_type(self): self.assertEqual(compute_type.type, "tosca.nodes.Compute") self.assertRaises(exception.InvalidTypeError, NodeType, 'tosca.nodes.Invalid') self.assertEqual(network_type.type, "tosca.nodes.network.Network") self.assertEqual(network_port_type.type, "tosca.nodes.network.Port") def test_parent_type(self): self.assertEqual(compute_type.parent_type.type, "tosca.nodes.Root") self.assertEqual(network_type.parent_type.type, "tosca.nodes.Root") self.assertEqual(network_port_type.parent_type.type, "tosca.nodes.Root") def test_group(self): self.assertEqual(group_type.type, "tosca.groups.Root") self.assertIsNone(group_type.parent_type) self.assertIn(ifaces.LIFECYCLE_SHORTNAME, group_type.interfaces) def test_capabilities(self): # Assure the normative Compute node type # has all the required Capability types # regardless of symbloc name # TODO(Matt) - since Compute IS a normative node type # we SHOULD test symbolic capability names as well self.assertEqual( ['tosca.capabilities.Container', 'tosca.capabilities.Endpoint.Admin', 'tosca.capabilities.Node', 'tosca.capabilities.OperatingSystem', 'tosca.capabilities.Scalable', 'tosca.capabilities.network.Bindable'], sorted([c.type for c in compute_type.get_capabilities_objects()])) # Assure the normative Network node type # hsa all the required Capability types # TODO(Matt) - since Network IS a normative node type # we SHOULD test symbolic capability names as well self.assertEqual( ['tosca.capabilities.Node', 'tosca.capabilities.network.Linkable'], sorted([c.type for c in network_type.get_capabilities_objects()])) # Assure the normative WebServer node type's # Endpoint cap. has all required property names # Note: we are testing them in alphabetic sort order endpoint_props_def_objects = \ self._get_capability_properties_def_objects( webserver_type.get_capabilities_objects(), 'tosca.capabilities.Endpoint') # Assure WebServer's Endpoint capability's properties have their # required keyname value set correctly self.assertEqual( [('initiator', False), ('network_name', False), ('port', False), ('port_name', False), ('ports', False), ('protocol', True), ('secure', False), ('url_path', False)], sorted([(p.name, p.required) for p in endpoint_props_def_objects])) os_props = self._get_capability_properties_def_objects( compute_type.get_capabilities_objects(), 'tosca.capabilities.OperatingSystem') self.assertEqual( [('architecture', False), ('distribution', False), ('type', False), ('version', False)], sorted([(p.name, p.required) for p in os_props])) host_props = self._get_capability_properties_def_objects( compute_type.get_capabilities_objects(), 'tosca.capabilities.Container') self.assertEqual( [('cpu_frequency', False), ('disk_size', False), ('mem_size', False), ('num_cpus', False)], sorted([(p.name, p.required) for p in host_props])) endpoint_admin_properties = 'secure' endpoint_admin_props_def_objects = \ self._get_capability_properties_def_objects( webserver_type.get_capabilities_objects(), 'tosca.capabilities.Endpoint.Admin') self.assertIn( endpoint_admin_properties, sorted([p.name for p in endpoint_admin_props_def_objects])) def _get_capability_properties_def_objects(self, caps, type): properties_def = None for cap in caps: if cap.type == type: properties_def = cap.get_properties_def_objects() break return properties_def def _get_capability_properties_def(self, caps, type): properties_def = None for cap in caps: if cap.type == type: properties_def = cap.get_properties_def() break return properties_def def test_properties_def(self): self.assertEqual( ['name', 'password', 'port', 'user'], sorted(database_type.get_properties_def().keys())) def test_attributes_def(self): self.assertEqual( ['networks', 'ports', 'private_address', 'public_address', 'state', 'tosca_id', 'tosca_name'], sorted(compute_type.get_attributes_def().keys())) def test_requirements(self): self.assertEqual( [{'host': {'capability': 'tosca.capabilities.Container', 'node': 'tosca.nodes.Compute', 'relationship': 'tosca.relationships.HostedOn'}}, {'dependency': {'capability': 'tosca.capabilities.Node', 'node': 'tosca.nodes.Root', 'occurrences': [0, 'UNBOUNDED'], 'relationship': 'tosca.relationships.DependsOn'}} ], [r for r in component_type.requirements]) def test_relationship(self): self.assertEqual( [('tosca.relationships.DependsOn', 'tosca.nodes.Root'), ('tosca.relationships.HostedOn', 'tosca.nodes.Compute')], sorted([(relation.type, node.type) for relation, node in component_type.relationship.items()])) self.assertIn( ('tosca.relationships.HostedOn', ['tosca.capabilities.Container']), [(relation.type, relation.valid_target_types) for relation in list(component_type.relationship.keys())]) self.assertIn( ('tosca.relationships.network.BindsTo', 'tosca.nodes.Compute'), [(relation.type, node.type) for relation, node in network_port_type.relationship.items()]) self.assertIn( ('tosca.relationships.network.LinksTo', 'tosca.nodes.network.Network'), [(relation.type, node.type) for relation, node in network_port_type.relationship.items()]) def test_interfaces(self): self.assertIsNone(compute_type.interfaces) root_node = NodeType('tosca.nodes.Root') self.assertIn(ifaces.LIFECYCLE_SHORTNAME, root_node.interfaces) def test_artifacts(self): self.assertIsNone(artif_root_type.parent_type) self.assertEqual('tosca.artifacts.Root', artif_file_type.parent_type.type) self.assertEqual({}, artif_file_type.parent_artifacts) self.assertEqual(sorted(['tosca.artifacts.Root'], key=lambda x: str(x)), sorted([artif_file_type.get_artifact(name) for name in artif_file_type.defs], key=lambda x: str(x))) self.assertEqual('tosca.artifacts.Implementation', artif_bash_type.parent_type.type) self.assertEqual({'tosca.artifacts.Implementation': {'derived_from': 'tosca.artifacts.Root', 'description': 'TOSCA base type for implementation artifacts'}}, artif_bash_type.parent_artifacts) self.assertEqual(sorted([['sh'], 'tosca.artifacts.Implementation', 'Script artifact for the Unix Bash shell', 'application/x-sh'], key=lambda x: str(x)), sorted([artif_bash_type.get_artifact(name) for name in artif_bash_type.defs], key=lambda x: str(x))) self.assertEqual('tosca.artifacts.Implementation', artif_python_type.parent_type.type) self.assertEqual({'tosca.artifacts.Implementation': {'derived_from': 'tosca.artifacts.Root', 'description': 'TOSCA base type for implementation artifacts'}}, artif_python_type.parent_artifacts) self.assertEqual(sorted([['py'], 'tosca.artifacts.Implementation', 'Artifact for the interpreted Python' ' language', 'application/x-python'], key=lambda x: str(x)), sorted([artif_python_type.get_artifact(name) for name in artif_python_type.defs], key=lambda x: str(x))) self.assertEqual('tosca.artifacts.Deployment.Image', artif_container_docker_type.parent_type.type) self.assertEqual({'tosca.artifacts.Deployment': {'derived_from': 'tosca.artifacts.Root', 'description': 'TOSCA base type for deployment artifacts'}, 'tosca.artifacts.Deployment.Image': {'derived_from': 'tosca.artifacts.Deployment'}}, artif_container_docker_type.parent_artifacts) self.assertEqual(sorted(['tosca.artifacts.Deployment.Image', 'Docker container image'], key=lambda x: str(x)), sorted([artif_container_docker_type. get_artifact(name) for name in artif_container_docker_type.defs], key=lambda x: str(x))) self.assertEqual('tosca.artifacts.Deployment.Image', artif_vm_iso_type.parent_type.type) self.assertEqual({'tosca.artifacts.Deployment': {'derived_from': 'tosca.artifacts.Root', 'description': 'TOSCA base type for deployment artifacts'}, 'tosca.artifacts.Deployment.Image': {'derived_from': 'tosca.artifacts.Deployment'}}, artif_vm_iso_type.parent_artifacts) self.assertEqual(sorted(['tosca.artifacts.Deployment.Image', 'Virtual Machine (VM) image in ' 'ISO disk format', 'application/octet-stream', ['iso']], key=lambda x: str(x)), sorted([artif_vm_iso_type. get_artifact(name) for name in artif_vm_iso_type.defs], key=lambda x: str(x))) self.assertEqual('tosca.artifacts.Deployment.Image', artif_vm_qcow2_type.parent_type.type) self.assertEqual({'tosca.artifacts.Deployment': {'derived_from': 'tosca.artifacts.Root', 'description': 'TOSCA base type for deployment artifacts'}, 'tosca.artifacts.Deployment.Image': {'derived_from': 'tosca.artifacts.Deployment'}}, artif_vm_qcow2_type.parent_artifacts) self.assertEqual(sorted(['tosca.artifacts.Deployment.Image', 'Virtual Machine (VM) image in QCOW v2 ' 'standard disk format', 'application/octet-stream', ['qcow2']], key=lambda x: str(x)), sorted([artif_vm_qcow2_type. get_artifact(name) for name in artif_vm_qcow2_type.defs], key=lambda x: str(x))) self.assertEqual('tosca.artifacts.Root', artif_tpl_type.parent_type.type) self.assertEqual({}, artif_tpl_type.parent_artifacts) self.assertEqual(sorted(['tosca.artifacts.Root', 'TOSCA base type for template ' 'type artifacts'], key=lambda x: str(x)), sorted([artif_tpl_type. get_artifact(name) for name in artif_tpl_type.defs], key=lambda x: str(x))) self.assertEqual('tosca.artifacts.template', artif_Jinja2_type.parent_type.type) self.assertEqual({'tosca.artifacts.template': {'derived_from': 'tosca.artifacts.Root', 'description': 'TOSCA base type for template ' 'type artifacts'}}, artif_Jinja2_type.parent_artifacts) self.assertEqual(sorted(['tosca.artifacts.template', 'Jinja2 template file'], key=lambda x: str(x)), sorted([artif_Jinja2_type. get_artifact(name) for name in artif_Jinja2_type.defs], key=lambda x: str(x))) self.assertEqual('tosca.artifacts.template', artif_Twig_type.parent_type.type) self.assertEqual({'tosca.artifacts.template': {'derived_from': 'tosca.artifacts.Root', 'description': 'TOSCA base type for template ' 'type artifacts'}}, artif_Twig_type.parent_artifacts) self.assertEqual(sorted(['tosca.artifacts.template', 'Twig template file'], key=lambda x: str(x)), sorted([artif_Twig_type. get_artifact(name) for name in artif_Twig_type.defs], key=lambda x: str(x))) def test_policies(self): self.assertIsNone(policy_root_type.parent_type) self.assertEqual('tosca.policies.Root', policy_placement_type.parent_type.type) self.assertEqual({}, policy_placement_type.parent_policies) self.assertEqual(sorted(['tosca.policies.Root', 'The TOSCA Policy Type definition that is ' 'used to govern placement of TOSCA nodes or ' 'groups of nodes.'], key=lambda x: str(x)), sorted([policy_placement_type.get_policy(name) for name in policy_placement_type.defs], key=lambda x: str(x))) self.assertEqual('tosca.policies.Root', policy_scaling_type.parent_type.type) self.assertEqual({}, policy_scaling_type.parent_policies) self.assertEqual(sorted(['tosca.policies.Root', 'The TOSCA Policy Type definition that is ' 'used to govern scaling of TOSCA nodes or ' 'groups of nodes.'], key=lambda x: str(x)), sorted([policy_scaling_type.get_policy(name) for name in policy_scaling_type.defs], key=lambda x: str(x))) self.assertEqual('tosca.policies.Root', policy_update_type.parent_type.type) self.assertEqual({}, policy_update_type.parent_policies) self.assertEqual(sorted(['tosca.policies.Root', 'The TOSCA Policy Type definition that is ' 'used to govern update of TOSCA nodes or ' 'groups of nodes.'], key=lambda x: str(x)), sorted([policy_update_type.get_policy(name) for name in policy_update_type.defs], key=lambda x: str(x))) self.assertEqual('tosca.policies.Root', policy_performance_type.parent_type.type) self.assertEqual({}, policy_performance_type.parent_policies) self.assertEqual(sorted(['tosca.policies.Root', 'The TOSCA Policy Type definition that is ' 'used to declare performance requirements ' 'for TOSCA nodes or groups of nodes.'], key=lambda x: str(x)), sorted([policy_performance_type.get_policy(name) for name in policy_performance_type.defs], key=lambda x: str(x))) self.assertEqual('tosca.policies.Root', policy_reservation_type.parent_type.type) self.assertEqual({}, policy_reservation_type.parent_policies) self.assertEqual(sorted(['tosca.policies.Root', 'The TOSCA Policy Type definition that ' 'is used to create TOSCA nodes or group ' 'of nodes based on the reservation.'], key=lambda x: str(x)), sorted([policy_reservation_type.get_policy(name) for name in policy_reservation_type.defs], key=lambda x: str(x))) def test_port_spec(self): tosca_def = EntityType.TOSCA_DEF port_spec = tosca_def.get('tosca.datatypes.network.PortSpec') self.assertEqual(port_spec.get('derived_from'), 'tosca.datatypes.Root') properties = port_spec.get('properties') self.assertEqual( sorted(['protocol', 'target', 'target_range', 'source', 'source_range']), sorted(properties.keys())) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8163092 tosca_parser-2.15.0/toscaparser/tests/test_toscatpl.py0000664000175000017500000013607415250006202022043 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os import requests from unittest import mock import urllib from toscaparser.common import exception import toscaparser.elements.interfaces as ifaces from toscaparser.elements.nodetype import NodeType from toscaparser.elements.portspectype import PortSpec from toscaparser.functions import GetInput from toscaparser.functions import GetProperty from toscaparser.nodetemplate import NodeTemplate from toscaparser.tests.base import MockTestClass from toscaparser.tests.base import TestCase from toscaparser.tests import utils from toscaparser.tosca_template import ToscaTemplate from toscaparser.utils.gettextutils import _ from toscaparser.utils.urlutils import UrlUtils import toscaparser.utils.yamlparser class ToscaTemplateTest(TestCase): '''TOSCA template.''' tosca_tpl = utils.get_sample_test_path( "data/tosca_single_instance_wordpress.yaml") params = {'db_name': 'my_wordpress', 'db_user': 'my_db_user', 'db_root_pwd': '12345678'} tosca = ToscaTemplate(tosca_tpl, parsed_params=params) tosca_elk_tpl = utils.get_sample_test_path("data/tosca_elk.yaml") tosca_repo_tpl = utils.get_sample_test_path( "data/repositories/tosca_repositories_test_definition.yaml") def test_version(self): self.assertEqual(self.tosca.version, "tosca_simple_yaml_1_0") def test_description(self): expected_description = "TOSCA simple profile with wordpress, " \ "web server and mysql on the same server." self.assertEqual(self.tosca.description, expected_description) def test_inputs(self): self.assertEqual( ['cpus', 'db_name', 'db_port', 'db_pwd', 'db_root_pwd', 'db_user'], sorted([input.name for input in self.tosca.inputs])) input_name = "db_port" expected_description = "Port for the MySQL database." for input in self.tosca.inputs: if input.name == input_name: self.assertEqual(input.description, expected_description) def test_node_tpls(self): '''Test nodetemplate names.''' self.assertEqual( ['mysql_database', 'mysql_dbms', 'server', 'webserver', 'wordpress'], sorted([tpl.name for tpl in self.tosca.nodetemplates])) tpl_name = "mysql_database" expected_type = "tosca.nodes.Database" expected_properties = ['name', 'password', 'user'] expected_capabilities = ['database_endpoint', 'feature'] expected_requirements = [{'host': 'mysql_dbms'}] ''' TODO: needs enhancement in tosca_elk.yaml.. expected_relationshp = ['tosca.relationships.HostedOn'] expected_host = ['mysql_dbms'] ''' expected_interface = [ifaces.LIFECYCLE_SHORTNAME] for tpl in self.tosca.nodetemplates: if tpl_name == tpl.name: '''Test node type.''' self.assertEqual(tpl.type, expected_type) '''Test properties.''' self.assertEqual( expected_properties, sorted(tpl.get_properties().keys())) '''Test capabilities.''' self.assertEqual( expected_capabilities, sorted(tpl.get_capabilities().keys())) '''Test requirements.''' self.assertEqual( expected_requirements, tpl.requirements) '''Test relationship.''' ''' needs enhancements in tosca_elk.yaml self.assertEqual( expected_relationshp, [x.type for x in tpl.relationships.keys()]) self.assertEqual( expected_host, [y.name for y in tpl.relationships.values()]) ''' '''Test interfaces.''' self.assertEqual( expected_interface, [x.type for x in tpl.interfaces]) if tpl.name == 'server': '''Test property value''' props = tpl.get_properties() if props and 'mem_size' in props.keys(): self.assertEqual(props['mem_size'].value, '4096 MB') '''Test capability''' caps = tpl.get_capabilities() self.assertIn('os', caps.keys()) os_props_objs = None os_props = None os_type_prop = None if caps and 'os' in caps.keys(): capability = caps['os'] os_props_objs = capability.get_properties_objects() os_props = capability.get_properties() os_type_prop = capability.get_property_value('type') break self.assertEqual( ['Linux'], [p.value for p in os_props_objs if p.name == 'type']) self.assertEqual( 'Linux', os_props['type'].value if 'type' in os_props else '') self.assertEqual('Linux', os_props['type'].value) self.assertEqual('Linux', os_type_prop) def test_node_inheritance_type(self): wordpress_node = [ node for node in self.tosca.nodetemplates if node.name == 'wordpress'][0] self.assertTrue( wordpress_node.is_derived_from("tosca.nodes.WebApplication")) self.assertTrue( wordpress_node.is_derived_from("tosca.nodes.Root")) self.assertFalse( wordpress_node.is_derived_from("tosca.policies.Root")) def test_nodetype_without_relationship(self): # Nodes that contain "relationship" in "requirements" depend_node_types = ( "tosca.nodes.SoftwareComponent", "sample.SC", ) # Nodes that do not contain "relationship" in "requirements" non_depend_node_types = ( "tosca.nodes.Compute", ) tosca_tpl = utils.get_sample_test_path( "data/test_nodetype_without_relationship.yaml") tosca = ToscaTemplate(tosca_tpl) nodetemplates = tosca.nodetemplates for node in nodetemplates: node_depend = node.related_nodes if node_depend: self.assertIn( node.type, depend_node_types ) else: self.assertIn( node.type, non_depend_node_types ) def test_outputs(self): self.assertEqual( ['website_url'], sorted([output.name for output in self.tosca.outputs])) def test_interfaces(self): wordpress_node = [ node for node in self.tosca.nodetemplates if node.name == 'wordpress'][0] interfaces = wordpress_node.interfaces self.assertEqual(2, len(interfaces)) for interface in interfaces: if interface.name == 'create': self.assertEqual(ifaces.LIFECYCLE_SHORTNAME, interface.type) self.assertEqual('wordpress/wordpress_install.sh', interface.implementation) self.assertIsNone(interface.inputs) elif interface.name == 'configure': self.assertEqual(ifaces.LIFECYCLE_SHORTNAME, interface.type) self.assertEqual('wordpress/wordpress_configure.sh', interface.implementation) self.assertEqual(3, len(interface.inputs)) self.skipTest('bug #1440247') wp_db_port = interface.inputs['wp_db_port'] self.assertIsInstance(wp_db_port, GetProperty) self.assertEqual('get_property', wp_db_port.name) self.assertEqual(['SELF', 'database_endpoint', 'port'], wp_db_port.args) result = wp_db_port.result() self.assertIsInstance(result, GetInput) else: raise AssertionError( 'Unexpected interface: {0}'.format(interface.name)) def test_normative_type_by_short_name(self): # test template with a short name Compute template = utils.get_sample_test_path( "data/test_tosca_normative_type_by_shortname.yaml") tosca_tpl = ToscaTemplate(template) expected_type = "tosca.nodes.Compute" for tpl in tosca_tpl.nodetemplates: self.assertEqual(tpl.type, expected_type) for tpl in tosca_tpl.nodetemplates: compute_type = NodeType(tpl.type) self.assertEqual( sorted(['tosca.capabilities.Container', 'tosca.capabilities.Endpoint.Admin', 'tosca.capabilities.Node', 'tosca.capabilities.OperatingSystem', 'tosca.capabilities.network.Bindable', 'tosca.capabilities.Scalable']), sorted([c.type for c in compute_type.get_capabilities_objects()])) def test_template_with_no_inputs(self): tosca_tpl = self._load_template('test_no_inputs_in_template.yaml') self.assertEqual(0, len(tosca_tpl.inputs)) def test_template_with_no_outputs(self): tosca_tpl = self._load_template('test_no_outputs_in_template.yaml') self.assertEqual(0, len(tosca_tpl.outputs)) def test_template_file_with_suffix_yml(self): tosca_tpl = self._load_template('custom_types/wordpress.yml') self.assertIsNotNone(tosca_tpl) def test_relationship_interface(self): template = ToscaTemplate(self.tosca_elk_tpl) for node_tpl in template.nodetemplates: if node_tpl.name == 'logstash': config_interface = 'Configure' artifact = 'logstash/configure_elasticsearch.py' relation = node_tpl.relationships for key in relation.keys(): rel_tpl = relation.get(key).get_relationship_template() if rel_tpl: self.assertTrue(rel_tpl[0].is_derived_from( "tosca.relationships.Root")) interfaces = rel_tpl[0].interfaces for interface in interfaces: self.assertEqual(config_interface, interface.type) self.assertEqual('pre_configure_source', interface.name) self.assertEqual(artifact, interface.implementation) def test_relationship(self): template = ToscaTemplate(self.tosca_elk_tpl) for node_tpl in template.nodetemplates: if node_tpl.name == 'paypal_pizzastore': expected_relationships = ['tosca.relationships.ConnectsTo', 'tosca.relationships.HostedOn'] expected_hosts = ['tosca.nodes.Database', 'tosca.nodes.WebServer'] self.assertEqual(len(node_tpl.relationships), 2) self.assertEqual( expected_relationships, sorted([k.type for k in node_tpl.relationships.keys()])) self.assertEqual( expected_hosts, sorted([v.type for v in node_tpl.relationships.values()])) def test_repositories(self): template = ToscaTemplate(self.tosca_repo_tpl) self.assertEqual( ['repo_code0', 'repo_code1', 'repo_code2'], sorted([input.name for input in template.repositories])) input_name = "repo_code2" expected_url = "https://github.com/nandinivemula/intern/master" for input in template.repositories: if input.name == input_name: self.assertEqual(input.url, expected_url) def test_template_macro(self): template = ToscaTemplate(self.tosca_elk_tpl) for node_tpl in template.nodetemplates: if node_tpl.name == 'mongo_server': self.assertEqual( ['disk_size', 'mem_size', 'num_cpus'], sorted(node_tpl.get_capability('host'). get_properties().keys())) def test_template_requirements(self): """Test different formats of requirements The requirements can be defined in few different ways, 1. Requirement expressed as a capability with an implicit relationship. 2. Requirement expressed with explicit relationship. 3. Requirement expressed with a relationship template. 4. Requirement expressed via TOSCA types to provision a node with explicit relationship. 5. Requirement expressed via TOSCA types with a filter. """ tosca_tpl = utils.get_sample_test_path( "data/requirements/test_requirements.yaml") tosca = ToscaTemplate(tosca_tpl) for node_tpl in tosca.nodetemplates: if node_tpl.name == 'my_app': expected_relationship = [ ('tosca.relationships.ConnectsTo', 'mysql_database'), ('tosca.relationships.ConnectsTo', 'mysql_database'), ('tosca.relationships.HostedOn', 'my_webserver'), ('tosca.relationships.HostedOn', 'my_webserver')] actual_relationship = sorted([ (relation.type, node.name) for relation, node in node_tpl.relationships.items()]) self.assertEqual(expected_relationship, actual_relationship) if node_tpl.name == 'mysql_database': self.assertEqual( [('tosca.relationships.HostedOn', 'my_dbms')], [(relation.type, node.name) for relation, node in node_tpl.relationships.items()]) if node_tpl.name == 'my_server': self.assertEqual( [('tosca.relationships.AttachesTo', 'my_storage')], [(relation.type, node.name) for relation, node in node_tpl.relationships.items()]) def test_template_requirements_not_implemented(self): # TODO(spzala): replace this test with new one once TOSCA types look up # support is implemented. """Requirements that yet need to be implemented The following requirement formats are not yet implemented, due to look up dependency: 1. Requirement expressed via TOSCA types to provision a node with explicit relationship. 2. Requirement expressed via TOSCA types with a filter. """ tpl_snippet_1 = ''' node_templates: mysql_database: type: tosca.nodes.Database description: Requires a particular node type and relationship. To be full-filled via lookup into node repository. requirements: - req1: node: tosca.nodes.DBMS relationship: tosca.relationships.HostedOn ''' tpl_snippet_2 = ''' node_templates: my_webserver: type: tosca.nodes.WebServer description: Requires a particular node type with a filter. To be full-filled via lookup into node repository. requirements: - req1: node: tosca.nodes.Compute target_filter: properties: num_cpus: { in_range: [ 1, 4 ] } mem_size: { greater_or_equal: 2 } capabilities: - tosca.capabilities.OS: properties: architecture: x86_64 type: linux ''' tpl_snippet_3 = ''' node_templates: my_webserver2: type: tosca.nodes.WebServer description: Requires a node type with a particular capability. To be full-filled via lookup into node repository. requirements: - req1: node: tosca.nodes.Compute relationship: tosca.relationships.HostedOn capability: tosca.capabilities.Container ''' self._requirements_not_implemented(tpl_snippet_1, 'mysql_database') self._requirements_not_implemented(tpl_snippet_2, 'my_webserver') self._requirements_not_implemented(tpl_snippet_3, 'my_webserver2') def _requirements_not_implemented(self, tpl_snippet, tpl_name): nodetemplates = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet))['node_templates'] self.assertRaises( NotImplementedError, lambda: NodeTemplate(tpl_name, nodetemplates).relationships) # Test the following: # 1. Custom node type derived from 'WebApplication' named 'TestApp' # with a custom Capability Type 'TestCapability' # 2. Same as #1, but referencing a custom 'TestCapability' Capability Type # that is not defined def test_custom_capability_type_definition(self): tpl_snippet = ''' node_templates: test_app: type: tosca.nodes.WebApplication.TestApp capabilities: test_cap: properties: test: 1 ''' # custom node type definition with custom capability type definition custom_def = ''' tosca.nodes.WebApplication.TestApp: derived_from: tosca.nodes.WebApplication capabilities: test_cap: type: tosca.capabilities.TestCapability tosca.capabilities.TestCapability: derived_from: tosca.capabilities.Root properties: test: type: integer required: false ''' expected_capabilities = ['app_endpoint', 'feature', 'test_cap'] nodetemplates = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet))['node_templates'] custom_def = (toscaparser.utils.yamlparser. simple_parse(custom_def)) name = list(nodetemplates.keys())[0] tpl = NodeTemplate(name, nodetemplates, custom_def) self.assertEqual( expected_capabilities, sorted(tpl.get_capabilities().keys())) # custom definition without valid capability type definition custom_def = ''' tosca.nodes.WebApplication.TestApp: derived_from: tosca.nodes.WebApplication capabilities: test_cap: type: tosca.capabilities.TestCapability ''' custom_def = (toscaparser.utils.yamlparser. simple_parse(custom_def)) tpl = NodeTemplate(name, nodetemplates, custom_def) err = self.assertRaises( exception.InvalidTypeError, lambda: NodeTemplate(name, nodetemplates, custom_def).get_capabilities_objects()) self.assertEqual('Type "tosca.capabilities.TestCapability" is not ' 'a valid type.', str(err)) def test_capability_without_properties(self): expected_version = "tosca_simple_yaml_1_0" expected_description = \ "Test resources for which properties are not defined in "\ "the parent of capabilitytype. "\ "TestApp has capabilities->test_cap, "\ "and the type of test_cap is TestCapabilityAA. "\ "The parents of TestCapabilityAA is TestCapabilityA, "\ "and TestCapabilityA has no properties." expected_nodetemplates = { "test_app": { "type": "tosca.nodes.WebApplication.TestApp", "capabilities": { "test_cap": { "properties": { "test": 1 } } }, "requirements": [ { "host": "test_server" } ] }, 'test_server': {'type': 'tosca.nodes.Compute'} } tosca_tpl = utils.get_sample_test_path( "data/test_capability_without_properties.yaml") tosca = ToscaTemplate(tosca_tpl) self.assertEqual(expected_version, tosca.version) self.assertEqual(expected_description, tosca.description) self.assertEqual( expected_nodetemplates, tosca.nodetemplates[0].templates, ) def test_local_template_with_local_relpath_import(self): tosca_tpl = utils.get_sample_test_path( "data/tosca_single_instance_wordpress.yaml") params = {'db_name': 'my_wordpress', 'db_user': 'my_db_user', 'db_root_pwd': '12345678'} tosca = ToscaTemplate(tosca_tpl, parsed_params=params) self.assertTrue(tosca.topology_template.custom_defs) @mock.patch.object(ToscaTemplate, '_tpl_imports') def test_local_template_with_url_import(self, mock_tpl_imports): tosca_tpl = utils.get_sample_test_path( "data/tosca_single_instance_wordpress_with_url_import.yaml") import_file_path = utils.get_sample_test_path( "data/custom_types/wordpress.yaml") mock_tpl_imports.return_value = [import_file_path] tosca = ToscaTemplate(tosca_tpl, parsed_params={'db_root_pwd': '123456'}) self.assertTrue(tosca.topology_template.custom_defs) @mock.patch.object(urllib.request, 'urlopen') def test_url_template_with_local_relpath_import(self, mock_urlopen): tosca_tpl = ('https://example.com/tosca_single_instance_' 'wordpress.yaml') mock_path = 'https://example.com/custom_types/wordpress.yaml' mockclass = MockTestClass() mockclass.comp_urldict = {tosca_tpl: utils.get_sample_test_path( "data/tosca_single_instance_wordpress.yaml"), mock_path: utils.get_sample_test_path( "data/custom_types/wordpress.yaml")} mock_urlopen.side_effect = mockclass.mock_urlopen_method tosca = ToscaTemplate(tosca_tpl, a_file=False, parsed_params={"db_name": "mysql", "db_user": "mysql", "db_root_pwd": "1234", "db_pwd": "5678", "db_port": 3306, "cpus": 4}) self.assertTrue(tosca.topology_template.custom_defs) @mock.patch.object(urllib.request, 'urlopen') def test_url_template_with_local_abspath_import(self, mock_urlopen): tosca_tpl = ('https://example.com/tosca_single_instance_wordpress_' 'with_local_abspath_import.yaml') mockclass = MockTestClass() mockclass.comp_urldict = {tosca_tpl: utils.get_sample_test_path( "data/tosca_single_instance_wordpress_with_local_abspath_" "import.yaml")} mock_urlopen.side_effect = mockclass.mock_urlopen_method self.assertRaises(exception.ValidationError, ToscaTemplate, tosca_tpl, None, False) err_msg = (_('Absolute file name "/tmp/tosca-parser/toscaparser/tests' '/data/custom_types/wordpress.yaml" cannot be used in a ' 'URL-based input template "%(tpl)s".') % {'tpl': tosca_tpl}) exception.ExceptionCollector.assertExceptionMessage(ImportError, err_msg) @mock.patch.object(UrlUtils, 'join_url') @mock.patch.object(os.path, 'isabs') @mock.patch.object(ToscaTemplate, '_tpl_imports') @mock.patch.object(urllib.request, 'urlopen') def test_url_template_with_url_import( self, mock_urlopen, mock_tpl_imports, mock_isabs, mock_join_url): tosca_tpl = ('https://example.com/tosca_single_instance_wordpress_' 'with_url_import.yaml') mockclass = MockTestClass() mockclass.comp_urldict = {tosca_tpl: utils.get_sample_test_path( "data/tosca_single_instance_wordpress_with_url_import.yaml")} mock_urlopen.side_effect = mockclass.mock_urlopen_method import_file_path = utils.get_sample_test_path( "data/custom_types/wordpress.yaml") mock_tpl_imports.return_value = [import_file_path] mock_isabs.return_value = False mock_join_url.return_value = import_file_path tosca = ToscaTemplate(tosca_tpl, a_file=False, parsed_params={"db_root_pwd": "1234"}) self.assertTrue(tosca.topology_template.custom_defs) def test_csar_parsing_wordpress(self): csar_archive = utils.get_sample_test_path( "data/CSAR/csar_wordpress.zip") self.assertTrue(ToscaTemplate(csar_archive, parsed_params={"db_name": "mysql", "db_user": "mysql", "db_root_pwd": "1234", "db_pwd": "5678", "db_port": 3306, "cpus": 4})) @mock.patch.object(requests, 'get') def test_csar_parsing_elk_url_based(self, mock_requests_get): csar_archive = 'https://example.com/csar_elk.zip' class TestResponse: content: bytes response = TestResponse() file_path = utils.get_sample_test_path("data/CSAR/csar_elk.zip") with open(file_path, 'br') as f: response.content = f.read() f.close() mock_requests_get.return_value = response self.assertTrue(ToscaTemplate(csar_archive, a_file=False, parsed_params={"my_cpus": 4})) def test_nested_imports_in_templates(self): tosca_tpl = utils.get_sample_test_path( "data/test_instance_nested_imports.yaml") tosca = ToscaTemplate(tosca_tpl) expected_custom_types = ['tosca.nodes.SoftwareComponent.Elasticsearch', 'tosca.nodes.SoftwareComponent.Kibana', 'tosca.nodes.WebApplication.WordPress', 'test_namespace_prefix.Rsyslog', 'Test2ndRsyslogType', 'test_2nd_namespace_prefix.Rsyslog', 'tosca.nodes.SoftwareComponent.Logstash', 'tosca.nodes.SoftwareComponent.Rsyslog.' 'TestRsyslogType'] self.assertCountEqual(tosca.topology_template.custom_defs.keys(), expected_custom_types) def test_invalid_template_file(self): template_file = 'invalid template file' expected_msg = (_('"%s" is not a valid file.') % template_file) self.assertRaises( exception.ValidationError, ToscaTemplate, template_file, None, False) exception.ExceptionCollector.assertExceptionMessage(ValueError, expected_msg) def test_multiple_validation_errors(self): tosca_tpl = utils.get_sample_test_path( "data/test_multiple_validation_errors.yaml") self.assertRaises(exception.ValidationError, ToscaTemplate, tosca_tpl, None) valid_versions = '", "'.join(ToscaTemplate.VALID_TEMPLATE_VERSIONS) err1_msg = (_('The template version "tosca_simple_yaml_1" is invalid. ' 'Valid versions are "%s".') % valid_versions) exception.ExceptionCollector.assertExceptionMessage( exception.InvalidTemplateVersion, err1_msg) err2_msg = _('Import "custom_types/not_there.yaml" is not valid.') exception.ExceptionCollector.assertExceptionMessage( ImportError, err2_msg) err3_msg = _('Type "tosca.nodes.WebApplication.WordPress" is not a ' 'valid type.') exception.ExceptionCollector.assertExceptionMessage( exception.InvalidTypeError, err3_msg) err4_msg = _('Node template "wordpress" contains unknown field ' '"requirement". Refer to the definition to verify valid ' 'values.') exception.ExceptionCollector.assertExceptionMessage( exception.UnknownFieldError, err4_msg) err5_msg = _('\'Property "passwords" was not found in node template ' '"mysql_database".\'') exception.ExceptionCollector.assertExceptionMessage( KeyError, err5_msg) err6_msg = _('Template "mysql_dbms" is missing required field "type".') exception.ExceptionCollector.assertExceptionMessage( exception.MissingRequiredFieldError, err6_msg) err7_msg = _('Node template "mysql_dbms" contains unknown field ' '"type1". Refer to the definition to verify valid ' 'values.') exception.ExceptionCollector.assertExceptionMessage( exception.UnknownFieldError, err7_msg) err8_msg = _('\'Node template "server1" was not found in ' '"webserver".\'') exception.ExceptionCollector.assertExceptionMessage( KeyError, err8_msg) err9_msg = _('"relationship" used in template "webserver" is missing ' 'required field "type".') exception.ExceptionCollector.assertExceptionMessage( exception.MissingRequiredFieldError, err9_msg) err10_msg = _('Type "tosca.nodes.XYZ" is not a valid type.') exception.ExceptionCollector.assertExceptionMessage( exception.InvalidTypeError, err10_msg) def test_invalid_section_names(self): tosca_tpl = utils.get_sample_test_path( "data/test_invalid_section_names.yaml") self.assertRaises(exception.ValidationError, ToscaTemplate, tosca_tpl, None) err1_msg = _('Template contains unknown field ' '"tosca_definitions_versions". Refer to the definition ' 'to verify valid values.') exception.ExceptionCollector.assertExceptionMessage( exception.UnknownFieldError, err1_msg) err2_msg = _('Template contains unknown field "descriptions". ' 'Refer to the definition to verify valid values.') exception.ExceptionCollector.assertExceptionMessage( exception.UnknownFieldError, err2_msg) err3_msg = _('Template contains unknown field "import". Refer to ' 'the definition to verify valid values.') exception.ExceptionCollector.assertExceptionMessage( exception.UnknownFieldError, err3_msg) err4_msg = _('Template contains unknown field "topology_templates". ' 'Refer to the definition to verify valid values.') exception.ExceptionCollector.assertExceptionMessage( exception.UnknownFieldError, err4_msg) def test_csar_with_alternate_extenstion(self): tosca_tpl = utils.get_sample_test_path("data/CSAR/csar_elk.csar") tosca = ToscaTemplate(tosca_tpl, parsed_params={"my_cpus": 2}) self.assertTrue(tosca.topology_template.custom_defs) def test_available_rel_tpls(self): tosca_tpl = utils.get_sample_test_path( "data/test_available_rel_tpls.yaml") tosca = ToscaTemplate(tosca_tpl) for node in tosca.nodetemplates: for relationship, target in node.relationships.items(): try: target.relationships except TypeError as error: self.fail(error) def test_no_input(self): self.assertRaises(exception.ValidationError, ToscaTemplate, None, None, False, None) err_msg = (('No path or yaml_dict_tpl was provided. ' 'There is nothing to parse.')) exception.ExceptionCollector.assertExceptionMessage(ValueError, err_msg) def test_path_and_yaml_dict_tpl_input(self): test_tpl = utils.get_sample_test_path("data/tosca_helloworld.yaml") yaml_dict_tpl = toscaparser.utils.yamlparser.load_yaml(test_tpl) tosca = ToscaTemplate(test_tpl, yaml_dict_tpl=yaml_dict_tpl) self.assertEqual(tosca.version, "tosca_simple_yaml_1_0") def test_yaml_dict_tpl_input(self): test_tpl = utils.get_sample_test_path("data/tosca_helloworld.yaml") yaml_dict_tpl = toscaparser.utils.yamlparser.load_yaml(test_tpl) tosca = ToscaTemplate(yaml_dict_tpl=yaml_dict_tpl) self.assertEqual(tosca.version, "tosca_simple_yaml_1_0") @mock.patch.object(ToscaTemplate, '_tpl_imports') def test_yaml_dict_tpl_with_params_and_url_import(self, mock_tpl_imports): test_tpl = utils.get_sample_test_path( "data/tosca_single_instance_wordpress_with_url_import.yaml") yaml_dict_tpl = toscaparser.utils.yamlparser.load_yaml(test_tpl) params = {'db_name': 'my_wordpress', 'db_user': 'my_db_user', 'db_root_pwd': 'mypasswd'} import_file_path = utils.get_sample_test_path( "data/custom_types/wordpress.yaml") mock_tpl_imports.return_value = [import_file_path] tosca = ToscaTemplate(parsed_params=params, yaml_dict_tpl=yaml_dict_tpl) self.assertEqual(tosca.version, "tosca_simple_yaml_1_0") def test_yaml_dict_tpl_with_rel_import(self): test_tpl = utils.get_sample_test_path( "data/tosca_single_instance_wordpress.yaml") yaml_dict_tpl = toscaparser.utils.yamlparser.load_yaml(test_tpl) params = {'db_name': 'my_wordpress', 'db_user': 'my_db_user', 'db_root_pwd': '12345678'} self.assertRaises(exception.ValidationError, ToscaTemplate, None, params, False, yaml_dict_tpl) err_msg = (_('Relative file name "custom_types/wordpress.yaml" ' 'cannot be used in a pre-parsed input template.')) exception.ExceptionCollector.assertExceptionMessage(ImportError, err_msg) def test_yaml_dict_tpl_with_fullpath_import(self): test_tpl = utils.get_sample_test_path( "data/tosca_single_instance_wordpress.yaml") yaml_dict_tpl = toscaparser.utils.yamlparser.load_yaml(test_tpl) yaml_dict_tpl['imports'] = [utils.get_sample_test_path( "data/custom_types/wordpress.yaml")] params = {'db_name': 'my_wordpress', 'db_user': 'my_db_user', 'db_root_pwd': 'mypasswd'} tosca = ToscaTemplate(parsed_params=params, yaml_dict_tpl=yaml_dict_tpl) self.assertEqual(tosca.version, "tosca_simple_yaml_1_0") def test_policies_for_node_templates(self): tosca_tpl = utils.get_sample_test_path( "data/policies/tosca_policy_template.yaml") tosca = ToscaTemplate(tosca_tpl) for policy in tosca.topology_template.policies: self.assertTrue( policy.is_derived_from("tosca.policies.Root")) if policy.name == 'my_compute_placement_policy': self.assertEqual('tosca.policies.Placement', policy.type) self.assertEqual(['my_server_1', 'my_server_2'], policy.targets) self.assertEqual('node_templates', policy.get_targets_type()) for node in policy.targets_list: if node.name == 'my_server_1': '''Test property value''' props = node.get_properties() if props and 'mem_size' in props.keys(): self.assertEqual(props['mem_size'].value, '4096 MB') def test_policies_for_groups(self): tosca_tpl = utils.get_sample_test_path( "data/policies/tosca_policy_template.yaml") tosca = ToscaTemplate(tosca_tpl) for policy in tosca.topology_template.policies: self.assertTrue( policy.is_derived_from("tosca.policies.Root")) if policy.name == 'my_groups_placement': self.assertEqual('mycompany.mytypes.myScalingPolicy', policy.type) self.assertEqual(['webserver_group'], policy.targets) self.assertEqual('groups', policy.get_targets_type()) group = policy.get_targets_list()[0] for node in group.get_member_nodes(): if node.name == 'my_server_2': '''Test property value''' props = node.get_properties() if props and 'mem_size' in props.keys(): self.assertEqual(props['mem_size'].value, '4096 MB') # Test the following: # check the inheritance between custom policies. # It will first parse the tosca template located at # data/policies/tosca_custom_policy_template.yaml where # two empty customs policies have been created. The child # empty custom policy tosca.policies.Adva.Failure.Restart # is derived from its parent empty custom policy # tosca.policies.Adva.Failure which is also derived # from its parent empty policy tosca.policies.Root. def test_policies_for_custom(self): host_prop = {} tosca_tpl = utils.get_sample_test_path( "data/policies/tosca_custom_policy_template.yaml") tosca = ToscaTemplate(tosca_tpl) for policy in tosca.topology_template.policies: self.assertTrue( policy.is_derived_from("tosca.policies.Root")) if policy.name == 'My_failure_policy_restart': self.assertEqual('tosca.policies.Adva.Failure.Restart', policy.type) targets = policy.targets for target in targets: if ('my_server_1' == target): '''Test property value''' for nodetemplate in tosca.nodetemplates: if nodetemplate.name == target: caps = nodetemplate.get_capabilities() for cap in caps.keys(): generic_cap = \ nodetemplate.get_capability(cap) if generic_cap: for prop in \ generic_cap.\ get_properties_objects(): host_prop[prop.name] = prop.value if cap == 'host': self.assertEqual(host_prop ['mem_size'], '512 MB') def test_node_filter(self): tosca_tpl = utils.get_sample_test_path( "data/node_filter/test_node_filter.yaml") ToscaTemplate(tosca_tpl) def test_attributes_inheritance(self): tosca_tpl = utils.get_sample_test_path( "data/test_attributes_inheritance.yaml") ToscaTemplate(tosca_tpl) @mock.patch.object(urllib.request, 'urlopen') def test_repositories_definition(self, mock_urlopen): tosca_tpl = utils.get_sample_test_path( "data/repositories/test_repositories_definition.yaml") mock_path = "https://example.com/custom_types/compute_with_prop.yaml" mockclass = MockTestClass() mockclass.comp_urldict = {mock_path: utils.get_sample_test_path( "data/custom_types/compute_with_prop.yaml")} mock_urlopen.side_effect = mockclass.mock_urlopen_method ToscaTemplate(tosca_tpl) def test_custom_caps_def(self): tosca_tpl = utils.get_sample_test_path( "data/test_custom_caps_def.yaml") ToscaTemplate(tosca_tpl) def test_custom_caps_with_custom_datatype(self): tosca_tpl = utils.get_sample_test_path( "data/test_custom_caps_with_datatype.yaml") ToscaTemplate(tosca_tpl) def test_custom_rel_with_script(self): tosca_tpl = utils.get_sample_test_path( "data/test_tosca_custom_rel_with_script.yaml") tosca = ToscaTemplate(tosca_tpl) rel = tosca.relationship_templates[0] self.assertEqual(rel.type, "tosca.relationships.HostedOn") self.assertTrue(rel.is_derived_from("tosca.relationships.Root")) self.assertEqual(len(rel.interfaces), 1) self.assertEqual(rel.interfaces[0].type, "Configure") def test_various_portspec_errors(self): tosca_tpl = utils.get_sample_test_path( "data/datatypes/test_datatype_portspec_add_req.yaml") self.assertRaises(exception.ValidationError, ToscaTemplate, tosca_tpl, None) # TODO(TBD) find way to reuse error messages from constraints.py msg = (_('The value "%(pvalue)s" of property "%(pname)s" is out of ' 'range "(min:%(vmin)s, max:%(vmax)s)".') % dict(pname=PortSpec.SOURCE, pvalue='0', vmin='1', vmax='65535')) exception.ExceptionCollector.assertExceptionMessage( exception.ValidationError, msg) # Test value below range min. msg = (_('The value "%(pvalue)s" of property "%(pname)s" is out of ' 'range "(min:%(vmin)s, max:%(vmax)s)".') % dict(pname=PortSpec.SOURCE, pvalue='1', vmin='2', vmax='65534')) exception.ExceptionCollector.assertExceptionMessage( exception.RangeValueError, msg) # Test value above range max. msg = (_('The value "%(pvalue)s" of property "%(pname)s" is out of ' 'range "(min:%(vmin)s, max:%(vmax)s)".') % dict(pname=PortSpec.SOURCE, pvalue='65535', vmin='2', vmax='65534')) exception.ExceptionCollector.assertExceptionMessage( exception.RangeValueError, msg) def test_containers(self): tosca_tpl = utils.get_sample_test_path( "data/containers/test_container_docker_mysql.yaml") ToscaTemplate(tosca_tpl, parsed_params={"mysql_root_pwd": "12345678"}) def test_endpoint_on_compute(self): tosca_tpl = utils.get_sample_test_path( "data/test_endpoint_on_compute.yaml") ToscaTemplate(tosca_tpl) def test_nested_dsl_def(self): tosca_tpl = utils.get_sample_test_path( "data/dsl_definitions/test_nested_dsl_def.yaml") self.assertIsNotNone(ToscaTemplate(tosca_tpl)) def test_multiple_policies(self): tosca_tpl = utils.get_sample_test_path( "data/policies/test_tosca_nfv_multiple_policies.yaml") tosca = ToscaTemplate(tosca_tpl) self.assertEqual( ['ALRM1', 'SP1', 'SP2'], sorted([policy.name for policy in tosca.policies])) def test_custom_capability(self): tosca_tpl = utils.get_sample_test_path( "data/test_custom_capabilty.yaml") ToscaTemplate(tosca_tpl) def test_csar_multilevel_imports_relative_path(self): csar_archive = utils.get_sample_test_path( "data/CSAR/csar_relative_path_import_check.zip") self.assertTrue(ToscaTemplate(csar_archive)) def test_csar_multiple_deployment_flavours(self): csar_archive = utils.get_sample_test_path( "data/CSAR/csar_multiple_deployment_flavour.zip") tosca = ToscaTemplate(csar_archive) flavours = list() for tp in tosca.nested_tosca_templates_with_topology: flavour_id = tp.substitution_mappings.properties.get('flavour_id') flavour = {'flavour_id': flavour_id} flavours.append(flavour) self.assertEqual(flavours[0]['flavour_id'], 'simple') self.assertEqual(flavours[1]['flavour_id'], 'complex') def test_custom_rel_get_type(self): tosca_tpl = utils.get_sample_test_path( "data/test_tosca_custom_rel.yaml") tosca = ToscaTemplate(tosca_tpl) for src in tosca.nodetemplates: for rel, trgt in src.relationships.items(): rel_tpls = trgt.get_relationship_template() self.assertEqual(rel_tpls[0].type, "MyAttachesTo") def test_policies_without_required_property(self): tosca_tpl = utils.get_sample_test_path( "data/policies/test_policies_without_required_property.yaml") self.assertRaises(exception.ValidationError, ToscaTemplate, tosca_tpl, None) @mock.patch.object(ToscaTemplate, '_tpl_imports') def test_local_custom_defs(self, mock_tpl_imports): """Compare if custom defs on local and remote the same.""" tosca_tpl = utils.get_sample_test_path( "data/tosca_single_instance_wordpress_with_url_import.yaml") local_def = utils.get_sample_test_path( "data/custom_types/wordpress.yaml") remote_def = ( "https://example.com/custom_types/wordpress.yaml") local_defs = {remote_def: local_def} params = {'db_name': 'my_wordpress', 'db_user': 'my_db_user', 'db_root_pwd': '12345678'} import_file_path = utils.get_sample_test_path( "data/custom_types/wordpress.yaml") mock_tpl_imports.return_value = [import_file_path] tosca = ToscaTemplate(tosca_tpl, parsed_params=params) tosca_local = ToscaTemplate(tosca_tpl, parsed_params=params, local_defs=local_defs) # Compare the name of input params defined in the custom defs expected = ["wp_db_name", "wp_db_user", "wp_db_password"] for t in [tosca, tosca_local]: actual = list( (t.tpl["topology_template"]["node_templates"]["wordpress"] ["interfaces"]["Standard"]["configure"]["inputs"]).keys()) self.assertEqual(expected, actual) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8173091 tosca_parser-2.15.0/toscaparser/tests/test_toscatplvalidation.py0000664000175000017500000025153515250006202024116 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock import urllib from toscaparser.common import exception from toscaparser.imports import ImportsLoader from toscaparser.nodetemplate import NodeTemplate from toscaparser.parameters import Input from toscaparser.parameters import Output from toscaparser.policy import Policy from toscaparser.relationship_template import RelationshipTemplate from toscaparser.repositories import Repository from toscaparser.reservation import Reservation from toscaparser.tests.base import MockTestClass from toscaparser.tests.base import TestCase from toscaparser.tests import utils from toscaparser.topology_template import TopologyTemplate from toscaparser.tosca_template import ToscaTemplate from toscaparser.triggers import Triggers from toscaparser.utils.gettextutils import _ import toscaparser.utils.yamlparser class ToscaTemplateValidationTest(TestCase): def test_well_defined_template(self): tpl_path = utils.get_sample_test_path( "data/tosca_single_instance_wordpress.yaml") params = {'db_name': 'my_wordpress', 'db_user': 'my_db_user', 'db_root_pwd': '12345678'} self.assertIsNotNone(ToscaTemplate(tpl_path, params)) def test_custom_interface_allowed(self): tpl_path = utils.get_sample_test_path( "data/interfaces/test_custom_interface_in_template.yaml") self.assertIsNotNone(ToscaTemplate(tpl_path)) def test_custom_interface_invalid_operation(self): tpl_path = utils.get_sample_test_path( "data/interfaces/test_custom_interface_invalid_operation.yaml") self.assertRaises(exception.ValidationError, ToscaTemplate, tpl_path) exception.ExceptionCollector.assertExceptionMessage( exception.UnknownFieldError, _('"interfaces" of template "customInterfaceTest" ' 'contains unknown field "CustomOp4". ' 'Refer to the definition to verify valid values.')) # Since 'operations' Keyname was defined in TOSCA1.3, # test whether operation_definitions defined # under 'operations' can be used. def test_custom_interface_operations(self): tpl_path = utils.get_sample_test_path( "data/interfaces/test_custom_interface_operations.yaml") tosca = ToscaTemplate(tpl_path) op_names = tosca.tpl['interface_types'][ 'tosca.interfaces.CustomInterface']['operations'].keys() self.assertEqual('CustomOp', list(op_names)[0]) op_names = tosca.topology_template.custom_defs[ 'tosca.interfaces.CustomInterface']['operations'].keys() self.assertEqual('CustomOp', list(op_names)[0]) op_names = tosca.topology_template.nodetemplates[0].templates[ 'customInterfaceTest']['interfaces']['CustomInterface'][ 'operations'].keys() self.assertEqual('CustomOp', list(op_names)[0]) # Since 'notifications' Keyname was defined in TOSCA1.3, # test whether notification_definitions defined # under 'notifications' can be used. def test_custom_interface_notifications(self): tpl_path = utils.get_sample_test_path( "data/interfaces/test_custom_interface_notifications.yaml") tosca = ToscaTemplate(tpl_path) no_names = tosca.tpl['interface_types'][ 'tosca.interfaces.CustomInterface']['notifications'].keys() self.assertEqual('CustomNo', list(no_names)[0]) no_names = tosca.topology_template.custom_defs[ 'tosca.interfaces.CustomInterface']['notifications'].keys() self.assertEqual('CustomNo', list(no_names)[0]) no_names = tosca.topology_template.nodetemplates[0].templates[ 'customInterfaceTest']['interfaces']['CustomInterface'][ 'notifications'].keys() self.assertEqual('CustomNo', list(no_names)[0]) def test_first_level_sections(self): tpl_path = utils.get_sample_test_path( "data/test_tosca_top_level_error1.yaml") self.assertRaises(exception.ValidationError, ToscaTemplate, tpl_path) exception.ExceptionCollector.assertExceptionMessage( exception.MissingRequiredFieldError, _('Template is missing required field ' '"tosca_definitions_version".')) tpl_path = utils.get_sample_test_path( "data/test_tosca_top_level_error2.yaml") self.assertRaises(exception.ValidationError, ToscaTemplate, tpl_path) exception.ExceptionCollector.assertExceptionMessage( exception.UnknownFieldError, _('Template contains unknown field "node_template". Refer to the ' 'definition to verify valid values.')) def test_template_with_imports_validation(self): tpl_path = utils.get_sample_test_path( "data/tosca_imports_validation.yaml") self.assertRaises(exception.ValidationError, ToscaTemplate, tpl_path) exception.ExceptionCollector.assertExceptionMessage( exception.UnknownFieldError, _('Template custom_types/imported_sample.yaml contains unknown ' 'field "descriptions". Refer to the definition' ' to verify valid values.')) exception.ExceptionCollector.assertExceptionMessage( exception.UnknownFieldError, _('Template custom_types/imported_sample.yaml contains unknown ' 'field "node_typess". Refer to the definition to ' 'verify valid values.')) exception.ExceptionCollector.assertExceptionMessage( exception.UnknownFieldError, _('Template custom_types/imported_sample.yaml contains unknown ' 'field "tosca1_definitions_version". Refer to the definition' ' to verify valid values.')) versions = '", "'.join(ToscaTemplate.VALID_TEMPLATE_VERSIONS) exception.ExceptionCollector.assertExceptionMessage( exception.InvalidTemplateVersion, _('The template version "tosca_simple_yaml_1_10 in ' 'custom_types/imported_sample.yaml" is invalid. ' 'Valid versions are "%s".') % versions) exception.ExceptionCollector.assertExceptionMessage( exception.UnknownFieldError, _('Template custom_types/imported_sample.yaml contains unknown ' 'field "policy_types1". Refer to the definition to ' 'verify valid values.')) exception.ExceptionCollector.assertExceptionMessage( exception.UnknownFieldError, _('Nodetype"tosca.nodes.SoftwareComponent.Logstash" contains ' 'unknown field "capabilities1". Refer to the definition ' 'to verify valid values.')) exception.ExceptionCollector.assertExceptionMessage( exception.UnknownFieldError, _('Policy "mycompany.mytypes.myScalingPolicy" contains unknown ' 'field "derived1_from". Refer to the definition to ' 'verify valid values.')) exception.ExceptionCollector.assertExceptionMessage( exception.UnknownFieldError, _('Relationshiptype "test.relation.connects" contains unknown ' 'field "derived_from4". Refer to the definition to ' 'verify valid values.')) def test_getoperation_IncorrectValue(self): # test case 1 tpl_snippet = ''' node_templates: front_end: type: tosca.nodes.Compute interfaces: Standard: create: implementation: scripts/frontend/create.sh configure: implementation: scripts/frontend/configure.sh inputs: data_dir: {get_operation_output: [front_end,Standard1, create,data_dir]} ''' tpl = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) err = self.assertRaises(ValueError, TopologyTemplate, tpl, None) expectedmessage = _('Node or relationship template "front_end" ' 'has not interface "Standard1" ' 'or operation "create".') self.assertEqual(expectedmessage, err.__str__()) # test case 2 tpl_snippet2 = ''' node_templates: front_end: type: tosca.nodes.Compute interfaces: Standard: create: implementation: scripts/frontend/create.sh configure: implementation: scripts/frontend/configure.sh inputs: data_dir: {get_operation_output: [front_end1,Standard, create,data_dir]} ''' tpl2 = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet2)) err2 = self.assertRaises(KeyError, TopologyTemplate, tpl2, None) expectedmessage2 = _('\'Node or relationship template "front_end1" ' 'was not found.\'') self.assertEqual(expectedmessage2, err2.__str__()) # test case 3 tpl_snippet3 = ''' node_templates: front_end: type: tosca.nodes.Compute interfaces: Standard: create: implementation: scripts/frontend/create.sh configure: implementation: scripts/frontend/configure.sh inputs: data_dir: {get_operation_output: [front_end,Standard, get_target,data_dir]} ''' tpl3 = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet3)) err3 = self.assertRaises(ValueError, TopologyTemplate, tpl3, None) expectedmessage3 = _('Enter an operation of Standard interface') self.assertEqual(expectedmessage3, err3.__str__()) # test case 4 tpl_snippet4 = ''' node_templates: front_end: type: tosca.nodes.Compute interfaces: Standard: create: implementation: scripts/frontend/create.sh configure: implementation: scripts/frontend/configure.sh inputs: data_dir: {get_operation_output: [front_end,Configure, create,data_dir]} ''' tpl4 = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet4)) err4 = self.assertRaises(ValueError, TopologyTemplate, tpl4, None) expectedmessage4 = _('Enter an operation of Configure interface') self.assertEqual(expectedmessage4, err4.__str__()) # test case 5 tpl_snippet5 = ''' node_templates: front_end: type: tosca.nodes.Compute interfaces: Standard: create: implementation: scripts/frontend/create.sh configure: implementation: scripts/frontend/configure.sh inputs: data_dir: {get_operation_output: [front_end,Standard, create]} ''' tpl5 = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet5)) err5 = self.assertRaises(ValueError, TopologyTemplate, tpl5, None) expectedmessage5 = _('Illegal arguments for function' ' "get_operation_output".' ' Expected arguments: "template_name",' '"interface_name",' '"operation_name","output_variable_name"') self.assertEqual(expectedmessage5, err5.__str__()) def test_unsupported_type(self): tpl_snippet = ''' node_templates: invalid_type: type: tosca.test.invalidtype properties: size: { get_input: storage_size } snapshot_id: { get_input: storage_snapshot_id } ''' tpl = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) err = self.assertRaises(exception.UnsupportedTypeError, TopologyTemplate, tpl, None) expectedmessage = _('Type "tosca.test.invalidtype" is valid' ' TOSCA type but not supported at this time.') self.assertEqual(expectedmessage, err.__str__()) def test_inputs(self): tpl_snippet1 = ''' inputs: cpus: type: integer description: Number of CPUs for the server. constraint: - valid_values: [ 1, 2, 4 ] required: yes status: supported ''' tpl_snippet2 = ''' inputs: cpus: type: integer description: Number of CPUs for the server. constraints: - valid_values: [ 1, 2, 4 ] required: yes status: supported ''' tpl_snippet3 = ''' inputs: some_list: type: list description: List of items entry_schema: type: string default: [] ''' tpl_snippet4 = ''' inputs: some_list: type: list description: List of items key_schema: type: string default: [] ''' inputs1 = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet1)['inputs']) name1, attrs1 = list(inputs1.items())[0] inputs2 = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet2)['inputs']) name2, attrs2 = list(inputs2.items())[0] try: Input(name1, attrs1) except Exception as err: self.assertEqual(_('Input "cpus" contains unknown field ' '"constraint". Refer to the definition to ' 'verify valid values.'), err.__str__()) input2 = Input(name2, attrs2) self.assertTrue(input2.required) toscaparser.utils.yamlparser.simple_parse(tpl_snippet3)['inputs'] input4 = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet4)['inputs']) self.assertEqual('string', input4['some_list']['key_schema']['type']) def _imports_content_test(self, tpl_snippet, path, custom_type_def): imports = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet)['imports']) loader = ImportsLoader(imports, path, custom_type_def) return loader.get_custom_defs() def test_imports_without_templates(self): tpl_snippet = ''' imports: # omitted here for brevity ''' path = utils.get_sample_test_path("data/tosca_elk.yaml") errormsg = _('"imports" keyname is defined without including ' 'templates.') err = self.assertRaises(exception.ValidationError, self._imports_content_test, tpl_snippet, path, "node_types") self.assertEqual(errormsg, err.__str__()) def test_imports_with_name_without_templates(self): tpl_snippet = ''' imports: - some_definitions: ''' path = utils.get_sample_test_path("data/tosca_elk.yaml") errormsg = _('A template file name is not provided with import ' 'definition "some_definitions".') err = self.assertRaises(exception.ValidationError, self._imports_content_test, tpl_snippet, path, None) self.assertEqual(errormsg, err.__str__()) @mock.patch.object(urllib.request, 'urlopen') def test_imports_without_import_name(self, mock_urlopen): tpl_snippet = ''' imports: - custom_types/paypalpizzastore_nodejs_app.yaml - https://example.com/custom_types/wordpress.yaml ''' mock_path = "https://example.com/custom_types/wordpress.yaml" mockclass = MockTestClass() mockclass.comp_urldict = {mock_path: utils.get_sample_test_path( "data/custom_types/wordpress.yaml")} mock_urlopen.side_effect = mockclass.mock_urlopen_method path = utils.get_sample_test_path("data/tosca_elk.yaml") custom_defs = self._imports_content_test(tpl_snippet, path, "node_types") self.assertTrue(custom_defs) @mock.patch.object(urllib.request, 'urlopen') def test_imports_wth_import_name(self, mock_urlopen): tpl_snippet = ''' imports: - some_definitions: custom_types/paypalpizzastore_nodejs_app.yaml - more_definitions: file: 'https://example.com/custom_types/wordpress.yaml' namespace_prefix: single_instance_wordpress ''' mock_path = "https://example.com/custom_types/wordpress.yaml" mockclass = MockTestClass() mockclass.comp_urldict = {mock_path: utils.get_sample_test_path( "data/custom_types/wordpress.yaml")} mock_urlopen.side_effect = mockclass.mock_urlopen_method path = utils.get_sample_test_path("data/tosca_elk.yaml") custom_defs = self._imports_content_test(tpl_snippet, path, "node_types") self.assertTrue(custom_defs.get("single_instance_wordpress.tosca." "nodes.WebApplication.WordPress")) def test_imports_wth_namespace_prefix(self): tpl_snippet = ''' imports: - more_definitions: file: custom_types/nested_rsyslog.yaml namespace_prefix: testprefix ''' path = utils.get_sample_test_path("data/tosca_elk.yaml") custom_defs = self._imports_content_test(tpl_snippet, path, "node_types") self.assertTrue(custom_defs.get("testprefix.Rsyslog")) def test_imports_with_no_main_template(self): tpl_snippet = ''' imports: - some_definitions: https://raw.githubusercontent.com/openstack/\ tosca-parser/master/toscaparser/tests/data/custom_types/wordpress.yaml - some_definitions: file: my_defns/my_typesdefs_n.yaml ''' errormsg = _('Input tosca template is not provided.') err = self.assertRaises(exception.ValidationError, self._imports_content_test, tpl_snippet, None, None) self.assertEqual(errormsg, err.__str__()) @mock.patch.object(urllib.request, 'urlopen') def test_imports_duplicate_name(self, mock_urlopen): tpl_snippet = ''' imports: - some_definitions: https://example.com/custom_types/wordpress.yaml - some_definitions: file: my_defns/my_typesdefs_n.yaml ''' mock_path = "https://example.com/custom_types/wordpress.yaml" mockclass = MockTestClass() mockclass.comp_urldict = {mock_path: utils.get_sample_test_path( "data/custom_types/wordpress.yaml")} mock_urlopen.side_effect = mockclass.mock_urlopen_method errormsg = _('Duplicate import name "some_definitions" was found.') path = utils.get_sample_test_path("data/tosca_elk.yaml") err = self.assertRaises(exception.ValidationError, self._imports_content_test, tpl_snippet, path, None) self.assertEqual(errormsg, err.__str__()) def test_imports_missing_req_field_in_def(self): tpl_snippet = ''' imports: - more_definitions: file1: my_defns/my_typesdefs_n.yaml repository: my_company_repo namespace_uri: http://mycompany.com/ns/tosca/2.0 namespace_prefix: mycompany ''' errormsg = _('Import of template "more_definitions" is missing ' 'required field "file".') path = utils.get_sample_test_path("data/tosca_elk.yaml") err = self.assertRaises(exception.MissingRequiredFieldError, self._imports_content_test, tpl_snippet, path, None) self.assertEqual(errormsg, err.__str__()) @mock.patch.object(urllib.request, 'urlopen') @mock.patch.object(ToscaTemplate, '_tpl_imports') def test_imports_file_with_uri(self, mock_tpl_imports, mock_urlopen): tpl_snippet = ''' imports: - more_definitions: file: https://example.com/custom_types/wordpress.yaml ''' path = ('https://example.com/tosca_single_instance_wordpress_' 'with_url_import.yaml') mock_path = "https://example.com/custom_types/wordpress.yaml" import_file_path = utils.get_sample_test_path( "data/custom_types/wordpress.yaml") mockclass = MockTestClass() mockclass.comp_urldict = {mock_path: import_file_path} mock_urlopen.side_effect = mockclass.mock_urlopen_method mock_tpl_imports.return_value = [import_file_path] custom_defs = self._imports_content_test(tpl_snippet, path, "node_types") self.assertTrue(custom_defs.get("tosca.nodes." "WebApplication.WordPress")) @mock.patch.object(urllib.request, 'urlopen') def test_imports_file_namespace_fields(self, mock_urlopen): tpl_snippet = ''' imports: - more_definitions: file: https://example.com/custom_types/wordpress.yaml namespace_prefix: mycompany namespace_uri: http://docs.oasis-open.org/tosca/ns/simple/yaml/1.0 ''' mock_path = "https://example.com/custom_types/wordpress.yaml" mockclass = MockTestClass() mockclass.comp_urldict = {mock_path: utils.get_sample_test_path( "data/custom_types/wordpress.yaml")} mock_urlopen.side_effect = mockclass.mock_urlopen_method path = utils.get_sample_test_path("data/tosca_elk.yaml") custom_defs = self._imports_content_test(tpl_snippet, path, "node_types") self.assertTrue(custom_defs.get("mycompany.tosca.nodes." "WebApplication.WordPress")) @mock.patch.object(urllib.request, 'urlopen') def test_imports_with_local_defs(self, mock_urlopen): """Compare custom types on local and remote.""" ctypes = { "remote": "https://example.com/custom_types/wordpress.yaml", "local": "../data/wordpress.yaml"} mock_path = "https://example.com/custom_types/wordpress.yaml" mockclass = MockTestClass() mockclass.comp_urldict = {mock_path: utils.get_sample_test_path( "data/custom_types/wordpress.yaml")} mock_urlopen.side_effect = mockclass.mock_urlopen_method tpl_snippet = ''' imports: - {} '''.format(ctypes["remote"]) local_defs = {ctypes["remote"]: ctypes["local"]} path = utils.get_sample_test_path("data/tosca_elk.yaml") imports = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet)['imports']) ld1 = ImportsLoader(imports, path, "node_types") ld2 = ImportsLoader(imports, path, "node_types", local_defs) self.assertEqual(ld1.get_custom_defs(), ld2.get_custom_defs()) def test_imports_file_with_suffix_yml(self): tpl_snippet = ''' imports: - custom_types/wordpress.yml ''' path = utils.get_sample_test_path("data/tosca_elk.yaml") custom_defs = self._imports_content_test(tpl_snippet, path, "node_types") self.assertTrue(custom_defs.get("tosca.nodes." "WebApplication.WordPress")) def test_import_error_file_uri(self): tpl_snippet = ''' imports: - more_definitions: file: mycompany.com/ns/tosca/2.0/toscaparser/tests/data\ /tosca_elk.yaml namespace_prefix: mycompany namespace_uri: http://docs.oasis-open.org/tosca/ns/simple/yaml/1.0 ''' path = utils.get_sample_test_path("data/tosca_elk.yaml") self.assertRaises(ImportError, self._imports_content_test, tpl_snippet, path, None) def test_import_single_line_error(self): tpl_snippet = ''' imports: - some_definitions: abc.com/tests/data/tosca_elk.yaml ''' errormsg = _('Import "abc.com/tests/data/tosca_elk.yaml" is not ' 'valid.') path = utils.get_sample_test_path("data/tosca_elk.yaml") err = self.assertRaises(ImportError, self._imports_content_test, tpl_snippet, path, None) self.assertEqual(errormsg, err.__str__()) def test_outputs(self): tpl_snippet = ''' outputs: server_address: description: IP address of server instance. values: { get_property: [server, private_address] } ''' outputs = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet)['outputs']) name, attrs = list(outputs.items())[0] output = Output(name, attrs) try: output.validate() except Exception as err: self.assertIsInstance(err, exception.MissingRequiredFieldError) self.assertEqual(_('Output "server_address" is missing required ' 'field "value".'), err.__str__()) tpl_snippet = ''' outputs: server_address: descriptions: IP address of server instance. value: { get_property: [server, private_address] } ''' outputs = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet)['outputs']) name, attrs = list(outputs.items())[0] output = Output(name, attrs) try: output.validate() except Exception as err: self.assertIsInstance(err, exception.UnknownFieldError) self.assertEqual(_('Output "server_address" contains unknown ' 'field "descriptions". Refer to the definition ' 'to verify valid values.'), err.__str__()) def _repo_content(self, path): repositories = path['repositories'] reposit = [] for name, val in repositories.items(): reposits = Repository(name, val) reposit.append(reposits) return reposit def test_repositories(self): tpl_snippet = ''' repositories: repo_code0: https://raw.githubusercontent.com/nandinivemula/intern repo_code1: description: My project's code Repository in github usercontent. url: https://github.com/nandinivemula/intern credential: user: nandini password: tcs@12345 repo_code2: description: My Project's code Repository in github. url: https://github.com/nandinivemula/intern credential: user: xyzw password: xyz@123 ''' tpl = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) repoobject = self._repo_content(tpl) actualrepo_names = [] for repo in repoobject: repos = repo.name actualrepo_names.append(repos) reposname = list(tpl.values()) reposnames = reposname[0] expected_reponames = list(reposnames.keys()) self.assertEqual(expected_reponames, actualrepo_names) def test_repositories_with_missing_required_field(self): tpl_snippet = ''' repositories: repo_code0: https://raw.githubusercontent.com/nandinivemula/intern repo_code1: description: My project's code Repository in github usercontent. credential: user: nandini password: tcs@12345 repo_code2: description: My Project's code Repository in github. url: https://github.com/nandinivemula/intern credential: user: xyzw password: xyz@123 ''' tpl = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) err = self.assertRaises(exception.MissingRequiredFieldError, self._repo_content, tpl) expectedmessage = _('Repository "repo_code1" is missing ' 'required field "url".') self.assertEqual(expectedmessage, err.__str__()) def test_repositories_with_unknown_field(self): tpl_snippet = ''' repositories: repo_code0: https://raw.githubusercontent.com/nandinivemula/intern repo_code1: description: My project's code Repository in github usercontent. url: https://github.com/nandinivemula/intern credential: user: nandini password: tcs@12345 repo_code2: descripton: My Project's code Repository in github. url: https://github.com/nandinivemula/intern credential: user: xyzw password: xyz@123 ''' tpl = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) err = self.assertRaises(exception.UnknownFieldError, self._repo_content, tpl) expectedmessage = _('repositories "repo_code2" contains unknown field' ' "descripton". Refer to the definition to verify' ' valid values.') self.assertEqual(expectedmessage, err.__str__()) def test_repositories_with_invalid_url(self): tpl_snippet = ''' repositories: repo_code0: https://raw.githubusercontent.com/nandinivemula/intern repo_code1: description: My project's code Repository in github usercontent. url: h credential: user: nandini password: tcs@12345 repo_code2: description: My Project's code Repository in github. url: https://github.com/nandinivemula/intern credential: user: xyzw password: xyz@123 ''' tpl = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) err = self.assertRaises(exception.URLException, self._repo_content, tpl) expectedmessage = _('repsositories "repo_code1" Invalid Url') self.assertEqual(expectedmessage, err.__str__()) def test_groups(self): tpl_snippet = ''' node_templates: server: type: tosca.nodes.Compute requirements: - log_endpoint: capability: log_endpoint mysql_dbms: type: tosca.nodes.DBMS properties: root_password: aaa port: 3376 requirements: - host: server groups: webserver_group: type: tosca.groups.Root members: [ server, mysql_dbms ] ''' tpl = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) TopologyTemplate(tpl, None) def test_groups_with_missing_required_field(self): tpl_snippet = ''' node_templates: server: type: tosca.nodes.Compute requirements: - log_endpoint: capability: log_endpoint mysql_dbms: type: tosca.nodes.DBMS properties: root_password: aaa port: 3376 requirements: - host: server groups: webserver_group: members: ['server', 'mysql_dbms'] ''' tpl = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) err = self.assertRaises(exception.MissingRequiredFieldError, TopologyTemplate, tpl, None) expectedmessage = _('Template "webserver_group" is missing ' 'required field "type".') self.assertEqual(expectedmessage, err.__str__()) def test_groups_with_unknown_target(self): tpl_snippet = ''' node_templates: server: type: tosca.nodes.Compute requirements: - log_endpoint: capability: log_endpoint mysql_dbms: type: tosca.nodes.DBMS properties: root_password: aaa port: 3376 requirements: - host: server groups: webserver_group: type: tosca.groups.Root members: [ serv, mysql_dbms ] ''' tpl = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) expectedmessage = _('"Target member "serv" is not found in ' 'node_templates"') err = self.assertRaises(exception.InvalidGroupTargetException, TopologyTemplate, tpl, None) self.assertEqual(expectedmessage, err.__str__()) def test_groups_with_repeated_targets(self): tpl_snippet = ''' node_templates: server: type: tosca.nodes.Compute requirements: - log_endpoint: capability: log_endpoint mysql_dbms: type: tosca.nodes.DBMS properties: root_password: aaa port: 3376 requirements: - host: server groups: webserver_group: type: tosca.groups.Root members: [ server, server, mysql_dbms ] ''' tpl = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) expectedmessage = _('"Member nodes ' '"[\'server\', \'server\', \'mysql_dbms\']" ' 'should be >= 1 and not repeated"') err = self.assertRaises(exception.InvalidGroupTargetException, TopologyTemplate, tpl, None) self.assertEqual(expectedmessage, err.__str__()) def test_groups_with_only_one_target(self): tpl_snippet = ''' node_templates: server: type: tosca.nodes.Compute requirements: - log_endpoint: capability: log_endpoint mysql_dbms: type: tosca.nodes.DBMS properties: root_password: aaa port: 3376 requirements: - host: server groups: webserver_group: type: tosca.groups.Root members: [] ''' tpl = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) expectedmessage = _('"Member nodes "[]" should be >= 1 ' 'and not repeated"') err = self.assertRaises(exception.InvalidGroupTargetException, TopologyTemplate, tpl, None) self.assertEqual(expectedmessage, err.__str__()) def test_groups_with_attributes(self): tpl_snippet = ''' node_templates: server: type: tosca.nodes.Compute requirements: - log_endpoint: capability: log_endpoint groups: webserver_group: type: tosca.groups.Root attributes: cpu_usage: description: 'Current CPU usage of the node' value: 75 members: [ server ] ''' tpl = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) groups = TopologyTemplate(tpl, None).groups self.assertEqual('Current CPU usage of the node', groups[0].entity_tpl['attributes'] ['cpu_usage']['description']) self.assertEqual(75, groups[0].entity_tpl['attributes'] ['cpu_usage']['value']) def _custom_types(self): custom_types = {} def_file = utils.get_sample_test_path( "data/custom_types/wordpress.yaml") custom_type = toscaparser.utils.yamlparser.load_yaml(def_file) node_types = custom_type['node_types'] for name in node_types: defintion = node_types[name] custom_types[name] = defintion return custom_types def _custom_types_policy(self): custom_types = {} def_file = utils.get_sample_test_path( "data/custom_types/custom_policy.yaml") custom_type = toscaparser.utils.yamlparser.load_yaml(def_file) policy_types = custom_type['policy_types'] for name in policy_types: defintion = policy_types[name] custom_types[name] = defintion return custom_types def _single_node_template_content_test(self, tpl_snippet): nodetemplates = (toscaparser.utils.yamlparser. simple_ordered_parse(tpl_snippet))['node_templates'] name = list(nodetemplates.keys())[0] nodetemplate = NodeTemplate(name, nodetemplates, self._custom_types()) nodetemplate.validate() nodetemplate.requirements nodetemplate.get_capabilities_objects() nodetemplate.get_properties_objects() nodetemplate.interfaces def test_node_templates(self): tpl_snippet = ''' node_templates: server: capabilities: host: properties: disk_size: 10 num_cpus: 4 mem_size: 4096 os: properties: architecture: x86_64 type: Linux distribution: Fedora version: 18.0 ''' expectedmessage = _('Template "server" is missing required field ' '"type".') err = self.assertRaises( exception.MissingRequiredFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_with_wrong_properties_keyname(self): """Node template keyname 'properties' given as 'propertiessss'.""" tpl_snippet = ''' node_templates: mysql_dbms: type: tosca.nodes.DBMS propertiessss: root_password: aaa port: 3376 ''' expectedmessage = _('Node template "mysql_dbms" contains unknown ' 'field "propertiessss". Refer to the definition ' 'to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_with_wrong_requirements_keyname(self): """Node template keyname 'requirements' given as 'requirement'.""" tpl_snippet = ''' node_templates: mysql_dbms: type: tosca.nodes.DBMS properties: root_password: aaa port: 3376 requirement: - host: server ''' expectedmessage = _('Node template "mysql_dbms" contains unknown ' 'field "requirement". Refer to the definition to ' 'verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_with_wrong_interfaces_keyname(self): """Node template keyname 'interfaces' given as 'interfac'.""" tpl_snippet = ''' node_templates: mysql_dbms: type: tosca.nodes.DBMS properties: root_password: aaa port: 3376 requirements: - host: server interfac: Standard: configure: mysql_database_configure.sh ''' expectedmessage = _('Node template "mysql_dbms" contains unknown ' 'field "interfac". Refer to the definition to ' 'verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_with_wrong_capabilities_keyname(self): """Node template keyname 'capabilities' given as 'capabilitiis'.""" tpl_snippet = ''' node_templates: mysql_database: type: tosca.nodes.Database properties: db_name: { get_input: db_name } db_user: { get_input: db_user } db_password: { get_input: db_pwd } capabilitiis: database_endpoint: properties: port: { get_input: db_port } ''' expectedmessage = _('Node template "mysql_database" contains unknown ' 'field "capabilitiis". Refer to the definition to ' 'verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_with_wrong_artifacts_keyname(self): """Node template keyname 'artifacts' given as 'artifactsss'.""" tpl_snippet = ''' node_templates: mysql_database: type: tosca.nodes.Database artifactsss: db_content: implementation: files/my_db_content.txt type: tosca.artifacts.File ''' expectedmessage = _('Node template "mysql_database" contains unknown ' 'field "artifactsss". Refer to the definition to ' 'verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_with_multiple_wrong_keynames(self): """Node templates given with multiple wrong keynames.""" tpl_snippet = ''' node_templates: mysql_dbms: type: tosca.nodes.DBMS propertieees: root_password: aaa port: 3376 requirements: - host: server interfacs: Standard: configure: mysql_database_configure.sh ''' expectedmessage = _('Node template "mysql_dbms" contains unknown ' 'field "propertieees". Refer to the definition to ' 'verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) tpl_snippet = ''' node_templates: mysql_database: type: tosca.nodes.Database properties: name: { get_input: db_name } user: { get_input: db_user } password: { get_input: db_pwd } capabilitiiiies: database_endpoint: properties: port: { get_input: db_port } requirementsss: - host: node: mysql_dbms interfac: Standard: configure: mysql_database_configure.sh ''' expectedmessage = _('Node template "mysql_database" contains unknown ' 'field "capabilitiiiies". Refer to the definition ' 'to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_type(self): tpl_snippet = ''' node_templates: mysql_database: type: tosca.nodes.Databases properties: db_name: { get_input: db_name } db_user: { get_input: db_user } db_password: { get_input: db_pwd } capabilities: database_endpoint: properties: port: { get_input: db_port } requirements: - host: mysql_dbms interfaces: Standard: configure: mysql_database_configure.sh ''' expectedmessage = _('Type "tosca.nodes.Databases" is not ' 'a valid type.') err = self.assertRaises( exception.InvalidTypeError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_requirements(self): tpl_snippet = ''' node_templates: webserver: type: tosca.nodes.WebServer requirements: host: server interfaces: Standard: create: webserver_install.sh start: d.sh ''' expectedmessage = _('"requirements" of template "webserver" must be ' 'of type "list".') err = self.assertRaises( exception.TypeMismatchError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) tpl_snippet = ''' node_templates: mysql_database: type: tosca.nodes.Database properties: db_name: { get_input: db_name } db_user: { get_input: db_user } db_password: { get_input: db_pwd } capabilities: database_endpoint: properties: port: { get_input: db_port } requirements: - host: mysql_dbms - database_endpoint: mysql_database interfaces: Standard: configure: mysql_database_configure.sh ''' expectedmessage = _('"requirements" of template "mysql_database" ' 'contains unknown field "database_endpoint". ' 'Refer to the definition to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_requirements_with_wrong_node_keyname(self): """Node template requirements keyname 'node' given as 'nodes'.""" tpl_snippet = ''' node_templates: mysql_database: type: tosca.nodes.Database requirements: - host: nodes: mysql_dbms ''' expectedmessage = _('"requirements" of template "mysql_database" ' 'contains unknown field "nodes". Refer to the ' 'definition to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_requirements_with_wrong_capability_keyname(self): """Incorrect node template requirements keyname Node template requirements keyname 'capability' given as 'capabilityy'. """ tpl_snippet = ''' node_templates: mysql_database: type: tosca.nodes.Database requirements: - host: node: mysql_dbms - log_endpoint: node: logstash capabilityy: log_endpoint relationship: type: tosca.relationships.ConnectsTo ''' expectedmessage = _('"requirements" of template "mysql_database" ' 'contains unknown field "capabilityy". Refer to ' 'the definition to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_requirements_with_wrong_relationship_keyname(self): """Incorrect node template requirements keyname Node template requirements keyname 'relationship' given as 'relationshipppp'. """ tpl_snippet = ''' node_templates: mysql_database: type: tosca.nodes.Database requirements: - host: node: mysql_dbms - log_endpoint: node: logstash capability: log_endpoint relationshipppp: type: tosca.relationships.ConnectsTo ''' expectedmessage = _('"requirements" of template "mysql_database" ' 'contains unknown field "relationshipppp". Refer ' 'to the definition to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_requirements_with_wrong_occurrences_keyname(self): """Incorrect node template requirements keyname Node template requirements keyname 'occurrences' given as 'occurences'. """ tpl_snippet = ''' node_templates: mysql_database: type: tosca.nodes.Database requirements: - host: node: mysql_dbms - log_endpoint: node: logstash capability: log_endpoint relationship: type: tosca.relationships.ConnectsTo occurences: [0, UNBOUNDED] ''' expectedmessage = _('"requirements" of template "mysql_database" ' 'contains unknown field "occurences". Refer to ' 'the definition to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_requirements_with_multiple_wrong_keynames(self): """Node templates given with multiple wrong requirements keynames.""" tpl_snippet = ''' node_templates: mysql_database: type: tosca.nodes.Database requirements: - host: node: mysql_dbms - log_endpoint: nod: logstash capabilit: log_endpoint relationshipppp: type: tosca.relationships.ConnectsTo ''' expectedmessage = _('"requirements" of template "mysql_database" ' 'contains unknown field "nod". Refer to the ' 'definition to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) tpl_snippet = ''' node_templates: mysql_database: type: tosca.nodes.Database requirements: - host: node: mysql_dbms - log_endpoint: node: logstash capabilit: log_endpoint relationshipppp: type: tosca.relationships.ConnectsTo ''' expectedmessage = _('"requirements" of template "mysql_database" ' 'contains unknown field "capabilit". Refer to the ' 'definition to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_requirements_invalid_occurrences(self): tpl_snippet = ''' node_templates: server: type: tosca.nodes.Compute requirements: - log_endpoint: capability: log_endpoint occurrences: [0, -1] ''' expectedmessage = _('Value of property "[0, -1]" is invalid.') err = self.assertRaises( exception.InvalidPropertyValueError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) tpl_snippet = ''' node_templates: server: type: tosca.nodes.Compute requirements: - log_endpoint: capability: log_endpoint occurrences: [a, w] ''' expectedmessage = _('"a" is not an integer.') err = self.assertRaises( ValueError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) tpl_snippet = ''' node_templates: server: type: tosca.nodes.Compute requirements: - log_endpoint: capability: log_endpoint occurrences: -1 ''' expectedmessage = _('"-1" is not a list.') err = self.assertRaises( ValueError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) tpl_snippet = ''' node_templates: server: type: tosca.nodes.Compute requirements: - log_endpoint: capability: log_endpoint occurrences: [5, 1] ''' expectedmessage = _('Value of property "[5, 1]" is invalid.') err = self.assertRaises( exception.InvalidPropertyValueError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) tpl_snippet = ''' node_templates: server: type: tosca.nodes.Compute requirements: - log_endpoint: capability: log_endpoint occurrences: [0, 0] ''' expectedmessage = _('Value of property "[0, 0]" is invalid.') err = self.assertRaises( exception.InvalidPropertyValueError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_requirements_valid_occurrences(self): tpl_snippet = ''' node_templates: server: type: tosca.nodes.Compute requirements: - log_endpoint: capability: log_endpoint occurrences: [2, 2] ''' self._single_node_template_content_test(tpl_snippet) def test_node_template_capabilities(self): tpl_snippet = ''' node_templates: mysql_database: type: tosca.nodes.Database properties: db_name: { get_input: db_name } db_user: { get_input: db_user } db_password: { get_input: db_pwd } capabilities: http_endpoint: properties: port: { get_input: db_port } requirements: - host: mysql_dbms interfaces: Standard: configure: mysql_database_configure.sh ''' expectedmessage = _('"capabilities" of template "mysql_database" ' 'contains unknown field "http_endpoint". Refer to ' 'the definition to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_properties(self): tpl_snippet = ''' node_templates: server: type: tosca.nodes.Compute properties: os_image: F18_x86_64 capabilities: host: properties: disk_size: 10 GB num_cpus: { get_input: cpus } mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Fedora version: 18.0 ''' expectedmessage = _('"properties" of template "server" contains ' 'unknown field "os_image". Refer to the ' 'definition to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_interfaces(self): tpl_snippet = ''' node_templates: wordpress: type: tosca.nodes.WebApplication.WordPress requirements: - host: webserver - database_endpoint: mysql_database interfaces: Standards: create: wordpress_install.sh configure: implementation: wordpress_configure.sh inputs: wp_db_name: { get_property: [ mysql_database, db_name ] } wp_db_user: { get_property: [ mysql_database, db_user ] } wp_db_password: { get_property: [ mysql_database, \ db_password ] } wp_db_port: { get_property: [ SELF, \ database_endpoint, port ] } ''' expectedmessage = _('"interfaces" of template "wordpress" contains ' 'unknown field "Standards". Refer to the ' 'definition to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) tpl_snippet = ''' node_templates: wordpress: type: tosca.nodes.WebApplication.WordPress requirements: - host: webserver - database_endpoint: mysql_database interfaces: Standard: create: wordpress_install.sh config: implementation: wordpress_configure.sh inputs: wp_db_name: { get_property: [ mysql_database, db_name ] } wp_db_user: { get_property: [ mysql_database, db_user ] } wp_db_password: { get_property: [ mysql_database, \ db_password ] } wp_db_port: { get_property: [ SELF, \ database_endpoint, port ] } ''' expectedmessage = _('"interfaces" of template "wordpress" contains ' 'unknown field "config". Refer to the definition ' 'to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) tpl_snippet = ''' node_templates: wordpress: type: tosca.nodes.WebApplication.WordPress requirements: - host: webserver - database_endpoint: mysql_database interfaces: Standard: create: wordpress_install.sh configure: implementation: wordpress_configure.sh input: wp_db_name: { get_property: [ mysql_database, db_name ] } wp_db_user: { get_property: [ mysql_database, db_user ] } wp_db_password: { get_property: [ mysql_database, \ db_password ] } wp_db_port: { get_ref_property: [ database_endpoint, \ database_endpoint, port ] } ''' expectedmessage = _('"interfaces" of template "wordpress" contains ' 'unknown field "input". Refer to the definition ' 'to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_relationship_template_properties(self): tpl_snippet = ''' relationship_templates: storage_attachto: type: AttachesTo properties: device: test_device ''' expectedmessage = _('"properties" of template "storage_attachto" is ' 'missing required field "[\'location\']".') rel_template = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet))['relationship_templates'] name = list(rel_template.keys())[0] rel_template = RelationshipTemplate(rel_template[name], name) err = self.assertRaises(exception.MissingRequiredFieldError, rel_template.validate) self.assertEqual(expectedmessage, str(err)) def test_relationship_template_properties_key_schema(self): tpl_path = utils.get_sample_test_path( "data/relationship/test_custom_relationship_key_schema.yaml") tosca = ToscaTemplate(tpl_path) p_key_schema_type = tosca.tpl['relationship_types'][ 'tosca.nodes.CustomRelationshipTest']['properties'][ 'property_test']['key_schema']['type'] self.assertEqual('string', p_key_schema_type) p_key_schema_type = tosca.relationship_templates[0].custom_def[ 'tosca.nodes.CustomRelationshipTest']['properties'][ 'property_test']['key_schema']['type'] self.assertEqual('string', p_key_schema_type) property_value = ( tosca.topology_template.relationship_templates[0].entity_tpl[ 'properties']['property_test']['test_key']) self.assertEqual('test_value', property_value) def test_tosca_version_1_3(self): tpl_path = utils.get_sample_test_path( "data/test_tosca_version_1_3.yaml") self.assertIsNotNone(ToscaTemplate(tpl_path)) def test_import_tosca_version_1_3(self): tpl_path = utils.get_sample_test_path( "data/test_import_tosca_version_1_3.yaml") self.assertIsNotNone(ToscaTemplate(tpl_path)) def test_invalid_template_version(self): tosca_tpl = utils.get_sample_test_path( "data/test_invalid_template_version.yaml") self.assertRaises(exception.ValidationError, ToscaTemplate, tosca_tpl) valid_versions = '", "'.join(ToscaTemplate.VALID_TEMPLATE_VERSIONS) exception.ExceptionCollector.assertExceptionMessage( exception.InvalidTemplateVersion, (_('The template version "tosca_xyz" is invalid. Valid versions ' 'are "%s".') % valid_versions)) def test_import_invalid_template_version(self): tosca_tpl = utils.get_sample_test_path( "data/test_import_invalid_template_version.yaml") self.assertRaises(exception.ValidationError, ToscaTemplate, tosca_tpl) valid_versions = '", "'.join(ToscaTemplate.VALID_TEMPLATE_VERSIONS) exception.ExceptionCollector.assertExceptionMessage( exception.InvalidTemplateVersion, (_('The template version "tosca_simple_yaml_XXX in ' '{\'invalid\': \'custom_types/invalid_template_version.yaml\'}"' ' is invalid. Valid versions are "%s".') % valid_versions)) def test_import_template_metadata(self): tosca_tpl = utils.get_sample_test_path("data/test_import_metadata.yml") ToscaTemplate(tosca_tpl) def test_node_template_capabilities_properties(self): # validating capability property values tpl_snippet = ''' node_templates: server: type: tosca.nodes.WebServer capabilities: data_endpoint: properties: initiator: test ''' expectedmessage = _('The value "test" of property "initiator" is ' 'not valid. Expected a value from "[source, ' 'target, peer]".') err = self.assertRaises( exception.ValidationError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) tpl_snippet = ''' node_templates: server: type: tosca.nodes.Compute capabilities: host: properties: disk_size: 10 GB num_cpus: { get_input: cpus } mem_size: 4096 MB os: properties: architecture: x86_64 type: Linux distribution: Fedora version: 18.0 scalable: properties: min_instances: 1 max_instances: 3 default_instances: 5 ''' expectedmessage = _('"properties" of template "server": ' '"default_instances" value is not between ' '"min_instances" and "max_instances".') err = self.assertRaises( exception.ValidationError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_objectstorage_without_required_property(self): tpl_snippet = ''' node_templates: server: type: tosca.nodes.ObjectStorage properties: maxsize: 1 GB ''' expectedmessage = _('"properties" of template "server" is missing ' 'required field "[\'name\']".') err = self.assertRaises( exception.MissingRequiredFieldError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_objectstorage_with_invalid_scalar_unit(self): tpl_snippet = ''' node_templates: server: type: tosca.nodes.ObjectStorage properties: name: test maxsize: -1 ''' expectedmessage = _('"-1" is not a valid scalar-unit.') err = self.assertRaises( ValueError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_node_template_objectstorage_with_invalid_scalar_type(self): tpl_snippet = ''' node_templates: server: type: tosca.nodes.ObjectStorage properties: name: test maxsize: 1 XB ''' expectedmessage = _('"1 XB" is not a valid scalar-unit.') err = self.assertRaises( ValueError, lambda: self._single_node_template_content_test(tpl_snippet)) self.assertEqual(expectedmessage, err.__str__()) def test_special_keywords(self): """Test special keywords Test that special keywords, e.g. metadata, which are not part of specification do not throw any validation error. """ tpl_snippet_metadata_map = ''' node_templates: server: type: tosca.nodes.Compute metadata: name: server A role: master ''' self._single_node_template_content_test(tpl_snippet_metadata_map) tpl_snippet_metadata_inline = ''' node_templates: server: type: tosca.nodes.Compute metadata: none ''' self._single_node_template_content_test(tpl_snippet_metadata_inline) def test_policy_valid_keynames(self): tpl_snippet = ''' policies: - servers_placement: type: tosca.policies.Placement description: Apply placement policy to servers metadata: { user1: 1001, user2: 1002 } targets: [ serv1, serv2 ] ''' policies = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet))['policies'][0] name = list(policies.keys())[0] Policy(name, policies[name], None, None) def test_policy_invalid_keyname(self): tpl_snippet = ''' policies: - servers_placement: type: tosca.policies.Placement testkey: testvalue ''' policies = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet))['policies'][0] name = list(policies.keys())[0] expectedmessage = _('Policy "servers_placement" contains ' 'unknown field "testkey". Refer to the ' 'definition to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: Policy(name, policies[name], None, None)) self.assertEqual(expectedmessage, err.__str__()) def test_policy_trigger_valid_keyname_senlin_resources(self): tpl_snippet = ''' triggers: - resize_compute: description: trigger event_type: tosca.events.resource.utilization schedule: start_time: "2015-05-07T07:00:00Z" end_time: "2015-06-07T07:00:00Z" target_filter: node: master-container requirement: host capability: Container condition: constraint: { greater_than: 50 } granularity: 60 evaluations: 1 aggregation_method : mean action: resize: # Operation name inputs: strategy: LEAST_USED implementation: Senlin.webhook() ''' triggers = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet))['triggers'][0] name = list(triggers.keys())[0] Triggers(name, triggers[name]) # Since the keyname 'event_type' has been changed in TOSCA1.3, # test whether the new keyname 'event' can be used. def test_policy_trigger_keyname_event(self): tpl_snippet = ''' triggers: - resize_compute: description: trigger event: tosca.events.resource.utilization schedule: start_time: "2015-05-07T07:00:00Z" end_time: "2015-06-07T07:00:00Z" target_filter: node: master-container requirement: host capability: Container condition: constraint: { greater_than: 50 } granularity: 60 evaluations: 1 aggregation_method : mean action: resize: # Operation name inputs: strategy: LEAST_USED implementation: Senlin.webhook() ''' triggers = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet))['triggers'][0] name = list(triggers.keys())[0] trigger = Triggers(name, triggers[name]) self.assertEqual('tosca.events.resource.utilization', trigger.get_event()) def test_policy_trigger_valid_keyname_heat_resources(self): tpl_snippet = ''' triggers: - high_cpu_usage: description: trigger metric: cpu_util condition: constraint: utilization greater_than 60% threshold: 60 granularity: 600 evaluations: 1 aggregation_method: mean resource_type: instance comparison_operator: gt metadata: SG1 action: [SP1] ''' triggers = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet))['triggers'][0] name = list(triggers.keys())[0] Triggers(name, triggers[name]) def test_policy_trigger_invalid_keyname_senlin_resources(self): tpl_snippet = ''' triggers: - resize_compute: description: trigger event_type: tosca.events.resource.utilization schedule: start_time: "2015-05-07T07:00:00Z" end_time: "2015-06-07T07:00:00Z" target_filter1: node: master-container requirement: host capability: Container condition: constraint: utilization greater_than 50% granularity1: 60 evaluations: 1 aggregation_method: mean resource_type: instance action: resize: # Operation name inputs: strategy: LEAST_USED implementation: Senlin.webhook() ''' triggers = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet))['triggers'][0] name = list(triggers.keys())[0] expectedmessage = _( 'Triggers "resize_compute" contains unknown field ' '"target_filter1". Refer to the definition ' 'to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: Triggers(name, triggers[name])) self.assertEqual(expectedmessage, err.__str__()) def test_policy_trigger_invalid_keyname_heat_resources(self): tpl_snippet = ''' triggers: - high_cpu_usage: description: trigger metric: cpu_util condition: constraint: utilization greater_than 60% threshold: 60 granularity: 600 evaluations: 1 aggregation_method: mean resource_type: instance comparison_operator: gt metadata1: SG1 action: [SP1] ''' triggers = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet))['triggers'][0] name = list(triggers.keys())[0] expectedmessage = _( 'Triggers "high_cpu_usage" contains unknown field ' '"metadata1". Refer to the definition ' 'to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: Triggers(name, triggers[name])) self.assertEqual(expectedmessage, err.__str__()) def test_policy_missing_required_keyname(self): tpl_snippet = ''' policies: - servers_placement: description: test description ''' policies = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet))['policies'][0] name = list(policies.keys())[0] expectedmessage = _('Template "servers_placement" is missing ' 'required field "type".') err = self.assertRaises( exception.MissingRequiredFieldError, lambda: Policy(name, policies[name], None, None)) self.assertEqual(expectedmessage, err.__str__()) def test_policy_without_required_property(self): tpl_snippet = ''' policies: - some_policy: type: tosca.policies.somePolicy properties: value: 100 ''' policies = (toscaparser.utils.yamlparser. simple_parse(tpl_snippet))['policies'][0] name = list(policies.keys())[0] policyObj = Policy(name, policies[name], None, None, self._custom_types_policy()) expectedmessage = _('"properties" of template "some_policy" is ' 'missing required field "[\'name\']".') err = self.assertRaises( exception.MissingRequiredFieldError, policyObj.validate) self.assertEqual(expectedmessage, err.__str__()) def test_credential_datatype(self): tosca_tpl = utils.get_sample_test_path( "data/test_credential_datatype.yaml") self.assertIsNotNone(ToscaTemplate(tosca_tpl)) def test_invalid_default_value(self): tpl_path = utils.get_sample_test_path( "data/test_invalid_input_defaults.yaml") self.assertRaises(exception.ValidationError, ToscaTemplate, tpl_path) exception.ExceptionCollector.assertExceptionMessage( ValueError, _('"two" is not an integer.')) def test_invalid_capability(self): tpl_snippet = ''' node_templates: server: type: tosca.nodes.Compute capabilities: oss: properties: architecture: x86_64 ''' tpl = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) err = self.assertRaises(exception.UnknownFieldError, TopologyTemplate, tpl, None) expectedmessage = _('"capabilities" of template "server" contains ' 'unknown field "oss". Refer to the definition ' 'to verify valid values.') self.assertEqual(expectedmessage, err.__str__()) def test_qualified_name(self): tpl_snippet_full_name = ''' node_templates: supported_type: type: tosca.nodes.Compute ''' tpl = ( toscaparser.utils.yamlparser.simple_parse( tpl_snippet_full_name)) TopologyTemplate(tpl, None) tpl_snippet_short_name = ''' node_templates: supported_type: type: Compute ''' tpl = ( toscaparser.utils.yamlparser.simple_parse( tpl_snippet_short_name)) TopologyTemplate(tpl, None) tpl_snippet_qualified_name = ''' node_templates: supported_type: type: tosca:Compute ''' tpl = ( toscaparser.utils.yamlparser.simple_parse( tpl_snippet_qualified_name)) TopologyTemplate(tpl, None) def test_requirements_as_list(self): """Node template with requirements provided with or without list Node template requirements are required to be provided as list. """ expectedmessage = _('"requirements" of template "my_webserver"' ' must be of type "list".') # requirements provided as dictionary tpl_snippet1 = ''' node_templates: my_webserver: type: tosca.nodes.WebServer requirements: host: server server: type: tosca.nodes.Compute ''' err1 = self.assertRaises( exception.TypeMismatchError, lambda: self._single_node_template_content_test(tpl_snippet1)) self.assertEqual(expectedmessage, err1.__str__()) # requirements provided as string tpl_snippet2 = ''' node_templates: my_webserver: type: tosca.nodes.WebServer requirements: server server: type: tosca.nodes.Compute ''' err2 = self.assertRaises( exception.TypeMismatchError, lambda: self._single_node_template_content_test(tpl_snippet2)) self.assertEqual(expectedmessage, err2.__str__()) # requirements provided as list tpl_snippet3 = ''' node_templates: my_webserver: type: tosca.nodes.WebServer requirements: - host: server server: type: tosca.nodes.Compute ''' self.assertIsNone( self._single_node_template_content_test(tpl_snippet3)) def test_properties_override_with_flavor_and_image(self): tpl_path = utils.get_sample_test_path( "data/test_normative_type_properties_override.yaml") self.assertIsNotNone(ToscaTemplate(tpl_path)) def test_long_rel(self): tpl_path = utils.get_sample_test_path("data/test_long_rel.yaml") self.assertIsNotNone(ToscaTemplate(tpl_path)) def test_policy_reservation_valid_keyname_heat_resources(self): tpl_snippet = ''' reservation: start_actions: [SP_RSV] before_end_actions: [SP_RSV] end_actions: [noop] properties: lease_id: '58d2239c-f181-4915-bdcb-040f7ef911a7' ''' reservation = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) name = list(reservation.keys())[0] Reservation(reservation[name]) def test_policy_reservation_invalid_keyname_heat_resources(self): tpl_snippet = ''' reservation: start_actions: [SP_RSV] before_actions: [SP_RSV] end_actions: [noop] properties: lease_id: '58d2239c-f181-4915-bdcb-040f7ef911a7' ''' reservation = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) name = list(reservation.keys())[0] expectedmessage = _( 'Reservation contains unknown field ' '"before_actions". Refer to the definition ' 'to verify valid values.') err = self.assertRaises( exception.UnknownFieldError, lambda: Reservation(reservation[name])) self.assertEqual(expectedmessage, err.__str__()) def test_policy_reservation_missing_key_heat_resources(self): tpl_snippet = ''' reservation: start_actions: [SP_RSV] end_actions: [noop] properties: lease_id: '58d2239c-f181-4915-bdcb-040f7ef911a7' ''' reservation = (toscaparser.utils.yamlparser.simple_parse(tpl_snippet)) name = list(reservation.keys())[0] expectedmessage = _('Reservation is missing ' 'required field "before_end_actions".') err = self.assertRaises( exception.MissingRequiredFieldError, lambda: Reservation(reservation[name])) self.assertEqual(expectedmessage, err.__str__()) def test_scalar_unit_without_unit(self): tpl_path = utils.get_sample_test_path( "data/test_scalar_unit_without_unit.yaml") self.assertRaises(exception.ValidationError, lambda: ToscaTemplate(tpl_path)) def test_template_without_requirement(self): tpl_path = utils.get_sample_test_path( "data/test_template_without_requirement.yaml") err = self.assertRaises(exception.ValidationError, lambda: ToscaTemplate(tpl_path)) expectedmessage = _('Relationship "host" in template "webserver" has ' 'a wrong number of occurrences') self.assertIn(expectedmessage, err.message) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8173091 tosca_parser-2.15.0/toscaparser/tests/test_utils.py0000664000175000017500000000410515250006202021337 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.tests.base import TestCase import toscaparser.utils.urlutils import toscaparser.utils.yamlparser YAML_LOADER = toscaparser.utils.yamlparser.load_yaml class UrlUtilsTest(TestCase): url_utils = toscaparser.utils.urlutils.UrlUtils def test_urlutils_validate_url(self): self.assertTrue(self.url_utils.validate_url("http://www.github.com/")) self.assertTrue( self.url_utils.validate_url("https://github.com:81/a/2/a.b")) self.assertTrue(self.url_utils.validate_url("ftp://github.com")) self.assertFalse(self.url_utils.validate_url("github.com")) self.assertFalse(self.url_utils.validate_url("123")) self.assertFalse(self.url_utils.validate_url("a/b/c")) self.assertTrue(self.url_utils.validate_url("file:///dir/file.ext")) def test_urlutils_join_url(self): self.assertEqual( self.url_utils.join_url("http://github.com/proj1", "proj2"), "http://github.com/proj2") self.assertEqual( self.url_utils.join_url("http://github.com/proj1/scripts/a.js", "b.js"), "http://github.com/proj1/scripts/b.js") self.assertEqual( self.url_utils.join_url("http://github.com/proj1/scripts", "b.js"), "http://github.com/proj1/b.js") self.assertEqual( self.url_utils.join_url("http://github.com/proj1/scripts", "scripts/b.js"), "http://github.com/proj1/scripts/b.js") ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8183093 tosca_parser-2.15.0/toscaparser/tests/test_validate_tosca_version.py0000664000175000017500000001241115250006202024725 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from toscaparser.common.exception import ( InvalidTOSCAVersionPropertyException) from toscaparser.tests.base import TestCase from toscaparser.utils.gettextutils import _ from toscaparser.utils.validateutils import TOSCAVersionProperty class TOSCAVersionPropertyTest(TestCase): def test_tosca_version_property(self): version = '18.0.3.beta-1' expected_output = '18.0.3.beta-1' output = TOSCAVersionProperty(version).get_version() self.assertEqual(output, expected_output) version = 18 expected_output = '18.0' output = TOSCAVersionProperty(version).get_version() self.assertEqual(output, expected_output) version = 18.0 expected_output = '18.0' output = TOSCAVersionProperty(version).get_version() self.assertEqual(output, expected_output) version = '18.0.3' expected_output = '18.0.3' output = TOSCAVersionProperty(version).get_version() self.assertEqual(output, expected_output) version = 0 expected_output = None output = TOSCAVersionProperty(version).get_version() self.assertEqual(output, expected_output) version = 00 expected_output = None output = TOSCAVersionProperty(version).get_version() self.assertEqual(output, expected_output) version = 0.0 expected_output = None output = TOSCAVersionProperty(version).get_version() self.assertEqual(output, expected_output) version = 00.00 expected_output = None output = TOSCAVersionProperty(version).get_version() self.assertEqual(output, expected_output) version = '0.0.0' expected_output = None output = TOSCAVersionProperty(version).get_version() self.assertEqual(output, expected_output) def test_tosca_version_property_invalid_major_version(self): version = 'x' exp_msg = _('Value of TOSCA version property "x" is invalid.') err = self.assertRaises(InvalidTOSCAVersionPropertyException, TOSCAVersionProperty, version) self.assertEqual(exp_msg, err.__str__()) def test_tosca_version_property_invalid_minor_version(self): version = '18.x' exp_msg = _('Value of TOSCA version property "18.x" is invalid.') err = self.assertRaises(InvalidTOSCAVersionPropertyException, TOSCAVersionProperty, version) self.assertEqual(exp_msg, err.__str__()) version = '18.x.y' exp_msg = _('Value of TOSCA version property "18.x.y" is invalid.') err = self.assertRaises(InvalidTOSCAVersionPropertyException, TOSCAVersionProperty, version) self.assertEqual(exp_msg, err.__str__()) version = '18-2' exp_msg = _('Value of TOSCA version property "18-2" is invalid.') err = self.assertRaises(InvalidTOSCAVersionPropertyException, TOSCAVersionProperty, version) self.assertEqual(exp_msg, err.__str__()) def test_tosca_version_property_invalid_fix_version(self): version = '18.0.a' exp_msg = _('Value of TOSCA version property "18.0.a" is invalid.') err = self.assertRaises(InvalidTOSCAVersionPropertyException, TOSCAVersionProperty, version) self.assertEqual(exp_msg, err.__str__()) def test_tosca_version_property_invalid_qualifier(self): version = '18.0.1-xyz' exp_msg = _('Value of TOSCA version property "18.0.1-xyz" is invalid.') err = self.assertRaises(InvalidTOSCAVersionPropertyException, TOSCAVersionProperty, version) self.assertEqual(exp_msg, err.__str__()) version = '0.0.0.abc' exp_msg = _('Value of TOSCA version property "0.0.0.abc" is invalid.') err = self.assertRaises(InvalidTOSCAVersionPropertyException, TOSCAVersionProperty, version) self.assertEqual(exp_msg, err.__str__()) def test_tosca_version_property_invalid_build_version(self): version = '18.0.1.abc-x' exp_msg = _('Value of TOSCA version property ' '"18.0.1.abc-x" is invalid.') err = self.assertRaises(InvalidTOSCAVersionPropertyException, TOSCAVersionProperty, version) self.assertEqual(exp_msg, err.__str__()) version = '0.0.0.abc-x' exp_msg = _('Value of TOSCA version property "0.0.0.abc-x" is ' 'invalid.') err = self.assertRaises(InvalidTOSCAVersionPropertyException, TOSCAVersionProperty, version) self.assertEqual(exp_msg, err.__str__()) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8183093 tosca_parser-2.15.0/toscaparser/tests/utils.py0000664000175000017500000000172715250006202020307 0ustar00zuulzuul# Copyright (C) 2024 Fujitsu # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os def get_sample_dir(): return os.path.abspath(os.path.join(os.path.dirname(__file__), '../../samples')) def get_sample_test_dir(): # {tosca-parser}/samples/tests return os.path.join(get_sample_dir(), 'tests') def get_sample_test_path(*p): return os.path.join(get_sample_test_dir(), *p) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8183093 tosca_parser-2.15.0/toscaparser/topology_template.py0000664000175000017500000003615115250006202021553 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging from toscaparser.common import exception from toscaparser.dataentity import DataEntity from toscaparser import functions from toscaparser.groups import Group from toscaparser.nodetemplate import NodeTemplate from toscaparser.parameters import Input from toscaparser.parameters import Output from toscaparser.policy import Policy from toscaparser.relationship_template import RelationshipTemplate from toscaparser.substitution_mappings import SubstitutionMappings from toscaparser.tpl_relationship_graph import ToscaGraph from toscaparser.utils.gettextutils import _ # Topology template key names SECTIONS = (DESCRIPTION, INPUTS, NODE_TEMPLATES, RELATIONSHIP_TEMPLATES, OUTPUTS, GROUPS, SUBSTITUION_MAPPINGS, POLICIES) = \ ('description', 'inputs', 'node_templates', 'relationship_templates', 'outputs', 'groups', 'substitution_mappings', 'policies') log = logging.getLogger("tosca.model") class TopologyTemplate(object): '''Load the template data.''' def __init__(self, template, custom_defs, rel_types=None, parsed_params=None, sub_mapped_node_template=None): self.tpl = template self.sub_mapped_node_template = sub_mapped_node_template if self.tpl: self.custom_defs = custom_defs self.rel_types = rel_types self.parsed_params = parsed_params self._validate_field() self.description = self._tpl_description() self.inputs = self._inputs() self.relationship_templates = self._relationship_templates() self.nodetemplates = self._nodetemplates() self.outputs = self._outputs() if hasattr(self, 'nodetemplates'): self.graph = ToscaGraph(self.nodetemplates) self.groups = self._groups() self.policies = self._policies() self._process_intrinsic_functions() self.substitution_mappings = self._substitution_mappings() def _inputs(self): inputs = [] for name, attrs in self._tpl_inputs().items(): input = Input(name, attrs) if self.parsed_params and name in self.parsed_params: input.validate(self.parsed_params[name]) else: default = input.default if default: input.validate(default) if (self.parsed_params and input.name not in self.parsed_params or self.parsed_params is None) and input.required \ and input.default is None: log.warning('The required parameter %s ' 'is not provided' % input.name) inputs.append(input) return inputs def _nodetemplates(self): nodetemplates = [] tpls = self._tpl_nodetemplates() if tpls: for name in tpls: tpl = NodeTemplate(name, tpls, self.custom_defs, self.relationship_templates, self.rel_types) if (tpl.type_definition and (tpl.type in tpl.type_definition.TOSCA_DEF or (tpl.type not in tpl.type_definition.TOSCA_DEF and bool(tpl.custom_def)))): tpl.validate(self) nodetemplates.append(tpl) return nodetemplates def _relationship_templates(self): rel_templates = [] tpls = self._tpl_relationship_templates() for name in tpls: tpl = RelationshipTemplate(tpls[name], name, self.custom_defs) rel_templates.append(tpl) return rel_templates def _outputs(self): outputs = [] for name, attrs in self._tpl_outputs().items(): output = Output(name, attrs) output.validate() outputs.append(output) return outputs def _substitution_mappings(self): tpl_substitution_mapping = self._tpl_substitution_mappings() # if tpl_substitution_mapping and self.sub_mapped_node_template: if tpl_substitution_mapping: return SubstitutionMappings(tpl_substitution_mapping, self.nodetemplates, self.inputs, self.outputs, self.sub_mapped_node_template, self.custom_defs) def _policies(self): policies = [] for policy in self._tpl_policies(): for policy_name, policy_tpl in policy.items(): target_list = policy_tpl.get('targets') target_objects = [] targets_type = "groups" if target_list and len(target_list) >= 1: target_objects = self._get_policy_groups(target_list) if not target_objects: targets_type = "node_templates" target_objects = self._get_group_members(target_list) policyObj = Policy(policy_name, policy_tpl, target_objects, targets_type, self.custom_defs) # If the policyObj.type is defined in TOSCA_definition_1_0.yaml # or is defined as a custom definition, validate the properties # before adding it to the policies list. if (policyObj.type_definition and (policyObj.type in policyObj.type_definition.TOSCA_DEF or (policyObj.type not in policyObj.type_definition.TOSCA_DEF and bool(policyObj.custom_def)))): policyObj.validate() policies.append(policyObj) return policies def _groups(self): groups = [] member_nodes = None for group_name, group_tpl in self._tpl_groups().items(): member_names = group_tpl.get('members') if member_names is not None: DataEntity.validate_datatype('list', member_names) if len(member_names) < 1 or \ len(member_names) != len(set(member_names)): exception.ExceptionCollector.appendException( exception.InvalidGroupTargetException( message=_('Member nodes "%s" should be >= 1 ' 'and not repeated') % member_names)) else: member_nodes = self._get_group_members(member_names) group = Group(group_name, group_tpl, member_nodes, self.custom_defs) groups.append(group) return groups def _get_group_members(self, member_names): member_nodes = [] self._validate_group_members(member_names) for member in member_names: for node in self.nodetemplates: if node.name == member: member_nodes.append(node) return member_nodes def _get_policy_groups(self, member_names): member_groups = [] for member in member_names: for group in self.groups: if group.name == member: member_groups.append(group) return member_groups def _validate_group_members(self, members): node_names = [] for node in self.nodetemplates: node_names.append(node.name) for member in members: if member not in node_names: exception.ExceptionCollector.appendException( exception.InvalidGroupTargetException( message=_('Target member "%s" is not found in ' 'node_templates') % member)) # topology template can act like node template # it is exposed by substitution_mappings. def nodetype(self): return self.substitution_mappings.node_type \ if self.substitution_mappings else None def capabilities(self): return self.substitution_mappings.capabilities \ if self.substitution_mappings else None def requirements(self): return self.substitution_mappings.requirements \ if self.substitution_mappings else None def _tpl_description(self): description = self.tpl.get(DESCRIPTION) if description: return description.rstrip() def _tpl_inputs(self): inputs = self.tpl.get(INPUTS) or {} if not isinstance(inputs, dict): exception.ExceptionCollector.appendException( exception.TypeMismatchError(what=INPUTS, type="dict")) return inputs def _tpl_nodetemplates(self): nodetemplates = self.tpl.get(NODE_TEMPLATES) if nodetemplates and not isinstance(nodetemplates, dict): exception.ExceptionCollector.appendException( exception.TypeMismatchError(what=NODE_TEMPLATES, type="dict")) return nodetemplates def _tpl_relationship_templates(self): relationship_templates = self.tpl.get(RELATIONSHIP_TEMPLATES) or {} if not isinstance(relationship_templates, dict): exception.ExceptionCollector.appendException( exception.TypeMismatchError(what=RELATIONSHIP_TEMPLATES, type="dict")) return relationship_templates def _tpl_outputs(self): outputs = self.tpl.get(OUTPUTS) or {} if not isinstance(outputs, dict): exception.ExceptionCollector.appendException( exception.TypeMismatchError(what=OUTPUTS, type="dict")) return outputs def _tpl_substitution_mappings(self): substitution_mappings = self.tpl.get(SUBSTITUION_MAPPINGS) or {} if not isinstance(substitution_mappings, dict): exception.ExceptionCollector.appendException( exception.TypeMismatchError(what=SUBSTITUION_MAPPINGS, type="dict")) return substitution_mappings def _tpl_groups(self): groups = self.tpl.get(GROUPS) or {} if not isinstance(groups, dict): exception.ExceptionCollector.appendException( exception.TypeMismatchError(what=GROUPS, type="dict")) return groups def _tpl_policies(self): policies = self.tpl.get(POLICIES) or [] if not isinstance(policies, list): exception.ExceptionCollector.appendException( exception.TypeMismatchError(what=POLICIES, type="list")) return policies def _validate_field(self): for name in self.tpl: if name not in SECTIONS: exception.ExceptionCollector.appendException( exception.UnknownFieldError(what='Template', field=name)) def _process_intrinsic_functions(self): """Process intrinsic functions Current implementation processes functions within node template properties, requirements, interfaces inputs and template outputs. """ if hasattr(self, 'nodetemplates'): for node_template in self.nodetemplates: for prop in node_template.get_properties_objects(): prop.value = functions.get_function(self, node_template, prop.value) for interface in node_template.interfaces: if interface.inputs: for name, value in interface.inputs.items(): interface.inputs[name] = functions.get_function( self, node_template, value) if node_template.requirements and \ isinstance(node_template.requirements, list): for req in node_template.requirements: rel = req for req_name, req_item in req.items(): if isinstance(req_item, dict): rel = req_item.get('relationship') break if rel and 'properties' in rel: for key, value in rel['properties'].items(): rel['properties'][key] = \ functions.get_function(self, req, value) if node_template.get_capabilities_objects(): for cap in node_template.get_capabilities_objects(): if cap.get_properties_objects(): for prop in cap.get_properties_objects(): propvalue = functions.get_function( self, node_template, prop.value) if isinstance(propvalue, functions.GetInput): propvalue = propvalue.result() for p, v in cap._properties.items(): if p == prop.name: cap._properties[p] = propvalue for rel, node in node_template.relationships.items(): rel_tpls = node.relationship_tpl if rel_tpls: for rel_tpl in rel_tpls: for interface in rel_tpl.interfaces: if interface.inputs: for name, value in \ interface.inputs.items(): interface.inputs[name] = \ functions.get_function(self, rel_tpl, value) for output in self.outputs: func = functions.get_function(self, self.outputs, output.value) if isinstance(func, functions.GetAttribute): output.attrs[output.VALUE] = func @classmethod def get_sub_mapping_node_type(cls, topology_tpl): if topology_tpl and isinstance(topology_tpl, dict): submap_tpl = topology_tpl.get(SUBSTITUION_MAPPINGS) return SubstitutionMappings.get_node_type(submap_tpl) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8183093 tosca_parser-2.15.0/toscaparser/tosca_template.py0000664000175000017500000003634715250006202021017 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging import os from copy import deepcopy from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import InvalidTemplateVersion from toscaparser.common.exception import MissingRequiredFieldError from toscaparser.common.exception import UnknownFieldError from toscaparser.common.exception import ValidationError from toscaparser.elements.entity_type import update_definitions from toscaparser.extensions.exttools import ExtTools import toscaparser.imports from toscaparser.prereq.csar import CSAR from toscaparser.repositories import Repository from toscaparser.topology_template import TopologyTemplate from toscaparser.tpl_relationship_graph import ToscaGraph from toscaparser.utils.gettextutils import _ import toscaparser.utils.yamlparser # TOSCA template key names SECTIONS = (DEFINITION_VERSION, DEFAULT_NAMESPACE, TEMPLATE_NAME, TOPOLOGY_TEMPLATE, TEMPLATE_AUTHOR, TEMPLATE_VERSION, DESCRIPTION, IMPORTS, DSL_DEFINITIONS, NODE_TYPES, RELATIONSHIP_TYPES, RELATIONSHIP_TEMPLATES, CAPABILITY_TYPES, ARTIFACT_TYPES, DATA_TYPES, INTERFACE_TYPES, POLICY_TYPES, GROUP_TYPES, REPOSITORIES) = \ ('tosca_definitions_version', 'tosca_default_namespace', 'template_name', 'topology_template', 'template_author', 'template_version', 'description', 'imports', 'dsl_definitions', 'node_types', 'relationship_types', 'relationship_templates', 'capability_types', 'artifact_types', 'data_types', 'interface_types', 'policy_types', 'group_types', 'repositories') # Sections that are specific to individual template definitions SPECIAL_SECTIONS = (METADATA) = ('metadata') log = logging.getLogger("tosca.model") YAML_LOADER = toscaparser.utils.yamlparser.load_yaml class ToscaTemplate(object): exttools = ExtTools() MAIN_TEMPLATE_VERSIONS = ['tosca_simple_yaml_1_0', 'tosca_simple_yaml_1_2', 'tosca_simple_yaml_1_3'] VALID_TEMPLATE_VERSIONS = MAIN_TEMPLATE_VERSIONS + exttools.get_versions() ADDITIONAL_SECTIONS = {'tosca_simple_yaml_1_0': SPECIAL_SECTIONS, 'tosca_simple_yaml_1_2': SPECIAL_SECTIONS, 'tosca_simple_yaml_1_3': SPECIAL_SECTIONS} ADDITIONAL_SECTIONS.update(exttools.get_sections()) '''Load the template data.''' def __init__(self, path=None, parsed_params=None, a_file=True, yaml_dict_tpl=None, local_defs=None): ExceptionCollector.start() self.a_file = a_file self.input_path = None self.path = None self.tpl = None self.nested_tosca_tpls_with_topology = {} self.nested_tosca_templates_with_topology = [] self.local_defs = local_defs if path: self.input_path = path self.path = self._get_path(path) if self.path: self.tpl = YAML_LOADER(self.path, self.a_file) if yaml_dict_tpl: msg = (_('Both path and yaml_dict_tpl arguments were ' 'provided. Using path and ignoring yaml_dict_tpl.')) log.info(msg) print(msg) else: if yaml_dict_tpl: self.tpl = yaml_dict_tpl else: ExceptionCollector.appendException( ValueError(_('No path or yaml_dict_tpl was provided. ' 'There is nothing to parse.'))) if self.tpl: self.parsed_params = parsed_params self._validate_field() self.version = self._tpl_version() self.relationship_types = self._tpl_relationship_types() self.description = self._tpl_description() self.topology_template = self._topology_template() self.repositories = self._tpl_repositories() if self.topology_template.tpl: self.inputs = self._inputs() self.relationship_templates = self._relationship_templates() self.nodetemplates = self._nodetemplates() self.outputs = self._outputs() self.policies = self._policies() self._handle_nested_tosca_templates_with_topology() self.graph = ToscaGraph(self.nodetemplates) self._validate_relationship_occurences() ExceptionCollector.stop() self.verify_template() def _validate_relationship_occurences(self): for tpl in self.nodetemplates: # Check if the requirements has a correct number of occurrences tpl._validate_relationship_occurrences() def _topology_template(self): return TopologyTemplate(self._tpl_topology_template(), self._get_all_custom_defs(), self.relationship_types, self.parsed_params, None) def _inputs(self): return self.topology_template.inputs def _nodetemplates(self): return self.topology_template.nodetemplates def _relationship_templates(self): return self.topology_template.relationship_templates def _outputs(self): return self.topology_template.outputs def _tpl_version(self): return self.tpl.get(DEFINITION_VERSION) def _tpl_description(self): desc = self.tpl.get(DESCRIPTION) if desc: return desc.rstrip() def _tpl_imports(self): return self.tpl.get(IMPORTS) def _tpl_repositories(self): repositories = self.tpl.get(REPOSITORIES) reposit = [] if repositories: for name, val in repositories.items(): reposits = Repository(name, val) reposit.append(reposits) return reposit def _tpl_relationship_types(self): custom_rel, _ = self._get_custom_types(RELATIONSHIP_TYPES) return custom_rel def _tpl_relationship_templates(self): topology_template = self._tpl_topology_template() return topology_template.get(RELATIONSHIP_TEMPLATES) def _tpl_topology_template(self): return self.tpl.get(TOPOLOGY_TEMPLATE) def _policies(self): return self.topology_template.policies def _get_all_custom_defs(self, imports=None, path=None): types = [IMPORTS, NODE_TYPES, CAPABILITY_TYPES, RELATIONSHIP_TYPES, DATA_TYPES, INTERFACE_TYPES, POLICY_TYPES, GROUP_TYPES] custom_defs_final = {} custom_defs, nested_imports = self._get_custom_types( types, imports, path) if custom_defs: custom_defs_final.update(custom_defs) if nested_imports: for a_file, nested_import in nested_imports.items(): import_defs = self._get_all_custom_defs( nested_import, a_file) custom_defs_final.update(import_defs) # As imports are not custom_types, removing from the dict custom_defs_final.pop(IMPORTS, None) return custom_defs_final def _get_custom_types(self, type_definitions, imports=None, path=None): """Handle custom types defined in imported template files This method loads the custom type definitions referenced in "imports" section of the TOSCA YAML template. """ custom_defs = {} nested_imports = None type_defs = [] if not isinstance(type_definitions, list): type_defs.append(type_definitions) else: type_defs = type_definitions if not imports: imports = self._tpl_imports() if not path: path = self.path if imports: custom_service = toscaparser.imports.\ ImportsLoader(imports, path, type_defs, self.tpl, self.local_defs) nested_tosca_tpls = custom_service.get_nested_tosca_tpls() self._update_nested_tosca_tpls_with_topology(nested_tosca_tpls) nested_imports = custom_service.get_nested_imports() custom_defs = custom_service.get_custom_defs() if not custom_defs: return None, None # Handle custom types defined in current template file for type_def in type_defs: if type_def != IMPORTS: inner_custom_types = self.tpl.get(type_def) or {} if inner_custom_types: custom_defs.update(inner_custom_types) return custom_defs, nested_imports def _update_nested_tosca_tpls_with_topology(self, nested_tosca_tpls): for tpl in nested_tosca_tpls: filename, tosca_tpl = list(tpl.items())[0] if (tosca_tpl.get(TOPOLOGY_TEMPLATE) and filename not in list( self.nested_tosca_tpls_with_topology.keys())): self.nested_tosca_tpls_with_topology.update(tpl) def _handle_nested_tosca_templates_with_topology(self): for fname, tosca_tpl in self.nested_tosca_tpls_with_topology.items(): for nodetemplate in self.nodetemplates: if self._is_sub_mapped_node(nodetemplate, tosca_tpl): parsed_params = self._get_params_for_nested_template( nodetemplate) topology_tpl = tosca_tpl.get(TOPOLOGY_TEMPLATE) topology_with_sub_mapping = TopologyTemplate( topology_tpl, self._get_all_custom_defs(), self.relationship_types, parsed_params, nodetemplate) if topology_with_sub_mapping.substitution_mappings: # Record nested topo templates in top level template self.nested_tosca_templates_with_topology.\ append(topology_with_sub_mapping) # Set substitution mapping object for mapped node nodetemplate.sub_mapping_tosca_template = \ topology_with_sub_mapping.substitution_mappings def _validate_field(self): version = self._tpl_version() if not version: ExceptionCollector.appendException( MissingRequiredFieldError(what='Template', required=DEFINITION_VERSION)) else: self._validate_version(version) self.version = version for name in self.tpl: if (name not in SECTIONS and name not in self.ADDITIONAL_SECTIONS.get(version, ())): ExceptionCollector.appendException( UnknownFieldError(what='Template', field=name)) def _validate_version(self, version): if version not in self.VALID_TEMPLATE_VERSIONS: ExceptionCollector.appendException( InvalidTemplateVersion( what=version, valid_versions='", "'. join(self.VALID_TEMPLATE_VERSIONS))) else: if version not in self.MAIN_TEMPLATE_VERSIONS: update_definitions(version) def _get_path(self, path): if path.lower().endswith('.yaml') or path.lower().endswith('.yml'): return path elif path.lower().endswith(('.zip', '.csar')): # a CSAR archive csar = CSAR(path, self.a_file) if csar.validate(): csar.decompress() self.a_file = True # the file has been decompressed locally return os.path.join(csar.temp_dir, csar.get_main_template()) else: ExceptionCollector.appendException( ValueError(_('"%(path)s" is not a valid file.') % {'path': path})) def verify_template(self): if ExceptionCollector.exceptionsCaught(): if self.input_path: raise ValidationError( message=(_('\nThe input "%(path)s" failed validation with ' 'the following error(s): \n\n\t') % {'path': self.input_path}) + '\n\t'.join(ExceptionCollector.getExceptionsReport())) else: raise ValidationError( message=_('\nThe pre-parsed input failed validation with ' 'the following error(s): \n\n\t') + '\n\t'.join(ExceptionCollector.getExceptionsReport())) else: if self.input_path: msg = (_('The input "%(path)s" successfully passed ' 'validation.') % {'path': self.input_path}) else: msg = _('The pre-parsed input successfully passed validation.') log.info(msg) def _is_sub_mapped_node(self, nodetemplate, tosca_tpl): """Return True if the nodetemple is substituted.""" # NOTE(ueha): Since condition "not nodetemplate.sub_mapping_tosca_\ # template" was deleted as a fix for bug/1883220, there is # some possibility of breaking something on translator side # that current tests not coverd. # And this enhancement does not align with TOSCA standard # but needed for ETSI NFV-SOL 001. if (nodetemplate and self.get_sub_mapping_node_type(tosca_tpl) == nodetemplate.type and len(nodetemplate.interfaces) < 1): return True else: return False def _get_params_for_nested_template(self, nodetemplate): """Return total params for nested_template.""" parsed_params = deepcopy(self.parsed_params) \ if self.parsed_params else {} if nodetemplate: for pname in nodetemplate.get_properties(): parsed_params.update({pname: nodetemplate.get_property_value(pname)}) return parsed_params def get_sub_mapping_node_type(self, tosca_tpl): """Return substitution mappings node type.""" if tosca_tpl: return TopologyTemplate.get_sub_mapping_node_type( tosca_tpl.get(TOPOLOGY_TEMPLATE)) def _has_substitution_mappings(self): """Return True if the template has valid substitution mappings.""" return self.topology_template is not None and \ self.topology_template.substitution_mappings is not None def has_nested_templates(self): """Return True if the tosca template has nested templates.""" return self.nested_tosca_templates_with_topology is not None and \ len(self.nested_tosca_templates_with_topology) >= 1 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8183093 tosca_parser-2.15.0/toscaparser/tpl_relationship_graph.py0000664000175000017500000000324215250006202022540 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. class ToscaGraph(object): '''Graph of Tosca Node Templates.''' def __init__(self, nodetemplates): self.nodetemplates = nodetemplates self.vertices = {} self._create() def _create_vertex(self, node): if node not in self.vertices: self.vertices[node.name] = node def _create_edge(self, node1, node2, relationship): if node1 not in self.vertices: self._create_vertex(node1) self.vertices[node1.name]._add_next(node2, relationship) def vertex(self, node): if node in self.vertices: return self.vertices[node] def __iter__(self): return iter(self.vertices.values()) def _create(self): for node in self.nodetemplates: relation = node.relationships if relation: for rel, nodetpls in relation.items(): for tpl in self.nodetemplates: if tpl.name == nodetpls.name: self._create_edge(node, tpl, rel) self._create_vertex(node) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8183093 tosca_parser-2.15.0/toscaparser/triggers.py0000664000175000017500000000636415250006202017635 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import UnknownFieldError from toscaparser.entity_template import EntityTemplate from toscaparser.utils import validateutils SECTIONS = (DESCRIPTION, EVENT_TYPE, EVENT, SCHEDULE, METRIC, METADATA, TARGET_FILTER, CONDITION, ACTION) = \ ('description', 'event_type', 'event', 'schedule', 'metric', 'metadata', 'target_filter', 'condition', 'action') CONDITION_KEYNAMES = (CONSTRAINT, GRANULARITY, EVALUATIONS, AGGREGATION_METHOD, THRESHOLD, COMPARISON_OPERATOR, RESOURCE_TYPE, STATE) = \ ('constraint', 'granularity', 'evaluations', 'aggregation_method', 'threshold', 'comparison_operator', 'resource_type', 'state') log = logging.getLogger('tosca') class Triggers(EntityTemplate): '''Triggers defined in policies of topology template''' def __init__(self, name, trigger_tpl): self.name = name self.trigger_tpl = trigger_tpl self._validate_keys() self._validate_condition() self._validate_input() def get_description(self): return self.trigger_tpl['description'] def get_event(self): # Corresponding to Keyname changes in TOSCA1.3 if self.trigger_tpl.get('event'): return self.trigger_tpl['event'] return self.trigger_tpl['event_type'] def get_schedule(self): return self.trigger_tpl['schedule'] def get_target_filter(self): return self.trigger_tpl['target_filter'] def get_condition(self): return self.trigger_tpl['condition'] def get_action(self): return self.trigger_tpl['action'] def _validate_keys(self): for key in self.trigger_tpl.keys(): if key not in SECTIONS: ExceptionCollector.appendException( UnknownFieldError(what='Triggers "%s"' % self.name, field=key)) def _validate_condition(self): for key in self.get_condition(): if key not in CONDITION_KEYNAMES: ExceptionCollector.appendException( UnknownFieldError(what='Triggers "%s"' % self.name, field=key)) def _validate_input(self): for key, value in self.get_condition().items(): if key in [GRANULARITY, EVALUATIONS]: validateutils.validate_integer(value) elif key == THRESHOLD: validateutils.validate_numeric(value) elif key in [METRIC, AGGREGATION_METHOD]: validateutils.validate_string(value) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8183093 tosca_parser-2.15.0/toscaparser/unsupportedtype.py0000664000175000017500000000411015250006202021264 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import UnsupportedTypeError from toscaparser.utils.gettextutils import _ log = logging.getLogger('tosca') class UnsupportedType(object): """Note: TOSCA spec version related The tosca.nodes.Storage.ObjectStorage and tosca.nodes.Storage.BlockStorage used here as un_supported_types are part of the name changes in TOSCA spec version 1.1. The original name as specified in version 1.0 are, tosca.nodes.BlockStorage and tosca.nodes.ObjectStorage which are supported by the tosca-parser. Since there are little overlapping in version support currently in the tosca-parser, the names tosca.nodes.Storage.ObjectStorage and tosca.nodes.Storage.BlockStorage are used here to demonstrate the usage of un_supported_types. As tosca-parser move to provide support for version 1.1 and higher, they will be removed. """ un_supported_types = ['tosca.test.invalidtype', 'tosca.nodes.Storage.ObjectStorage', 'tosca.nodes.Storage.BlockStorage'] def __init__(self): pass @staticmethod def validate_type(entitytype): if entitytype in UnsupportedType.un_supported_types: ExceptionCollector.appendException(UnsupportedTypeError( what=_('%s') % entitytype)) return True else: return False ././@PaxHeader0000000000000000000000000000003100000000000010207 xustar0025 mtime=1788873902.5294 tosca_parser-2.15.0/toscaparser/utils/0000775000175000017500000000000015250006257016576 5ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8193092 tosca_parser-2.15.0/toscaparser/utils/__init__.py0000664000175000017500000000000015250006202020663 0ustar00zuulzuul././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8193092 tosca_parser-2.15.0/toscaparser/utils/gettextutils.py0000664000175000017500000000151115250006202021701 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import gettext import os _localedir = os.environ.get('tosca-parser'.upper() + '_LOCALEDIR') _t = gettext.translation('tosca-parser', localedir=_localedir, fallback=True) def _(msg): # type: (object) -> object return _t.gettext(msg) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8193092 tosca_parser-2.15.0/toscaparser/utils/urlutils.py0000664000175000017500000000410615250006202021022 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import urllib.request as urllib2 from urllib.parse import urljoin from urllib.parse import urlparse from toscaparser.common.exception import ExceptionCollector from toscaparser.utils.gettextutils import _ class UrlUtils(object): @staticmethod def validate_url(path): """Validates whether the given path is a URL or not. If the given path includes a scheme (http, https, ftp, ...) and a net location (a domain name such as www.github.com) it is validated as a URL. """ parsed = urlparse(path) if parsed.scheme == 'file': # If the url uses the file scheme netloc will be "" return True else: return bool(parsed.scheme) and bool(parsed.netloc) @staticmethod def join_url(url, relative_path): """Builds a new URL from the given URL and the relative path. Example: url: http://www.githib.com/openstack/heat relative_path: heat-translator - joined: http://www.githib.com/openstack/heat-translator """ if not UrlUtils.validate_url(url): ExceptionCollector.appendException( ValueError(_('"%s" is not a valid URL.') % url)) return urljoin(url, relative_path) @staticmethod def url_accessible(url): """Validates whether the given URL is accessible. Returns true if the get call returns a 200 response code. Otherwise, returns false. """ return urllib2.urlopen(url).getcode() == 200 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8193092 tosca_parser-2.15.0/toscaparser/utils/validateutils.py0000664000175000017500000001742215250006202022016 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import collections.abc import dateutil.parser import logging import numbers import re # from toscaparser.elements import constraints from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import InvalidTOSCAVersionPropertyException from toscaparser.common.exception import RangeValueError from toscaparser.utils.gettextutils import _ log = logging.getLogger('tosca') RANGE_UNBOUNDED = 'UNBOUNDED' def str_to_num(value): '''Convert a string representation of a number into a numeric type.''' # TODO(TBD) we should not allow numeric values in, input should be str if isinstance(value, numbers.Number): return value try: return int(value) except ValueError: return float(value) def validate_numeric(value): if not isinstance(value, numbers.Number): ExceptionCollector.appendException( ValueError(_('"%s" is not a numeric.') % value)) return value def validate_integer(value): if not isinstance(value, int): try: value = int(value) except Exception: ExceptionCollector.appendException( ValueError(_('"%s" is not an integer.') % value)) return value def validate_float(value): if not isinstance(value, float): ExceptionCollector.appendException( ValueError(_('"%s" is not a float.') % value)) return value def validate_string(value): if not isinstance(value, str): ExceptionCollector.appendException( ValueError(_('"%s" is not a string.') % value)) return value def validate_list(value): if not isinstance(value, list): ExceptionCollector.appendException( ValueError(_('"%s" is not a list.') % value)) return value def validate_range(range): # list class check validate_list(range) # validate range list has a min and max if len(range) != 2: ExceptionCollector.appendException( ValueError(_('"%s" is not a valid range.') % range)) # validate min and max are numerics or the keyword UNBOUNDED min_test = max_test = False if not range[0] == RANGE_UNBOUNDED: min = validate_numeric(range[0]) else: min_test = True if not range[1] == RANGE_UNBOUNDED: max = validate_numeric(range[1]) else: max_test = True # validate the max > min (account for UNBOUNDED) if not min_test and not max_test: # Note: min == max is allowed if min > max: ExceptionCollector.appendException( ValueError(_('"%s" is not a valid range.') % range)) return range def validate_value_in_range(value, range, prop_name): validate_numeric(value) validate_range(range) # Note: value is valid if equal to min if range[0] != RANGE_UNBOUNDED: if value < range[0]: ExceptionCollector.appendException( RangeValueError(pname=prop_name, pvalue=value, vmin=range[0], vmax=range[1])) # Note: value is valid if equal to max if range[1] != RANGE_UNBOUNDED: if value > range[1]: ExceptionCollector.appendException( RangeValueError(pname=prop_name, pvalue=value, vmin=range[0], vmax=range[1])) return value def validate_map(value): if not isinstance(value, collections.abc.Mapping): ExceptionCollector.appendException( ValueError(_('"%s" is not a map.') % value)) return value def validate_boolean(value): if isinstance(value, bool): return value if isinstance(value, str): normalised = value.lower() if normalised in ['true', 'false']: return normalised == 'true' ExceptionCollector.appendException( ValueError(_('"%s" is not a boolean.') % value)) def validate_timestamp(value): try: # Note: we must return our own exception message # as dateutil's parser returns different types / values on # different systems. OSX, for example, returns a tuple # containing a different error message than Linux dateutil.parser.parse(value) except Exception as e: original_err_msg = str(e) log.error(original_err_msg) ExceptionCollector.appendException( ValueError(_('"%(val)s" is not a valid timestamp. "%(msg)s"') % {'val': value, 'msg': original_err_msg})) return class TOSCAVersionProperty(object): VERSION_RE = re.compile(r'^(?P([0-9][0-9]*))' r'(\.(?P([0-9][0-9]*)))?' r'(\.(?P([0-9][0-9]*)))?' r'(\.(?P([0-9A-Za-z]+)))?' r'(\-(?P[0-9])*)?$') def __init__(self, version): self.version = str(version) match = self.VERSION_RE.match(self.version) if not match: ExceptionCollector.appendException( InvalidTOSCAVersionPropertyException(what=(self.version))) return ver = match.groupdict() if self.version in ['0', '0.0', '0.0.0']: log.warning('Version assumed as not provided') self.version = None self.minor_version = ver['minor_version'] self.major_version = ver['major_version'] self.fix_version = ver['fix_version'] self.qualifier = self._validate_qualifier(ver['qualifier']) self.build_version = self._validate_build(ver['build_version']) self._validate_major_version(self.major_version) def _validate_major_version(self, value): """Validate major version Checks if only major version is provided and assumes minor version as 0. Eg: If version = 18, then it returns version = '18.0' """ if self.minor_version is None and self.build_version is None and \ value != '0': log.warning('Minor version assumed "0".') self.version = '.'.join([value, '0']) return value def _validate_qualifier(self, value): """Validate qualifier TOSCA version is invalid if a qualifier is present without the fix version or with all of major, minor and fix version 0s. For example, the following versions are invalid 18.0.abc 0.0.0.abc """ if (self.fix_version is None and value) or \ (self.minor_version == self.major_version == self.fix_version == '0' and value): ExceptionCollector.appendException( InvalidTOSCAVersionPropertyException(what=(self.version))) return value def _validate_build(self, value): """Validate build version TOSCA version is invalid if build version is present without the qualifier. Eg: version = 18.0.0-1 is invalid. """ if not self.qualifier and value: ExceptionCollector.appendException( InvalidTOSCAVersionPropertyException(what=(self.version))) return value def get_version(self): return self.version ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8193092 tosca_parser-2.15.0/toscaparser/utils/yamlparser.py0000664000175000017500000000540715250006202021323 0ustar00zuulzuul# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import codecs import urllib import yaml from collections import OrderedDict from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import URLException from toscaparser.utils.gettextutils import _ if hasattr(yaml, 'CSafeLoader'): yaml_loader = yaml.CSafeLoader else: yaml_loader = yaml.SafeLoader def load_yaml(path, a_file=True): f = None try: if a_file: f = codecs.open(path, encoding='utf-8', errors='strict') else: f = urllib.request.urlopen(path) contents = f.read() f.close() return yaml.load(contents, Loader=yaml_loader) except urllib.error.URLError as e: if hasattr(e, 'reason'): msg = (_('Failed to reach server "%(path)s". Reason is: ' '%(reason)s.') % {'path': path, 'reason': e.reason}) ExceptionCollector.appendException(URLException(what=msg)) return elif hasattr(e, 'code'): msg = (_('The server "%(path)s" couldn\'t fulfill the request. ' 'Error code: "%(code)s".') % {'path': path, 'code': e.code}) ExceptionCollector.appendException(URLException(what=msg)) return except Exception: raise def simple_parse(tmpl_str): try: tpl = yaml.load(tmpl_str, Loader=yaml_loader) except yaml.YAMLError as yea: ExceptionCollector.appendException(ValueError(yea)) else: if tpl is None: tpl = {} return tpl def ordered_load(stream, Loader=yaml.Loader, object_pairs_hook=OrderedDict): class OrderedLoader(Loader): pass def construct_mapping(loader, node): loader.flatten_mapping(node) return object_pairs_hook(loader.construct_pairs(node)) OrderedLoader.add_constructor( yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG, construct_mapping) return yaml.load(stream, OrderedLoader) def simple_ordered_parse(tmpl_str): try: tpl = ordered_load(tmpl_str) except yaml.YAMLError as yea: ExceptionCollector.appendException(ValueError(yea)) else: if tpl is None: tpl = {} return tpl ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1788873857.8193092 tosca_parser-2.15.0/tox.ini0000664000175000017500000000231615250006202014413 0ustar00zuulzuul[tox] minversion = 3.1.0 envlist = py3,pep8 ignore_basepython_conflict = True [testenv] basepython = python3 usedevelop = True setenv = VIRTUAL_ENV={envdir} PYTHONWARNINGS=default::DeprecationWarning passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = stestr run --slowest '{posargs}' [testenv:pep8] commands = flake8 [testenv:venv] commands = {posargs} [testenv:cover] setenv = PYTHON=coverage run --source toscaparser --parallel-mode commands = stestr run '{posargs}' coverage combine coverage html -d cover coverage xml -o cover/coverage.xml [testenv:docs] deps = -r{toxinidir}/doc/requirements.txt commands = sphinx-build -b html doc/source doc/build/html [testenv:debug] commands = oslo_debug_helper -t toscaparser/tests {posargs} [flake8] show-source = True builtins = _ # Enable either of these: # W503 line break before binary operator # W504 line break after binary operator ignore = W503,W504 exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build