ariatosca-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emblempar...@apache.org
Subject [3/3] incubator-ariatosca git commit: ARIA-321 Provide Clearwater IMS example
Date Mon, 11 Sep 2017 15:21:09 GMT
ARIA-321 Provide Clearwater IMS example

Related fixes included in this commit:

* Allows capabilities, interfaces, and properties to override parent
definition types only if the new type is a descendant of the overridden
type
* Fix to get_property intrinsic function
* Fix the "required" field for parameters (it wasn't working)
* Don't let scalar values be negative
* Doc fixes related to ARIA-277
* Fix SSH tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/126d4e89
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/126d4e89
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/126d4e89

Branch: refs/heads/ARIA-321-clearwater
Commit: 126d4e8972bff30c00e14aa70df773282ff5cf14
Parents: 969149b
Author: Tal Liron <tal.liron@gmail.com>
Authored: Thu Jul 27 17:58:17 2017 -0500
Committer: Tal Liron <tal.liron@gmail.com>
Committed: Mon Sep 11 10:20:58 2017 -0500

----------------------------------------------------------------------
 .travis.yml                                     |  61 +-
 README.rst                                      |  35 +-
 aria/modeling/functions.py                      |   4 +-
 aria/modeling/service_common.py                 |   2 +-
 aria/modeling/service_instance.py               |  60 +-
 aria/orchestrator/topology/template_handler.py  |  17 +-
 aria/orchestrator/topology/topology.py          |  12 +-
 .../clearwater-live-test-existing.yaml          |  54 ++
 .../clearwater/clearwater-single-existing.yaml  | 147 ++++
 examples/clearwater/scripts/bono/create.sh      |  20 +
 examples/clearwater/scripts/bono/delete.sh      |  17 +
 examples/clearwater/scripts/dime/create.sh      |  21 +
 examples/clearwater/scripts/dime/delete.sh      |  17 +
 examples/clearwater/scripts/ellis/configure.sh  |  29 +
 examples/clearwater/scripts/ellis/create.sh     |  19 +
 examples/clearwater/scripts/ellis/delete.sh     |  17 +
 examples/clearwater/scripts/homer/create.sh     |  27 +
 examples/clearwater/scripts/homer/delete.sh     |  17 +
 examples/clearwater/scripts/homestead/create.sh |  25 +
 examples/clearwater/scripts/homestead/delete.sh |  17 +
 .../clearwater/scripts/host-base/configure.sh   |  23 +
 examples/clearwater/scripts/host/configure.sh   | 183 +++++
 examples/clearwater/scripts/live-test/create.sh |  69 ++
 examples/clearwater/scripts/live-test/delete.sh |  23 +
 examples/clearwater/scripts/memento/create.sh   |  20 +
 examples/clearwater/scripts/memento/delete.sh   |  17 +
 examples/clearwater/scripts/ralf/create.sh      |  15 +
 examples/clearwater/scripts/ralf/delete.sh      |  17 +
 examples/clearwater/scripts/sprout/create.sh    |  19 +
 examples/clearwater/scripts/sprout/delete.sh    |  17 +
 examples/clearwater/scripts/vellum/create.sh    |  23 +
 examples/clearwater/scripts/vellum/delete.sh    |  17 +
 examples/clearwater/types/cassandra.yaml        |  30 +
 examples/clearwater/types/clearwater.yaml       | 728 +++++++++++++++++++
 examples/clearwater/types/ims.yaml              | 446 ++++++++++++
 examples/clearwater/types/smtp.yaml             |  35 +
 examples/hello-world/hello-world.yaml           |  38 +
 examples/hello-world/helloworld.yaml            |  38 -
 .../block-storage-1/block-storage-1.yaml        |   6 +-
 .../block-storage-2/block-storage-2.yaml        |   6 +-
 .../block-storage-3/block-storage-3.yaml        |   4 +-
 .../block-storage-4/block-storage-4.yaml        |   2 +-
 .../use-cases/non-normative-types.yaml          |   6 +-
 .../webserver-dbms-1/webserver-dbms-1.yaml      |  10 +-
 .../profiles/tosca-simple-1.0/artifacts.yaml    |  18 +-
 .../profiles/tosca-simple-1.0/capabilities.yaml |   8 +-
 .../profiles/tosca-simple-1.0/data.yaml         |  10 +-
 .../profiles/tosca-simple-1.0/interfaces.yaml   |   2 +-
 .../profiles/tosca-simple-1.0/nodes.yaml        |  18 +-
 .../profiles/tosca-simple-1.0/policies.yaml     |   8 +-
 .../tosca-simple-1.0/relationships.yaml         |  16 +-
 .../profiles/tosca-simple-nfv-1.0/nodes.yaml    |   4 +-
 .../simple_v1_0/assignments.py                  |   8 +-
 .../simple_v1_0/data_types.py                   |  15 +-
 .../simple_v1_0/modeling/capabilities.py        |  14 +-
 .../simple_v1_0/modeling/data_types.py          |   4 -
 .../simple_v1_0/modeling/functions.py           |  18 +-
 .../simple_v1_0/modeling/interfaces.py          |  14 +-
 .../simple_v1_0/modeling/parameters.py          |  47 +-
 .../simple_v1_0/presentation/types.py           |   8 +-
 .../aria_extension_tosca/simple_v1_0/types.py   |  25 +-
 test_ssh.py                                     | 528 ++++++++++++++
 tests/end2end/test_hello_world.py               |   2 +-
 tests/orchestrator/execution_plugin/test_ssh.py |  15 +-
 .../node-cellar/node-cellar.yaml                |  18 +-
 .../node-cellar/types/mongodb.yaml              |   2 +-
 .../node-cellar/types/nodejs.yaml               |   2 +-
 .../node-cellar/types/openstack.yaml            |   4 +-
 .../types/shorthand-1/shorthand-1.yaml          |   6 +-
 .../types/typequalified-1/typequalified-1.yaml  |   6 +-
 tox.ini                                         |   7 +-
 71 files changed, 3002 insertions(+), 235 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index a7362e7..958be80 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,36 +10,55 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-sudo: false
+# We need to set "sudo: true" in order to use a virtual machine instead of a container, because
+# SSH tests fail in the container. See:
+# https://docs.travis-ci.com/user/reference/overview/#Virtualization-environments
+
+dist: trusty
+sudo: true
 
 language: python
 
-dist: precise
+addons:
+  apt:
+    sources:
+      - sourceline: 'ppa:fkrull/deadsnakes'
+    packages:
+      # Ubuntu 14.04 (trusty) does not come with Python 2.6, so we will install it from Felix
+      # Krull's PPA
+      - python2.6
+      - python2.6-dev
+
 python:
+  # We handle Python 2.6 testing from within tox (see tox.ini); note that this means that we run
+  # tox itself always from Python 2.7
   - '2.7'
 
 env:
-  - TOX_ENV=pylint_code
-  - TOX_ENV=pylint_tests
-  - TOX_ENV=py27
-  - TOX_ENV=py26
-  - TOX_ENV=py27e2e
-  - TOX_ENV=py26e2e
-  - TOX_ENV=py27ssh
-  - TOX_ENV=py26ssh
-  - TOX_ENV=docs
-
-install:
+  # The PYTEST_PROCESSES environment var is used in tox.ini to override the --numprocesses argument
+  # for PyTest's xdist plugin. The reason this is necessary is that conventional Travis environments
+  # may report a large amount of available CPUs, but they they are greatly restricted. Through trial
+  # and error we found that more than 1 process may result in failures.
+  - PYTEST_PROCESSES=1 TOX_ENV=pylint_code
+  - PYTEST_PROCESSES=1 TOX_ENV=pylint_tests
+  - PYTEST_PROCESSES=1 TOX_ENV=py27
+  - PYTEST_PROCESSES=1 TOX_ENV=py26
+  - PYTEST_PROCESSES=1 TOX_ENV=py27e2e
+  - PYTEST_PROCESSES=1 TOX_ENV=py26e2e
+  - PYTEST_PROCESSES=1 TOX_ENV=py27ssh
+  - PYTEST_PROCESSES=1 TOX_ENV=py26ssh
+  - PYTEST_PROCESSES=1 TOX_ENV=docs
+
+before_install:
+  # Create SSH keys for SSH tests
+  - ssh-keygen -f $HOME/.ssh/id_rsa -t rsa -N ''
+  - cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
+
+  # Python dependencies
   - pip install --upgrade pip
   - pip install --upgrade setuptools
   - pip install tox
-
-script:
-  - pip --version
   - tox --version
-  - PYTEST_PROCESSES=1 tox -e $TOX_ENV
 
-# The PYTEST_PROCESSES environment var is used in tox.ini to override the --numprocesses argument
-# for PyTest's xdist plugin. The reason this is necessary is that conventional Travis environments
-# may report a large amount of available CPUs, but they they are greatly restricted. Through trial
-# and error we found that more than 1 process may result in failures.
+script:
+  - tox -e $TOX_ENV

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/README.rst
----------------------------------------------------------------------
diff --git a/README.rst b/README.rst
index b1a48c2..6f8885c 100644
--- a/README.rst
+++ b/README.rst
@@ -36,26 +36,28 @@ To install ARIA directly from PyPI (using a ``wheel``), use::
     pip install apache-ariatosca
 
 To install ARIA from source, download the source tarball from
-`PyPI <https://pypi.python.org/pypi/apache-ariatosca>`__, extract and ``cd`` into the extract dir, and run::
+`PyPI <https://pypi.python.org/pypi/apache-ariatosca>`__, extract and ``cd`` into the extract dir,
+and run::
 
     pip install --upgrade pip setuptools
     pip install .
 
-| The source package comes along with relevant examples, documentation, ``requirements.txt`` (for installing specifically the frozen dependencies' versions with which ARIA was tested) and more.
-|
+| The source package comes along with relevant examples, documentation, ``requirements.txt`` (for
+| installing specifically the frozen dependencies' versions with which ARIA was tested) and more.
 |
 | ARIA has additional optional dependencies. These are required for running operations over SSH.
-| Below are instructions on how to install these dependencies, including required system dependencies per OS.
-|
-| Note: These dependencies may have varying licenses which may not be compatible with Apache license 2.0.
+| Below are instructions on how to install these dependencies, including required system
+| dependencies per OS.
 |
+| Note: These dependencies may have varying licenses which may not be compatible with Apache license
+| 2.0.
 
-**Ubuntu/Debian** (tested on Ubuntu14.04, Ubuntu16.04)::
+**Ubuntu/Debian** (tested on Ubuntu 14.04, Ubuntu 16.04)::
 
     apt-get install -y python-dev gcc libffi-dev libssl-dev
     pip install apache-ariatosca[ssh]
 
-**Centos** (tested on Centos6.6, Centos7)::
+**CentOS/Fedora** (tested on CentOS 6.6, CentOS 7)::
 
     yum install -y python-devel gcc libffi-devel openssl-devel
     pip install apache-ariatosca[ssh]
@@ -65,7 +67,7 @@ To install ARIA from source, download the source tarball from
     pacman -Syu --noconfirm python2 gcc libffi openssl
     pip2 install apache-ariatosca[ssh]
 
-**Windows** (tested on Win10)::
+**Windows** (tested on Windows 10)::
 
     # no additional system requirements are needed
     pip install apache-ariatosca[ssh]
@@ -76,7 +78,7 @@ To install ARIA from source, download the source tarball from
 
 
 
-To install ``pip``, either use your distro's package management system, or run::
+To install ``pip``, either use your operating system's package management system, or run::
 
     wget http://bootstrap.pypa.io/get-pip.py
     python get-pip.py
@@ -91,7 +93,7 @@ This section will describe how to run a simple "Hello World" example.
 First, provide ARIA with the ARIA "hello world" service-template and name it (e.g.
 ``my-service-template``)::
 
-    aria service-templates store examples/hello-world/helloworld.yaml my-service-template
+    aria service-templates store examples/hello-world/hello-world.yaml my-service-template
 
 Now create a service based on this service-template and name it (e.g. ``my-service``)::
 
@@ -117,7 +119,8 @@ Contribution
 You are welcome and encouraged to participate and contribute to the ARIA project.
 
 Please see our guide to
-`Contributing to ARIA <https://cwiki.apache.org/confluence/display/ARIATOSCA/Contributing+to+ARIA>`__.
+`Contributing to ARIA
+<https://cwiki.apache.org/confluence/display/ARIATOSCA/Contributing+to+ARIA>`__.
 
 Feel free to also provide feedback on the mailing lists (see `Resources <#user-content-resources>`__
 section).
@@ -126,12 +129,12 @@ section).
 Resources
 ---------
 
--  `ARIA homepage <http://ariatosca.incubator.apache.org/>`__
--  `ARIA wiki <https://cwiki.apache.org/confluence/display/AriaTosca>`__
+- `ARIA homepage <http://ariatosca.incubator.apache.org/>`__
+- `ARIA wiki <https://cwiki.apache.org/confluence/display/AriaTosca>`__
 -  `Issue tracker <https://issues.apache.org/jira/browse/ARIA>`__
 
--  Dev mailing list: dev@ariatosca.incubator.apache.org
--  User mailing list: user@ariatosca.incubator.apache.org
+- Dev mailing list: dev@ariatosca.incubator.apache.org
+- User mailing list: user@ariatosca.incubator.apache.org
 
 Subscribe by sending a mail to ``<group>-subscribe@ariatosca.incubator.apache.org`` (e.g.
 ``dev-subscribe@ariatosca.incubator.apache.org``). See information on how to subscribe to mailing

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/aria/modeling/functions.py
----------------------------------------------------------------------
diff --git a/aria/modeling/functions.py b/aria/modeling/functions.py
index 31c3839..554bbfb 100644
--- a/aria/modeling/functions.py
+++ b/aria/modeling/functions.py
@@ -19,6 +19,7 @@ Mechanism for evaluating intrinsic functions.
 from ..parser.exceptions import InvalidValueError
 from ..parser.consumption import ConsumptionContext
 from ..utils.collections import OrderedDict
+from ..utils.type import full_type_name
 from . import exceptions
 
 
@@ -88,7 +89,8 @@ def evaluate(value, container_holder, report_issues=False): # pylint: disable=to
             if (evaluation is None) \
                 or (not hasattr(evaluation, 'value')) \
                 or (not hasattr(evaluation, 'final')):
-                raise InvalidValueError('bad __evaluate__ implementation')
+                raise InvalidValueError('bad __evaluate__ implementation: {0}'
+                                        .format(full_type_name(value)))
 
             evaluated = True
             value = evaluation.value

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/aria/modeling/service_common.py
----------------------------------------------------------------------
diff --git a/aria/modeling/service_common.py b/aria/modeling/service_common.py
index 478e530..d1f6b00 100644
--- a/aria/modeling/service_common.py
+++ b/aria/modeling/service_common.py
@@ -28,7 +28,7 @@ from sqlalchemy.ext.declarative import declared_attr
 
 from ..utils import (
     collections,
-    formatting,
+    formatting
 )
 from .mixins import InstanceModelMixin, TemplateModelMixin, ParameterMixin
 from . import relationship

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/aria/modeling/service_instance.py
----------------------------------------------------------------------
diff --git a/aria/modeling/service_instance.py b/aria/modeling/service_instance.py
index daeb0a4..01c4da9 100644
--- a/aria/modeling/service_instance.py
+++ b/aria/modeling/service_instance.py
@@ -38,7 +38,7 @@ from .mixins import InstanceModelMixin
 
 from ..utils import (
     collections,
-    formatting,
+    formatting
 )
 
 
@@ -228,6 +228,36 @@ class ServiceBase(InstanceModelMixin):
     :type: :class:`~datetime.datetime`
     """)
 
+    def get_node_by_type(self, type_name):
+        """
+        Finds the first node of a type (or descendent type).
+        """
+        service_template = self.service_template
+
+        if service_template is not None:
+            node_types = service_template.node_types
+            if node_types is not None:
+                for node in self.nodes.itervalues():
+                    if node_types.is_descendant(type_name, node.type.name):
+                        return node
+
+        return None
+
+    def get_policy_by_type(self, type_name):
+        """
+        Finds the first policy of a type (or descendent type).
+        """
+        service_template = self.service_template
+
+        if service_template is not None:
+            policy_types = service_template.policy_types
+            if policy_types is not None:
+                for policy in self.policies.itervalues():
+                    if policy_types.is_descendant(type_name, policy.type.name):
+                        return policy
+
+        return None
+
     @property
     def as_raw(self):
         return collections.OrderedDict((
@@ -479,14 +509,15 @@ class NodeBase(InstanceModelMixin):
 
     @classmethod
     def determine_state(cls, op_name, is_transitional):
-        """ :returns the state the node should be in as a result of running the
-            operation on this node.
+        """
+        :returns the state the node should be in as a result of running the operation on this node.
 
-            e.g. if we are running tosca.interfaces.node.lifecycle.Standard.create, then
-            the resulting state should either 'creating' (if the task just started) or 'created'
-            (if the task ended).
+        E.g. if we are running tosca.interfaces.node.lifecycle.Standard.create, then
+        the resulting state should either 'creating' (if the task just started) or 'created'
+        (if the task ended).
 
-            If the operation is not a standard tosca lifecycle operation, then we return None"""
+        If the operation is not a standard TOSCA lifecycle operation, then we return None.
+        """
 
         state_type = 'transitional' if is_transitional else 'finished'
         try:
@@ -497,11 +528,24 @@ class NodeBase(InstanceModelMixin):
     def is_available(self):
         return self.state not in (self.INITIAL, self.DELETED, self.ERROR)
 
+    def get_outbound_relationship_by_name(self, name):
+        for the_relationship in self.outbound_relationships:
+            if the_relationship.name == name:
+                return the_relationship
+        return None
+
+    def get_inbound_relationship_by_name(self, name):
+        for the_relationship in self.inbound_relationships:
+            if the_relationship.name == name:
+                return the_relationship
+        return None
+
     @property
     def host_address(self):
         if self.host and self.host.attributes:
             attribute = self.host.attributes.get('ip')
-            return attribute.value if attribute else None
+            if attribute is not None:
+                return attribute.value
         return None
 
     @property

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/aria/orchestrator/topology/template_handler.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/topology/template_handler.py b/aria/orchestrator/topology/template_handler.py
index bf0ef9f..a84a988 100644
--- a/aria/orchestrator/topology/template_handler.py
+++ b/aria/orchestrator/topology/template_handler.py
@@ -206,12 +206,15 @@ class CapabilityTemplate(common.TemplateHandlerBase):
         self._topology.coerce(self._model.properties, **kwargs)
 
     def instantiate(self, instance_cls, **_):
-        return instance_cls(name=self._model.name,
-                            type=self._model.type,
-                            min_occurrences=self._model.min_occurrences,
-                            max_occurrences=self._model.max_occurrences,
-                            occurrences=0,
-                            capability_template=self._model)
+        capability = instance_cls(
+            name=self._model.name,
+            type=self._model.type,
+            min_occurrences=self._model.min_occurrences,
+            max_occurrences=self._model.max_occurrences,
+            occurrences=0,
+            capability_template=self._model)
+        capability.properties = self._topology.instantiate(self._model.properties)
+        return capability
 
     def validate(self, **kwargs):
         self._topology.validate(self._model.properties, **kwargs)
@@ -446,7 +449,7 @@ class SubstitutionTemplate(common.TemplateHandlerBase):
 class SubstitutionTemplateMapping(common.TemplateHandlerBase):
 
     def dump(self, out_stream):
-        if self._topology.capability_template is not None:
+        if self._model.capability_template is not None:
             node_template = self._model.capability_template.node_template
         else:
             node_template = self._model.requirement_template.node_template

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/aria/orchestrator/topology/topology.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/topology/topology.py b/aria/orchestrator/topology/topology.py
index 8ee33d1..f86c9dd 100644
--- a/aria/orchestrator/topology/topology.py
+++ b/aria/orchestrator/topology/topology.py
@@ -57,11 +57,11 @@ class Topology(issue.ReporterMixin):
     @staticmethod
     def _init_handlers(module_):
         """
-        Register handlers from a handler module to the models
+        Register handlers from a handler module to the models.
 
-        :param module_: The module to look for handlers
-        :return: a dict where the key is the models class, and the value is the handler class
-        associated with it from the provided module
+        :param module_: the module to look for handlers
+        :returns: dict where the key is the models class, and the value is the handler class
+         associated with it from the provided module
         """
         handlers = {}
         for attribute_name in dir(module_):
@@ -74,11 +74,11 @@ class Topology(issue.ReporterMixin):
 
     def instantiate(self, model, **kwargs):
         """
-        instantiate the provided model
+        Instantiate the provided model.
 
         :param model:
         :param kwargs:
-        :return:
+        :returns:
         """
         if isinstance(model, dict):
             return dict((name, self.instantiate(value, **kwargs))

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/clearwater-live-test-existing.yaml
----------------------------------------------------------------------
diff --git a/examples/clearwater/clearwater-live-test-existing.yaml b/examples/clearwater/clearwater-live-test-existing.yaml
new file mode 100644
index 0000000..0e6a11c
--- /dev/null
+++ b/examples/clearwater/clearwater-live-test-existing.yaml
@@ -0,0 +1,54 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+  Project Clearwater is an open-source IMS core, developed by Metaswitch Networks and released under
+  the GNU GPLv3.
+
+metadata:
+  template_name: clearwater-live-test-existing
+  template_author: ARIA
+  template_version: '1.0'
+  aria_version: '0.2.0'
+
+imports:
+  - types/clearwater.yaml
+  - aria-1.0
+
+topology_template:
+
+  inputs:
+    hosts.ssh.user:
+      type: string
+    hosts.ssh.password:
+      type: string
+    existing_host.public_address:
+      type: string
+
+  node_templates:
+    live_test:
+      type: clearwater.LiveTest
+
+    existing_host:
+      type: clearwater.HostBase
+      attributes:
+        public_address: { get_input: existing_host.public_address }
+      capabilities:
+        host:
+          properties:
+            ssh.user: { get_input: hosts.ssh.user }
+            ssh.password: { get_input: hosts.ssh.password }

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/clearwater-single-existing.yaml
----------------------------------------------------------------------
diff --git a/examples/clearwater/clearwater-single-existing.yaml b/examples/clearwater/clearwater-single-existing.yaml
new file mode 100644
index 0000000..72b882a
--- /dev/null
+++ b/examples/clearwater/clearwater-single-existing.yaml
@@ -0,0 +1,147 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >-
+  Project Clearwater is an open-source IMS core, developed by Metaswitch Networks and released under
+  the GNU GPLv3.
+
+metadata:
+  template_name: clearwater-single-existing
+  template_author: ARIA
+  template_version: '1.0'
+  aria_version: '0.2.0'
+
+imports:
+  - types/clearwater.yaml
+  - aria-1.0
+
+topology_template:
+
+  inputs:
+    hosts.ssh.user:
+      description: >-
+        Existing SSH user.
+      type: string
+    hosts.ssh.password:
+      description: >-
+        Existing SSH password.
+      type: string
+    existing_host.public_address:
+      description: >-
+        Existing IP address that can be accessed by ARIA.
+      type: string
+    existing_host.private_address:
+      description: >-
+        Existing IP address that can be accessed within the service.
+      type: string
+      default: { get_input: existing_host.public_address }
+    existing_host.hostname:
+      description: >-
+        The hostname will be changed to this.
+      type: string
+      default: aria-clearwater-single
+
+  node_templates:
+    bono:
+      type: clearwater.Bono
+      requirements:
+        - sip_downstream: clearwater.Sprout
+        - sip_secure_downstream: clearwater.Sprout
+        - ralf: clearwater.Ralf
+
+    sprout:
+      type: clearwater.Sprout
+      requirements:
+        - ralf: clearwater.Ralf
+# cyclical: see ARIA-327
+#        - sip_upstream: clearwater.Bono
+
+    dime:
+      type: clearwater.Dime
+
+    homestead:
+      type: clearwater.Homestead
+
+    ralf:
+      type: clearwater.Ralf
+      description: >-
+        Optional, only required if you are using a CCF (Charging Collection Function).
+
+    homer:
+      type: clearwater.Homer
+
+    vellum:
+      type: clearwater.Vellum
+#      requirements:
+# cyclical: see ARIA-327
+#        - ralf: clearwater.Ralf
+
+    i-cscf:
+      type: clearwater.I-CSCF
+
+    s-cscf:
+      type: clearwater.S-CSCF
+
+    ellis:
+      type: clearwater.Ellis
+      description: >-
+        Optional, only required if you want a web frontend.
+      properties:
+        provision_numbers_count: 1000
+      requirements:
+        - ralf: clearwater.Ralf
+
+    existing_host:
+      type: clearwater.Host
+      attributes:
+        public_address: { get_input: existing_host.public_address }
+        private_address: { get_input: existing_host.private_address }
+      capabilities:
+        host:
+          properties:
+            hostname: { get_input: existing_host.hostname }
+            ssh.user: { get_input: hosts.ssh.user }
+            ssh.password: { get_input: hosts.ssh.password }
+            max_log_directory_size: 50 MiB
+            reduce_cassandra_mem_usage: true
+
+    smtp:
+      type: smtp.SMTP
+      properties:
+        address: 127.0.0.1
+      capabilities:
+        smtp:
+          properties:
+            username: username
+            password: password
+
+  policies:
+    configuration:
+      type: clearwater.Configuration
+      properties:
+        zone: example.com
+        secret: secret
+
+  substitution_mappings:
+    node_type: ims.nodes.IMS
+    capabilities:
+       p-cscf: [ bono, p-cscf ]
+       i-cscf: [ i-cscf, i-cscf ]
+       s-cscf: [ s-cscf, s-cscf ]
+       hss: [ homestead, hss ]
+       ctf: [ ralf, ctf ]
+       xdms: [ homer, xdms ]

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/bono/create.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/bono/create.sh b/examples/clearwater/scripts/bono/create.sh
new file mode 100644
index 0000000..b2a3a68
--- /dev/null
+++ b/examples/clearwater/scripts/bono/create.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+set -e
+
+yes | aptdcon --hide-terminal --install bono
+yes | aptdcon --hide-terminal --install restund

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/bono/delete.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/bono/delete.sh b/examples/clearwater/scripts/bono/delete.sh
new file mode 100644
index 0000000..73485c3
--- /dev/null
+++ b/examples/clearwater/scripts/bono/delete.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+TODO

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/dime/create.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/dime/create.sh b/examples/clearwater/scripts/dime/create.sh
new file mode 100644
index 0000000..9b25876
--- /dev/null
+++ b/examples/clearwater/scripts/dime/create.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+set -e
+
+# Installs Homestead and Ralf
+yes | aptdcon --hide-terminal --install dime
+yes | aptdcon --hide-terminal --install clearwater-prov-tools

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/dime/delete.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/dime/delete.sh b/examples/clearwater/scripts/dime/delete.sh
new file mode 100644
index 0000000..73485c3
--- /dev/null
+++ b/examples/clearwater/scripts/dime/delete.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+TODO

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/ellis/configure.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/ellis/configure.sh b/examples/clearwater/scripts/ellis/configure.sh
new file mode 100644
index 0000000..b52cc08
--- /dev/null
+++ b/examples/clearwater/scripts/ellis/configure.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+set -e
+
+PROVISION_NUMBERS_START=$(ctx node properties provision_numbers_start)
+PROVISION_NUMBERS_COUNT=$(ctx node properties provision_numbers_count)
+
+if [ "$PROVISION_NUMBERS_COUNT" != 0 ]; then
+	cd /usr/share/clearwater/ellis
+	. env/bin/activate
+	python src/metaswitch/ellis/tools/create_numbers.py \
+		--start "$PROVISION_NUMBERS_START" \
+		--count "$PROVISION_NUMBERS_COUNT"
+	deactivate
+fi

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/ellis/create.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/ellis/create.sh b/examples/clearwater/scripts/ellis/create.sh
new file mode 100644
index 0000000..bdd9341
--- /dev/null
+++ b/examples/clearwater/scripts/ellis/create.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+set -e
+
+yes | aptdcon --hide-terminal --install ellis

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/ellis/delete.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/ellis/delete.sh b/examples/clearwater/scripts/ellis/delete.sh
new file mode 100644
index 0000000..73485c3
--- /dev/null
+++ b/examples/clearwater/scripts/ellis/delete.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+TODO

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/homer/create.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/homer/create.sh b/examples/clearwater/scripts/homer/create.sh
new file mode 100644
index 0000000..5f40960
--- /dev/null
+++ b/examples/clearwater/scripts/homer/create.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+set -e
+
+yes | aptdcon --hide-terminal --install homer
+
+# ARIA fix to avoid warnings by Twisted for missing service_identity library
+# (Crest is used by both Homer and Homestead-prov)
+cd /usr/share/clearwater/crest
+. env/bin/activate
+pip install service_identity
+deactivate
+service homer restart

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/homer/delete.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/homer/delete.sh b/examples/clearwater/scripts/homer/delete.sh
new file mode 100644
index 0000000..73485c3
--- /dev/null
+++ b/examples/clearwater/scripts/homer/delete.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+TODO

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/homestead/create.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/homestead/create.sh b/examples/clearwater/scripts/homestead/create.sh
new file mode 100644
index 0000000..d280033
--- /dev/null
+++ b/examples/clearwater/scripts/homestead/create.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+set -e
+
+# ARIA fix to avoid warnings by Twisted for missing service_identity library
+# (Crest is used by both Homer and Homestead-prov)
+cd /usr/share/clearwater/crest
+. env/bin/activate
+pip install service_identity
+deactivate
+service homer restart

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/homestead/delete.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/homestead/delete.sh b/examples/clearwater/scripts/homestead/delete.sh
new file mode 100644
index 0000000..73485c3
--- /dev/null
+++ b/examples/clearwater/scripts/homestead/delete.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+TODO

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/host-base/configure.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/host-base/configure.sh b/examples/clearwater/scripts/host-base/configure.sh
new file mode 100644
index 0000000..c5b87d9
--- /dev/null
+++ b/examples/clearwater/scripts/host-base/configure.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+set -e
+
+if ! type aptdcon > /dev/null; then
+	# This will allow us to do concurrent installs
+	apt update
+	apt install aptdaemon --yes
+fi

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/host/configure.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/host/configure.sh b/examples/clearwater/scripts/host/configure.sh
new file mode 100644
index 0000000..61cb835
--- /dev/null
+++ b/examples/clearwater/scripts/host/configure.sh
@@ -0,0 +1,183 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+set -e
+
+HOSTNAME=$(ctx node capabilities host properties hostname)
+
+# Change hostname
+OLD_HOSTNAME=$(hostname)
+if [ "$OLD_HOSTNAME" != "$HOSTNAME" ]; then
+	hostname "$HOSTNAME"
+	echo "$HOSTNAME" > /etc/hostname
+	sed --in-place --expression "s/127.0.1.1\s\+$OLD_HOSTNAME/127.0.1.1 $HOSTNAME/" /etc/hosts
+fi
+
+ZONE=$(ctx service get_policy_by_type [ clearwater.Configuration ] properties zone)
+GEOGRAPHICALLY_REDUNDANT=$(ctx service get_policy_by_type [ clearwater.Configuration ] properties geographically_redundant)
+SITE_NAME=$(ctx service get_policy_by_type [ clearwater.Configuration ] properties site_name)
+SECRET=$(ctx service get_policy_by_type [ clearwater.Configuration ] properties secret)
+
+SMTP_HOSTNAME=$(ctx service get_node_by_type [ clearwater.Ellis ] get_outbound_relationship_by_name [ smtp ] target_node properties address)
+SMTP_USERNAME=$(ctx service get_node_by_type [ clearwater.Ellis ] get_outbound_relationship_by_name [ smtp ] target_node capabilities smtp properties username)
+SMTP_PASSWORD=$(ctx service get_node_by_type [ clearwater.Ellis ] get_outbound_relationship_by_name [ smtp ] target_node capabilities smtp properties password)
+
+MAX_LOG_DIRECTORY_SIZE=$(ctx node capabilities host properties max_log_directory_size value)
+REDUCE_CASSANDRA_MEM_USAGE=$(ctx node capabilities host properties reduce_cassandra_mem_usage)
+
+PRIVATE_IP=$(ctx node attributes private_address)
+PUBLIC_IP=$(ctx node attributes public_address)
+PUBLIC_HOSTNAME=$(hostname)
+# TODO: comma-separated list of all private IP addresses in group
+ETCD_CLUSTER=$PRIVATE_IP
+
+REPO_FILE=/etc/apt/sources.list.d/clearwater.list
+REPO_LINE='deb http://repo.cw-ngv.com/stable binary/'
+KEY_URL=http://repo.cw-ngv.com/repo_key
+
+
+#
+# Repository
+#
+
+if [ ! -f "$REPO_FILE" ]; then
+	echo "$REPO_LINE" > "$REPO_FILE"
+	curl --location "$KEY_URL" | apt-key add -
+fi
+
+apt update
+
+if ! type aptdcon > /dev/null; then
+	# This will allow us to do concurrent installs
+	apt install aptdaemon --yes
+fi
+
+yes | aptdcon --hide-terminal --install clearwater-management
+
+
+#
+# DNS
+#
+
+S_CSCF_HOST="$PRIVATE_IP scscf.$PUBLIC_HOSTNAME # ARIA"
+grep --quiet --fixed-strings "$S_CSCF_HOST" /etc/hosts || echo "$S_CSCF_HOST" >> /etc/hosts
+
+
+#
+# Local configuration
+#
+
+mkdir --parents /etc/clearwater
+CONFIG_FILE=/etc/clearwater/local_config
+echo "# Created by ARIA on $(date -u)" > "$CONFIG_FILE"
+
+echo >> "$CONFIG_FILE"
+echo "# Local IP configuration" >> "$CONFIG_FILE"
+echo "local_ip=$PRIVATE_IP" >> "$CONFIG_FILE"
+echo "public_ip=$PUBLIC_IP" >> "$CONFIG_FILE"
+echo "public_hostname=$PUBLIC_HOSTNAME" >> "$CONFIG_FILE"
+echo "etcd_cluster=$ETCD_CLUSTER" >> "$CONFIG_FILE"
+
+if [ "$MAX_LOG_DIRECTORY_SIZE" != 0 ]; then
+	echo >> "$CONFIG_FILE"
+	echo "max_log_directory_size=$MAX_LOG_DIRECTORY_SIZE" >> "$CONFIG_FILE"
+fi
+
+if [ "$GEOGRAPHICALLY_REDUNDANT" = True ]; then
+	echo >> "$CONFIG_FILE"
+	echo "# Geographically redundant" >> "$CONFIG_FILE"
+	echo "local_site_name=$SITE_NAME" >> "$CONFIG_FILE"
+
+	# On the first Vellum node in the second site, you should set remote_cassandra_seeds to the
+	# IP address of a Vellum node in the first site.
+	#echo "remote_cassandra_seeds=" >> "$CONFIG_FILE"
+fi
+
+
+#
+# Shared configuration
+#
+
+if [ "$GEOGRAPHICALLY_REDUNDANT" = True ]; then
+	SPROUT_HOSTNAME=sprout.$SITE_NAME.$ZONE
+	SPROUT_REGISTRATION_STORE=vellum.$SITE_NAME.$ZONE
+	HS_HOSTNAME=hs.$SITE_NAME.$ZONE:8888
+	HS_PROVISIONING_HOSTNAME=hs.$SITE_NAME.$ZONE:8889
+	RALF_HOSTNAME=ralf.$SITE_NAME.$ZONE:10888
+	RALF_SESSION_STORE=vellum.$ZONE
+	XDMS_HOSTNAME=homer.$SITE_NAME.$ZONE:7888
+	CHRONOS_HOSTNAME=vellum.$SITE_NAME.$ZONE
+	CASSANDRA_HOSTNAME=vellum.$SITE_NAME.$ZONE
+else
+	VELLUM_IP=$PRIVATE_IP
+	HOMESTEAD_IP=$PRIVATE_IP
+	HOMER_IP=$PRIVATE_IP
+
+	SPROUT_HOSTNAME=$PUBLIC_HOSTNAME
+	SPROUT_REGISTRATION_STORE=$VELLUM_IP
+	HS_HOSTNAME=$HOMESTEAD_IP:8888
+	HS_PROVISIONING_HOSTNAME=$HOMESTEAD_IP:8889
+	RALF_HOSTNAME=
+	RALF_SESSION_STORE=
+	XDMS_HOSTNAME=$HOMER_IP:7888
+	CHRONOS_HOSTNAME=
+	CASSANDRA_HOSTNAME=
+fi
+
+mkdir --parents /etc/clearwater
+CONFIG_FILE=/etc/clearwater/shared_config
+echo "# Created by ARIA on $(date -u)" > "$CONFIG_FILE"
+
+echo >> "$CONFIG_FILE"
+echo "# Deployment definitions" >> "$CONFIG_FILE"
+echo "home_domain=$ZONE" >> "$CONFIG_FILE"
+echo "sprout_hostname=$SPROUT_HOSTNAME" >> "$CONFIG_FILE"
+echo "sprout_registration_store=$SPROUT_REGISTRATION_STORE" >> "$CONFIG_FILE"
+echo "hs_hostname=$HS_HOSTNAME" >> "$CONFIG_FILE"
+echo "hs_provisioning_hostname=$HS_PROVISIONING_HOSTNAME" >> "$CONFIG_FILE"
+echo "ralf_hostname=$RALF_HOSTNAME" >> "$CONFIG_FILE"
+echo "ralf_session_store=$RALF_SESSION_STORE" >> "$CONFIG_FILE"
+echo "xdms_hostname=$XDMS_HOSTNAME" >> "$CONFIG_FILE"
+echo "chronos_hostname=$CHRONOS_HOSTNAME" >> "$CONFIG_FILE"
+echo "cassandra_hostname=$CASSANDRA_HOSTNAME" >> "$CONFIG_FILE"
+
+echo >> "$CONFIG_FILE"
+echo "# Email server configuration" >> "$CONFIG_FILE"
+echo "smtp_smarthost=$SMTP_HOSTNAME" >> "$CONFIG_FILE"
+echo "smtp_username=$SMTP_USERNAME" >> "$CONFIG_FILE"
+echo "smtp_password=$SMTP_PASSWORD" >> "$CONFIG_FILE"
+echo "email_recovery_sender=clearwater@$ZONE" >> "$CONFIG_FILE"
+
+echo >> "$CONFIG_FILE"
+echo "# I-CSCF/S-CSCF configuration (used by Bono to proxy to Sprout)" >> "$CONFIG_FILE"
+echo "upstream_hostname=scscf.$HOSTNAME" >> "$CONFIG_FILE"
+
+echo >> "$CONFIG_FILE"
+echo "# Keys" >> "$CONFIG_FILE"
+echo "signup_key=$SECRET" >> "$CONFIG_FILE"
+echo "turn_workaround=$SECRET" >> "$CONFIG_FILE"
+echo "ellis_api_key=$SECRET" >> "$CONFIG_FILE"
+echo "ellis_cookie_key=$SECRET" >> "$CONFIG_FILE"
+
+if [ "$REDUCE_CASSANDRA_MEM_USAGE" = True ]; then
+	echo >> "$CONFIG_FILE"
+	echo "# $REDUCE_CASSANDRA_MEM_USAGE" >> "$CONFIG_FILE"
+	echo "reduce_cassandra_mem_usage=Y" >> "$CONFIG_FILE"
+fi
+
+# Copy to other hosts in etcd group
+#yes | aptdcon --hide-terminal --install clearwater-config-manager
+#cw-upload_shared_config

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/live-test/create.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/live-test/create.sh b/examples/clearwater/scripts/live-test/create.sh
new file mode 100644
index 0000000..f28bff3
--- /dev/null
+++ b/examples/clearwater/scripts/live-test/create.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+set -e
+
+LIB=/opt/clearwater-live-test
+COMMAND=/usr/bin/clearwater-live-test
+RUBY_VERSION=1.9.3
+RVM=/usr/local/rvm
+QUAFF_OLD_URL=git@github.com:metaswitch/quaff.git
+QUAFF_NEW_URL=https://github.com/Metaswitch/quaff.git
+
+# Build requirements
+yes | aptdcon --hide-terminal --install build-essential
+yes | aptdcon --hide-terminal --install bundler
+yes | aptdcon --hide-terminal --install git
+
+# Required by nokogiri Ruby gem
+yes | aptdcon --hide-terminal --install zlib1g-dev
+
+# Install Ruby enVironment Manager
+if [ ! -d "$RVM" ]; then
+	# Install
+	curl --location https://get.rvm.io | bash -s stable
+fi
+
+# Install Ruby using RVM
+. "$RVM/scripts/rvm"
+rvm autolibs enable
+rvm install "$RUBY_VERSION"
+rvm use "$RUBY_VERSION@global"
+
+# Install Clearwater Live Test
+if [ ! -d "$LIB" ]; then
+	mkdir --parents /opt
+	cd /opt
+	git clone --depth 1 https://github.com/Metaswitch/clearwater-live-test.git
+	cd clearwater-live-test
+	chmod a+rw -R .
+
+	# Note: we must fix the URLs for Quaff
+	sed --in-place --expression "s,$QUAFF_OLD_URL,$QUAFF_NEW_URL,g" Gemfile Gemfile.lock
+
+	# Install required Ruby gems 
+	bundle install
+fi
+
+# Create command
+echo "#!/bin/bash" > "$COMMAND"
+echo ". \"$RVM/scripts/rvm\"" >> "$COMMAND"
+echo "rvm use \"$RUBY_VERSION@global\"" >> "$COMMAND"
+echo "cd \"$LIB\"" >> "$COMMAND"
+echo "rake \"\$@\"" >> "$COMMAND"
+chmod a+x "$COMMAND"
+
+# clearwater-live-test test[example.com] SIGNUP_CODE=secret PROXY=192.168.1.171 ELLIS=192.168.1.171

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/live-test/delete.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/live-test/delete.sh b/examples/clearwater/scripts/live-test/delete.sh
new file mode 100644
index 0000000..079627c
--- /dev/null
+++ b/examples/clearwater/scripts/live-test/delete.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+set -e
+
+LIB=/opt/clearwater-live-test
+COMMAND=/usr/bin/clearwater-live-test
+
+rm --recursive --force "$LIB"
+rm --force "$COMMAND"

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/memento/create.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/memento/create.sh b/examples/clearwater/scripts/memento/create.sh
new file mode 100644
index 0000000..91ffd9f
--- /dev/null
+++ b/examples/clearwater/scripts/memento/create.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+set -e
+
+yes | aptdcon --hide-terminal --install memento-as
+yes | aptdcon --hide-terminal --install memento-nginx

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/memento/delete.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/memento/delete.sh b/examples/clearwater/scripts/memento/delete.sh
new file mode 100644
index 0000000..73485c3
--- /dev/null
+++ b/examples/clearwater/scripts/memento/delete.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+TODO

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/ralf/create.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/ralf/create.sh b/examples/clearwater/scripts/ralf/create.sh
new file mode 100644
index 0000000..5cae7ef
--- /dev/null
+++ b/examples/clearwater/scripts/ralf/create.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/ralf/delete.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/ralf/delete.sh b/examples/clearwater/scripts/ralf/delete.sh
new file mode 100644
index 0000000..73485c3
--- /dev/null
+++ b/examples/clearwater/scripts/ralf/delete.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+TODO

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/sprout/create.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/sprout/create.sh b/examples/clearwater/scripts/sprout/create.sh
new file mode 100644
index 0000000..a9946b9
--- /dev/null
+++ b/examples/clearwater/scripts/sprout/create.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+set -e
+
+yes | aptdcon --hide-terminal --install sprout

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/sprout/delete.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/sprout/delete.sh b/examples/clearwater/scripts/sprout/delete.sh
new file mode 100644
index 0000000..73485c3
--- /dev/null
+++ b/examples/clearwater/scripts/sprout/delete.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+TODO

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/vellum/create.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/vellum/create.sh b/examples/clearwater/scripts/vellum/create.sh
new file mode 100644
index 0000000..1d7b2db
--- /dev/null
+++ b/examples/clearwater/scripts/vellum/create.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+set -e
+
+yes | aptdcon --hide-terminal --install vellum
+
+# Memento
+# TODO: see if there is a Memento node
+#yes | aptdcon --hide-terminal --install memento-cassandra

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/scripts/vellum/delete.sh
----------------------------------------------------------------------
diff --git a/examples/clearwater/scripts/vellum/delete.sh b/examples/clearwater/scripts/vellum/delete.sh
new file mode 100644
index 0000000..73485c3
--- /dev/null
+++ b/examples/clearwater/scripts/vellum/delete.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+TODO

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/126d4e89/examples/clearwater/types/cassandra.yaml
----------------------------------------------------------------------
diff --git a/examples/clearwater/types/cassandra.yaml b/examples/clearwater/types/cassandra.yaml
new file mode 100644
index 0000000..cbb3a5d
--- /dev/null
+++ b/examples/clearwater/types/cassandra.yaml
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+capability_types:
+
+  cassandra.Endpoint:
+    derived_from: tosca.capabilities.Endpoint.Database
+    properties:
+      port: # override
+        type: tosca.datatypes.network.PortDef
+        default: 7000
+
+  cassandra.Endpoint.Thrift:
+    derived_from: tosca.capabilities.Endpoint.Database
+    properties:
+      port: # override
+        type: tosca.datatypes.network.PortDef
+        default: 9160


Mime
View raw message