[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-11 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/incubator-ariatosca/pull/191


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-11 Thread tliron
Github user tliron commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r138103044
  
--- Diff: .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
--- End diff --

While working on this file it seemed odd to me that this one env variable 
is not in the .travis.yml "env" section. It makes sense to group it here, too, 
because in the future we might find that some tox envs run fine with 
multiprocess. (The Travis VMs/containers all have 2 cores, actually. I still 
don't know why are our tests fail when we switch to 2 processes.)


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-11 Thread tliron
Github user tliron commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r138102421
  
--- Diff: .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
--- End diff --

While working on fixing the tests, I actually added a whole bunch of stuff 
here to assist debugging. And then it occurred to me, why test pip version 
specifically? There is so much other stuff here that might be useful. (Also, we 
explicitly upgrade pip to the latest version when the test runs.) I think it's 
more confusing to have this here. If someone needs to debug something specific 
with the test mechanism on Travis, they can add whatever they want here (like I 
did) that is relevant.


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-11 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r138003712
  
--- Diff: .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 ''
--- End diff --

I don't really see the benefit of replacing password with keypair usage, 
and so IMO it's better to avoid this extra work + hardcoding file systme path 
in the actual SSH test - though obviously the test is aimed specifically at 
Travis env and so it doesn't matter that much I guess.


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-11 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r138002768
  
--- Diff: .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
--- End diff --

why remove this? it can be useful for debugging


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-06 Thread tliron
Github user tliron commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r137270329
  
--- Diff: examples/clearwater/scripts/bono/delete.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.
--- End diff --

+1 added TODO


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-06 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r137211470
  
--- Diff: aria/modeling/service_instance.py ---
@@ -228,6 +228,80 @@ def service_template_fk(cls):
 :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
+
+def satisfy_requirements(self):
--- End diff --

I agree, those indeed seem useful - But I was actually referring to the 
`satisfy_requirements` and other methods, which I now see are the result of a 
merge issue - Note that they have been moved to `topology.py`, and should no 
longer be in `service_instance.py`.


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-06 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r137209471
  
--- Diff: examples/clearwater/scripts/bono/delete.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.
--- End diff --

Ok - it wasn't clear that this was a TODO


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-06 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r137208385
  
--- Diff: 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.1.2'
+
+imports:
+  - types/clearwater.yaml
+  - aria-1.0
+
+topology_template:
+
+  inputs:
+hosts.ssh.user:
+  type: string
+hosts.ssh.password:
--- End diff --

:+1: 


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-05 Thread tliron
Github user tliron commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r137070505
  
--- Diff: aria/modeling/service_instance.py ---
@@ -228,6 +228,80 @@ def service_template_fk(cls):
 :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
+
+def satisfy_requirements(self):
+satisfied = True
+for node in self.nodes.itervalues():
+if not node.satisfy_requirements():
+satisfied = False
+return satisfied
+
+def validate_capabilities(self):
+satisfied = True
+for node in self.nodes.itervalues():
+if not node.validate_capabilities():
+satisfied = False
+return satisfied
+
+def find_hosts(self):
+for node in self.nodes.itervalues():
+node.find_host()
+
+def configure_operations(self):
+for node in self.nodes.itervalues():
+node.configure_operations()
+for group in self.groups.itervalues():
+group.configure_operations()
+for operation in self.workflows.itervalues():
+operation.configure()
+
+def is_node_a_target(self, target_node):
+for node in self.nodes.itervalues():
+if self._is_node_a_target(node, target_node):
+return True
+return False
+
+def _is_node_a_target(self, source_node, target_node):
--- End diff --

This is a leftover utility function from a previous experiment of mine (for 
solving an SMTP config challenge). It's not needed anymore, so I will just 
remove it.


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-05 Thread tliron
Github user tliron commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r137052935
  
--- Diff: 
extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py ---
@@ -159,10 +159,6 @@ def get_data_type(context, presentation, field_name, 
allow_none=False):
 else:
 return str
 
-# Make sure not derived from self
-if type_name == presentation._name:
--- End diff --

The previous code was broken and threw an exception when reaching those 
lines. I found the bug by accident while working on this so just decided to do 
a spot fix.


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-05 Thread tliron
Github user tliron commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r137049267
  
--- Diff: examples/clearwater/scripts/ralf/create.sh ---
@@ -0,0 +1,15 @@
+#!/bin/bash
--- End diff --

In terms of software installation, installing Dime will install 
Ralf+Homestead. However, those components run entirely differently in terms of 
configuration, logging, networking, etc. I imagine that in the multi-node 
Clearwater there will be things in this script to configure networking (open 
ports) for Ralf specifically. So, again, this is left here as a TODO.


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-05 Thread tliron
Github user tliron commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r137048198
  
--- Diff: examples/clearwater/scripts/bono/delete.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.
--- End diff --

I'm leaving that as TODOs -- we do need a way to uininstall, too, no?


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-05 Thread tliron
Github user tliron commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r137048035
  
--- Diff: 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.1.2'
+
+imports:
+  - types/clearwater.yaml
+  - aria-1.0
+
+topology_template:
+
+  inputs:
+hosts.ssh.user:
+  type: string
+hosts.ssh.password:
--- End diff --

I was thinking forward here to the future template that will have multiple 
hosts. For consistency, I thought to call "hosts." so it would apply to all 
hosts. This is a simpler example with only one host.


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-05 Thread tliron
Github user tliron commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r137048061
  
--- Diff: 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.1.2'
--- End diff --

+1


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-05 Thread tliron
Github user tliron commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r137047729
  
--- Diff: 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.1.2'
--- End diff --

+1


---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-03 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r136713311
  
--- Diff: examples/clearwater/scripts/bono/delete.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.
--- End diff --

Why have these empty files?
Why not simply omit such operation implementations?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-03 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r136715926
  
--- Diff: aria/modeling/service_instance.py ---
@@ -228,6 +228,80 @@ def service_template_fk(cls):
 :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
+
+def satisfy_requirements(self):
--- End diff --

im not sure i understand this addition. who's calling this, and why is this 
a part of this PR?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-03 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r136713948
  
--- Diff: examples/clearwater/scripts/ralf/create.sh ---
@@ -0,0 +1,15 @@
+#!/bin/bash
--- End diff --

why does dime's create operation install ralf? I'm not sure i understand 
the modeling. Is Ralf "contained in" Dime conceptually?
(even if this is the case, why have this file at all?)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-03 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r136714399
  
--- Diff: 
extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py ---
@@ -159,10 +159,6 @@ def get_data_type(context, presentation, field_name, 
allow_none=False):
 else:
 return str
 
-# Make sure not derived from self
-if type_name == presentation._name:
--- End diff --

what is this about?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-03 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r136713007
  
--- Diff: 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.1.2'
--- End diff --

the version should probably be 0.2.0


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-03 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r136713056
  
--- Diff: 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.1.2'
--- End diff --

0.2.0


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-03 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r136716094
  
--- Diff: aria/modeling/service_instance.py ---
@@ -228,6 +228,80 @@ def service_template_fk(cls):
 :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
+
+def satisfy_requirements(self):
+satisfied = True
+for node in self.nodes.itervalues():
+if not node.satisfy_requirements():
+satisfied = False
+return satisfied
+
+def validate_capabilities(self):
+satisfied = True
+for node in self.nodes.itervalues():
+if not node.validate_capabilities():
+satisfied = False
+return satisfied
+
+def find_hosts(self):
+for node in self.nodes.itervalues():
+node.find_host()
+
+def configure_operations(self):
+for node in self.nodes.itervalues():
+node.configure_operations()
+for group in self.groups.itervalues():
+group.configure_operations()
+for operation in self.workflows.itervalues():
+operation.configure()
+
+def is_node_a_target(self, target_node):
+for node in self.nodes.itervalues():
+if self._is_node_a_target(node, target_node):
+return True
+return False
+
+def _is_node_a_target(self, source_node, target_node):
--- End diff --

Pretty confused by this.
1) Who's using this?
2) Why not check the node's `incoming_relationships`?
3) Why is the private helper function recursive? The main public function 
already goes over all nodes and checks each one for a source node.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-03 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r136713061
  
--- Diff: 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.1.2'
+
+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:
--- End diff --

same comment about `hosts` vs `existing_host`..?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-09-03 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/191#discussion_r136713034
  
--- Diff: 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.1.2'
+
+imports:
+  - types/clearwater.yaml
+  - aria-1.0
+
+topology_template:
+
+  inputs:
+hosts.ssh.user:
+  type: string
+hosts.ssh.password:
--- End diff --

why is one "hosts.X.Y" and the other "existing_host.Z.W"? It makes it seem 
like the user/password and the public-address are for two different hosts, 
doesn't it?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #191: ARIA-321 Provide Clearwater IMS examp...

2017-08-15 Thread tliron
GitHub user tliron opened a pull request:

https://github.com/apache/incubator-ariatosca/pull/191

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 bugs in model instrumentation (to allow ctx access to capability
properties and complex values)
* 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

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/incubator-ariatosca ARIA-321-clearwater

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-ariatosca/pull/191.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #191


commit 8bb52180a34ca5617cc89c1ac39b152e0bda7d25
Author: Tal Liron 
Date:   2017-07-27T22:58:17Z

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 bugs in model instrumentation (to allow ctx access to capability
properties and complex values)
* 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




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---