Create test model 98/134998/10
authorJvD_Ericsson <jeff.van.dam@est.tech>
Tue, 13 Jun 2023 07:48:16 +0000 (08:48 +0100)
committerVasyl Razinkov <vasyl.razinkov@est.tech>
Thu, 29 Jun 2023 19:59:09 +0000 (19:59 +0000)
Issue-ID: SDC-4471
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: I49d6721b9c60cf62ddcdc47beed70db08ba0a031

30 files changed:
catalog-be/src/main/resources/scripts/sdcBePy/common/normative/toscaTypes.py
catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/node_type_client.py
integration-tests/.gitignore [new file with mode: 0644]
integration-tests/integration-tests-init/Dockerfile [new file with mode: 0644]
integration-tests/integration-tests-init/chef-repo/cookbooks/sdc-integration-tests-setup/attributes/default.rb [new file with mode: 0644]
integration-tests/integration-tests-init/chef-repo/cookbooks/sdc-integration-tests-setup/recipes/1_check_Backend.rb [new file with mode: 0644]
integration-tests/integration-tests-init/chef-repo/cookbooks/sdc-integration-tests-setup/recipes/2_import_Normatives.rb [new file with mode: 0644]
integration-tests/integration-tests-init/chef-solo/LICENSE [new file with mode: 0644]
integration-tests/integration-tests-init/chef-solo/README.md [new file with mode: 0644]
integration-tests/integration-tests-init/chef-solo/chefignore [new file with mode: 0644]
integration-tests/integration-tests-init/chef-solo/cookbooks/README.md [new file with mode: 0644]
integration-tests/integration-tests-init/chef-solo/data_bags/README.md [new file with mode: 0644]
integration-tests/integration-tests-init/chef-solo/environments/README.md [new file with mode: 0644]
integration-tests/integration-tests-init/chef-solo/importNormatives.json [new file with mode: 0644]
integration-tests/integration-tests-init/chef-solo/importNormatives.rb [new file with mode: 0644]
integration-tests/integration-tests-init/chef-solo/roles/README.md [new file with mode: 0644]
integration-tests/integration-tests-init/chef-solo/roles/integration-tests-setup.json [new file with mode: 0644]
integration-tests/integration-tests-init/chef-solo/solo.json [new file with mode: 0644]
integration-tests/integration-tests-init/chef-solo/solo.rb [new file with mode: 0644]
integration-tests/integration-tests-init/startup.sh [new file with mode: 0644]
integration-tests/pom.xml
integration-tests/src/main/assembly/normatives.xml [new file with mode: 0644]
integration-tests/src/main/assembly/replace.xml [new file with mode: 0644]
integration-tests/src/main/resources/import/tosca/models/init/README.md [new file with mode: 0644]
integration-tests/src/main/resources/import/tosca/models/init/testModel/imports/testModel.yaml [new file with mode: 0644]
integration-tests/src/main/resources/import/tosca/models/init/testModel/payload.json [new file with mode: 0644]
integration-tests/src/main/resources/import/tosca/models/init/testModel/tosca/categories/categoryTypes.yml [new file with mode: 0644]
integration-tests/src/main/resources/import/tosca/models/init/testModel/tosca/data-types/dataTypes.yml [new file with mode: 0644]
integration-tests/src/main/resources/import/tosca/models/init/testModel/tosca/node-types/metadata.json [new file with mode: 0644]
integration-tests/src/main/resources/import/tosca/models/init/testModel/tosca/node-types/nodeTypes.yaml [new file with mode: 0644]

index 9d37c2a..fecc88a 100644 (file)
@@ -1,6 +1,6 @@
 import json
 import zipfile
-
+import os
 import pycurl
 
 from sdcBePy.common.errors import ResourceCreationError
@@ -48,6 +48,8 @@ def _create_normatives_type(file_dir, sdc_be_proxy, types, update_version):
     results = []
     response_codes = _get_response_code()
     for normative_type in types:
+        if not os.path.exists(file_dir):
+            break
         result = _send_request(sdc_be_proxy, file_dir, normative_type, update_version)
         results.append(result)
         if result[1] is None or result[1] not in response_codes:
index 7937002..d241288 100644 (file)
@@ -71,5 +71,4 @@ class NodeTypeClient:
             error_msg = "Failed to import node types '{}'".format(node_type_yaml_path)
             logger.log(error_msg, response_buffer.getvalue())
             raise Exception(error_msg)
-        logger.log("Failed to import node types '{}'".format(node_type_yaml_path))
 
