diff options
Diffstat (limited to 'nfvparser/toscaparser/tests/data')
167 files changed, 5384 insertions, 0 deletions
diff --git a/nfvparser/toscaparser/tests/data/CSAR/csar_elk.csar b/nfvparser/toscaparser/tests/data/CSAR/csar_elk.csar Binary files differnew file mode 100644 index 0000000..a514dc6 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/csar_elk.csar diff --git a/nfvparser/toscaparser/tests/data/CSAR/csar_elk.zip b/nfvparser/toscaparser/tests/data/CSAR/csar_elk.zip Binary files differnew file mode 100644 index 0000000..0d860d4 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/csar_elk.zip diff --git a/nfvparser/toscaparser/tests/data/CSAR/csar_hello_world.zip b/nfvparser/toscaparser/tests/data/CSAR/csar_hello_world.zip Binary files differnew file mode 100644 index 0000000..43ffbbc --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/csar_hello_world.zip diff --git a/nfvparser/toscaparser/tests/data/CSAR/csar_invalid_entry_def.zip b/nfvparser/toscaparser/tests/data/CSAR/csar_invalid_entry_def.zip Binary files differnew file mode 100644 index 0000000..382f790 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/csar_invalid_entry_def.zip diff --git a/nfvparser/toscaparser/tests/data/CSAR/csar_metadata_not_yaml.zip b/nfvparser/toscaparser/tests/data/CSAR/csar_metadata_not_yaml.zip Binary files differnew file mode 100644 index 0000000..3e6120b --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/csar_metadata_not_yaml.zip diff --git a/nfvparser/toscaparser/tests/data/CSAR/csar_missing_metadata.zip b/nfvparser/toscaparser/tests/data/CSAR/csar_missing_metadata.zip Binary files differnew file mode 100644 index 0000000..5ec7a99 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/csar_missing_metadata.zip diff --git a/nfvparser/toscaparser/tests/data/CSAR/csar_no_metadata_file.zip b/nfvparser/toscaparser/tests/data/CSAR/csar_no_metadata_file.zip Binary files differnew file mode 100644 index 0000000..b0df9b9 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/csar_no_metadata_file.zip diff --git a/nfvparser/toscaparser/tests/data/CSAR/csar_not_zip.zip b/nfvparser/toscaparser/tests/data/CSAR/csar_not_zip.zip new file mode 100644 index 0000000..43b7f5f --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/csar_not_zip.zip @@ -0,0 +1 @@ +This is an invalid CSAR file.
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress.zip b/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress.zip Binary files differnew file mode 100644 index 0000000..5df7b48 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress.zip diff --git a/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress_invalid_import_path.zip b/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress_invalid_import_path.zip Binary files differnew file mode 100644 index 0000000..9dc6c9a --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress_invalid_import_path.zip diff --git a/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress_invalid_import_url.zip b/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress_invalid_import_url.zip Binary files differnew file mode 100644 index 0000000..c7a260f --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress_invalid_import_url.zip diff --git a/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress_invalid_script_path.zip b/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress_invalid_script_path.zip Binary files differnew file mode 100644 index 0000000..5e4f9e0 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress_invalid_script_path.zip diff --git a/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress_invalid_script_url.zip b/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress_invalid_script_url.zip Binary files differnew file mode 100644 index 0000000..b4133b6 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress_invalid_script_url.zip diff --git a/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress_with_url_import_and_script.zip b/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress_with_url_import_and_script.zip Binary files differnew file mode 100644 index 0000000..5dedfcd --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/csar_wordpress_with_url_import_and_script.zip diff --git a/nfvparser/toscaparser/tests/data/CSAR/csar_wrong_metadata_file.zip b/nfvparser/toscaparser/tests/data/CSAR/csar_wrong_metadata_file.zip Binary files differnew file mode 100644 index 0000000..85d660a --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/csar_wrong_metadata_file.zip diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/collectd.yaml b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/collectd.yaml new file mode 100644 index 0000000..1ac0935 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/collectd.yaml @@ -0,0 +1,13 @@ +tosca_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
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/elasticsearch.yaml b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/elasticsearch.yaml new file mode 100644 index 0000000..4a1770f --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/elasticsearch.yaml @@ -0,0 +1,11 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/kibana.yaml b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/kibana.yaml new file mode 100644 index 0000000..3a4351c --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/kibana.yaml @@ -0,0 +1,16 @@ +tosca_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 + + diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/logstash.yaml b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/logstash.yaml new file mode 100644 index 0000000..8495954 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/logstash.yaml @@ -0,0 +1,25 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +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 + diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/paypalpizzastore_nodejs_app.yaml b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/paypalpizzastore_nodejs_app.yaml new file mode 100644 index 0000000..cdabeae --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/paypalpizzastore_nodejs_app.yaml @@ -0,0 +1,29 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/rsyslog.yaml b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/rsyslog.yaml new file mode 100644 index 0000000..4614ee7 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/rsyslog.yaml @@ -0,0 +1,13 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/tosca_elk.yaml b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/tosca_elk.yaml new file mode 100644 index 0000000..932f131 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Definitions/tosca_elk.yaml @@ -0,0 +1,217 @@ +tosca_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: + - paypalpizzastore_nodejs_app.yaml + - elasticsearch.yaml + - logstash.yaml + - kibana.yaml + - collectd.yaml + - rsyslog.yaml + +dsl_definitions: + host_capabilities: &host_capabilities + # container properties (flavor) + 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 ] + 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: ../Scripts/nodejs/config.sh + inputs: + github_url: { get_property: [ SELF, github_url ] } + mongodb_ip: { get_attribute: [mongo_server, private_address] } + start: ../Scripts/nodejs/start.sh + nodejs: + type: tosca.nodes.WebServer + requirements: + - host: + node: app_server + interfaces: + Standard: + create: ../Scripts/nodejs/create.sh + mongo_db: + type: tosca.nodes.Database + requirements: + - host: mongo_dbms + interfaces: + Standard: + create: ../Scripts/mongodb/create_database.sh + mongo_dbms: + type: tosca.nodes.DBMS + requirements: + - host: mongo_server + interfaces: + Standard: + create: ../Scripts/mongodb/create.sh + configure: + implementation: ../Scripts/mongodb/config.sh + inputs: + mongodb_ip: { get_attribute: [mongo_server, private_address] } + start: ../Scripts/mongodb/start.sh + elasticsearch: + type: tosca.nodes.SoftwareComponent.Elasticsearch + requirements: + - host: elasticsearch_server + interfaces: + Standard: + create: ../Scripts/elasticsearch/create.sh + start: ../Scripts/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: ../Python/logstash/configure_elasticsearch.py + inputs: + elasticsearch_ip: { get_attribute: [elasticsearch_server, private_address] } + interfaces: + Standard: + create: ../Scripts/logstash/create.sh + start: ../Scripts/logstash/start.sh + kibana: + type: tosca.nodes.SoftwareComponent.Kibana + requirements: + - host: kibana_server + - search_endpoint: elasticsearch + interfaces: + Standard: + create: ../Scripts/kibana/create.sh + configure: + implementation: ../Scripts/kibana/config.sh + inputs: + elasticsearch_ip: { get_attribute: [elasticsearch_server, private_address] } + kibana_ip: { get_attribute: [kibana_server, private_address] } + start: ../Scripts/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: ../Python/logstash/configure_collectd.py + interfaces: + Standard: + create: ../Scripts/collectd/create.sh + configure: + implementation: ../Python/collectd/config.py + inputs: + logstash_ip: { get_attribute: [logstash_server, private_address] } + start: ../Scripts/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: ../Python/logstash/configure_rsyslog.py + interfaces: + Standard: + create: ../Scripts/rsyslog/create.sh + configure: + implementation: ../Scripts/rsyslog/config.sh + inputs: + logstash_ip: { get_attribute: [logstash_server, private_address] } + start: ../Scripts/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://<IP>: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 ] } diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Python/collectd/config.py b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Python/collectd/config.py new file mode 100644 index 0000000..686bbd1 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Python/collectd/config.py @@ -0,0 +1,25 @@ +#!/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 + <Plugin network> + Server "%s" "25826" + </Plugin> + """ % (os.environ['logstash_ip'])) diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Python/logstash/configure_collectd.py b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Python/logstash/configure_collectd.py new file mode 100644 index 0000000..18fdacf --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Python/logstash/configure_collectd.py @@ -0,0 +1,28 @@ +#!/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" + } + }""") diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Python/logstash/configure_elasticsearch.py b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Python/logstash/configure_elasticsearch.py new file mode 100644 index 0000000..2e5389c --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Python/logstash/configure_elasticsearch.py @@ -0,0 +1,26 @@ +#!/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'])) diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Python/logstash/configure_rsyslog.py b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Python/logstash/configure_rsyslog.py new file mode 100644 index 0000000..fc610c2 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Python/logstash/configure_rsyslog.py @@ -0,0 +1,25 @@ +#!/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"] + } + }""") diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/README.txt b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/README.txt new file mode 100644 index 0000000..382c9b0 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/README.txt @@ -0,0 +1,5 @@ +README: + +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 syslog and collectd are installed on a nodejs server. + +Entry information for processing through an orchestrator is contained in file TOSCA-Metadata/TOSCA.meta. This file provides high-level information such as CSAR version or creator of the CSAR. Furthermore, it provides pointers to the entry template under 'Entry-Definitions' key. The entry template itself may contain pointers to one or more files that are used to define TOSCA base type, unless provided by orchestrator as built-in TOSCA basetypes, and other non-normative types. These are typically provided under 'imports' section in the entry template file. Those type definitions will be read and processed by orchestrator or TOSCA parser to create an internal graph showing dependencies and relationships between various TOSCA types. The entry template may have references to various artifacts required for deployment and will be processed accordingly. diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/collectd/create.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/collectd/create.sh new file mode 100644 index 0000000..a483b88 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/collectd/create.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# This script install collectd for monitoring data + +apt-get update +apt-get install -y collectd diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/collectd/start.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/collectd/start.sh new file mode 100644 index 0000000..7e8e033 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/collectd/start.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# This script starts collectd as a service in init.d +service collectd stop +service collectd start diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/elasticsearch/create.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/elasticsearch/create.sh new file mode 100644 index 0000000..c34126c --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/elasticsearch/create.sh @@ -0,0 +1,14 @@ +#!/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 diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/elasticsearch/start.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/elasticsearch/start.sh new file mode 100644 index 0000000..bbc0347 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/elasticsearch/start.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# This script starts elasticsearch as a service in init.d +service elasticsearch stop +service elasticsearch start diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/kibana/config.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/kibana/config.sh new file mode 100644 index 0000000..f28215a --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/kibana/config.sh @@ -0,0 +1,7 @@ +#!/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 diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/kibana/create.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/kibana/create.sh new file mode 100644 index 0000000..41914b1 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/kibana/create.sh @@ -0,0 +1,12 @@ +#!/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 diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/kibana/start.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/kibana/start.sh new file mode 100644 index 0000000..5149bb3 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/kibana/start.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# This script starts kibana as a service in init.d +service kibana4 stop +service kibana4 start diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/logstash/create.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/logstash/create.sh new file mode 100644 index 0000000..77cc8fd --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/logstash/create.sh @@ -0,0 +1,20 @@ +#!/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 diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/logstash/start.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/logstash/start.sh new file mode 100644 index 0000000..a73cf61 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/logstash/start.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# Run logstash as service in init.d +service logstash stop +service logstash start diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/mongodb/config.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/mongodb/config.sh new file mode 100644 index 0000000..78f484e --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/mongodb/config.sh @@ -0,0 +1,7 @@ +#!/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 = <IP for Mongo server> +# 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 diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/mongodb/create.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/mongodb/create.sh new file mode 100644 index 0000000..d84c275 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/mongodb/create.sh @@ -0,0 +1,14 @@ +#!/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 diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/mongodb/create_database.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/mongodb/create_database.sh new file mode 100644 index 0000000..16f1358 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/mongodb/create_database.sh @@ -0,0 +1,5 @@ +#!/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 diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/mongodb/start.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/mongodb/start.sh new file mode 100644 index 0000000..ac200a5 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/mongodb/start.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# This script starts mongodb +service mongod stop +rm /var/lib/mongodb/mongod.lock +service mongod start diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/nodejs/config.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/nodejs/config.sh new file mode 100644 index 0000000..1e149a2 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/nodejs/config.sh @@ -0,0 +1,28 @@ +#!/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 <<EOS +description "node.js app" + +start on (net-device-up + and local-filesystems + and runlevel [2345]) +stop on runlevel [!2345] + +expect fork +respawn + +script + export HOME=/ + export NODE_PATH=/usr/lib/node + exec /usr/bin/node ${app_dir}/app.js >> /var/log/nodeapp.log 2>&1 & +end script +EOS diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/nodejs/create.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/nodejs/create.sh new file mode 100644 index 0000000..04fd6c6 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/nodejs/create.sh @@ -0,0 +1,7 @@ +#!/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 diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/nodejs/start.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/nodejs/start.sh new file mode 100644 index 0000000..6939cb7 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/nodejs/start.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# This script starts the nodejs application +start nodeapp diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/rsyslog/config.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/rsyslog/config.sh new file mode 100644 index 0000000..630767d --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/rsyslog/config.sh @@ -0,0 +1,30 @@ +#!/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 diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/rsyslog/create.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/rsyslog/create.sh new file mode 100644 index 0000000..affdd6e --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/rsyslog/create.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# This script installs rsyslog and the library for RELP + +apt-get update +apt-get install -y rsyslog rsyslog-relp diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/rsyslog/start.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/rsyslog/start.sh new file mode 100644 index 0000000..3de82d1 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/Scripts/rsyslog/start.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# This script starts rsyslogd as a service in init.d +service rsyslog stop +service rsyslog start diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/TOSCA-Metadata/TOSCA.meta b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000..feb3d4f --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_elk/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,4 @@ +TOSCA-Meta-File-Version: 1.0 +CSAR-Version: 1.1 +Created-By: OASIS TOSCA TC +Entry-Definitions: Definitions/tosca_elk.yaml
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Definitions/tosca_single_instance_wordpress.yaml b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Definitions/tosca_single_instance_wordpress.yaml new file mode 100644 index 0000000..1dd195a --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Definitions/tosca_single_instance_wordpress.yaml @@ -0,0 +1,109 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + TOSCA simple profile with wordpress, web server and mysql on the same server. + +imports: + - wordpress.yaml + +topology_template: + inputs: + cpus: + type: integer + description: Number of CPUs for the server. + constraints: + - valid_values: [ 1, 2, 4, 8 ] + db_name: + type: string + description: The name of the database. + db_user: + type: string + description: The user name of the DB user. + db_pwd: + type: string + description: The WordPress database admin account password. + db_root_pwd: + type: string + description: Root password for MySQL. + db_port: + type: PortDef + description: Port for the MySQL database. + + node_templates: + wordpress: + type: tosca.nodes.WebApplication.WordPress + requirements: + - host: webserver + - database_endpoint: mysql_database + interfaces: + Standard: + create: ../Scripts/WordPress/install.sh + configure: + implementation: ../Scripts/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 } + requirements: + - host: mysql_dbms + interfaces: + Standard: + configure: + implementation: ../Scripts/MYSQLDatabase/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: ../Scripts/MYSQLDBMS/install.sh + start: ../Scripts/MYSQLDBMS/start.sh + configure: + implementation: ../Scripts/MYSQLDBMS/configure.sh + inputs: + root_password: { get_property: [ mysql_dbms, root_password ] } + + webserver: + type: tosca.nodes.WebServer + requirements: + - host: server + interfaces: + Standard: + create: ../Scripts/WebServer/install.sh + start: ../Scripts/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: Fedora + version: 18.0 + + outputs: + website_url: + description: IP address for Wordpress wiki. + value: { get_attribute: [server, private_address] } diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Definitions/wordpress.yaml b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Definitions/wordpress.yaml new file mode 100644 index 0000000..5899ed9 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Definitions/wordpress.yaml @@ -0,0 +1,19 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/README.txt b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/README.txt new file mode 100644 index 0000000..e882ff6 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/README.txt @@ -0,0 +1,22 @@ +README: + +This CSAR contains all definitions that are required for deploying WordPress +and MySQL on a single compute instance. + +Entry information for processing through an orchestrator is contained in file +TOSCA-Metadata/TOSCA.meta. This file provides high-level information such as +CSAR version or creator of the CSAR. Furthermore, it provides pointers to the +various TOSCA definitions files that contain the real details. +The entry 'Entry-Definitions' points to the definitions file which holds the +service template for the workload. +'Entry-Definitions' is optional. An orchestrator can also process the contents +like this: +1) Read in and process each definitions file. +2) For each definitions file: + 2.1) Read in all * type definitions (node types, capability types, etc.) and + store them in an internal map +3) Verify and build dependencies (e.g. inheritance) between all type definitions + previously read in. Orchestrator built-in types (e.g. TOSCA base types) are + also considered in this step. +4) Process the actual service template (the file with a node_templates section). + Validate using previously obtained type information. diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/MYSQLDBMS/configure.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/MYSQLDBMS/configure.sh new file mode 100644 index 0000000..d4ef6b4 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/MYSQLDBMS/configure.sh @@ -0,0 +1,5 @@ +#!/bin/sh +sed --regexp-extended "s/(port\s*=\s*)[0-9]*/\1$db_port/g" </etc/mysql/my.cnf >/tmp/my.cnf +mv -f /tmp/my.cnf /etc/mysql/my.cnf +/etc/init.d/mysql stop +/etc/init.d/mysql start
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/MYSQLDBMS/install.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/MYSQLDBMS/install.sh new file mode 100644 index 0000000..38628b9 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/MYSQLDBMS/install.sh @@ -0,0 +1,9 @@ +#!/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
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/MYSQLDBMS/start.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/MYSQLDBMS/start.sh new file mode 100644 index 0000000..3378670 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/MYSQLDBMS/start.sh @@ -0,0 +1,2 @@ +#!/bin/sh +/etc/init.d/mysql start
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/MYSQLDatabase/configure.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/MYSQLDatabase/configure.sh new file mode 100644 index 0000000..092136a --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/MYSQLDatabase/configure.sh @@ -0,0 +1,8 @@ +#!/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
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/WebServer/install.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/WebServer/install.sh new file mode 100644 index 0000000..4ca9b4e --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/WebServer/install.sh @@ -0,0 +1,5 @@ +#!/bin/sh +#This script installs apache web server + +apt-get update +apt-get install -y apache2
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/WebServer/start.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/WebServer/start.sh new file mode 100644 index 0000000..e962ca5 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/WebServer/start.sh @@ -0,0 +1,2 @@ +#!/bin/sh +service apache2 start
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/WordPress/configure.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/WordPress/configure.sh new file mode 100644 index 0000000..5598b4f --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/WordPress/configure.sh @@ -0,0 +1,4 @@ +#!/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
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/WordPress/install.sh b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/WordPress/install.sh new file mode 100644 index 0000000..1320443 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/Scripts/WordPress/install.sh @@ -0,0 +1,5 @@ +#!/bin/sh +#This script installs wordpress + +apt-get update +apt-get install -y wordpress
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/TOSCA-Metadata/TOSCA.meta b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000..5208113 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/CSAR/tosca_single_instance_wordpress/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,5 @@ +TOSCA-Meta-File-Version: 1.0 +CSAR-Version: 1.1 +Created-By: OASIS TOSCA TC +Entry-Definitions: Definitions/tosca_single_instance_wordpress.yaml +Content-Type: application/vnd.oasis.tosca.definitions.yaml diff --git a/nfvparser/toscaparser/tests/data/containers/test_container_docker_mysql.yaml b/nfvparser/toscaparser/tests/data/containers/test_container_docker_mysql.yaml new file mode 100644 index 0000000..3fd4466 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/containers/test_container_docker_mysql.yaml @@ -0,0 +1,44 @@ +tosca_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 + diff --git a/nfvparser/toscaparser/tests/data/custom_types/collectd.yaml b/nfvparser/toscaparser/tests/data/custom_types/collectd.yaml new file mode 100644 index 0000000..1ac0935 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/collectd.yaml @@ -0,0 +1,13 @@ +tosca_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
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/custom_types/compute_with_attribute_list.yaml b/nfvparser/toscaparser/tests/data/custom_types/compute_with_attribute_list.yaml new file mode 100644 index 0000000..3487433 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/compute_with_attribute_list.yaml @@ -0,0 +1,13 @@ +tosca_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 + diff --git a/nfvparser/toscaparser/tests/data/custom_types/compute_with_nested_atributes.yaml b/nfvparser/toscaparser/tests/data/custom_types/compute_with_nested_atributes.yaml new file mode 100644 index 0000000..909a297 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/compute_with_nested_atributes.yaml @@ -0,0 +1,22 @@ +tosca_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 + diff --git a/nfvparser/toscaparser/tests/data/custom_types/compute_with_prop.yaml b/nfvparser/toscaparser/tests/data/custom_types/compute_with_prop.yaml new file mode 100644 index 0000000..93a82af --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/compute_with_prop.yaml @@ -0,0 +1,13 @@ +tosca_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 + diff --git a/nfvparser/toscaparser/tests/data/custom_types/custom_caps_def.yaml b/nfvparser/toscaparser/tests/data/custom_types/custom_caps_def.yaml new file mode 100644 index 0000000..337c38f --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/custom_caps_def.yaml @@ -0,0 +1,22 @@ +tosca_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 + diff --git a/nfvparser/toscaparser/tests/data/custom_types/custom_interface.yaml b/nfvparser/toscaparser/tests/data/custom_types/custom_interface.yaml new file mode 100644 index 0000000..2d9bec4 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/custom_interface.yaml @@ -0,0 +1,20 @@ +tosca_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: + diff --git a/nfvparser/toscaparser/tests/data/custom_types/custom_relationship_type_defs.yaml b/nfvparser/toscaparser/tests/data/custom_types/custom_relationship_type_defs.yaml new file mode 100644 index 0000000..cf5c2b4 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/custom_relationship_type_defs.yaml @@ -0,0 +1,23 @@ +node_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 ] + diff --git a/nfvparser/toscaparser/tests/data/custom_types/db_with_list_param.yaml b/nfvparser/toscaparser/tests/data/custom_types/db_with_list_param.yaml new file mode 100644 index 0000000..57ce279 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/db_with_list_param.yaml @@ -0,0 +1,10 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/custom_types/elasticsearch.yaml b/nfvparser/toscaparser/tests/data/custom_types/elasticsearch.yaml new file mode 100644 index 0000000..b140a32 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/elasticsearch.yaml @@ -0,0 +1,12 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/custom_types/imported_sample.yaml b/nfvparser/toscaparser/tests/data/custom_types/imported_sample.yaml new file mode 100644 index 0000000..c8e4532 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/imported_sample.yaml @@ -0,0 +1,38 @@ +tosca1_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 diff --git a/nfvparser/toscaparser/tests/data/custom_types/kibana.yaml b/nfvparser/toscaparser/tests/data/custom_types/kibana.yaml new file mode 100644 index 0000000..5701e69 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/kibana.yaml @@ -0,0 +1,14 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/custom_types/logstash.yaml b/nfvparser/toscaparser/tests/data/custom_types/logstash.yaml new file mode 100644 index 0000000..cf60521 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/logstash.yaml @@ -0,0 +1,25 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +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 diff --git a/nfvparser/toscaparser/tests/data/custom_types/nested_rsyslog.yaml b/nfvparser/toscaparser/tests/data/custom_types/nested_rsyslog.yaml new file mode 100644 index 0000000..8c04171 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/nested_rsyslog.yaml @@ -0,0 +1,17 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/custom_types/nested_test_wordpress.yaml b/nfvparser/toscaparser/tests/data/custom_types/nested_test_wordpress.yaml new file mode 100644 index 0000000..4df277d --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/nested_test_wordpress.yaml @@ -0,0 +1,32 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/custom_types/node_with_cap.yaml b/nfvparser/toscaparser/tests/data/custom_types/node_with_cap.yaml new file mode 100644 index 0000000..b17513f --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/node_with_cap.yaml @@ -0,0 +1,33 @@ +tosca_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.Root + properties: + type: + type: string + required: true + default: someval + constraints: + - equal: someval + +node_types: + + tosca.nodes.SomeNode: + derived_from: tosca.nodes.Root + 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 + diff --git a/nfvparser/toscaparser/tests/data/custom_types/paypalpizzastore_nodejs_app.yaml b/nfvparser/toscaparser/tests/data/custom_types/paypalpizzastore_nodejs_app.yaml new file mode 100644 index 0000000..cdabeae --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/paypalpizzastore_nodejs_app.yaml @@ -0,0 +1,29 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/custom_types/rsyslog.yaml b/nfvparser/toscaparser/tests/data/custom_types/rsyslog.yaml new file mode 100644 index 0000000..4614ee7 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/rsyslog.yaml @@ -0,0 +1,13 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/custom_types/wordpress.yaml b/nfvparser/toscaparser/tests/data/custom_types/wordpress.yaml new file mode 100644 index 0000000..5899ed9 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/custom_types/wordpress.yaml @@ -0,0 +1,19 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/datatypes/custom_datatype_def.yaml b/nfvparser/toscaparser/tests/data/datatypes/custom_datatype_def.yaml new file mode 100644 index 0000000..b1fb402 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/datatypes/custom_datatype_def.yaml @@ -0,0 +1,53 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/datatypes/test_custom_datatypes_in_current_template.yaml b/nfvparser/toscaparser/tests/data/datatypes/test_custom_datatypes_in_current_template.yaml new file mode 100644 index 0000000..befa198 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/datatypes/test_custom_datatypes_in_current_template.yaml @@ -0,0 +1,70 @@ +tosca_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'} diff --git a/nfvparser/toscaparser/tests/data/datatypes/test_custom_datatypes_nested_datatype_error.yaml b/nfvparser/toscaparser/tests/data/datatypes/test_custom_datatypes_nested_datatype_error.yaml new file mode 100644 index 0000000..b28f499 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/datatypes/test_custom_datatypes_nested_datatype_error.yaml @@ -0,0 +1,25 @@ +tosca_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'} diff --git a/nfvparser/toscaparser/tests/data/datatypes/test_custom_datatypes_positive.yaml b/nfvparser/toscaparser/tests/data/datatypes/test_custom_datatypes_positive.yaml new file mode 100644 index 0000000..f1762f4 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/datatypes/test_custom_datatypes_positive.yaml @@ -0,0 +1,24 @@ +tosca_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'} diff --git a/nfvparser/toscaparser/tests/data/datatypes/test_custom_datatypes_value_error.yaml b/nfvparser/toscaparser/tests/data/datatypes/test_custom_datatypes_value_error.yaml new file mode 100644 index 0000000..31cf681 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/datatypes/test_custom_datatypes_value_error.yaml @@ -0,0 +1,18 @@ +tosca_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] diff --git a/nfvparser/toscaparser/tests/data/datatypes/test_datatype_portspec_add_req.yaml b/nfvparser/toscaparser/tests/data/datatypes/test_datatype_portspec_add_req.yaml new file mode 100644 index 0000000..f944927 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/datatypes/test_datatype_portspec_add_req.yaml @@ -0,0 +1,41 @@ +tosca_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 ] diff --git a/nfvparser/toscaparser/tests/data/dsl_definitions/test_nested_dsl_def.yaml b/nfvparser/toscaparser/tests/data/dsl_definitions/test_nested_dsl_def.yaml new file mode 100644 index 0000000..6155595 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/dsl_definitions/test_nested_dsl_def.yaml @@ -0,0 +1,23 @@ +tosca_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
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/functions/test_capabilties_inheritance.yaml b/nfvparser/toscaparser/tests/data/functions/test_capabilties_inheritance.yaml new file mode 100644 index 0000000..f0bec84 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_capabilties_inheritance.yaml @@ -0,0 +1,25 @@ +tosca_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 + diff --git a/nfvparser/toscaparser/tests/data/functions/test_concat.yaml b/nfvparser/toscaparser/tests/data/functions/test_concat.yaml new file mode 100644 index 0000000..22fcfb4 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_concat.yaml @@ -0,0 +1,30 @@ +tosca_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 ] ] }
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/functions/test_concat_invalid.yaml b/nfvparser/toscaparser/tests/data/functions/test_concat_invalid.yaml new file mode 100644 index 0000000..7c7b0aa --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_concat_invalid.yaml @@ -0,0 +1,9 @@ +tosca_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: []}
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_attribute_host_keyword.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_host_keyword.yaml new file mode 100644 index 0000000..90ffbe2 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_host_keyword.yaml @@ -0,0 +1,33 @@ +tosca_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 ] } diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_attribute_host_not_found.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_host_not_found.yaml new file mode 100644 index 0000000..69679ff --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_host_not_found.yaml @@ -0,0 +1,20 @@ +tosca_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 ] } + diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_attribute_illegal_host_in_outputs.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_illegal_host_in_outputs.yaml new file mode 100644 index 0000000..6c7d9bb --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_illegal_host_in_outputs.yaml @@ -0,0 +1,17 @@ +tosca_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 ] } diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_attribute_source_target_keywords.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_source_target_keywords.yaml new file mode 100644 index 0000000..047387f --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_source_target_keywords.yaml @@ -0,0 +1,30 @@ +tosca_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 + diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_attribute_unknown_attribute_name.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_unknown_attribute_name.yaml new file mode 100644 index 0000000..0570c7c --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_unknown_attribute_name.yaml @@ -0,0 +1,28 @@ +tosca_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 ] } diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_attribute_unknown_node_template_name.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_unknown_node_template_name.yaml new file mode 100644 index 0000000..34c1c33 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_unknown_node_template_name.yaml @@ -0,0 +1,30 @@ +tosca_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 ] } diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_index.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_index.yaml new file mode 100644 index 0000000..5766490 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_index.yaml @@ -0,0 +1,19 @@ +tosca_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 ] } + diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_index_error.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_index_error.yaml new file mode 100644 index 0000000..7511999 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_index_error.yaml @@ -0,0 +1,19 @@ +tosca_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 ] } + diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_nested_params.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_nested_params.yaml new file mode 100644 index 0000000..79e632c --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_attribute_with_nested_params.yaml @@ -0,0 +1,23 @@ +tosca_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 ] } + diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_implicit_attribute.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_implicit_attribute.yaml new file mode 100644 index 0000000..a269005 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_implicit_attribute.yaml @@ -0,0 +1,25 @@ +tosca_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 + + outputs: + ip_address: + value: { get_attribute: [ my_server, notification_port ] }
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_property_source_target_keywords.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_property_source_target_keywords.yaml new file mode 100644 index 0000000..c460257 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_property_source_target_keywords.yaml @@ -0,0 +1,35 @@ +tosca_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 + diff --git a/nfvparser/toscaparser/tests/data/functions/test_get_property_with_host.yaml b/nfvparser/toscaparser/tests/data/functions/test_get_property_with_host.yaml new file mode 100644 index 0000000..1ca69ca --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_get_property_with_host.yaml @@ -0,0 +1,65 @@ +tosca_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 + diff --git a/nfvparser/toscaparser/tests/data/functions/test_invalid_function_signature.yaml b/nfvparser/toscaparser/tests/data/functions/test_invalid_function_signature.yaml new file mode 100644 index 0000000..dde8427 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_invalid_function_signature.yaml @@ -0,0 +1,34 @@ +tosca_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] } diff --git a/nfvparser/toscaparser/tests/data/functions/test_token.yaml b/nfvparser/toscaparser/tests/data/functions/test_token.yaml new file mode 100644 index 0000000..495a930 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_token.yaml @@ -0,0 +1,15 @@ +tosca_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 ] } diff --git a/nfvparser/toscaparser/tests/data/functions/test_token_invalid.yaml b/nfvparser/toscaparser/tests/data/functions/test_token_invalid.yaml new file mode 100644 index 0000000..35ae2ff --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_token_invalid.yaml @@ -0,0 +1,17 @@ +tosca_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"]} diff --git a/nfvparser/toscaparser/tests/data/functions/test_unknown_capability_property.yaml b/nfvparser/toscaparser/tests/data/functions/test_unknown_capability_property.yaml new file mode 100644 index 0000000..4a92530 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_unknown_capability_property.yaml @@ -0,0 +1,36 @@ +tosca_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 ] } diff --git a/nfvparser/toscaparser/tests/data/functions/test_unknown_input_in_interface.yaml b/nfvparser/toscaparser/tests/data/functions/test_unknown_input_in_interface.yaml new file mode 100644 index 0000000..cbfb391 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_unknown_input_in_interface.yaml @@ -0,0 +1,20 @@ + +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 } diff --git a/nfvparser/toscaparser/tests/data/functions/test_unknown_input_in_property.yaml b/nfvparser/toscaparser/tests/data/functions/test_unknown_input_in_property.yaml new file mode 100644 index 0000000..9ba7ee5 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/test_unknown_input_in_property.yaml @@ -0,0 +1,13 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/functions/tosca_nested_property_names_indexes.yaml b/nfvparser/toscaparser/tests/data/functions/tosca_nested_property_names_indexes.yaml new file mode 100644 index 0000000..8fb7b96 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/functions/tosca_nested_property_names_indexes.yaml @@ -0,0 +1,47 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/groups/definitions.yaml b/nfvparser/toscaparser/tests/data/groups/definitions.yaml new file mode 100644 index 0000000..40c1d8b --- /dev/null +++ b/nfvparser/toscaparser/tests/data/groups/definitions.yaml @@ -0,0 +1,10 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +group_types: + mycompany.mytypes.groups.placement: + description: My company's group type for placing nodes of type Compute + members: [ tosca.nodes.Compute ] + metadata: + type: map + entry_schema: + type: string diff --git a/nfvparser/toscaparser/tests/data/groups/tosca_group_template.yaml b/nfvparser/toscaparser/tests/data/groups/tosca_group_template.yaml new file mode 100644 index 0000000..0e94240 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/groups/tosca_group_template.yaml @@ -0,0 +1,54 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + Service template with topology_template, act as a nested system inside another system. + +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. + receiver_port: + type: string + description: Port to be used for receiving messages. + my_cpus: + type: integer + description: Number of CPUs for the server. + constraints: + - valid_values: [ 1, 2, 4, 8 ] + + node_templates: + 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 + + groups: + webserver_group: + type: mycompany.mytypes.groups.placement + members: [ websrv, server ] diff --git a/nfvparser/toscaparser/tests/data/interfaces/test_custom_interface_in_template.yaml b/nfvparser/toscaparser/tests/data/interfaces/test_custom_interface_in_template.yaml new file mode 100644 index 0000000..c23917c --- /dev/null +++ b/nfvparser/toscaparser/tests/data/interfaces/test_custom_interface_in_template.yaml @@ -0,0 +1,23 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/interfaces/test_custom_interface_invalid_operation.yaml b/nfvparser/toscaparser/tests/data/interfaces/test_custom_interface_invalid_operation.yaml new file mode 100644 index 0000000..d56ad9c --- /dev/null +++ b/nfvparser/toscaparser/tests/data/interfaces/test_custom_interface_invalid_operation.yaml @@ -0,0 +1,19 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/load_balancer/tosca_load_balancer.yaml b/nfvparser/toscaparser/tests/data/load_balancer/tosca_load_balancer.yaml new file mode 100644 index 0000000..2fcdb48 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/load_balancer/tosca_load_balancer.yaml @@ -0,0 +1,75 @@ +# Note: this could eventually be translated to a Neutron Load Balancer +# However, in Heat/HOT the preferred way of doing this is creating an Autoscale Group +# +#heat_template_version: 2015-04-30 ... +#resources: +#load_bal_resource: +# type: OS::Neutron::Pool +# properties: +# admin_state_up: Boolean +# description: String +# lb_method: String +# monitors: [Value, Value, ...] +# name: String +# protocol: String +# provider: String +# subnet: String +# vip: { +# "description": String, +# "name": String, +# "connection_limit": Integer, +# "protocol_port": Integer, +# "subnet": String, +# "address": String, +# "admin_state_up": Boolean, +# "session_persistence": +# { +# "cookie_name": String, +# "type": String} +# } +# +# example from: https://gist.github.com/therve/9231701 +# +#resources: +# web_server_group: +# type: AWS::AutoScaling::AutoScalingGroup +# properties: +# AvailabilityZones: [nova] +# LaunchConfigurationName: {get_resource: launch_config} +# MinSize: 1 +# MaxSize: 3 +# LoadBalancerNames: +# - {get_resource: mylb} +# mypool: +# type: OS::Neutron::Pool +# properties: +# protocol: HTTP +# monitors: [{get_resource: mymonitor}] +# subnet_id: {get_param: subnet_id} +# lb_method: ROUND_ROBIN +# vip: +# protocol_port: 80 +# mylb: +# type: OS::Neutron::LoadBalancer +# properties: +# protocol_port: 80 +# pool_id: {get_resource: mypool} + +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: Template for deploying a load balancer with predefined endpoint properties. + +topology_template: + node_templates: + simple_load_balancer: + type: tosca.nodes.LoadBalancer + capabilities: + # properties: + # algorithm: DEFAULT (define new keyword, ROUND_ROBIN?) + # Client, public facing endpoint + client: + properties: + network_name: PUBLIC + floating: true + dns_name: http://mycompany.com/ + diff --git a/nfvparser/toscaparser/tests/data/node_filter/test_node_filter.yaml b/nfvparser/toscaparser/tests/data/node_filter/test_node_filter.yaml new file mode 100644 index 0000000..3dd8e26 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/node_filter/test_node_filter.yaml @@ -0,0 +1,18 @@ +tosca_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 } + diff --git a/nfvparser/toscaparser/tests/data/policies/custom_definitions.yaml b/nfvparser/toscaparser/tests/data/policies/custom_definitions.yaml new file mode 100644 index 0000000..7f15ade --- /dev/null +++ b/nfvparser/toscaparser/tests/data/policies/custom_definitions.yaml @@ -0,0 +1,10 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +policy_types: + mycompany.mytypes.myScalingPolicy: + derived_from: tosca.policies.Scaling + metadata: + type: map + entry_schema: + type: string + diff --git a/nfvparser/toscaparser/tests/data/policies/tacker_defs.yaml b/nfvparser/toscaparser/tests/data/policies/tacker_defs.yaml new file mode 100644 index 0000000..96b0d45 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/policies/tacker_defs.yaml @@ -0,0 +1,183 @@ +tosca_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... diff --git a/nfvparser/toscaparser/tests/data/policies/tacker_nfv_defs.yaml b/nfvparser/toscaparser/tests/data/policies/tacker_nfv_defs.yaml new file mode 100644 index 0000000..1387509 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/policies/tacker_nfv_defs.yaml @@ -0,0 +1,261 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/policies/test_tosca_nfv_multiple_policies.yaml b/nfvparser/toscaparser/tests/data/policies/test_tosca_nfv_multiple_policies.yaml new file mode 100644 index 0000000..452dbb5 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/policies/test_tosca_nfv_multiple_policies.yaml @@ -0,0 +1,95 @@ +tosca_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 + + - SP2: + type: tosca.policies.tacker.Scaling + targets: [VDU2] + properties: + increment: 1 + cooldown: 120 + min_instances: 1 + max_instances: 2 + default_instances: 1 + + - ALRM1: + type: tosca.policies.tacker.Monitoring + triggers: + resize_compute: + event_type: + type: tosca.events.resource.utilization + implementation: ceilometer + condition: + constraint: 50 + period: 600 + evaluations: 1 + method: avg + action: + resize_compute: + action_name: SP1 diff --git a/nfvparser/toscaparser/tests/data/policies/tosca_policy_template.yaml b/nfvparser/toscaparser/tests/data/policies/tosca_policy_template.yaml new file mode 100644 index 0000000..47f7870 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/policies/tosca_policy_template.yaml @@ -0,0 +1,85 @@ +tosca_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 } + period: 60 + evaluations: 1 + method: average + action: + resize: # Operation name + inputs: + strategy: LEAST_USED + implementation: Senlin.webhook() + - my_groups_placement: + type: mycompany.mytypes.myScalingPolicy + targets: [ webserver_group ] + description: my company scaling policy + metadata: + user1: 1001 + user2: 1003 + diff --git a/nfvparser/toscaparser/tests/data/relationship/test_custom_relationship.yaml b/nfvparser/toscaparser/tests/data/relationship/test_custom_relationship.yaml new file mode 100644 index 0000000..81b92b4 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/relationship/test_custom_relationship.yaml @@ -0,0 +1,48 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/repositories/test_repositories_definition.yaml b/nfvparser/toscaparser/tests/data/repositories/test_repositories_definition.yaml new file mode 100644 index 0000000..c2856c8 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/repositories/test_repositories_definition.yaml @@ -0,0 +1,23 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +repositories: + some_repository: + description: Some repo + url: https://raw.githubusercontent.com/openstack/tosca-parser/master/toscaparser/tests/data/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 diff --git a/nfvparser/toscaparser/tests/data/repositories/tosca_repositories_test_definition.yaml b/nfvparser/toscaparser/tests/data/repositories/tosca_repositories_test_definition.yaml new file mode 100644 index 0000000..0001d06 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/repositories/tosca_repositories_test_definition.yaml @@ -0,0 +1,26 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/requirements/test_requirements.yaml b/nfvparser/toscaparser/tests/data/requirements/test_requirements.yaml new file mode 100644 index 0000000..bb67577 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/requirements/test_requirements.yaml @@ -0,0 +1,67 @@ +tosca_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 + 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 + my_webserver: + type: tosca.nodes.WebServer + 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 diff --git a/nfvparser/toscaparser/tests/data/test_attributes_inheritance.yaml b/nfvparser/toscaparser/tests/data/test_attributes_inheritance.yaml new file mode 100644 index 0000000..0649c11 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_attributes_inheritance.yaml @@ -0,0 +1,28 @@ +tosca_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 ] } + diff --git a/nfvparser/toscaparser/tests/data/test_available_rel_tpls.yaml b/nfvparser/toscaparser/tests/data/test_available_rel_tpls.yaml new file mode 100644 index 0000000..e8d9045 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_available_rel_tpls.yaml @@ -0,0 +1,23 @@ +tosca_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 + diff --git a/nfvparser/toscaparser/tests/data/test_containers.yaml b/nfvparser/toscaparser/tests/data/test_containers.yaml new file mode 100644 index 0000000..ba1cc16 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_containers.yaml @@ -0,0 +1,44 @@ +tosca_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 + 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 + diff --git a/nfvparser/toscaparser/tests/data/test_credential_datatype.yaml b/nfvparser/toscaparser/tests/data/test_credential_datatype.yaml new file mode 100644 index 0000000..583ec82 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_credential_datatype.yaml @@ -0,0 +1,77 @@ +tosca_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] } diff --git a/nfvparser/toscaparser/tests/data/test_custom_caps_def.yaml b/nfvparser/toscaparser/tests/data/test_custom_caps_def.yaml new file mode 100644 index 0000000..0b0984a --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_custom_caps_def.yaml @@ -0,0 +1,13 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/test_custom_relationships.yaml b/nfvparser/toscaparser/tests/data/test_custom_relationships.yaml new file mode 100644 index 0000000..9c8171d --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_custom_relationships.yaml @@ -0,0 +1,48 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/test_endpoint_on_compute.yaml b/nfvparser/toscaparser/tests/data/test_endpoint_on_compute.yaml new file mode 100644 index 0000000..cf2ec94 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_endpoint_on_compute.yaml @@ -0,0 +1,21 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/test_instance_nested_imports.yaml b/nfvparser/toscaparser/tests/data/test_instance_nested_imports.yaml new file mode 100644 index 0000000..6aa9307 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_instance_nested_imports.yaml @@ -0,0 +1,22 @@ +tosca_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 + +topology_template: + + node_templates: + wordpress: + type: tosca.nodes.WebApplication.WordPress + + testrsyslogtype: + type: tosca.nodes.SoftwareComponent.Rsyslog.TestRsyslogType + + rsyslog: + type: Test2ndRsyslogType + + logstash: + type: tosca.nodes.SoftwareComponent.Logstash diff --git a/nfvparser/toscaparser/tests/data/test_invalid_input_defaults.yaml b/nfvparser/toscaparser/tests/data/test_invalid_input_defaults.yaml new file mode 100644 index 0000000..f8f4ae7 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_invalid_input_defaults.yaml @@ -0,0 +1,12 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/test_invalid_section_names.yaml b/nfvparser/toscaparser/tests/data/test_invalid_section_names.yaml new file mode 100644 index 0000000..6241585 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_invalid_section_names.yaml @@ -0,0 +1,25 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/test_invalid_template_version.yaml b/nfvparser/toscaparser/tests/data/test_invalid_template_version.yaml new file mode 100644 index 0000000..86dce79 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_invalid_template_version.yaml @@ -0,0 +1,14 @@ +tosca_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 + diff --git a/nfvparser/toscaparser/tests/data/test_multiple_validation_errors.yaml b/nfvparser/toscaparser/tests/data/test_multiple_validation_errors.yaml new file mode 100644 index 0000000..479a1ec --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_multiple_validation_errors.yaml @@ -0,0 +1,128 @@ +tosca_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] } diff --git a/nfvparser/toscaparser/tests/data/test_no_inputs_in_template.yaml b/nfvparser/toscaparser/tests/data/test_no_inputs_in_template.yaml new file mode 100644 index 0000000..0b9da4c --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_no_inputs_in_template.yaml @@ -0,0 +1,17 @@ +tosca_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: diff --git a/nfvparser/toscaparser/tests/data/test_no_outputs_in_template.yaml b/nfvparser/toscaparser/tests/data/test_no_outputs_in_template.yaml new file mode 100644 index 0000000..51d42ff --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_no_outputs_in_template.yaml @@ -0,0 +1,15 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/test_node_filter.yaml b/nfvparser/toscaparser/tests/data/test_node_filter.yaml new file mode 100644 index 0000000..3dd8e26 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_node_filter.yaml @@ -0,0 +1,18 @@ +tosca_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 } + diff --git a/nfvparser/toscaparser/tests/data/test_normative_type_properties_override.yaml b/nfvparser/toscaparser/tests/data/test_normative_type_properties_override.yaml new file mode 100644 index 0000000..3c3e272 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_normative_type_properties_override.yaml @@ -0,0 +1,37 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/test_repositories_definition.yaml b/nfvparser/toscaparser/tests/data/test_repositories_definition.yaml new file mode 100644 index 0000000..c2856c8 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_repositories_definition.yaml @@ -0,0 +1,23 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +repositories: + some_repository: + description: Some repo + url: https://raw.githubusercontent.com/openstack/tosca-parser/master/toscaparser/tests/data/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 diff --git a/nfvparser/toscaparser/tests/data/test_requirements.yaml b/nfvparser/toscaparser/tests/data/test_requirements.yaml new file mode 100644 index 0000000..269c46d --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_requirements.yaml @@ -0,0 +1,67 @@ +tosca_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 + 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 + my_webserver: + type: tosca.nodes.WebServer + 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 diff --git a/nfvparser/toscaparser/tests/data/test_tosca_custom_rel_with_script.yaml b/nfvparser/toscaparser/tests/data/test_tosca_custom_rel_with_script.yaml new file mode 100644 index 0000000..18a94a3 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_tosca_custom_rel_with_script.yaml @@ -0,0 +1,23 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/test_tosca_normative_type_by_shortname.yaml b/nfvparser/toscaparser/tests/data/test_tosca_normative_type_by_shortname.yaml new file mode 100644 index 0000000..c0653e7 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_tosca_normative_type_by_shortname.yaml @@ -0,0 +1,34 @@ +tosca_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] } diff --git a/nfvparser/toscaparser/tests/data/test_tosca_top_level_error1.yaml b/nfvparser/toscaparser/tests/data/test_tosca_top_level_error1.yaml new file mode 100644 index 0000000..d35c022 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_tosca_top_level_error1.yaml @@ -0,0 +1,2 @@ +description: > + TOSCA simple profile missing version section.
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/test_tosca_top_level_error2.yaml b/nfvparser/toscaparser/tests/data/test_tosca_top_level_error2.yaml new file mode 100644 index 0000000..b3e80f9 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/test_tosca_top_level_error2.yaml @@ -0,0 +1,11 @@ +tosca_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 + diff --git a/nfvparser/toscaparser/tests/data/topology_template/databasesubsystem.yaml b/nfvparser/toscaparser/tests/data/topology_template/databasesubsystem.yaml new file mode 100644 index 0000000..b6e9c42 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/topology_template/databasesubsystem.yaml @@ -0,0 +1,81 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/topology_template/definitions.yaml b/nfvparser/toscaparser/tests/data/topology_template/definitions.yaml new file mode 100644 index 0000000..ba5eac1 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/topology_template/definitions.yaml @@ -0,0 +1,74 @@ +tosca_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.SoftwareComponent + 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 diff --git a/nfvparser/toscaparser/tests/data/topology_template/queuingsubsystem.yaml b/nfvparser/toscaparser/tests/data/topology_template/queuingsubsystem.yaml new file mode 100644 index 0000000..578aa4a --- /dev/null +++ b/nfvparser/toscaparser/tests/data/topology_template/queuingsubsystem.yaml @@ -0,0 +1,75 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/topology_template/system.yaml b/nfvparser/toscaparser/tests/data/topology_template/system.yaml new file mode 100644 index 0000000..f4e10ae --- /dev/null +++ b/nfvparser/toscaparser/tests/data/topology_template/system.yaml @@ -0,0 +1,62 @@ +tosca_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 + + 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 diff --git a/nfvparser/toscaparser/tests/data/topology_template/transactionsubsystem.yaml b/nfvparser/toscaparser/tests/data/topology_template/transactionsubsystem.yaml new file mode 100644 index 0000000..42e100a --- /dev/null +++ b/nfvparser/toscaparser/tests/data/topology_template/transactionsubsystem.yaml @@ -0,0 +1,88 @@ +tosca_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 + + 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 diff --git a/nfvparser/toscaparser/tests/data/topology_template/validate/queuingsubsystem_invalid_input.yaml b/nfvparser/toscaparser/tests/data/topology_template/validate/queuingsubsystem_invalid_input.yaml new file mode 100644 index 0000000..67ef341 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/topology_template/validate/queuingsubsystem_invalid_input.yaml @@ -0,0 +1,76 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/topology_template/validate/system_invalid_input.yaml b/nfvparser/toscaparser/tests/data/topology_template/validate/system_invalid_input.yaml new file mode 100644 index 0000000..e3cdd71 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/topology_template/validate/system_invalid_input.yaml @@ -0,0 +1,24 @@ +tosca_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 } diff --git a/nfvparser/toscaparser/tests/data/topology_template/validate/system_invalid_missing_output.yaml b/nfvparser/toscaparser/tests/data/topology_template/validate/system_invalid_missing_output.yaml new file mode 100644 index 0000000..2028c38 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/topology_template/validate/system_invalid_missing_output.yaml @@ -0,0 +1,24 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +imports: + - transactionsubsystem_invalid_missing_output.yaml + +topology_template: + description: Test template with invalid missing output. + + 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: + trans: + type: example.TransactionSubsystem + properties: + mq_server_ip: { get_input: mq_server_ip } + receiver_port: { get_input: mq_server_port } diff --git a/nfvparser/toscaparser/tests/data/topology_template/validate/system_invalid_unknown_output.yaml b/nfvparser/toscaparser/tests/data/topology_template/validate/system_invalid_unknown_output.yaml new file mode 100644 index 0000000..de16ca2 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/topology_template/validate/system_invalid_unknown_output.yaml @@ -0,0 +1,24 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +imports: + - transactionsubsystem_invalid_unknown_output.yaml + +topology_template: + description: Test template with invalid unknown output. + + 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: + trans: + type: example.TransactionSubsystem + properties: + mq_server_ip: { get_input: mq_server_ip } + receiver_port: { get_input: mq_server_port } diff --git a/nfvparser/toscaparser/tests/data/topology_template/validate/test_example_app_substitution_mappings.yaml b/nfvparser/toscaparser/tests/data/topology_template/validate/test_example_app_substitution_mappings.yaml new file mode 100644 index 0000000..718022a --- /dev/null +++ b/nfvparser/toscaparser/tests/data/topology_template/validate/test_example_app_substitution_mappings.yaml @@ -0,0 +1,70 @@ +tosca_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 + + 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 diff --git a/nfvparser/toscaparser/tests/data/topology_template/validate/test_substitution_mappings_invalid_output.yaml b/nfvparser/toscaparser/tests/data/topology_template/validate/test_substitution_mappings_invalid_output.yaml new file mode 100644 index 0000000..ef21811 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/topology_template/validate/test_substitution_mappings_invalid_output.yaml @@ -0,0 +1,31 @@ +tosca_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 ] }
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/topology_template/validate/test_substitution_mappings_valid_output.yaml b/nfvparser/toscaparser/tests/data/topology_template/validate/test_substitution_mappings_valid_output.yaml new file mode 100644 index 0000000..766ca87 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/topology_template/validate/test_substitution_mappings_valid_output.yaml @@ -0,0 +1,31 @@ +tosca_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 ] }
\ No newline at end of file diff --git a/nfvparser/toscaparser/tests/data/topology_template/validate/transactionsubsystem_invalid_missing_output.yaml b/nfvparser/toscaparser/tests/data/topology_template/validate/transactionsubsystem_invalid_missing_output.yaml new file mode 100644 index 0000000..c92e5f8 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/topology_template/validate/transactionsubsystem_invalid_missing_output.yaml @@ -0,0 +1,92 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + This template is a test template which contains invalid output + needed for 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. + But this template misses output of receiver_port which is not + defined in node type of example.TransactionSubsystem, so it will + be validated error for substitution mappings. + +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 + + 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 ] } + + # This output is invalid if comment receiver_out out only for + # substituion mappings +# receiver_port: +# description: receiver_port of the message receiver application +# value: { get_input: receiver_port } diff --git a/nfvparser/toscaparser/tests/data/topology_template/validate/transactionsubsystem_invalid_unknown_output.yaml b/nfvparser/toscaparser/tests/data/topology_template/validate/transactionsubsystem_invalid_unknown_output.yaml new file mode 100644 index 0000000..ffca24b --- /dev/null +++ b/nfvparser/toscaparser/tests/data/topology_template/validate/transactionsubsystem_invalid_unknown_output.yaml @@ -0,0 +1,94 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + This template is a test template which contains invalid output + needed for 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. + But this template contains output of my_cpu_output which is not + defined in node type of example.TransactionSubsystem, so it will + be validated error for substitution mappings. + +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 + + 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 } + + my_cpu_output: + description: this output is only invalid for substitution mappings + value: { get_input: my_cpus } diff --git a/nfvparser/toscaparser/tests/data/tosca_elk.yaml b/nfvparser/toscaparser/tests/data/tosca_elk.yaml new file mode 100644 index 0000000..6fc1756 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/tosca_elk.yaml @@ -0,0 +1,217 @@ +tosca_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://<IP>: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 ] } diff --git a/nfvparser/toscaparser/tests/data/tosca_helloworld.yaml b/nfvparser/toscaparser/tests/data/tosca_helloworld.yaml new file mode 100644 index 0000000..5b913ff --- /dev/null +++ b/nfvparser/toscaparser/tests/data/tosca_helloworld.yaml @@ -0,0 +1,23 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/tosca_imports_validation.yaml b/nfvparser/toscaparser/tests/data/tosca_imports_validation.yaml new file mode 100644 index 0000000..257beb8 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/tosca_imports_validation.yaml @@ -0,0 +1,45 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/tosca_load_balancer.yaml b/nfvparser/toscaparser/tests/data/tosca_load_balancer.yaml new file mode 100644 index 0000000..2fcdb48 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/tosca_load_balancer.yaml @@ -0,0 +1,75 @@ +# Note: this could eventually be translated to a Neutron Load Balancer +# However, in Heat/HOT the preferred way of doing this is creating an Autoscale Group +# +#heat_template_version: 2015-04-30 ... +#resources: +#load_bal_resource: +# type: OS::Neutron::Pool +# properties: +# admin_state_up: Boolean +# description: String +# lb_method: String +# monitors: [Value, Value, ...] +# name: String +# protocol: String +# provider: String +# subnet: String +# vip: { +# "description": String, +# "name": String, +# "connection_limit": Integer, +# "protocol_port": Integer, +# "subnet": String, +# "address": String, +# "admin_state_up": Boolean, +# "session_persistence": +# { +# "cookie_name": String, +# "type": String} +# } +# +# example from: https://gist.github.com/therve/9231701 +# +#resources: +# web_server_group: +# type: AWS::AutoScaling::AutoScalingGroup +# properties: +# AvailabilityZones: [nova] +# LaunchConfigurationName: {get_resource: launch_config} +# MinSize: 1 +# MaxSize: 3 +# LoadBalancerNames: +# - {get_resource: mylb} +# mypool: +# type: OS::Neutron::Pool +# properties: +# protocol: HTTP +# monitors: [{get_resource: mymonitor}] +# subnet_id: {get_param: subnet_id} +# lb_method: ROUND_ROBIN +# vip: +# protocol_port: 80 +# mylb: +# type: OS::Neutron::LoadBalancer +# properties: +# protocol_port: 80 +# pool_id: {get_resource: mypool} + +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: Template for deploying a load balancer with predefined endpoint properties. + +topology_template: + node_templates: + simple_load_balancer: + type: tosca.nodes.LoadBalancer + capabilities: + # properties: + # algorithm: DEFAULT (define new keyword, ROUND_ROBIN?) + # Client, public facing endpoint + client: + properties: + network_name: PUBLIC + floating: true + dns_name: http://mycompany.com/ + diff --git a/nfvparser/toscaparser/tests/data/tosca_repositories_test_definition.yaml b/nfvparser/toscaparser/tests/data/tosca_repositories_test_definition.yaml new file mode 100644 index 0000000..0001d06 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/tosca_repositories_test_definition.yaml @@ -0,0 +1,26 @@ +tosca_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 diff --git a/nfvparser/toscaparser/tests/data/tosca_single_instance_wordpress.yaml b/nfvparser/toscaparser/tests/data/tosca_single_instance_wordpress.yaml new file mode 100644 index 0000000..9e686ab --- /dev/null +++ b/nfvparser/toscaparser/tests/data/tosca_single_instance_wordpress.yaml @@ -0,0 +1,121 @@ +tosca_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] } diff --git a/nfvparser/toscaparser/tests/data/tosca_single_instance_wordpress_with_local_abspath_import.yaml b/nfvparser/toscaparser/tests/data/tosca_single_instance_wordpress_with_local_abspath_import.yaml new file mode 100644 index 0000000..6caac11 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/tosca_single_instance_wordpress_with_local_abspath_import.yaml @@ -0,0 +1,122 @@ +tosca_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] } diff --git a/nfvparser/toscaparser/tests/data/tosca_single_instance_wordpress_with_url_import.yaml b/nfvparser/toscaparser/tests/data/tosca_single_instance_wordpress_with_url_import.yaml new file mode 100644 index 0000000..e5f1580 --- /dev/null +++ b/nfvparser/toscaparser/tests/data/tosca_single_instance_wordpress_with_url_import.yaml @@ -0,0 +1,120 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 + +description: > + TOSCA simple profile with wordpress, web server and mysql on the same server. + +imports: + - https://raw.githubusercontent.com/openstack/heat-translator/master/translator/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] } diff --git a/nfvparser/toscaparser/tests/data/tosca_test_get_operation_output.yaml b/nfvparser/toscaparser/tests/data/tosca_test_get_operation_output.yaml new file mode 100644 index 0000000..f47f33c --- /dev/null +++ b/nfvparser/toscaparser/tests/data/tosca_test_get_operation_output.yaml @@ -0,0 +1,19 @@ +tosca_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]} |