aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc_upload/config.json5
-rw-r--r--policyhandler/deploy_handler.py19
-rw-r--r--pom.xml2
-rw-r--r--setup.py2
-rw-r--r--tests/test_policyhandler.py8
-rw-r--r--version.properties4
6 files changed, 25 insertions, 15 deletions
diff --git a/etc_upload/config.json b/etc_upload/config.json
index a38d81c..2e3b412 100644
--- a/etc_upload/config.json
+++ b/etc_upload/config.json
@@ -24,7 +24,10 @@
"deploy_handler" : {
"target_entity" : "deployment_handler",
"url" : "http://deployment_handler:8188",
- "max_msg_length_mb" : 5
+ "max_msg_length_mb" : 5,
+ "query" : {
+ "cfy_tenant_name" : "default_tenant"
+ }
}
}
}
diff --git a/policyhandler/deploy_handler.py b/policyhandler/deploy_handler.py
index 3d299f3..6d258f2 100644
--- a/policyhandler/deploy_handler.py
+++ b/policyhandler/deploy_handler.py
@@ -150,6 +150,7 @@ class DeployHandler(object):
_url = None
_url_policy = None
_max_msg_length_mb = 10
+ _query = {}
_target_entity = None
_custom_kwargs = None
_server_instance_uuid = None
@@ -186,12 +187,16 @@ class DeployHandler(object):
# "deploy_handler" : {
# "target_entity" : "deployment_handler",
# "url" : "http://deployment_handler:8188",
- # "max_msg_length_mb" : 100
+ # "max_msg_length_mb" : 10,
+ # "query" : {
+ # "cfy_tenant_name" : "default_tenant"
+ # }
# }
DeployHandler._target_entity = config_dh.get("target_entity", "deployment_handler")
DeployHandler._url = config_dh.get("url")
DeployHandler._max_msg_length_mb = config_dh.get("max_msg_length_mb",
DeployHandler._max_msg_length_mb)
+ DeployHandler._query = deepcopy(config_dh.get("query", {}))
DeployHandler._logger.info("dns based routing to %s: url(%s)",
DeployHandler._target_entity, DeployHandler._url)
@@ -256,8 +261,8 @@ class DeployHandler(object):
log_action = "put to {0} at {1}".format(
DeployHandler._target_entity, DeployHandler._url_policy)
- log_data = " msg={0} headers={1}".format(json.dumps(message),
- json.dumps(headers))
+ log_data = " msg={} headers={}, params={}".format(json.dumps(message), json.dumps(headers),
+ json.dumps(DeployHandler._query))
log_line = log_action + log_data
DeployHandler._logger.info(log_line)
metrics.metrics_start(log_line)
@@ -273,7 +278,8 @@ class DeployHandler(object):
res = None
try:
res = DeployHandler._requests_session.put(
- DeployHandler._url_policy, json=message, headers=headers,
+ DeployHandler._url_policy, json=message,
+ headers=headers, params=DeployHandler._query,
**DeployHandler._custom_kwargs
)
except Exception as ex:
@@ -316,7 +322,8 @@ class DeployHandler(object):
headers = {REQUEST_X_ECOMP_REQUESTID : metrics.request_id}
log_action = "get {0}: {1}".format(DeployHandler._target_entity, DeployHandler._url_policy)
- log_data = " headers={}".format(json.dumps(headers))
+ log_data = " headers={}, params={}".format(json.dumps(headers),
+ json.dumps(DeployHandler._query))
log_line = log_action + log_data
DeployHandler._logger.info(log_line)
metrics.metrics_start(log_line)
@@ -332,7 +339,7 @@ class DeployHandler(object):
res = None
try:
res = DeployHandler._requests_session.get(
- DeployHandler._url_policy, headers=headers,
+ DeployHandler._url_policy, headers=headers, params=DeployHandler._query,
**DeployHandler._custom_kwargs
)
except Exception as ex:
diff --git a/pom.xml b/pom.xml
index 76ae7d9..6230822 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<groupId>org.onap.dcaegen2.platform</groupId>
<artifactId>policy-handler</artifactId>
<name>dcaegen2-platform-policy-handler</name>
- <version>4.0.1-SNAPSHOT</version>
+ <version>4.1.0-SNAPSHOT</version>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
diff --git a/setup.py b/setup.py
index 3667b49..f8c4aeb 100644
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@ from setuptools import setup
setup(
name='policyhandler',
description='DCAE-Controller policy-handler to communicate with policy-engine',
- version="4.0.1",
+ version="4.1.0",
author='Alex Shatov',
packages=['policyhandler'],
zip_safe=False,
diff --git a/tests/test_policyhandler.py b/tests/test_policyhandler.py
index eda1981..dec760a 100644
--- a/tests/test_policyhandler.py
+++ b/tests/test_policyhandler.py
@@ -293,12 +293,12 @@ def fix_select_latest_policies_boom(monkeypatch):
@pytest.fixture()
def fix_deploy_handler(monkeypatch, fix_discovery):
"""monkeyed requests to deployment-handler"""
- def monkeyed_deploy_handler_put(full_path, json=None, headers=None):
+ def monkeyed_deploy_handler_put(full_path, json=None, headers=None, params=None):
"""monkeypatch for policy-update request.put to deploy_handler"""
return MonkeyedResponse(full_path, MockDeploymentHandler.default_response(),
json, headers)
- def monkeyed_deploy_handler_get(full_path, headers=None):
+ def monkeyed_deploy_handler_get(full_path, headers=None, params=None):
"""monkeypatch policy-update request.get to deploy_handler"""
return MonkeyedResponse(full_path, MockDeploymentHandler.get_deployed_policies(),
None, headers)
@@ -319,7 +319,7 @@ def fix_deploy_handler(monkeypatch, fix_discovery):
@pytest.fixture()
def fix_deploy_handler_fail(monkeypatch, fix_discovery):
"""monkeyed failed discovery request.get"""
- def monkeyed_deploy_handler_put(full_path, json=None, headers=None):
+ def monkeyed_deploy_handler_put(full_path, json=None, headers=None, params=None):
"""monkeypatch for deploy_handler"""
res = MonkeyedResponse(
full_path,
@@ -329,7 +329,7 @@ def fix_deploy_handler_fail(monkeypatch, fix_discovery):
res.status_code = 413
return res
- def monkeyed_deploy_handler_get(full_path, headers=None):
+ def monkeyed_deploy_handler_get(full_path, headers=None, params=None):
"""monkeypatch policy-update request.get to deploy_handler"""
return MonkeyedResponse(full_path, MockDeploymentHandler.default_response(),
None, headers)
diff --git a/version.properties b/version.properties
index 53d98c4..03b71bc 100644
--- a/version.properties
+++ b/version.properties
@@ -1,6 +1,6 @@
major=4
-minor=0
-patch=1
+minor=1
+patch=0
base_version=${major}.${minor}.${patch}
release_version=${base_version}
snapshot_version=${base_version}-SNAPSHOT