diff --git a/integration-tests/.gitignore b/integration-tests/.gitignore
new file mode 100644 (file)
index 0000000..d084626
--- /dev/null
@@ -0,0 +1,2 @@
+/integration-tests-init/scripts/**
+/integration-tests-init/BE-configuration.yaml.erb
diff --git a/integration-tests/integration-tests-init/Dockerfile b/integration-tests/integration-tests-init/Dockerfile
new file mode 100644 (file)
index 0000000..76e502a
--- /dev/null
@@ -0,0 +1,55 @@
+FROM onap/integration-python:8.0.0
+
+USER root
+
+# Needed for pycurl
+ENV PYCURL_SSL_LIBRARY=openssl
+
+# Install packages only needed for building
+RUN apk update && \
+    apk add binutils jq libpng && \
+    apk add --no-cache \
+        libcurl \
+        ruby && \
+    apk add --no-cache --virtual .build-dependencies \
+        libressl-dev \
+        ruby-dev \
+        libffi-dev \
+        libxml2-dev \
+        build-base \
+        curl-dev && \
+    # needed libcurl to install correctly \
+    python -m pip install --upgrade pip \
+    pip install 'pycurl==7.44.1' &&  \
+    set -ex && \
+    gem update --system --no-document && \
+    gem install --no-update-sources public_suffix:4.0.7 multipart-post:2.2.0 etc:1.3.0 bundler:2.3.26 chef:13.8.5 berkshelf:6.3.1 io-console:0.4.6 webrick --no-document && \
+    apk del .build-dependencies && \
+    gem cleanup
+
+ENV ONAP_LOG=/home/onap/logs
+RUN mkdir $ONAP_LOG && chown onap:onap $ONAP_LOG
+
+# user/group are the same as in integration/docker/onap-python base image
+ENV user=onap group=onap
+
+USER onap
+
+# user/group args are inherited from base_sdc-python base image
+COPY --chown=onap:onap scripts /home/onap/scripts
+
+RUN chmod 770 -R /home/onap/scripts && \
+    cd /home/onap/scripts && \
+    python setup.py install --user
+
+ENV PATH=$PATH:/home/onap/.local/bin
+
+COPY --chown=onap:onap chef-solo /home/onap/chef-solo/
+COPY --chown=onap:onap chef-repo/cookbooks /home/onap/chef-solo/cookbooks/
+COPY --chown=onap:onap startup.sh /home/onap/
+
+RUN chmod 770 /home/onap/startup.sh
+
+WORKDIR /home/onap/
+
+ENTRYPOINT /home/${user}/startup.sh
diff --git a/integration-tests/integration-tests-init/chef-repo/cookbooks/sdc-integration-tests-setup/attributes/default.rb b/integration-tests/integration-tests-init/chef-repo/cookbooks/sdc-integration-tests-setup/attributes/default.rb
new file mode 100644 (file)
index 0000000..6828853
--- /dev/null
@@ -0,0 +1,5 @@
+#BasicAuth
+default['basic_auth']['enabled'] = true
+default['basic_auth'][:user_name] = "testName"
+default['basic_auth'][:user_pass] = "testPass"
+
diff --git a/integration-tests/integration-tests-init/chef-repo/cookbooks/sdc-integration-tests-setup/recipes/1_check_Backend.rb b/integration-tests/integration-tests-init/chef-repo/cookbooks/sdc-integration-tests-setup/recipes/1_check_Backend.rb
new file mode 100644 (file)
index 0000000..2e479e0
--- /dev/null
@@ -0,0 +1,27 @@
+require 'base64'
+if node['disableHttp']
+  protocol = "https"
+  https_flag = "--https"
+  be_port = node['BE']['https_port']
+else
+  protocol = "http"
+  https_flag = ""
+  be_port = node['BE']['http_port']
+end
+
+if node['basic_auth']
+  basic_auth_enabled = node['basic_auth']['enabled']
+  basic_auth_user = node['basic_auth']['user_name']
+  basic_auth_pass = node['basic_auth']['user_pass']
+  if basic_auth_enabled
+    basic_auth_config = "--header " + Base64.strict_encode64(basic_auth_user + ":" + basic_auth_pass)
+  else
+    # set default user configuration file
+    basic_auth_config = ""
+  end
+end
+
+execute "executing-check_backend_health" do
+  command "sdccheckbackend -i #{node['Nodes']['BE']} -p #{be_port} #{basic_auth_config} #{https_flag}"
+  action :run
+end
\ No newline at end of file
diff --git a/integration-tests/integration-tests-init/chef-repo/cookbooks/sdc-integration-tests-setup/recipes/2_import_Normatives.rb b/integration-tests/integration-tests-init/chef-repo/cookbooks/sdc-integration-tests-setup/recipes/2_import_Normatives.rb
new file mode 100644 (file)
index 0000000..be32e98
--- /dev/null
@@ -0,0 +1,33 @@
+require 'base64'
+be_ip=node['Nodes'][:BE]
+
+if node['disableHttp']
+  protocol = "https"
+  be_port = node['BE']['https_port']
+  param="-i #{be_ip} -p #{be_port} --https"
+else
+  protocol = "http"
+  be_port = node['BE']['http_port']
+  param="-i #{be_ip} -p #{be_port}"
+end
+
+if node['basic_auth']
+  basic_auth_enabled = node['basic_auth']['enabled']
+  basic_auth_user = node['basic_auth']['user_name']
+  basic_auth_pass = node['basic_auth']['user_pass']
+  if basic_auth_enabled
+    basic_auth_config = "--header " + Base64.strict_encode64(basic_auth_user + ":" + basic_auth_pass)
+  else
+    # set default user configuration file
+    basic_auth_config = ""
+  end
+end
+cookbook_file "/var/tmp/normatives.tar.gz" do
+  source "normatives.tar.gz"
+end
+
+execute "create-jetty-modules" do
+  command "set -ex && tar -xvf normatives.tar.gz && cd /var/tmp/normatives/import/tosca && sdcinit #{param} #{basic_auth_config} > #{ENV['ONAP_LOG']}/init.log"
+  cwd "/var/tmp/"
+  action :run
+end
diff --git a/integration-tests/integration-tests-init/chef-solo/LICENSE b/integration-tests/integration-tests-init/chef-solo/LICENSE
new file mode 100644 (file)
index 0000000..11069ed
--- /dev/null
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+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.
diff --git a/integration-tests/integration-tests-init/chef-solo/README.md b/integration-tests/integration-tests-init/chef-solo/README.md
new file mode 100644 (file)
index 0000000..ddb0fda
--- /dev/null
@@ -0,0 +1,37 @@
+Deprecated
+==========
+
+Use of this repository is deprecated. We recommend using the `chef generate repo` command that comes with [ChefDK](http://downloads.chef.io/chef-dk/).
+
+Overview
+========
+
+Every Chef installation needs a Chef Repository. This is the place where cookbooks, roles, config files and other artifacts for managing systems with Chef will live. We strongly recommend storing this repository in a version control system such as Git and treat it like source code.
+
+While we prefer Git, and make this repository available via GitHub, you are welcome to download a tar or zip archive and use your favorite version control system to manage the code.
+
+Repository Directories
+======================
+
+This repository contains several directories, and each directory contains a README file that describes what it is for in greater detail, and how to use it for managing your systems with Chef.
+
+* `cookbooks/` - Cookbooks you download or create.
+* `data_bags/` - Store data bags and items in .json in the repository.
+* `roles/` - Store roles in .rb or .json in the repository.
+* `environments/` - Store environments in .rb or .json in the repository.
+
+Configuration
+=============
+
+The repository contains a knife configuration file.
+
+* .chef/knife.rb
+
+The knife configuration file `.chef/knife.rb` is a repository specific configuration file for knife. If you're using Hosted Chef, you can download one for your organization from the management console. If you're using the Open Source Chef Server, you can generate a new one with `knife configure`. For more information about configuring Knife, see the Knife documentation.
+
+https://docs.chef.io/knife.html
+
+Next Steps
+==========
+
+Read the README file in each of the subdirectories for more information about what goes in those directories.
diff --git a/integration-tests/integration-tests-init/chef-solo/chefignore b/integration-tests/integration-tests-init/chef-solo/chefignore
new file mode 100644 (file)
index 0000000..ba30af6
--- /dev/null
@@ -0,0 +1,11 @@
+# Put files/directories that should be ignored in this file.
+# Lines that start with '# ' are comments.
+
+# emacs
+*~
+
+# vim
+*.sw[a-z]
+
+# subversion
+*/.svn/*
diff --git a/integration-tests/integration-tests-init/chef-solo/cookbooks/README.md b/integration-tests/integration-tests-init/chef-solo/cookbooks/README.md
new file mode 100644 (file)
index 0000000..86ea46b
--- /dev/null
@@ -0,0 +1,54 @@
+This directory contains the cookbooks used to configure systems in your infrastructure with Chef.
+
+Knife needs to be configured to know where the cookbooks are located with the `cookbook_path` setting. If this is not set, then several cookbook operations will fail to work properly.
+
+    cookbook_path ["./cookbooks"]
+
+This setting tells knife to look for the cookbooks directory in the present working directory. This means the knife cookbook subcommands need to be run in the `chef-repo` directory itself. To make sure that the cookbooks can be found elsewhere inside the repository, use an absolute path. This is a Ruby file, so something like the following can be used:
+
+    current_dir = File.dirname(__FILE__)
+    cookbook_path ["#{current_dir}/../cookbooks"]
+
+Which will set `current_dir` to the location of the knife.rb file itself (e.g. `~/chef-repo/.chef/knife.rb`).
+
+Configure knife to use your preferred copyright holder, email contact and license. Add the following lines to `.chef/knife.rb`.
+
+    cookbook_copyright "Example, Com."
+    cookbook_email     "cookbooks@example.com"
+    cookbook_license   "apachev2"
+
+Supported values for `cookbook_license` are "apachev2", "mit","gplv2","gplv3",  or "none". These settings are used to prefill comments in the default recipe, and the corresponding values in the metadata.rb. You are free to change the the comments in those files.
+
+Create new cookbooks in this directory with Knife.
+
+    knife cookbook create COOKBOOK
+
+This will create all the cookbook directory components. You don't need to use them all, and can delete the ones you don't need. It also creates a README file, metadata.rb and default recipe.
+
+You can also download cookbooks directly from the Opscode Cookbook Site. There are two subcommands to help with this depending on what your preference is.
+
+The first and recommended method is to use a vendor branch if you're using Git. This is automatically handled with Knife.
+
+    knife cookbook site install COOKBOOK
+
+This will:
+
+* Download the cookbook tarball from cookbooks.opscode.com.
+* Ensure its on the git master branch.
+* Checks for an existing vendor branch, and creates if it doesn't.
+* Checks out the vendor branch (chef-vendor-COOKBOOK).
+* Removes the existing (old) version.
+* Untars the cookbook tarball it downloaded in the first step.
+* Adds the cookbook files to the git index and commits.
+* Creates a tag for the version downloaded.
+* Checks out the master branch again.
+* Merges the cookbook into master.
+* Repeats the above for all the cookbooks dependencies, downloading them from the community site
+
+The last step will ensure that any local changes or modifications you have made to the cookbook are preserved, so you can keep your changes through upstream updates.
+
+If you're not using Git, use the site download subcommand to download the tarball.
+
+    knife cookbook site download COOKBOOK
+
+This creates the COOKBOOK.tar.gz from in the current directory (e.g., `~/chef-repo`). We recommend following a workflow similar to the above for your version control tool.
diff --git a/integration-tests/integration-tests-init/chef-solo/data_bags/README.md b/integration-tests/integration-tests-init/chef-solo/data_bags/README.md
new file mode 100644 (file)
index 0000000..0c15a39
--- /dev/null
@@ -0,0 +1,63 @@
+Data Bags
+---------
+
+This directory contains directories of the various data bags you create for your infrastructure. Each subdirectory corresponds to a data bag on the Chef Server, and contains JSON files of the items that go in the bag.
+
+First, create a directory for the data bag.
+
+    mkdir data_bags/BAG
+
+Then create the JSON files for items that will go into that bag.
+
+    $EDITOR data_bags/BAG/ITEM.json
+
+The JSON for the ITEM must contain a key named "id" with a value equal to "ITEM". For example,
+
+    {
+      "id": "foo"
+    }
+
+Next, create the data bag on the Chef Server.
+
+    knife data bag create BAG
+
+Then upload the items in the data bag's directory to the Chef Server.
+
+    knife data bag from file BAG ITEM.json
+
+
+Encrypted Data Bags
+-------------------
+
+Added in Chef 0.10, encrypted data bags allow you to encrypt the contents of your data bags. The content of attributes will no longer be searchable. To use encrypted data bags, first you must have or create a secret key.
+
+    openssl rand -base64 512 > secret_key
+
+You may use this secret_key to add items to a data bag during a create.
+
+    knife data bag create --secret-file secret_key passwords mysql
+
+You may also use it when adding ITEMs from files,
+
+    knife data bag create passwords
+    knife data bag from file passwords data_bags/passwords/mysql.json --secret-file secret_key
+
+The JSON for the ITEM must contain a key named "id" with a value equal to "ITEM" and the contents will be encrypted when uploaded. For example,
+
+    {
+      "id": "mysql",
+      "password": "abc123"
+    }
+
+Without the secret_key, the contents are encrypted.
+
+    knife data bag show passwords mysql
+    id:        mysql
+    password:  2I0XUUve1TXEojEyeGsjhw==
+
+Use the secret_key to view the contents.
+
+    knife data bag show passwords mysql --secret-file secret_key
+    id:        mysql
+    password:  abc123
+
diff --git a/integration-tests/integration-tests-init/chef-solo/environments/README.md b/integration-tests/integration-tests-init/chef-solo/environments/README.md
new file mode 100644 (file)
index 0000000..50ac48d
--- /dev/null
@@ -0,0 +1,5 @@
+Requires Chef 0.10.0+.
+
+This directory is for Ruby DSL and JSON files for environments. For more information see the Chef wiki page:
+
+http://docs.chef.io/environments.html
diff --git a/integration-tests/integration-tests-init/chef-solo/importNormatives.json b/integration-tests/integration-tests-init/chef-solo/importNormatives.json
new file mode 100644 (file)
index 0000000..f5c9276
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "run_list": [ "recipe[sdc-normatives::import_Normatives]" ]
+}
+
diff --git a/integration-tests/integration-tests-init/chef-solo/importNormatives.rb b/integration-tests/integration-tests-init/chef-solo/importNormatives.rb
new file mode 100644 (file)
index 0000000..2693926
--- /dev/null
@@ -0,0 +1,16 @@
+root = File.absolute_path(File.dirname(__FILE__))
+file_cache_path root
+cookbook_path root + '/cookbooks'
+json_attribs root + '/importNormatives.json'
+checksum_path root + '/checksums'
+data_bag_path root + '/data_bags'
+environment_path root + '/environments'
+file_backup_path root + '/backup'
+file_cache_path root + '/cache'
+log_level :info
+log_location STDOUT
+rest_timeout 300
+role_path root + '/roles'
+syntax_check_cache_path
+umask 0022
+verbose_logging nil
diff --git a/integration-tests/integration-tests-init/chef-solo/roles/README.md b/integration-tests/integration-tests-init/chef-solo/roles/README.md
new file mode 100644 (file)
index 0000000..b0ee0b4
--- /dev/null
@@ -0,0 +1,16 @@
+Create roles here, in either the Role Ruby DSL (.rb) or JSON (.json) files. To install roles on the server, use knife.
+
+For example, create `roles/base_example.rb`:
+
+    name "base_example"
+    description "Example base role applied to all nodes."
+    # List of recipes and roles to apply. Requires Chef 0.8, earlier versions use 'recipes()'.
+    #run_list()
+    # Attributes applied if the node doesn't have it set already.
+    #default_attributes()
+    # Attributes applied no matter what the node has set already.
+    #override_attributes()
+
+Then upload it to the Chef Server:
+    
+    knife role from file roles/base_example.rb
diff --git a/integration-tests/integration-tests-init/chef-solo/roles/integration-tests-setup.json b/integration-tests/integration-tests-init/chef-solo/roles/integration-tests-setup.json
new file mode 100644 (file)
index 0000000..e0ca937
--- /dev/null
@@ -0,0 +1,20 @@
+{
+  "name": "integration-tests",
+  "description": "Installation application - integrationTest",
+  "json_class": "Chef::Role",
+  "default_attributes": {
+
+  },
+  "override_attributes": {
+
+  },
+  "chef_type": "role",
+  "run_list": [
+    "recipe[sdc-integration-tests-setup::1_check_Backend]",
+    "recipe[sdc-integration-tests-setup::2_import_Normatives]"
+
+  ],
+  "env_run_lists": {
+  }
+}
+
diff --git a/integration-tests/integration-tests-init/chef-solo/solo.json b/integration-tests/integration-tests-init/chef-solo/solo.json
new file mode 100644 (file)
index 0000000..537de66
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "run_list": [ "role[integration-tests-setup]" ]
+}
+
diff --git a/integration-tests/integration-tests-init/chef-solo/solo.rb b/integration-tests/integration-tests-init/chef-solo/solo.rb
new file mode 100644 (file)
index 0000000..06c1af4
--- /dev/null
@@ -0,0 +1,16 @@
+root = File.absolute_path(File.dirname(__FILE__))
+file_cache_path root
+cookbook_path root + '/cookbooks'
+json_attribs root + '/solo.json'
+checksum_path root + '/checksums'
+data_bag_path root + '/data_bags'
+environment_path root + '/environments'
+file_backup_path root + '/backup'
+file_cache_path root + '/cache'
+log_level :info
+log_location STDOUT
+rest_timeout 300
+role_path root + '/roles'
+syntax_check_cache_path
+umask 0022
+verbose_logging nil
diff --git a/integration-tests/integration-tests-init/startup.sh b/integration-tests/integration-tests-init/startup.sh
new file mode 100644 (file)
index 0000000..e216341
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd /home/"${user}"/chef-solo || exit $?
+chef-solo -c solo.rb -E "${ENVNAME}"
\ No newline at end of file
index a2a41db..0db0050 100644 (file)
@@ -52,6 +52,7 @@ limitations under the License.
         <it.docker.version>latest</it.docker.version>
         <it.ui.firefox.version>86.0</it.ui.firefox.version>
         <it.helm-validator.disabled>true</it.helm-validator.disabled>
+        <it.test-model.disabled>true</it.test-model.disabled>
         <it.helm-validator.version>1.3.1</it.helm-validator.version>
 
         <!-- parser-->
@@ -439,6 +440,72 @@ limitations under the License.
                             </resources>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>copy-normatives</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>
+                                integration-tests-init/chef-repo/cookbooks/sdc-integration-tests-setup/files/default
+                            </outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${project.build.directory}</directory>
+                                    <includes>
+                                        <include>normatives.tar.gz</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>copy-sdc-be-py</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>
+                                integration-tests-init/
+                            </outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>
+                                        ${project.parent.basedir}/catalog-be/src/main/resources/
+                                    </directory>
+                                    <includes>
+                                        <include>scripts/sdcBePy/**</include>
+                                        <inculde>scripts/setup.py</inculde>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>copy-be-configuration</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <overwrite>true</overwrite>
+                            <outputDirectory>
+                                integration-tests-init/
+                            </outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>
+                                        ${project.parent.basedir}/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/
+                                    </directory>
+                                    <includes>
+                                        <include>BE-configuration.yaml.erb</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
             <plugin>
@@ -500,6 +567,20 @@ limitations under the License.
                             <goal>run</goal>
                         </goals>
                     </execution>
+                    <execution>
+                        <id>add-test-model-to-config</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <configuration>
+                            <target name="replace config" unless="${it.test-model.disabled}">
+                                <ant antfile="src/main/assembly/replace.xml">
+                                    <target name="BE-configuration"/>
+                                </ant>
+                            </target>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
             <plugin>
@@ -520,6 +601,53 @@ limitations under the License.
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <version>${mvn.assembly.version}</version>
+                <executions>
+                    <execution>
+                        <id>normatives</id>
+                        <phase>prepare-package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <finalName>normatives</finalName>
+                            <appendAssemblyId>false</appendAssemblyId>
+                            <descriptors>
+                                <descriptor>src/main/assembly/normatives.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-clean-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>clean.test.folder</id>
+                        <phase>clean</phase>
+                        <goals>
+                            <goal>clean</goal>
+                        </goals>
+                        <configuration>
+                            <filesets>
+                                <fileset>
+                                    <directory>
+                                        integration-tests-init/chef-repo/cookbooks/sdc-integration-tests-setup/files/default
+                                    </directory>
+                                    <followSymlinks>false</followSymlinks>
+                                    <includes>
+                                        <include>normatives.tar.gz</include>
+                                    </includes>
+                                </fileset>
+                            </filesets>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>io.fabric8</groupId>
                 <artifactId>docker-maven-plugin</artifactId>
@@ -727,6 +855,9 @@ limitations under the License.
                                 <hostname>sdc-BE</hostname>
                                 <volumes>
                                     <bind>
+                                        <volume>
+                                            ${project.basedir}/integration-tests-init/BE-configuration.yaml.erb:/app/jetty/chef-solo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
+                                        </volume>
                                         <volume>${it.chef.config}:/app/jetty/chef-solo/environments</volume>
                                         <volume>${it.shared.volume}:/app/jetty/logs</volume>
                                         <volume>
@@ -875,7 +1006,6 @@ limitations under the License.
                                 </network>
                             </run>
                         </image>
-
                         <image>
                             <name>selenium/standalone-firefox:${it.ui.firefox.version}</name>
                             <alias>firefox-standalone</alias>
@@ -946,9 +1076,59 @@ limitations under the License.
                                 </network>
                             </run>
                         </image>
+                        <image>
+                            <name>${docker.namespace}/sdc-integration-tests-init</name>
+                            <alias>integration-tests-init</alias>
+                            <build>
+                                <cleanup>try</cleanup>
+                                <dockerFileDir>${project.basedir}/integration-tests-init</dockerFileDir>
+                                <tags>
+                                    <tag>latest</tag>
+                                    <tag>
+                                        ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest
+                                    </tag>
+                                    <tag>
+                                        ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-${maven.build.timestamp}
+                                    </tag>
+                                </tags>
+                            </build>
+                            <run>
+                                <skip>${it.test-model.disabled}</skip>
+                                <dependsOn>
+                                    <container>sdc-backend-init</container>
+                                </dependsOn>
+                                <env>
+                                    <ENVNAME>${it.env.name}</ENVNAME>
+                                </env>
+                                <hostname>integration-tests-init</hostname>
+                                <volumes>
+                                    <bind>
+                                        <volume>
+                                            ${it.chef.config}:/home/onap/chef-solo/environments
+                                        </volume>
+                                    </bind>
+                                </volumes>
+                                <wait>
+                                    <time>660000</time>
+                                    <log>Chef Client finished</log>
+                                </wait>
+                                <network>
+                                    <mode>custom</mode>
+                                    <name>sdc-network</name>
+                                    <alias>sdc-integration-tests-init</alias>
+                                </network>
+                            </run>
+                        </image>
                     </images>
                 </configuration>
                 <executions>
+                    <execution>
+                        <id>docker-build-for-it</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>build</goal>
+                        </goals>
+                    </execution>
                     <execution>
                         <id>docker-start-for-it</id>
                         <phase>pre-integration-test</phase>
@@ -965,7 +1145,6 @@ limitations under the License.
                     </execution>
                 </executions>
             </plugin>
-
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
@@ -973,7 +1152,6 @@ limitations under the License.
                     <skip>true</skip>
                 </configuration>
             </plugin>
-
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-failsafe-plugin</artifactId>
@@ -1016,17 +1194,25 @@ limitations under the License.
         </plugins>
     </build>
     <profiles>
+        <profile>
+            <id>add-test-model</id>
+            <properties>
+                <it.test-model.disabled>false</it.test-model.disabled>
+            </properties>
+        </profile>
         <profile>
             <id>all-for-integration-tests-only</id>
             <properties>
                 <surefire.skip.tests>true</surefire.skip.tests>
                 <skipTest>false</skipTest>
+                <it.test-model.disabled>false</it.test-model.disabled>
             </properties>
         </profile>
         <profile>
             <id>integration-tests-with-helm-validator</id>
             <properties>
                 <it.helm-validator.disabled>false</it.helm-validator.disabled>
+                <it.test-model.disabled>false</it.test-model.disabled>
             </properties>
             <build>
                 <plugins>
diff --git a/integration-tests/src/main/assembly/normatives.xml b/integration-tests/src/main/assembly/normatives.xml
new file mode 100644 (file)
index 0000000..6f78bba
--- /dev/null
@@ -0,0 +1,14 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+  <id>bin</id>
+  <formats>
+    <format>tar.gz</format>
+  </formats>
+  <fileSets>  
+       <fileSet>
+               <directory>src/main/resources/import</directory>
+        <outputDirectory>import</outputDirectory>
+       </fileSet>
+  </fileSets>
+</assembly>
diff --git a/integration-tests/src/main/assembly/replace.xml b/integration-tests/src/main/assembly/replace.xml
new file mode 100644 (file)
index 0000000..77e9c41
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<project name="stack_overflow">
+    <target name ="BE-configuration">
+        <echo>********** Replacing BE-configuration to add TEST service config *************</echo>
+        <replaceregexp file="integration-tests-init/BE-configuration.yaml.erb" match="serviceBaseNodeTypes:">
+            <substitution expression="serviceBaseNodeTypes:${line.separator}  TEST service:${line.separator}    required: true${line.separator}    baseTypes:${line.separator}      - tosca.nodes.nfv.testNodeComplex${line.separator}    doNotExtendBaseType: true"/>
+        </replaceregexp>
+    </target>
+</project>
\ No newline at end of file
diff --git a/integration-tests/src/main/resources/import/tosca/models/init/README.md b/integration-tests/src/main/resources/import/tosca/models/init/README.md
new file mode 100644 (file)
index 0000000..d4d1a36
--- /dev/null
@@ -0,0 +1,26 @@
+This folder purpose is to contain any models that needs to be created during the first 
+initialization of the system (install).
+
+```bash
+├── init
+│   ├── <model_1_to_create>
+│   │   ├── payload.json
+│   │   ├── imports
+│   │   │   ├── **/*.yaml
+[...]
+│   ├── <model_n_to_create>
+│   │   ├── payload.json
+│   │   ├── imports
+│   │   │   ├── **/*.yaml
+```
+
+The model folder name is irrelevant to indicate which model should be created. This information must
+be provided in the payload.json contained within the model folder.
+
+The content of the payload.json for the model with name "ETSI SOL001 v2.5.1" is expected to be:
+```json
+{
+  "name": "ETSI SOL001 v2.5.1"
+}
+```
+
diff --git a/integration-tests/src/main/resources/import/tosca/models/init/testModel/imports/testModel.yaml b/integration-tests/src/main/resources/import/tosca/models/init/testModel/imports/testModel.yaml
new file mode 100644 (file)
index 0000000..9948231
--- /dev/null
@@ -0,0 +1,222 @@
+tosca_definitions_version: tosca_simple_yaml_1_3
+description: test model types definitions
+
+data_types:
+  tosca.datatypes.test.testDataTypeSimple:
+    derived_from: tosca.datatypes.Root
+    description: A simple data type used for testing
+    properties:
+      str_prop:
+        type: string
+        required: true
+      int_prop:
+        type: integer
+        required: true
+      timestamp_prop:
+        type: timestamp
+        required: true
+      boolean_prop:
+        type: boolean
+        required: true
+      float_prop:
+        type: float
+        required: true
+      json_prop:
+        type: json
+        required: true
+      list_str_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: string
+      list_int_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: integer
+      list_map_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: map
+      map_str_prop:
+        type: map
+        required: true
+        entry_schema:
+          type: string
+      map_int_prop:
+        type: map
+        required: true
+        entry_schema:
+          type: integer
+  tosca.datatypes.test.testDataTypeComplex:
+    derived_from: tosca.datatypes.Root
+    description: A complex data type used for testing
+    properties:
+      str_prop:
+        type: string
+        required: true
+      int_prop:
+        type: integer
+        required: true
+      timestamp_prop:
+        type: timestamp
+        required: true
+      boolean_prop:
+        type: boolean
+        required: true
+      float_prop:
+        type: float
+        required: true
+      json_prop:
+        type: json
+        required: true
+      complex_prop:
+        type: tosca.datatypes.test.testDataTypeSimple
+      list_str_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: string
+      list_int_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: integer
+      list_complex_prop:
+        type: list
+        entry_schema:
+          type: tosca.datatypes.test.testDataTypeSimple
+      list_map_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: map
+      map_str_prop:
+        type: map
+        required: true
+        entry_schema:
+          type: string
+      map_int_prop:
+        type: map
+        required: true
+        entry_schema:
+          type: integer
+      map_complex_prop:
+        type: map
+        required: true
+        entry_schema:
+          type: tosca.datatypes.test.testDataTypeSimple
+node_types:
+  tosca.nodes.test.testWithConstraints:
+    derived_from: tosca.nodes.Root
+    properties:
+      string_prop_with_c:
+        type: string
+        constraints:
+          - valid_values:
+              - abc
+              - def
+  tosca.nodes.test.testNodeSimple:
+    derived_from: tosca.nodes.Root
+    properties:
+      str_prop:
+        type: string
+        required: true
+      int_prop:
+        type: integer
+        required: true
+      timestamp_prop:
+        type: timestamp
+        required: true
+      boolean_prop:
+        type: boolean
+        required: true
+      float_prop:
+        type: float
+        required: true
+      json_prop:
+        type: json
+        required: true
+      list_str_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: string
+      list_int_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: integer
+      list_map_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: map
+      map_str_prop:
+        type: map
+        required: true
+        entry_schema:
+          type: string
+      map_int_prop:
+        type: map
+        required: true
+        entry_schema:
+          type: integer
+  tosca.nodes.test.testNodeComplex:
+    derived_from: tosca.nodes.Root
+    properties:
+      str_prop:
+        type: string
+        required: true
+      int_prop:
+        type: integer
+        required: true
+      timestamp_prop:
+        type: timestamp
+        required: true
+      boolean_prop:
+        type: boolean
+        required: true
+      float_prop:
+        type: float
+        required: true
+      json_prop:
+        type: json
+        required: true
+      complex_prop:
+        type: tosca.datatypes.test.testDataTypeComplex
+      list_str_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: string
+      list_int_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: integer
+      list_complex_prop:
+        type: list
+        entry_schema:
+          type: tosca.datatypes.test.testDataTypeComplex
+      list_map_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: map
+      map_str_prop:
+        type: map
+        required: true
+        entry_schema:
+          type: string
+      map_int_prop:
+        type: map
+        required: true
+        entry_schema:
+          type: integer
+      map_complex_prop:
+        type: map
+        required: true
+        entry_schema:
+          type: tosca.datatypes.test.testDataTypeComplex
diff --git a/integration-tests/src/main/resources/import/tosca/models/init/testModel/payload.json b/integration-tests/src/main/resources/import/tosca/models/init/testModel/payload.json
new file mode 100644 (file)
index 0000000..093326d
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "name": "TEST MODEL",
+  "modelType": "NORMATIVE"
+}
diff --git a/integration-tests/src/main/resources/import/tosca/models/init/testModel/tosca/categories/categoryTypes.yml b/integration-tests/src/main/resources/import/tosca/models/init/testModel/tosca/categories/categoryTypes.yml
new file mode 100644 (file)
index 0000000..18e3e54
--- /dev/null
@@ -0,0 +1,7 @@
+services:
+    Mobility:
+      name: "TEST service"
+      icons: ['network_l_1-3']
+      models: [
+          "TEST MODEL"
+      ]
diff --git a/integration-tests/src/main/resources/import/tosca/models/init/testModel/tosca/data-types/dataTypes.yml b/integration-tests/src/main/resources/import/tosca/models/init/testModel/tosca/data-types/dataTypes.yml
new file mode 100644 (file)
index 0000000..8b55f56
--- /dev/null
@@ -0,0 +1,135 @@
+tosca.datatypes.Root:
+  description: The TOSCA root Data Type all other TOSCA base Data Types derive from
+integer:
+  derived_from: tosca.datatypes.Root
+string:
+  derived_from: tosca.datatypes.Root
+timestamp:
+  derived_from: tosca.datatypes.Root
+boolean:
+  derived_from: tosca.datatypes.Root
+float:
+  derived_from: tosca.datatypes.Root
+range:
+  derived_from: tosca.datatypes.Root
+list:
+  derived_from: tosca.datatypes.Root
+map:
+  derived_from: tosca.datatypes.Root
+json:
+  derived_from: tosca.datatypes.Root
+scalar-unit:
+  derived_from: tosca.datatypes.Root
+scalar-unit.size:
+  derived_from: scalar-unit
+scalar-unit.time:
+  derived_from: scalar-unit
+scalar-unit.frequency:
+  derived_from: scalar-unit
+scalar-unit.bitrate:
+  derived_from: scalar-unit
+tosca.datatypes.test.testDataTypeSimple:
+  derived_from: tosca.datatypes.Root
+  description: A simple data type used for testing
+  properties:
+    str_prop:
+      type: string
+      required: true
+    int_prop:
+      type: integer
+      required: true
+    timestamp_prop:
+      type: timestamp
+      required: true
+    boolean_prop:
+      type: boolean
+      required: true
+    float_prop:
+      type: float
+      required: true
+    json_prop:
+      type: json
+      required: true
+    list_str_prop:
+      type: list
+      required: true
+      entry_schema:
+        type: string
+    list_int_prop:
+      type: list
+      required: true
+      entry_schema:
+        type: integer
+    list_map_prop:
+      type: list
+      required: true
+      entry_schema:
+        type: map
+    map_str_prop:
+      type: map
+      required: true
+      entry_schema:
+        type: string
+    map_int_prop:
+      type: map
+      required: true
+      entry_schema:
+        type: integer
+tosca.datatypes.test.testDataTypeComplex:
+  derived_from: tosca.datatypes.Root
+  description: A complex data type used for testing
+  properties:
+    str_prop:
+      type: string
+      required: true
+    int_prop:
+      type: integer
+      required: true
+    timestamp_prop:
+      type: timestamp
+      required: true
+    boolean_prop:
+      type: boolean
+      required: true
+    float_prop:
+      type: float
+      required: true
+    json_prop:
+      type: json
+      required: true
+    complex_prop:
+      type: tosca.datatypes.test.testDataTypeSimple
+    list_str_prop:
+      type: list
+      required: true
+      entry_schema:
+        type: string
+    list_int_prop:
+      type: list
+      required: true
+      entry_schema:
+        type: integer
+    list_complex_prop:
+      type: list
+      entry_schema:
+        type: tosca.datatypes.test.testDataTypeSimple
+    list_map_prop:
+      type: list
+      required: true
+      entry_schema:
+        type: map
+    map_str_prop:
+      type: map
+      required: true
+      entry_schema:
+        type: string
+    map_int_prop:
+      type: map
+      required: true
+      entry_schema:
+        type: integer
+    map_complex_prop:
+      type: map
+      required: true
+      entry_schema:
+        type: tosca.datatypes.test.testDataTypeSimple
\ No newline at end of file
diff --git a/integration-tests/src/main/resources/import/tosca/models/init/testModel/tosca/node-types/metadata.json b/integration-tests/src/main/resources/import/tosca/models/init/testModel/tosca/node-types/metadata.json
new file mode 100644 (file)
index 0000000..e38dd6c
--- /dev/null
@@ -0,0 +1,91 @@
+{
+  "nodeMetadataList": [
+    {
+      "contactId": "jh0003",
+      "toscaName": "tosca.nodes.Root",
+      "name": "Root",
+      "model": "TEST MODEL",
+      "description": "The TOSCA Node Type all other TOSCA base Node Types derive from",
+      "resourceIconPath": "defaulticon",
+      "categories": [
+        {
+          "name": "Generic",
+          "subcategories": [
+            {
+              "name": "Abstract"
+            }
+          ]
+        }
+      ],
+      "tags": [
+        "Root",
+        "tosca.nodes.Root"
+      ]
+    },
+    {
+      "contactId": "jh0003",
+      "toscaName": "tosca.nodes.test.testWithConstraints",
+      "name": "TestWithConstraints",
+      "model": "TEST MODEL",
+      "description": "A vfc used for testing constraints",
+      "resourceIconPath": "defaulticon",
+      "categories": [
+        {
+          "name": "Generic",
+          "subcategories": [
+            {
+              "name": "Infrastructure"
+            }
+          ]
+        }
+      ],
+      "tags": [
+        "TestWithConstraints"
+      ]
+    },
+    {
+      "payloadName": "testNodeSimple.yml",
+      "contactId": "jh0003",
+      "toscaName": "tosca.nodes.test.testNodeSimple",
+      "name": "TestNodeSimple",
+      "model": "TEST MODEL",
+      "description": "A vfc used for testing simple data types",
+      "resourceIconPath": "defaulticon",
+      "categories": [
+        {
+          "name": "Generic",
+          "subcategories": [
+            {
+              "name": "Infrastructure"
+            }
+          ]
+        }
+      ],
+      "tags": [
+        "TestNodeSimple"
+      ]
+    },
+    {
+      "payloadName": "testNodeComplex.yml",
+      "contactId": "jh0003",
+      "toscaName": "tosca.nodes.test.testNodeComplex",
+      "name": "TestNodeComplex",
+      "model": "TEST MODEL",
+      "description": "A vfc used for testing complex data types",
+      "resourceIconPath": "defaulticon",
+      "categories": [
+        {
+          "name": "Generic",
+          "subcategories": [
+            {
+              "name": "Infrastructure"
+            }
+          ]
+        }
+      ],
+      "tags": [
+        "TestNodeComplex"
+      ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/integration-tests/src/main/resources/import/tosca/models/init/testModel/tosca/node-types/nodeTypes.yaml b/integration-tests/src/main/resources/import/tosca/models/init/testModel/tosca/node-types/nodeTypes.yaml
new file mode 100644 (file)
index 0000000..928459d
--- /dev/null
@@ -0,0 +1,137 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+description: Node types used during integration testing
+
+node_types:
+  tosca.nodes.Root:
+    description: The TOSCA Node Type all other TOSCA base Node Types derive from
+    attributes:
+      tosca_id:
+        type: string
+      tosca_name:
+        type: string
+      state:
+        type: string
+    capabilities:
+      feature:
+        type: tosca.capabilities.Node
+    requirements:
+      - dependency:
+          capability: tosca.capabilities.Node
+          node: tosca.nodes.Root
+          relationship: tosca.relationships.DependsOn
+          occurrences: [ 0, UNBOUNDED ]
+    interfaces:
+      Standard:
+        type: tosca.interfaces.node.lifecycle.Standard
+  tosca.nodes.test.testWithConstraints:
+    derived_from: tosca.nodes.Root
+    properties:
+      string_prop_with_c:
+        type: string
+        constraints:
+          - valid_values:
+              - abc
+              - def
+  tosca.nodes.test.testNodeSimple:
+    derived_from: tosca.nodes.Root
+    properties:
+      str_prop:
+        type: string
+        required: true
+      int_prop:
+        type: integer
+        required: true
+      timestamp_prop:
+        type: timestamp
+        required: true
+      boolean_prop:
+        type: boolean
+        required: true
+      float_prop:
+        type: float
+        required: true
+      json_prop:
+        type: json
+        required: true
+      list_str_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: string
+      list_int_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: integer
+      list_map_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: map
+      map_str_prop:
+        type: map
+        required: true
+        entry_schema:
+          type: string
+      map_int_prop:
+        type: map
+        required: true
+        entry_schema:
+          type: integer
+  tosca.nodes.test.testNodeComplex:
+    derived_from: tosca.nodes.Root
+    properties:
+      str_prop:
+        type: string
+        required: true
+      int_prop:
+        type: integer
+        required: true
+      timestamp_prop:
+        type: timestamp
+        required: true
+      boolean_prop:
+        type: boolean
+        required: true
+      float_prop:
+        type: float
+        required: true
+      json_prop:
+        type: json
+        required: true
+      complex_prop:
+        type: tosca.datatypes.test.testDataTypeComplex
+      list_str_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: string
+      list_int_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: integer
+      list_complex_prop:
+        type: list
+        entry_schema:
+          type: tosca.datatypes.test.testDataTypeComplex
+      list_map_prop:
+        type: list
+        required: true
+        entry_schema:
+          type: map
+      map_str_prop:
+        type: map
+        required: true
+        entry_schema:
+          type: string
+      map_int_prop:
+        type: map
+        required: true
+        entry_schema:
+          type: integer
+      map_complex_prop:
+        type: map
+        required: true
+        entry_schema:
+          type: tosca.datatypes.test.testDataTypeComplex