summaryrefslogtreecommitdiffstats
path: root/dmaap
diff options
context:
space:
mode:
Diffstat (limited to 'dmaap')
-rw-r--r--dmaap/consulif/consulif.py7
-rw-r--r--dmaap/dmaap.yaml2
-rw-r--r--dmaap/dmaapcontrollerif/dmaap_requests.py16
-rw-r--r--dmaap/dmaapplugin/__init__.py3
-rw-r--r--dmaap/dmaapplugin/dr_bridge.py3
-rw-r--r--dmaap/dmaapplugin/dr_lifecycle.py15
-rw-r--r--dmaap/dmaapplugin/dr_relationships.py3
-rw-r--r--dmaap/dmaapplugin/mr_lifecycle.py3
-rw-r--r--dmaap/pom.xml4
-rw-r--r--dmaap/requirements.txt4
-rw-r--r--dmaap/setup.py28
-rw-r--r--dmaap/tests/test_dmaapcontrollerif.py17
-rw-r--r--dmaap/tests/test_dr_lifecycle.py17
-rw-r--r--dmaap/tests/test_mr_lifecycle.py17
-rw-r--r--dmaap/tox.ini8
15 files changed, 96 insertions, 51 deletions
diff --git a/dmaap/consulif/consulif.py b/dmaap/consulif/consulif.py
index 8033603..5c78b89 100644
--- a/dmaap/consulif/consulif.py
+++ b/dmaap/consulif/consulif.py
@@ -2,6 +2,7 @@
# org.onap.ccsdk
# =============================================================================
# Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2020 Pantheon.tech. All rights reserved.
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,7 +19,11 @@
import consul
import json
-from urlparse import urlparse
+try:
+ from urllib.parse import urlparse
+except ImportError:
+ from urlparse import urlparse
+
class ConsulHandle(object):
'''
diff --git a/dmaap/dmaap.yaml b/dmaap/dmaap.yaml
index 4a47a7f..a4fe9fb 100644
--- a/dmaap/dmaap.yaml
+++ b/dmaap/dmaap.yaml
@@ -25,7 +25,7 @@ plugins:
dmaapplugin:
executor: 'central_deployment_agent'
package_name: dmaap
- package_version: 1.3.5
+ package_version: 1.4.0
node_types:
diff --git a/dmaap/dmaapcontrollerif/dmaap_requests.py b/dmaap/dmaapcontrollerif/dmaap_requests.py
index 231953a..0f02594 100644
--- a/dmaap/dmaapcontrollerif/dmaap_requests.py
+++ b/dmaap/dmaapcontrollerif/dmaap_requests.py
@@ -2,6 +2,7 @@
# org.onap.ccsdk
# =============================================================================
# Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2020 Pantheon.tech. All rights reserved.
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -287,14 +288,15 @@ class DMaaPControllerHandle(object):
locations.raise_for_status()
# pull out location names for VALID locations with matching dcae_layer
- return map(lambda l: l["dcaeLocationName"],
- filter(lambda i : (i['dcaeLayer'] == dcae_layer and i['status'] == 'VALID'),
- locations.json()))
+ return [location["dcaeLocationName"] for location in locations.json()
+ if location['dcaeLayer'] == dcae_layer
+ and location['status'] == 'VALID']
def get_dcae_central_locations(self):
'''
Get the list of location names known to the DMaaP bus controller
- whose "dcaeLayer" property contains "central" (ignoring case) and whose status is "VALID".
+ whose "dcaeLayer" property contains "central" (ignoring case)
+ and whose status is "VALID".
"dcaeLayer" contains "central" for central sites.
'''
# Do these as a separate step so things like 404 get reported precisely
@@ -302,7 +304,7 @@ class DMaaPControllerHandle(object):
locations.raise_for_status()
# pull out location names for VALID central locations
- return map(lambda l: l["dcaeLocationName"],
- filter(lambda i : ('central' in i['dcaeLayer'].lower() and i['status'] == 'VALID'),
- locations.json()))
+ return [location["dcaeLocationName"] for location in locations.json()
+ if 'central' in location['dcaeLayer'].lower()
+ and location['status'] == 'VALID']
diff --git a/dmaap/dmaapplugin/__init__.py b/dmaap/dmaapplugin/__init__.py
index 43da00e..faa331b 100644
--- a/dmaap/dmaapplugin/__init__.py
+++ b/dmaap/dmaapplugin/__init__.py
@@ -2,6 +2,7 @@
# org.onap.ccsdk
# =============================================================================
# Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2020 Pantheon.tech. All rights reserved.
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -21,7 +22,7 @@ from consulif.consulif import ConsulHandle
from cloudify.exceptions import NonRecoverableError
import os
-os.environ["REQUESTS_CA_BUNDLE"]="/opt/onap/certs/cacert.pem" # This is to handle https request thru plugin
+os.environ["REQUESTS_CA_BUNDLE"]="/opt/onap/certs/cacert.pem" # This is to handle https request thru plugin
CONSUL_HOST = "consul" # Should always be a local consul agent on Cloudify Manager
DBCL_KEY_NAME = "dmaap-plugin" # Consul key containing DMaaP data bus credentials
diff --git a/dmaap/dmaapplugin/dr_bridge.py b/dmaap/dmaapplugin/dr_bridge.py
index 25022bb..f4c5cdc 100644
--- a/dmaap/dmaapplugin/dr_bridge.py
+++ b/dmaap/dmaapplugin/dr_bridge.py
@@ -2,6 +2,7 @@
# org.onap.ccsdk
# =============================================================================
# Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2020 Pantheon.tech. All rights reserved.
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,7 +21,7 @@ from cloudify import ctx
from cloudify.decorators import operation
from cloudify.exceptions import NonRecoverableError
from dmaapplugin import DMAAP_API_URL, DMAAP_USER, DMAAP_PASS
-from dmaaputils import random_string
+from dmaapplugin.dmaaputils import random_string
from dmaapcontrollerif.dmaap_requests import DMaaPControllerHandle
# Set up a subscriber to a source feed
diff --git a/dmaap/dmaapplugin/dr_lifecycle.py b/dmaap/dmaapplugin/dr_lifecycle.py
index 718158a..4efeef5 100644
--- a/dmaap/dmaapplugin/dr_lifecycle.py
+++ b/dmaap/dmaapplugin/dr_lifecycle.py
@@ -2,6 +2,7 @@
# org.onap.ccsdk
# =============================================================================
# Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2020 Pantheon.tech. All rights reserved.
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,7 +21,7 @@ from cloudify import ctx
from cloudify.decorators import operation
from cloudify.exceptions import NonRecoverableError
from dmaapplugin import DMAAP_API_URL, DMAAP_USER, DMAAP_PASS, DMAAP_OWNER
-from dmaaputils import random_string
+from dmaapplugin.dmaaputils import random_string
from dmaapcontrollerif.dmaap_requests import DMaaPControllerHandle
# Lifecycle operations for DMaaP Data Router feeds
@@ -47,19 +48,19 @@ def create_feed(**kwargs):
feed_name = random_string(12)
# Set defaults/placeholders for the optional properties for the feed
- if "feed_version" in ctx.node.properties.keys():
+ if "feed_version" in ctx.node.properties:
feed_version = ctx.node.properties["feed_version"]
else:
feed_version = "0.0"
- if "feed_description" in ctx.node.properties.keys():
+ if "feed_description" in ctx.node.properties:
feed_description = ctx.node.properties["feed_description"]
else:
feed_description = "No description provided"
- if "aspr_classification" in ctx.node.properties.keys():
+ if "aspr_classification" in ctx.node.properties:
aspr_classification = ctx.node.properties["aspr_classification"]
else:
aspr_classification = "unclassified"
- if "useExisting" in ctx.node.properties.keys():
+ if "useExisting" in ctx.node.properties:
useExisting = ctx.node.properties["useExisting"]
else:
useExisting = False
@@ -98,10 +99,10 @@ def get_existing_feed(**kwargs):
dmc = DMaaPControllerHandle(DMAAP_API_URL, DMAAP_USER, DMAAP_PASS, ctx.logger)
ctx.logger.info("DMaaPControllerHandle() returned")
feed_id_input = False
- if "feed_id" in ctx.node.properties.keys():
+ if "feed_id" in ctx.node.properties:
feed_id_input = True
f = dmc.get_feed_info(ctx.node.properties["feed_id"])
- elif "feed_name" in ctx.node.properties.keys():
+ elif "feed_name" in ctx.node.properties:
feed_name = ctx.node.properties["feed_name"]
f = dmc.get_feed_info_by_name(feed_name)
if f is None:
diff --git a/dmaap/dmaapplugin/dr_relationships.py b/dmaap/dmaapplugin/dr_relationships.py
index 4c955f2..bdb742d 100644
--- a/dmaap/dmaapplugin/dr_relationships.py
+++ b/dmaap/dmaapplugin/dr_relationships.py
@@ -2,6 +2,7 @@
# org.onap.ccsdk
# =============================================================================
# Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2020 Pantheon.tech. All rights reserved.
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,7 +21,7 @@ from cloudify import ctx
from cloudify.decorators import operation
from cloudify.exceptions import NonRecoverableError
from dmaapplugin import DMAAP_API_URL, DMAAP_USER, DMAAP_PASS, CONSUL_HOST
-from dmaaputils import random_string
+from dmaapplugin.dmaaputils import random_string
from dmaapcontrollerif.dmaap_requests import DMaaPControllerHandle
from consulif.consulif import ConsulHandle
diff --git a/dmaap/dmaapplugin/mr_lifecycle.py b/dmaap/dmaapplugin/mr_lifecycle.py
index ec674de..eb4e1ba 100644
--- a/dmaap/dmaapplugin/mr_lifecycle.py
+++ b/dmaap/dmaapplugin/mr_lifecycle.py
@@ -2,6 +2,7 @@
# org.onap.ccsdk
# =============================================================================
# Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2020 Pantheon.tech. All rights reserved.
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,7 +21,7 @@ from cloudify import ctx
from cloudify.decorators import operation
from cloudify.exceptions import NonRecoverableError
from dmaapplugin import DMAAP_API_URL, DMAAP_USER, DMAAP_PASS, DMAAP_OWNER
-from dmaaputils import random_string
+from dmaapplugin.dmaaputils import random_string
from dmaapcontrollerif.dmaap_requests import DMaaPControllerHandle
# Lifecycle operations for DMaaP Message Router topics
diff --git a/dmaap/pom.xml b/dmaap/pom.xml
index f49bb8c..95f0774 100644
--- a/dmaap/pom.xml
+++ b/dmaap/pom.xml
@@ -23,7 +23,7 @@ limitations under the License.
<parent>
<groupId>org.onap.ccsdk.platform</groupId>
<artifactId>plugins</artifactId>
- <version>1.0.1-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
</parent>
<!--- CHANGE THE FOLLOWING 3 OBJECTS for your own repo -->
@@ -31,7 +31,7 @@ limitations under the License.
<artifactId>dmaap</artifactId>
<name>dmaap</name>
- <version>1.0.1-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
<url>http://maven.apache.org</url>
<properties>
<!-- name from the setup.py file -->
diff --git a/dmaap/requirements.txt b/dmaap/requirements.txt
index ffdb97f..54ffbc4 100644
--- a/dmaap/requirements.txt
+++ b/dmaap/requirements.txt
@@ -1 +1,3 @@
-python-consul==0.7.0
+python-consul>=0.7.0
+requests
+cloudify-common>=5.0.5
diff --git a/dmaap/setup.py b/dmaap/setup.py
index c423d95..7a4c85c 100644
--- a/dmaap/setup.py
+++ b/dmaap/setup.py
@@ -1,8 +1,26 @@
+# ============LICENSE_START====================================================
+# =============================================================================
+# Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2020 Pantheon.tech. All rights reserved.
+# =============================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END======================================================
+
from setuptools import setup, find_packages
setup(
name = "dmaap",
- version = "1.3.5",
+ version = "1.4.0",
packages=find_packages(),
author = "AT&T",
description = ("Cloudify plugin for creating DMaaP feeds and topics, and setting up publishers and subscribers."),
@@ -10,7 +28,9 @@ setup(
keywords = "",
url = "",
zip_safe=False,
- install_requires = [
- "python-consul==0.7.0"
- ]
+ install_requires=[
+ 'python-consul>=0.7.0',
+ 'requests',
+ 'cloudify-common>=5.0.5',
+ ],
)
diff --git a/dmaap/tests/test_dmaapcontrollerif.py b/dmaap/tests/test_dmaapcontrollerif.py
index 0f6a5c0..6ca15ba 100644
--- a/dmaap/tests/test_dmaapcontrollerif.py
+++ b/dmaap/tests/test_dmaapcontrollerif.py
@@ -2,6 +2,7 @@
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2020 Pantheon.tech. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -52,13 +53,15 @@ def test_dmaapc (monkeypatch, mockconsul, mockdmaapbc):
DMAAP_OWNER = config['owner']
properties = {'fqdn': 'a.x.example.com', 'openstack': _goodosv2 }
- mock_ctx = MockCloudifyContext(node_id='test_node_id', node_name='test_node_name', properties=properties,
- runtime_properties = {
- "admin": { "user": "admin_user" },
- "user": { "user": "user_user" },
- "viewer": { "user": "viewer_user" }
- }
- )
+ mock_ctx = MockCloudifyContext(
+ node_id='test_node_id',
+ node_name='test_node_name',
+ properties=properties,
+ runtime_properties = {
+ "admin": { "user": "admin_user" },
+ "user": { "user": "user_user" },
+ "viewer": { "user": "viewer_user" }
+ })
current_ctx.set(mock_ctx)
diff --git a/dmaap/tests/test_dr_lifecycle.py b/dmaap/tests/test_dr_lifecycle.py
index 925d575..d08e9db 100644
--- a/dmaap/tests/test_dr_lifecycle.py
+++ b/dmaap/tests/test_dr_lifecycle.py
@@ -2,6 +2,7 @@
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2020 Pantheon.tech. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -41,13 +42,15 @@ def test_create_feed(monkeypatch, mockconsul, mockdmaapbc):
from dmaapplugin import dr_lifecycle
properties = {'fqdn': 'a.x.example.com', 'openstack': _goodosv2, 'feed_id': 'test_feed_id' }
- mock_ctx = MockCloudifyContext(node_id='test_node_id', node_name='test_node_name', properties=properties,
- runtime_properties = {
- "admin": { "user": "admin_user" },
- "user": { "user": "user_user" },
- "viewer": { "user": "viewer_user" }
- }
- )
+ mock_ctx = MockCloudifyContext(
+ node_id='test_node_id',
+ node_name='test_node_name',
+ properties=properties,
+ runtime_properties = {
+ "admin": { "user": "admin_user" },
+ "user": { "user": "user_user" },
+ "viewer": { "user": "viewer_user" }
+ })
current_ctx.set(mock_ctx)
diff --git a/dmaap/tests/test_mr_lifecycle.py b/dmaap/tests/test_mr_lifecycle.py
index b2ee713..593c091 100644
--- a/dmaap/tests/test_mr_lifecycle.py
+++ b/dmaap/tests/test_mr_lifecycle.py
@@ -2,6 +2,7 @@
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2020 Pantheon.tech. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -40,13 +41,15 @@ def test_create_topic(monkeypatch, mockconsul, mockdmaapbc):
import dmaapplugin
from dmaapplugin import mr_lifecycle
properties = {'fqdn': 'a.x.example.com', 'openstack': _goodosv2, 'fqtn': 'test_fqtn' }
- mock_ctx = MockCloudifyContext(node_id='test_node_id', node_name='test_node_name', properties=properties,
- runtime_properties = {
- "admin": { "user": "admin_user" },
- "user": { "user": "user_user" },
- "viewer": { "user": "viewer_user" }
- }
- )
+ mock_ctx = MockCloudifyContext(
+ node_id='test_node_id',
+ node_name='test_node_name',
+ properties=properties,
+ runtime_properties = {
+ "admin": { "user": "admin_user" },
+ "user": { "user": "user_user" },
+ "viewer": { "user": "viewer_user" }
+ })
current_ctx.set(mock_ctx)
diff --git a/dmaap/tox.ini b/dmaap/tox.ini
index 15a07f2..020413f 100644
--- a/dmaap/tox.ini
+++ b/dmaap/tox.ini
@@ -2,6 +2,7 @@
# org.onap.ccsdk
# =============================================================================
# Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2020 Pantheon.tech. All rights reserved.
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,14 +18,15 @@
# ============LICENSE_END======================================================
[tox]
-envlist = py27
+envlist = py27,py36,py37
+skip_missing_interpreters = true
+
[testenv]
deps=
- requests
- cloudify==3.4
pytest
coverage
pytest-cov
+ -r requirements.txt
setenv =
PYTHONPATH={toxinidir}
commands=