Merge branch 'master' of https://github.com/apache/incubator-ariatosca
diff --git a/examples/aria-service-proxy-plugin/.gitignore b/examples/aria-service-proxy-plugin/.gitignore
new file mode 100644
index 0000000..e26c3bb
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/.gitignore
@@ -0,0 +1,71 @@
+conf/nohup.out
+
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+#  Usually these files are written by a python script from a template
+#  before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+cover
+.tox/
+.coverage
+.cache
+nosetests.xml
+coverage.xml
+
+# testing sqlite db's
+*.db
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+.idea/*
+.venv/*
+
+AUTHORS
+ChangeLog
+.cloudify
+local-storage/
+
+# Emacs
+\#*
diff --git a/examples/aria-service-proxy-plugin/.travis.yml b/examples/aria-service-proxy-plugin/.travis.yml
new file mode 100644
index 0000000..ba05d7a
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/.travis.yml
@@ -0,0 +1,12 @@
+dist: trusty
+
+language: python
+python:
+  - '2.7'
+  
+install:
+  - pip install -r requirements.txt
+
+script:
+  - pytest
+
diff --git a/examples/aria-service-proxy-plugin/CHANGELOG.txt b/examples/aria-service-proxy-plugin/CHANGELOG.txt
new file mode 100644
index 0000000..2229826
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/CHANGELOG.txt
@@ -0,0 +1,2 @@
+releases:
+ 
diff --git a/examples/aria-service-proxy-plugin/LICENSE b/examples/aria-service-proxy-plugin/LICENSE
new file mode 100644
index 0000000..f433b1a
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/LICENSE
@@ -0,0 +1,177 @@
+
+                                 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
diff --git a/examples/aria-service-proxy-plugin/README.md b/examples/aria-service-proxy-plugin/README.md
new file mode 100644
index 0000000..ad50a99
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/README.md
@@ -0,0 +1,19 @@
+# ARIA Service Proxy Plugin
+
+A plugin for inter-service coordination
+
+## Types
+
+### aria.serviceproxy.ServiceProxy
+Abstract representation of an ARIA service.  The type operates by copying the outputs of target services into its local runtime attributes.  The service must be installed, and node properties control other conditions for successful instantiation.  It isn't assumed that the service exists at the time of instantiation, and properties control timeout behavior.  A failed service discovery, or listed desired outputs, results in a NonRecoverableError.
+
+#### Properties
+* __service_name__ : The name of the target service.
+* __outputs__ : A `string` list of service outputs.  Acts as a filter to selected desired outputs. An empty list will result in no outputs being copied.
+* __wait_config__: A `dictionary` with two keys:
+* * __wait_for_service__: A `boolean` that indicates whether to wait for a service that doesn't exist yet.  If `False`, if either the service or requested outputs are not present immediately, a non-recoverable exception is thrown.  If `True`, the plugin will wait.
+* * __wait_time__: An `integer` that indicates the number of seconds to wait for the service, and specified outputs, to exist.  Beyond this time, a non-recoverable exception is thrown.
+* * __wait_expression__: A Python evaluatable boolean expression using output names.  The expression acts as another barrier to matching the target service.  Examples values: "output1 > 4", "len(output1) == 7", "status == "ready"".
+
+#### Attributes
+The outputs of the target are placed in a `list` in the runtime attributes named `service_outputs`.  Service outputs entries consist of single entry dictionaries, with the keys `name` and `value`.
diff --git a/examples/aria-service-proxy-plugin/aria_service_proxy/__init__.py b/examples/aria-service-proxy-plugin/aria_service_proxy/__init__.py
new file mode 100644
index 0000000..ae1e83e
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/aria_service_proxy/__init__.py
@@ -0,0 +1,14 @@
+# 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.
diff --git a/examples/aria-service-proxy-plugin/aria_service_proxy/tasks.py b/examples/aria-service-proxy-plugin/aria_service_proxy/tasks.py
new file mode 100644
index 0000000..2470d64
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/aria_service_proxy/tasks.py
@@ -0,0 +1,155 @@
+# 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.
+
+from cloudify.decorators import operation
+from cloudify import ctx
+from cloudify.exceptions import NonRecoverableError
+from datetime import datetime
+from aria.cli.core import aria
+
+@operation
+def proxy_connect(**kwargs):
+
+    service_names = get_service_names()
+
+    duration = ctx.node.properties['wait_config']['wait_time']
+
+    installed = False
+
+    service_exists = ctx.node.properties['service_name'] in service_names
+
+    if service_exists:
+        installed = is_installed(
+            service_names[ctx.node.properties['service_name']])
+
+    wait_for_service =  ctx.node.properties['wait_config']['wait_for_service']
+
+    wait_expr = ctx.node.properties['wait_config'].get('wait_expression',
+                                                       None)
+
+    if not service_exists or not installed:
+        if wait_for_service:
+            if duration > ctx.operation.retry_number:
+                return ctx.operation.retry(
+                    message = 'Waiting for service', retry_after=1)
+            else:
+                if not service_exists:
+                    raise NonRecoverableError(
+                        "service {} not found".format(
+                            ctx.node.properties['service_name']))
+                else:
+                    raise NonRecoverableError(
+                        "service {} not installed".format(
+                            ctx.node.properties['service_name']))
+        else:
+            if not service_exists:
+                raise NonRecoverableError(
+                    "service {} not found".format(
+                        ctx.node.properties['service_name']))
+            else:
+                raise NonRecoverableError(
+                    "service {} not installed".format(
+                        ctx.node.properties['service_name']))
+
+    # Service exists, so see if outputs exist yet
+    elif( ctx.node.properties['outputs']):
+        outputs = service_names[ctx.node.properties['service_name']].outputs
+        if not output_equivalence( ctx.node.properties['outputs'], outputs):
+            return fail_or_wait(wait_for_service,
+                                duration,
+                                'Waiting for service outputs',
+                                "service {} outputs {} not found".format(
+                                    ctx.node.properties['service_name'],
+                                    ctx.node.properties['outputs']))
+
+        else:
+            # Success
+            # place outputs in attributes
+            # final wicket: expression
+            if wait_expr:
+                if not eval_waitexpr(wait_expr, outputs):
+                    return(fail_or_wait(wait_for_service, duration,
+                                        "waiting for expr",
+                                        "Expr {} evaluates false".format(
+                                        wait_expr)))
+
+            service_outputs = []
+            if('service_outputs' in ctx.instance.runtime_properties and
+               ctx.instance.runtime_properties['service_outputs']):
+                 service_outputs = list(
+                    ctx.instance.runtime_properties['service_outputs'])
+            for k,v in outputs.iteritems():
+                service_outputs.append( dict(name = k,value = v.value))
+            ctx.instance.runtime_properties['service_outputs'] = service_outputs
+
+            ctx.instance.runtime_properties['last_update'] = str(datetime.utcnow())
+    else:
+        ctx.logger.info("service exists, but no outputs specified = success")
+
+
+# returns service names
+@aria.pass_model_storage
+def get_service_names(model_storage):
+    """
+    Lists all services
+    """
+    services_list = model_storage.service.list()
+    outdict = {}
+    for service in services_list:
+        outdict[str(service.name)] = service
+    return outdict
+
+
+# Tests whether the list of configured outputs (a simple string list) is equivalent
+# to the list returned from Aria (possible duplicate keys)
+def output_equivalence( config_list, service_list ):
+    sset = set()
+    for k,v in service_list.iteritems():
+        sset.add( k )
+    if not len(sset) == len(config_list):
+        return False
+    for entry in sset:
+        if not entry in config_list:
+            return False
+    return True
+
+# Looks at the execution history to determine of service is installed
+@aria.pass_model_storage
+def is_installed( service, model_storage ):
+    executions = model_storage.execution.list(
+        filters=dict(service=service)).items
+    for e in reversed(executions):
+        if e.workflow_name == "uninstall":
+            return False
+        if e.workflow_name == "install" and e.status == "succeeded":
+            return True
+    return False
+
+# Evaluates wait_expr in the context of supplied outputs
+def eval_waitexpr( expr, outputs):
+    locals = {}
+    for k,v in outputs.iteritems():
+        locals[k] = v.value
+    return eval(expr,locals)
+
+def fail_or_wait( wait_flag, duration, wait_msg, fail_msg ):
+    if wait_flag:
+        if duration > ctx.operation.retry_number:
+            return ctx.operation.retry(
+                      message = wait_msg, retry_after=1)
+        else:
+            raise NonRecoverableError( fail_msg)
+    else:
+        raise NonRecoverableError( fail_msg)
diff --git a/examples/aria-service-proxy-plugin/circle.yml b/examples/aria-service-proxy-plugin/circle.yml
new file mode 100644
index 0000000..fcb3732
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/circle.yml
@@ -0,0 +1,25 @@
+machine:
+  python:
+    version: 2.7.9
+
+checkout:
+  post:
+    - >
+      if [ -n "$CI_PULL_REQUEST" ]; then
+        PR_ID=${CI_PULL_REQUEST##*/}
+        git fetch origin +refs/pull/$PR_ID/merge:
+        git checkout -qf FETCH_HEAD
+      fi
+
+dependencies:
+  override:
+    - pip install tox
+
+test:
+  override:
+    - tox -e flake8
+    - tox -e py27
+    - tox -e validate
+  post:
+    - mkdir -p $CIRCLE_TEST_REPORTS/reports
+    - cp nosetests.xml $CIRCLE_TEST_REPORTS
diff --git a/examples/aria-service-proxy-plugin/plugin.yaml b/examples/aria-service-proxy-plugin/plugin.yaml
new file mode 100644
index 0000000..3c3ab90
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/plugin.yaml
@@ -0,0 +1,85 @@
+# 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
+
+topology_template:
+  policies:
+    aria-service-proxy-plugin:
+      type: aria.Plugin
+      properties:
+        version: 0.1
+        
+data_types:
+  serviceproxy.waitconfig:
+    properties:
+      wait_for_service:
+        type: boolean
+        description: >-
+          If True, wait for 'wait_time' for service to exist and other conditions
+          to be True.  Otherwise don't retry in case of failure.
+        required: false
+        default: false
+      wait_time:
+        description: time to wait for service outputs to be available in seconds
+        type: integer
+        required: false
+        default: 30
+      wait_expression:
+        description: >-
+          boolean expression to wait for truth value.  Python syntax. 
+          Example: output1 > output2
+        type: string
+        required: false
+        
+node_types:
+
+  aria.serviceproxy.ServiceProxy:
+    derived_from: tosca.nodes.Root
+    properties:
+      service_name:
+        description: the name of the service to proxy
+        required: true
+        type: string
+      outputs:
+        description: >-
+          list of outputs that will be mapped to proxy attributes
+          under the \"proxied\" key
+        required: false
+        default: []
+        type: list
+        entry_schema:
+          type: string
+      wait_config:
+        type: serviceproxy.waitconfig
+        required: false
+        default:
+          wait_for_service:
+            false
+    attributes:
+      last_update:
+        description: time of last update
+        type: timestamp
+      service_outputs:
+        description: outputs copied from proxied service
+        type: map
+        entry_schema:
+          type: string
+    interfaces:
+      Standard:
+        type: tosca.interfaces.node.lifecycle.Standard
+        create:
+          implementation: aria-service-proxy-plugin > aria_service_proxy.tasks.proxy_connect
+            
diff --git a/examples/aria-service-proxy-plugin/requirements.txt b/examples/aria-service-proxy-plugin/requirements.txt
new file mode 100644
index 0000000..86986db
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/requirements.txt
@@ -0,0 +1,17 @@
+Jinja2==2.9
+MarkupSafe==1.0
+bottle==0.12.7
+certifi==2017.11.05
+chardet==3.0.4
+cloudify-plugins-common==4.2
+cloudify-rest-client==4.2
+decorator==4.1.2
+idna==2.6
+networkx==2.0
+pika==0.9.14
+proxy-tools==0.1.0
+requests==2.18.4
+requests-toolbelt==0.8.0
+urllib3==1.22
+wsgiref==0.1.2
+apache-ariatosca==0.2.0
diff --git a/examples/aria-service-proxy-plugin/setup.py b/examples/aria-service-proxy-plugin/setup.py
new file mode 100644
index 0000000..1762f45
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/setup.py
@@ -0,0 +1,31 @@
+# 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.
+
+import setuptools
+
+setuptools.setup(
+    name='aria-service-proxy-plugin',
+    version='0.1',
+    author='dfilppi',
+    author_email='dewayne@cloudify.co',
+    description='service proxy plugin',
+    packages=[ 'aria_service_proxy' ],
+    license='LICENSE',
+    install_requires=[
+        'cloudify-plugins-common>=4.0',
+        'networkx==2.0',
+        'Jinja2==2.9'
+        ]
+)
diff --git a/examples/aria-service-proxy-plugin/tests/__init__.py b/examples/aria-service-proxy-plugin/tests/__init__.py
new file mode 100644
index 0000000..38302fc
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/tests/__init__.py
@@ -0,0 +1,3 @@
+import os
+
+ROOT_DIR = os.path.dirname(os.path.dirname(__file__))
diff --git a/examples/aria-service-proxy-plugin/tests/test_proxy.py b/examples/aria-service-proxy-plugin/tests/test_proxy.py
new file mode 100644
index 0000000..9656a3e
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/tests/test_proxy.py
@@ -0,0 +1,191 @@
+# 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.
+
+from mock import (
+    MagicMock,
+    Mock
+    )
+import pytest
+from aria_service_proxy import tasks
+from cloudify.exceptions import NonRecoverableError
+from cloudify.state import current_ctx
+
+def test_noservice_with_wait(monkeypatch):
+    node = Mock(properties = {'service_name': 'testwait',
+                              'wait_config':{'wait_for_service': True, 'wait_time':5},
+                              'outputs': ['someoutput']})
+    attrs = {'retry.return_value' : 'retry' }
+    operation = Mock( retry_number = 0, **attrs)
+    ctxmock = MagicMock( node = node , operation = operation)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks,"get_service_names",lambda: {})
+    ret = tasks.proxy_connect()
+    assert(ret == 'retry')
+
+def test_noservice_no_wait(monkeypatch):
+    node = Mock(properties = {'service_name': 'testfail',
+                              'wait_config':{'wait_for_service': False, 'wait_time':5 },
+                              'outputs': ['someoutput']})
+    ctxmock = MagicMock(node = node)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks,"get_service_names",lambda: {})
+    with pytest.raises(NonRecoverableError):
+        tasks.proxy_connect()
+
+def test_service_eventual_complete(monkeypatch):
+    output = Mock( value = 'someval')
+    service = Mock(outputs = { 'someoutput': output })
+
+    node = Mock( properties = {
+                      'service_name': 'test',
+                      'wait_config': { 'wait_for_service':True,
+                                       'wait_time': 1 },
+                      'outputs':['someoutput']
+                      }
+               )
+
+    instance = Mock(runtime_properties = {})
+    attrs = {'retry.return_value' : 'retry' }
+    operation = Mock( retry_number = 0, **attrs)
+    ctxmock = MagicMock( node = node , operation = operation, instance = instance)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test': service })
+    monkeypatch.setattr(tasks, "is_installed", lambda a: False)
+
+    ret = tasks.proxy_connect()
+    assert(ret == 'retry')
+
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test': service })
+    monkeypatch.setattr(tasks, "is_installed", lambda a: True)
+    ret = tasks.proxy_connect()
+    assert(ret == None)
+    assert(len(ctxmock.instance.runtime_properties['service_outputs']) == 1)
+    assert(ctxmock.instance.runtime_properties['service_outputs'][0]['name'] == 'someoutput')
+    assert(ctxmock.instance.runtime_properties['service_outputs'][0]['value'] == 'someval')
+
+def test_output_retry(monkeypatch):
+    output = Mock( value = 'someval')
+    service = Mock(outputs= {'test':output})
+    node = Mock(properties = {'service_name': 'test',
+                              'wait_config':{'wait_for_service': True, 'wait_time':5},
+                              'outputs': ['someoutput']})
+    attrs = {'retry.return_value' : 'retry' }
+    operation = Mock( retry_number = 0, **attrs)
+    ctxmock = MagicMock( node = node , operation = operation)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test': service})
+    monkeypatch.setattr(tasks, "is_installed", lambda a: True)
+
+    ret = tasks.proxy_connect()
+    assert(ret == 'retry')
+
+def test_output_complete(monkeypatch):
+    output = Mock( value = 'someval')
+    service = Mock(outputs= {'someoutput':output})
+    node = Mock(properties = {'service_name': 'test',
+                              'wait_config':{'wait_for_service': True, 'wait_time':5},
+                              'outputs': ['someoutput']})
+    attrs = {'retry.return_value' : 'retry' }
+    operation = Mock( retry_number = 5, **attrs)
+    ctxmock = MagicMock( node = node , operation = operation)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test':service})
+    monkeypatch.setattr(tasks, "is_installed", lambda a: True)
+
+    ret = tasks.proxy_connect()
+    assert(ret == None)
+
+def test_output_eventual_complete(monkeypatch):
+    output = Mock( value = 'someval')
+    service = Mock(outputs= {'test':output})
+    node = Mock(properties = {'service_name': 'test',
+                              'wait_config':{'wait_for_service': True, 'wait_time':1},
+                              'outputs': ['someoutput']})
+    attrs = {'retry.return_value' : 'retry' }
+    instance = Mock(runtime_properties = {})
+    operation = Mock( retry_number = 0, **attrs)
+    ctxmock = MagicMock( node = node , operation = operation, instance = instance)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks, "is_installed", lambda a: True)
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test':service})
+
+    ret = tasks.proxy_connect()
+    assert(ret == 'retry')
+
+    service = Mock(outputs= {'someoutput':output})
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test':service})
+    ret = tasks.proxy_connect()
+    assert(ret == None)
+    assert(len(ctxmock.instance.runtime_properties['service_outputs']) == 1)
+    assert(ctxmock.instance.runtime_properties['service_outputs'][0]['name'] == 'someoutput')
+    assert(ctxmock.instance.runtime_properties['service_outputs'][0]['value'] == 'someval')
+
+def test_expr_fail(monkeypatch):
+    output = Mock( value = 'someval')
+    service = Mock(outputs= {'someoutput':output})
+    node = Mock(properties = {'service_name': 'test',
+                              'wait_config':
+                                {'wait_for_service': True,
+                                 'wait_expression': 'len(someoutput) == 1',
+                                 'wait_time':5},
+                              'outputs': ['someoutput']})
+    attrs = {'retry.return_value' : 'retry' }
+    operation = Mock( retry_number = 5, **attrs)
+    ctxmock = MagicMock( node = node , operation = operation)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test':service})
+    monkeypatch.setattr(tasks, "is_installed", lambda a: True)
+
+    with pytest.raises(NonRecoverableError):
+        tasks.proxy_connect()
+
+def test_expr_succeed(monkeypatch):
+    output = Mock( value = 'someval')
+    service = Mock(outputs= {'someoutput':output})
+    node = Mock(properties = {'service_name': 'test',
+                              'wait_config':
+                                {'wait_for_service': True,
+                                 'wait_expression': 'len(someoutput) == 7',
+                                 'wait_time':5},
+                              'outputs': ['someoutput']})
+    attrs = {'retry.return_value' : 'retry' }
+    operation = Mock( retry_number = 5, **attrs)
+    ctxmock = MagicMock( node = node , operation = operation)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test':service})
+    monkeypatch.setattr(tasks, "is_installed", lambda a: True)
+
+    ret = tasks.proxy_connect()
+    assert(ret == None)
+
+def test_expr_succeed_mult(monkeypatch):
+    output1 = Mock( value = 4)
+    output2 = Mock( value = 7)
+    service = Mock(outputs= {'o1':output1, 'o2': output2})
+    node = Mock(properties = {'service_name': 'test',
+                              'wait_config':
+                                {'wait_for_service': True,
+                                 'wait_expression': 'o1 < o2',
+                                 'wait_time':5},
+                              'outputs': ['o1','o2']})
+    attrs = {'retry.return_value' : 'retry' }
+    operation = Mock( retry_number = 5, **attrs)
+    ctxmock = MagicMock( node = node , operation = operation)
+    current_ctx.set(ctxmock)
+    monkeypatch.setattr(tasks, "get_service_names", lambda: {'test':service})
+    monkeypatch.setattr(tasks, "is_installed", lambda a: True)
+
+    ret = tasks.proxy_connect()
+    assert(ret == None)
diff --git a/examples/aria-service-proxy-plugin/tox.ini b/examples/aria-service-proxy-plugin/tox.ini
new file mode 100644
index 0000000..14fa90c
--- /dev/null
+++ b/examples/aria-service-proxy-plugin/tox.ini
@@ -0,0 +1,66 @@
+# content of: tox.ini , put in same dir as setup.py
+[tox]
+envlist=flake8,py27,validate
+
+[testenv:py27]
+deps =
+    -rdev-requirements.txt
+    -rtest-requirements.txt
+commands =
+    nosetests -v --cover-html --with-coverage \
+        --cover-package=cloudify_cloudinit \
+        --cover-package=cloudify_deployment_proxy \
+        --cover-package=cloudify_ssh_key \
+        --cover-package=cloudify_configuration \
+        --cover-package=cloudify_terminal \
+        --cover-package=cloudify_suspend \
+        --cover-package=cloudify_custom_workflow \
+        --with-xunit --xunit-file=nosetests.xml .
+
+[testenv:flake8]
+deps =
+    -rdev-requirements.txt
+    -rtest-requirements.txt
+commands =
+    flake8 cloudify_cloudinit
+    flake8 cloudify_deployment_proxy
+    flake8 cloudify_ssh_key
+    flake8 cloudify_configuration
+    flake8 cloudify_terminal
+    flake8 cloudify_suspend
+    flake8 cloudify_custom_workflow
+    pylint -E cloudify_deployment_proxy \
+           -E cloudify_ssh_key \
+           -E cloudify_terminal \
+           -E cloudify_configuration \
+           -E cloudify_custom_workflow \
+           -E cloudify_suspend
+
+[testenv:validate]
+deps =
+    -rdev-requirements.txt
+    -rtest-requirements.txt
+commands =
+    # configration plugin
+    cfy blueprint validate cloudify_cloudinit/examples/simple.yaml
+    # configration plugin
+    cfy blueprint validate cloudify_configuration/examples/simple.yaml
+    # deployment proxy examples
+    cfy blueprint validate cloudify_deployment_proxy/examples/deployment-proxy.yaml
+    cfy blueprint validate cloudify_deployment_proxy/examples/deployment-proxy-reuse.yaml
+    cfy blueprint validate cloudify_deployment_proxy/examples/deployment-proxy-custom-workflow.yaml
+    cfy blueprint validate cloudify_deployment_proxy/examples/deployment-without-workflow.yaml
+    cfy blueprint validate cloudify_deployment_proxy/examples/node-instance-proxy.yaml
+    # ssh examples
+    cfy blueprint validate cloudify_ssh_key/examples/import-simple-manager.yaml
+    cfy blueprint validate cloudify_ssh_key/examples/ssh-key-blueprint.yaml
+    # too slow
+    # cfy blueprint validate cloudify_ssh_key/examples/azure-blueprint.yaml
+    # terminal examples
+    cfy blueprint validate cloudify_terminal/examples/fortigate.yaml
+    cfy blueprint validate cloudify_terminal/examples/cisco.yaml
+    cfy blueprint validate cloudify_terminal/examples/linux-ssh.yaml
+    # suspend examples
+    cfy blueprint validate cloudify_suspend/examples/example.yaml
+    # custom workflow
+    cfy blueprint validate cloudify_custom_workflow/examples/example.yaml