aboutsummaryrefslogtreecommitdiffstats
path: root/tests/pdp_api_v0
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pdp_api_v0')
-rw-r--r--tests/pdp_api_v0/__init__.py20
-rw-r--r--tests/pdp_api_v0/conftest.py133
-rw-r--r--tests/pdp_api_v0/mock_expected.py3012
-rw-r--r--tests/pdp_api_v0/mock_policy_engine.py130
-rw-r--r--tests/pdp_api_v0/mock_websocket.py90
-rw-r--r--tests/pdp_api_v0/test_policy_rest.py47
-rw-r--r--tests/pdp_api_v0/test_policyhandler.py280
-rw-r--r--tests/pdp_api_v0/test_pz_catch_up.py107
-rw-r--r--tests/pdp_api_v0/test_pz_pdp_boom.py255
-rw-r--r--tests/pdp_api_v0/test_pz_ph_boom.py256
10 files changed, 4330 insertions, 0 deletions
diff --git a/tests/pdp_api_v0/__init__.py b/tests/pdp_api_v0/__init__.py
new file mode 100644
index 0000000..b8e4605
--- /dev/null
+++ b/tests/pdp_api_v0/__init__.py
@@ -0,0 +1,20 @@
+# ================================================================================
+# Copyright (c) 2019 AT&T Intellectual Property. 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=========================================================
+#
+
+
+# empty __init__.py so that pytest can add correct path to coverage report, -- per pytest
+# best practice guideline
diff --git a/tests/pdp_api_v0/conftest.py b/tests/pdp_api_v0/conftest.py
new file mode 100644
index 0000000..07e566f
--- /dev/null
+++ b/tests/pdp_api_v0/conftest.py
@@ -0,0 +1,133 @@
+# ============LICENSE_START=======================================================
+# Copyright (c) 2018-2019 AT&T Intellectual Property. 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=========================================================
+#
+"""
+startdard pytest file that contains the shared fixtures
+https://docs.pytest.org/en/latest/fixture.html
+"""
+
+import pytest
+
+from policyhandler import pdp_client
+from policyhandler.pdp_api_v0.pdp_consts import POLICY_NAME
+from policyhandler.utils import Utils
+
+from ..mock_settings import MockSettings
+from ..mock_tracker import MockHttpResponse
+from .mock_policy_engine import MockPolicyEngine2018
+from .mock_websocket import MockWebSocket
+
+_LOGGER = Utils.get_logger(__file__)
+
+@pytest.fixture(scope="session", autouse=True)
+def _auto_setup_policy_engine_pdp_api_v0():
+ """initialize the mock-policy-engine_pdp_api_v0 per the whole test session"""
+ _LOGGER.info("create _auto_setup_policy_engine_pdp_api_v0")
+ MockPolicyEngine2018.init()
+ yield _auto_setup_policy_engine_pdp_api_v0
+ _LOGGER.info("teardown _auto_setup_policy_engine_pdp_api_v0")
+
+
+@pytest.fixture(scope="module")
+def fix_pdp_api_v0():
+ """test on the old (pdp_api_v0) pdp API"""
+ _LOGGER.info("setup fix_pdp_api_v0 %s", MockSettings.OLD_PDP_API_VERSION)
+ MockSettings.setup_pdp_api(MockSettings.OLD_PDP_API_VERSION)
+
+ yield fix_pdp_api_v0
+ MockSettings.setup_pdp_api()
+ _LOGGER.info("teardown fix_pdp_api_v0 %s", MockSettings.OLD_PDP_API_VERSION)
+
+@pytest.fixture()
+def fix_pdp_post(monkeypatch):
+ """monkeyed request /getConfig to PDP"""
+ def monkeyed_policy_rest_post(uri, json=None, **kwargs):
+ """monkeypatch for the POST to policy-engine"""
+ res_json = MockPolicyEngine2018.get_config(json.get(POLICY_NAME))
+ return MockHttpResponse("post", uri, res_json, json=json, **kwargs)
+
+ _LOGGER.info("setup fix_pdp_post")
+ pdp_client.PolicyRest._lazy_init()
+ monkeypatch.setattr('policyhandler.pdp_client.PolicyRest._requests_session.post',
+ monkeyed_policy_rest_post)
+ yield fix_pdp_post
+ _LOGGER.info("teardown fix_pdp_post")
+
+@pytest.fixture()
+def fix_pdp_post_big(monkeypatch):
+ """monkeyed request /getConfig to PDP"""
+ def monkeyed_policy_rest_post(uri, **kwargs):
+ """monkeypatch for the POST to policy-engine"""
+ res_json = MockPolicyEngine2018.get_configs_all()
+ return MockHttpResponse("post", uri, res_json, **kwargs)
+
+ _LOGGER.info("setup fix_pdp_post_big")
+ pdp_client.PolicyRest._lazy_init()
+ monkeypatch.setattr('policyhandler.pdp_client.PolicyRest._requests_session.post',
+ monkeyed_policy_rest_post)
+ yield fix_pdp_post_big
+ _LOGGER.info("teardown fix_pdp_post_big")
+
+
+class MockException(Exception):
+ """mock exception"""
+ pass
+
+@pytest.fixture()
+def fix_pdp_post_boom(monkeypatch):
+ """monkeyed request /getConfig to PDP - exception"""
+ def monkeyed_policy_rest_post_boom(uri, **_):
+ """monkeypatch for the POST to policy-engine"""
+ raise MockException("fix_pdp_post_boom {}".format(uri))
+
+ _LOGGER.info("setup fix_pdp_post_boom")
+ pdp_client.PolicyRest._lazy_init()
+ monkeypatch.setattr('policyhandler.pdp_client.PolicyRest._requests_session.post',
+ monkeyed_policy_rest_post_boom)
+ yield fix_pdp_post_boom
+ _LOGGER.info("teardown fix_pdp_post_boom")
+
+
+@pytest.fixture()
+def fix_policy_receiver_websocket(monkeypatch):
+ """monkeyed websocket for policy_receiver"""
+ _LOGGER.info("setup fix_policy_receiver_websocket")
+ monkeypatch.setattr('policyhandler.pdp_api_v0.policy_listener.websocket', MockWebSocket)
+
+ yield fix_policy_receiver_websocket
+ _LOGGER.info("teardown fix_policy_receiver_websocket")
+
+class MockBoom(Exception):
+ """mock exception"""
+ pass
+
+@pytest.fixture()
+def fix_select_latest_policies_boom(monkeypatch):
+ """monkeyed exception"""
+ def monkeyed_boom(*_, **__):
+ """monkeypatch for the select_latest_policies"""
+ raise MockBoom("fix_select_latest_policies_boom")
+
+ policy_utils_path = 'policyhandler.pdp_api_v0.policy_utils.PolicyUtils'
+
+ _LOGGER.info("setup fix_select_latest_policies_boom at %s", policy_utils_path)
+
+ monkeypatch.setattr('{}.select_latest_policies'.format(policy_utils_path), monkeyed_boom)
+ monkeypatch.setattr('{}.select_latest_policy'.format(policy_utils_path), monkeyed_boom)
+ monkeypatch.setattr('{}.extract_policy_id'.format(policy_utils_path), monkeyed_boom)
+
+ yield fix_select_latest_policies_boom
+ _LOGGER.info("teardown fix_select_latest_policies_boom at %s", policy_utils_path)
diff --git a/tests/pdp_api_v0/mock_expected.py b/tests/pdp_api_v0/mock_expected.py
new file mode 100644
index 0000000..6210e10
--- /dev/null
+++ b/tests/pdp_api_v0/mock_expected.py
@@ -0,0 +1,3012 @@
+# ============LICENSE_START=======================================================
+# Copyright (c) 2018-2019 AT&T Intellectual Property. 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=========================================================
+#
+"""expected message history per test for pdp API 2018 and before"""
+
+
+HISTORY_EXPECTED = {
+ "tests/pdp_api_v0/test_policy_rest.py::test_get_policy_latest" : [
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_sit"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_policyhandler.py::WebServer2018Test::test_web_all_policies_latest": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_policyhandler.py::WebServer2018Test::test_web_policies_latest": [
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_amet.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_policyhandler.py::WebServer2018Test::test_web_policy_latest": [
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_sit"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_policyhandler.py::WebServer2018Test::test_zzz_get_catch_up": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "catch_up": True,
+ "latest_policies": {
+ "test_scope_prefix.Config_Lorem": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "0",
+ "policy_updated_to_ver": "1",
+ "updated_policy_id": "test_scope_prefix.Config_Lorem"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_Lorem.1.xml",
+ "policyVersion": "1",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_Lorem"
+ },
+ "test_scope_prefix.Config_amet": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "4",
+ "policy_updated_to_ver": "5",
+ "updated_policy_id": "test_scope_prefix.Config_amet"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_amet.5.xml",
+ "policyVersion": "5",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_amet"
+ },
+ "test_scope_prefix.Config_ametist": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "6",
+ "policy_updated_to_ver": "7",
+ "updated_policy_id": "test_scope_prefix.Config_ametist"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ametist.7.xml",
+ "policyVersion": "7",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ametist"
+ },
+ "test_scope_prefix.Config_consectetur": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "5",
+ "policy_updated_to_ver": "6",
+ "updated_policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_consectetur.6.xml",
+ "policyVersion": "6",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "test_scope_prefix.Config_dolor": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "2",
+ "policy_updated_to_ver": "3",
+ "updated_policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_dolor.3.xml",
+ "policyVersion": "3",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "test_scope_prefix.Config_ipsum": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "1",
+ "policy_updated_to_ver": "2",
+ "updated_policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ipsum.2.xml",
+ "policyVersion": "2",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "test_scope_prefix.Config_sit": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "3",
+ "policy_updated_to_ver": "4",
+ "updated_policy_id": "test_scope_prefix.Config_sit"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_sit.4.xml",
+ "policyVersion": "4",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_sit"
+ }
+ },
+ "policy_filter_matches": {
+ "test_scope_prefix.Config_Lorem": {},
+ "test_scope_prefix.Config_amet": {},
+ "test_scope_prefix.Config_ametist": {},
+ "test_scope_prefix.Config_consectetur": {},
+ "test_scope_prefix.Config_dolor": {},
+ "test_scope_prefix.Config_ipsum": {},
+ "test_scope_prefix.Config_sit": {}
+ },
+ "removed_policies": {}
+ },
+ "method": "put",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "catch_up": True,
+ "latest_policies": {
+ "test_scope_prefix.Config_Lorem": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "0",
+ "policy_updated_to_ver": "1",
+ "updated_policy_id": "test_scope_prefix.Config_Lorem"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_Lorem.1.xml",
+ "policyVersion": "1",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_Lorem"
+ },
+ "test_scope_prefix.Config_amet": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "4",
+ "policy_updated_to_ver": "5",
+ "updated_policy_id": "test_scope_prefix.Config_amet"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_amet.5.xml",
+ "policyVersion": "5",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_amet"
+ },
+ "test_scope_prefix.Config_ametist": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "6",
+ "policy_updated_to_ver": "7",
+ "updated_policy_id": "test_scope_prefix.Config_ametist"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ametist.7.xml",
+ "policyVersion": "7",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ametist"
+ },
+ "test_scope_prefix.Config_consectetur": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "5",
+ "policy_updated_to_ver": "6",
+ "updated_policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_consectetur.6.xml",
+ "policyVersion": "6",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "test_scope_prefix.Config_dolor": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "2",
+ "policy_updated_to_ver": "3",
+ "updated_policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_dolor.3.xml",
+ "policyVersion": "3",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "test_scope_prefix.Config_ipsum": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "1",
+ "policy_updated_to_ver": "2",
+ "updated_policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ipsum.2.xml",
+ "policyVersion": "2",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "test_scope_prefix.Config_sit": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "3",
+ "policy_updated_to_ver": "4",
+ "updated_policy_id": "test_scope_prefix.Config_sit"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_sit.4.xml",
+ "policyVersion": "4",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_sit"
+ }
+ },
+ "policy_filter_matches": {
+ "test_scope_prefix.Config_Lorem": {},
+ "test_scope_prefix.Config_amet": {},
+ "test_scope_prefix.Config_ametist": {},
+ "test_scope_prefix.Config_consectetur": {},
+ "test_scope_prefix.Config_dolor": {},
+ "test_scope_prefix.Config_ipsum": {},
+ "test_scope_prefix.Config_sit": {}
+ },
+ "removed_policies": {}
+ },
+ "method": "put",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_policyhandler.py::WebServer2018Test::test_zzz_policy_updates_and_catch_ups": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "catch_up": True,
+ "latest_policies": {
+ "test_scope_prefix.Config_Lorem": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "0",
+ "policy_updated_to_ver": "1",
+ "updated_policy_id": "test_scope_prefix.Config_Lorem"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_Lorem.1.xml",
+ "policyVersion": "1",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_Lorem"
+ },
+ "test_scope_prefix.Config_amet": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "4",
+ "policy_updated_to_ver": "5",
+ "updated_policy_id": "test_scope_prefix.Config_amet"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_amet.5.xml",
+ "policyVersion": "5",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_amet"
+ },
+ "test_scope_prefix.Config_ametist": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "6",
+ "policy_updated_to_ver": "7",
+ "updated_policy_id": "test_scope_prefix.Config_ametist"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ametist.7.xml",
+ "policyVersion": "7",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ametist"
+ },
+ "test_scope_prefix.Config_consectetur": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "5",
+ "policy_updated_to_ver": "6",
+ "updated_policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_consectetur.6.xml",
+ "policyVersion": "6",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "test_scope_prefix.Config_dolor": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "2",
+ "policy_updated_to_ver": "3",
+ "updated_policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_dolor.3.xml",
+ "policyVersion": "3",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "test_scope_prefix.Config_ipsum": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "1",
+ "policy_updated_to_ver": "2",
+ "updated_policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ipsum.2.xml",
+ "policyVersion": "2",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "test_scope_prefix.Config_sit": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "3",
+ "policy_updated_to_ver": "4",
+ "updated_policy_id": "test_scope_prefix.Config_sit"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_sit.4.xml",
+ "policyVersion": "4",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_sit"
+ }
+ },
+ "policy_filter_matches": {
+ "test_scope_prefix.Config_Lorem": {},
+ "test_scope_prefix.Config_amet": {},
+ "test_scope_prefix.Config_ametist": {},
+ "test_scope_prefix.Config_consectetur": {},
+ "test_scope_prefix.Config_dolor": {},
+ "test_scope_prefix.Config_ipsum": {},
+ "test_scope_prefix.Config_sit": {}
+ },
+ "removed_policies": {}
+ },
+ "method": "put",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_ipsum"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_sit"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_consectetur"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "catch_up": False,
+ "latest_policies": {
+ "test_scope_prefix.Config_consectetur": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "5",
+ "policy_updated_to_ver": "6",
+ "updated_policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_consectetur.6.xml",
+ "policyVersion": "6",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "test_scope_prefix.Config_ipsum": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "1",
+ "policy_updated_to_ver": "2",
+ "updated_policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ipsum.2.xml",
+ "policyVersion": "2",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "test_scope_prefix.Config_sit": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "3",
+ "policy_updated_to_ver": "4",
+ "updated_policy_id": "test_scope_prefix.Config_sit"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_sit.4.xml",
+ "policyVersion": "4",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_sit"
+ }
+ },
+ "policy_filter_matches": {
+ "test_scope_prefix.Config_consectetur": {},
+ "test_scope_prefix.Config_ipsum": {},
+ "test_scope_prefix.Config_sit": {}
+ },
+ "removed_policies": {}
+ },
+ "method": "put",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_policyhandler.py::WebServer2018Test::test_zzzzz_shutdown": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "catch_up": True,
+ "latest_policies": {
+ "test_scope_prefix.Config_Lorem": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "0",
+ "policy_updated_to_ver": "1",
+ "updated_policy_id": "test_scope_prefix.Config_Lorem"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_Lorem.1.xml",
+ "policyVersion": "1",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_Lorem"
+ },
+ "test_scope_prefix.Config_amet": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "4",
+ "policy_updated_to_ver": "5",
+ "updated_policy_id": "test_scope_prefix.Config_amet"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_amet.5.xml",
+ "policyVersion": "5",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_amet"
+ },
+ "test_scope_prefix.Config_ametist": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "6",
+ "policy_updated_to_ver": "7",
+ "updated_policy_id": "test_scope_prefix.Config_ametist"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ametist.7.xml",
+ "policyVersion": "7",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ametist"
+ },
+ "test_scope_prefix.Config_consectetur": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "5",
+ "policy_updated_to_ver": "6",
+ "updated_policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_consectetur.6.xml",
+ "policyVersion": "6",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "test_scope_prefix.Config_dolor": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "2",
+ "policy_updated_to_ver": "3",
+ "updated_policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_dolor.3.xml",
+ "policyVersion": "3",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "test_scope_prefix.Config_ipsum": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "1",
+ "policy_updated_to_ver": "2",
+ "updated_policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ipsum.2.xml",
+ "policyVersion": "2",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "test_scope_prefix.Config_sit": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "3",
+ "policy_updated_to_ver": "4",
+ "updated_policy_id": "test_scope_prefix.Config_sit"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_sit.4.xml",
+ "policyVersion": "4",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_sit"
+ }
+ },
+ "policy_filter_matches": {
+ "test_scope_prefix.Config_Lorem": {},
+ "test_scope_prefix.Config_amet": {},
+ "test_scope_prefix.Config_ametist": {},
+ "test_scope_prefix.Config_consectetur": {},
+ "test_scope_prefix.Config_dolor": {},
+ "test_scope_prefix.Config_ipsum": {},
+ "test_scope_prefix.Config_sit": {}
+ },
+ "removed_policies": {}
+ },
+ "method": "put",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_ipsum"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_sit"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_consectetur"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "catch_up": False,
+ "latest_policies": {
+ "test_scope_prefix.Config_consectetur": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "5",
+ "policy_updated_to_ver": "6",
+ "updated_policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_consectetur.6.xml",
+ "policyVersion": "6",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "test_scope_prefix.Config_ipsum": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "1",
+ "policy_updated_to_ver": "2",
+ "updated_policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ipsum.2.xml",
+ "policyVersion": "2",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "test_scope_prefix.Config_sit": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "3",
+ "policy_updated_to_ver": "4",
+ "updated_policy_id": "test_scope_prefix.Config_sit"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_sit.4.xml",
+ "policyVersion": "4",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_sit"
+ }
+ },
+ "policy_filter_matches": {
+ "test_scope_prefix.Config_consectetur": {},
+ "test_scope_prefix.Config_ipsum": {},
+ "test_scope_prefix.Config_sit": {}
+ },
+ "removed_policies": {}
+ },
+ "method": "put",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_policyhandler.py::WebServer2018Test::test_zzz_catch_up_on_deploy_handler_changed": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "catch_up": True,
+ "latest_policies": {
+ "test_scope_prefix.Config_Lorem": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "0",
+ "policy_updated_to_ver": "1",
+ "updated_policy_id": "test_scope_prefix.Config_Lorem"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_Lorem.1.xml",
+ "policyVersion": "1",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_Lorem"
+ },
+ "test_scope_prefix.Config_amet": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "4",
+ "policy_updated_to_ver": "5",
+ "updated_policy_id": "test_scope_prefix.Config_amet"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_amet.5.xml",
+ "policyVersion": "5",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_amet"
+ },
+ "test_scope_prefix.Config_ametist": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "6",
+ "policy_updated_to_ver": "7",
+ "updated_policy_id": "test_scope_prefix.Config_ametist"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ametist.7.xml",
+ "policyVersion": "7",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ametist"
+ },
+ "test_scope_prefix.Config_consectetur": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "5",
+ "policy_updated_to_ver": "6",
+ "updated_policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_consectetur.6.xml",
+ "policyVersion": "6",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "test_scope_prefix.Config_dolor": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "2",
+ "policy_updated_to_ver": "3",
+ "updated_policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_dolor.3.xml",
+ "policyVersion": "3",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "test_scope_prefix.Config_ipsum": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "1",
+ "policy_updated_to_ver": "2",
+ "updated_policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ipsum.2.xml",
+ "policyVersion": "2",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "test_scope_prefix.Config_sit": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "3",
+ "policy_updated_to_ver": "4",
+ "updated_policy_id": "test_scope_prefix.Config_sit"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_sit.4.xml",
+ "policyVersion": "4",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_sit"
+ }
+ },
+ "policy_filter_matches": {
+ "test_scope_prefix.Config_Lorem": {},
+ "test_scope_prefix.Config_amet": {},
+ "test_scope_prefix.Config_ametist": {},
+ "test_scope_prefix.Config_consectetur": {},
+ "test_scope_prefix.Config_dolor": {},
+ "test_scope_prefix.Config_ipsum": {},
+ "test_scope_prefix.Config_sit": {}
+ },
+ "removed_policies": {}
+ },
+ "method": "put",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_ipsum"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "catch_up": False,
+ "latest_policies": {
+ "test_scope_prefix.Config_ipsum": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "1",
+ "policy_updated_to_ver": "2",
+ "updated_policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ipsum.2.xml",
+ "policyVersion": "2",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ipsum"
+ }
+ },
+ "policy_filter_matches": {
+ "test_scope_prefix.Config_ipsum": {}
+ },
+ "removed_policies": {}
+ },
+ "method": "put",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_dolor"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_amet"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "catch_up": False,
+ "latest_policies": {
+ "test_scope_prefix.Config_amet": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "4",
+ "policy_updated_to_ver": "5",
+ "updated_policy_id": "test_scope_prefix.Config_amet"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_amet.5.xml",
+ "policyVersion": "5",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_amet"
+ },
+ "test_scope_prefix.Config_dolor": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "2",
+ "policy_updated_to_ver": "3",
+ "updated_policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_dolor.3.xml",
+ "policyVersion": "3",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_dolor"
+ }
+ },
+ "policy_filter_matches": {
+ "test_scope_prefix.Config_amet": {},
+ "test_scope_prefix.Config_dolor": {}
+ },
+ "removed_policies": {}
+ },
+ "method": "put",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "catch_up": True,
+ "latest_policies": {
+ "test_scope_prefix.Config_Lorem": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "0",
+ "policy_updated_to_ver": "1",
+ "updated_policy_id": "test_scope_prefix.Config_Lorem"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_Lorem.1.xml",
+ "policyVersion": "1",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_Lorem"
+ },
+ "test_scope_prefix.Config_amet": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "4",
+ "policy_updated_to_ver": "5",
+ "updated_policy_id": "test_scope_prefix.Config_amet"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_amet.5.xml",
+ "policyVersion": "5",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_amet"
+ },
+ "test_scope_prefix.Config_ametist": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "6",
+ "policy_updated_to_ver": "7",
+ "updated_policy_id": "test_scope_prefix.Config_ametist"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ametist.7.xml",
+ "policyVersion": "7",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ametist"
+ },
+ "test_scope_prefix.Config_consectetur": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "5",
+ "policy_updated_to_ver": "6",
+ "updated_policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_consectetur.6.xml",
+ "policyVersion": "6",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "test_scope_prefix.Config_dolor": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "2",
+ "policy_updated_to_ver": "3",
+ "updated_policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_dolor.3.xml",
+ "policyVersion": "3",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "test_scope_prefix.Config_ipsum": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "1",
+ "policy_updated_to_ver": "2",
+ "updated_policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ipsum.2.xml",
+ "policyVersion": "2",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "test_scope_prefix.Config_sit": {
+ "policy_body": {
+ "config": {
+ "policy_hello": "world!",
+ "policy_updated_from_ver": "3",
+ "policy_updated_to_ver": "4",
+ "updated_policy_id": "test_scope_prefix.Config_sit"
+ },
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_sit.4.xml",
+ "policyVersion": "4",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_sit"
+ }
+ },
+ "policy_filter_matches": {
+ "test_scope_prefix.Config_Lorem": {},
+ "test_scope_prefix.Config_amet": {},
+ "test_scope_prefix.Config_ametist": {},
+ "test_scope_prefix.Config_consectetur": {},
+ "test_scope_prefix.Config_dolor": {},
+ "test_scope_prefix.Config_ipsum": {},
+ "test_scope_prefix.Config_sit": {}
+ },
+ "removed_policies": {}
+ },
+ "method": "put",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_pz_catch_up.py::test_catch_up_failed_dh": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "catch_up": True,
+ "latest_policies": {
+ "test_scope_prefix.Config_Lorem": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_Lorem.1.xml",
+ "policyVersion": "1",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_Lorem"
+ },
+ "test_scope_prefix.Config_amet": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_amet.5.xml",
+ "policyVersion": "5",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_amet"
+ },
+ "test_scope_prefix.Config_ametist": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ametist.7.xml",
+ "policyVersion": "7",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ametist"
+ },
+ "test_scope_prefix.Config_consectetur": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_consectetur.6.xml",
+ "policyVersion": "6",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "test_scope_prefix.Config_dolor": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_dolor.3.xml",
+ "policyVersion": "3",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "test_scope_prefix.Config_ipsum": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ipsum.2.xml",
+ "policyVersion": "2",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "test_scope_prefix.Config_sit": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_sit.4.xml",
+ "policyVersion": "4",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_sit"
+ }
+ },
+ "policy_filter_matches": {
+ "test_scope_prefix.Config_Lorem": {},
+ "test_scope_prefix.Config_amet": {},
+ "test_scope_prefix.Config_ametist": {},
+ "test_scope_prefix.Config_consectetur": {},
+ "test_scope_prefix.Config_dolor": {},
+ "test_scope_prefix.Config_ipsum": {},
+ "test_scope_prefix.Config_sit": {}
+ },
+ "removed_policies": {}
+ },
+ "method": "put",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 413
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "catch_up": True,
+ "latest_policies": {
+ "test_scope_prefix.Config_Lorem": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_Lorem.1.xml",
+ "policyVersion": "1",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_Lorem"
+ },
+ "test_scope_prefix.Config_amet": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_amet.5.xml",
+ "policyVersion": "5",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_amet"
+ },
+ "test_scope_prefix.Config_ametist": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ametist.7.xml",
+ "policyVersion": "7",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ametist"
+ },
+ "test_scope_prefix.Config_consectetur": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_consectetur.6.xml",
+ "policyVersion": "6",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "test_scope_prefix.Config_dolor": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_dolor.3.xml",
+ "policyVersion": "3",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "test_scope_prefix.Config_ipsum": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ipsum.2.xml",
+ "policyVersion": "2",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "test_scope_prefix.Config_sit": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_sit.4.xml",
+ "policyVersion": "4",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_sit"
+ }
+ },
+ "policy_filter_matches": {
+ "test_scope_prefix.Config_Lorem": {},
+ "test_scope_prefix.Config_amet": {},
+ "test_scope_prefix.Config_ametist": {},
+ "test_scope_prefix.Config_consectetur": {},
+ "test_scope_prefix.Config_dolor": {},
+ "test_scope_prefix.Config_ipsum": {},
+ "test_scope_prefix.Config_sit": {}
+ },
+ "removed_policies": {}
+ },
+ "method": "put",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 413
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "catch_up": True,
+ "latest_policies": {
+ "test_scope_prefix.Config_Lorem": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_Lorem.1.xml",
+ "policyVersion": "1",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_Lorem"
+ },
+ "test_scope_prefix.Config_amet": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_amet.5.xml",
+ "policyVersion": "5",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_amet"
+ },
+ "test_scope_prefix.Config_ametist": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ametist.7.xml",
+ "policyVersion": "7",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ametist"
+ },
+ "test_scope_prefix.Config_consectetur": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_consectetur.6.xml",
+ "policyVersion": "6",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_consectetur"
+ },
+ "test_scope_prefix.Config_dolor": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_dolor.3.xml",
+ "policyVersion": "3",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_dolor"
+ },
+ "test_scope_prefix.Config_ipsum": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_ipsum.2.xml",
+ "policyVersion": "2",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_ipsum"
+ },
+ "test_scope_prefix.Config_sit": {
+ "policy_body": {
+ "config": "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ "matchingConditions": {
+ "ConfigName": "alex_config_name",
+ "ONAPName": "DCAE"
+ },
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "policyName": "test_scope_prefix.Config_sit.4.xml",
+ "policyVersion": "4",
+ "property": None,
+ "responseAttributes": {},
+ "type": "JSON"
+ },
+ "policy_id": "test_scope_prefix.Config_sit"
+ }
+ },
+ "policy_filter_matches": {
+ "test_scope_prefix.Config_Lorem": {},
+ "test_scope_prefix.Config_amet": {},
+ "test_scope_prefix.Config_ametist": {},
+ "test_scope_prefix.Config_consectetur": {},
+ "test_scope_prefix.Config_dolor": {},
+ "test_scope_prefix.Config_ipsum": {},
+ "test_scope_prefix.Config_sit": {}
+ },
+ "removed_policies": {}
+ },
+ "method": "put",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 413
+ }
+ ],
+ "tests/pdp_api_v0/test_pz_catch_up.py::test_catch_up_dh_404": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_pz_pdp_boom.py::WebServerPDPBoom2018Test::test_web_all_policies_latest": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_pz_pdp_boom.py::WebServerPDPBoom2018Test::test_zzz_catch_up_on_deploy_handler_changed": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_pz_pdp_boom.py::WebServerPDPBoom2018Test::test_zzz_get_catch_up": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_pz_pdp_boom.py::WebServerPDPBoom2018Test::test_zzz_policy_updates_and_catch_ups": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_pz_pdp_boom.py::WebServerPDPBoom2018Test::test_zzzzz_shutdown": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_pz_ph_boom.py::WebServerInternalBoom2018Test::test_web_all_policies_latest": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_pz_ph_boom.py::WebServerInternalBoom2018Test::test_web_policies_latest": [
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_amet.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_pz_ph_boom.py::WebServerInternalBoom2018Test::test_web_policy_latest": [
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_sit"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_pz_ph_boom.py::WebServerInternalBoom2018Test::test_zzz_catch_up_on_deploy_handler_changed": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_pz_ph_boom.py::WebServerInternalBoom2018Test::test_zzz_get_catch_up": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_pz_ph_boom.py::WebServerInternalBoom2018Test::test_zzz_policy_updates_and_catch_ups": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ],
+ "tests/pdp_api_v0/test_pz_ph_boom.py::WebServerInternalBoom2018Test::test_zzzzz_shutdown": [
+ {
+ "request": {
+ "headers": {
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": None,
+ "method": "get",
+ "params": {
+ "cfy_tenant_name": "default_tenant"
+ },
+ "uri": "http://unit-test-deployment_handler:8188000/policy"
+ },
+ "res": "*",
+ "status_code": 200
+ },
+ {
+ "request": {
+ "headers": {
+ "Accept": "application/json",
+ "Authorization": "Basic auth",
+ "ClientAuth": "Basic user",
+ "Content-Type": "application/json",
+ "Environment": "TEST",
+ "X-ECOMP-RequestID": "*"
+ },
+ "json": {
+ "policyName": "test_scope_prefix.Config_.*"
+ },
+ "method": "post",
+ "params": None,
+ "uri": "https://unit-test-pdp-server:8081000/pdp/api/getConfig"
+ },
+ "res": "*",
+ "status_code": 200
+ }
+ ]
+}
diff --git a/tests/pdp_api_v0/mock_policy_engine.py b/tests/pdp_api_v0/mock_policy_engine.py
new file mode 100644
index 0000000..cdded14
--- /dev/null
+++ b/tests/pdp_api_v0/mock_policy_engine.py
@@ -0,0 +1,130 @@
+# ============LICENSE_START=======================================================
+# Copyright (c) 2018-2019 AT&T Intellectual Property. 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=========================================================
+#
+"""mocking for the policy-engine - shared by many tests"""
+
+import copy
+import json
+import re
+
+from policyhandler.pdp_api_v0.pdp_consts import (POLICY_CONFIG, POLICY_NAME,
+ POLICY_VERSION)
+from policyhandler.pdp_api_v0.policy_utils import PolicyUtils
+from policyhandler.policy_consts import POLICY_BODY, POLICY_ID
+from policyhandler.utils import Utils
+
+_LOGGER = Utils.get_logger(__file__)
+
+
+class MockPolicyEngine2018(object):
+ """pretend this is the policy-engine"""
+ scope_prefix = "test_scope_prefix.Config_"
+ LOREM_IPSUM = """Lorem ipsum dolor sit amet consectetur ametist""".split()
+ LONG_TEXT = "0123456789" * 100
+ _policies = []
+
+ _inited = False
+
+ @staticmethod
+ def init():
+ """init collection of policies: policy_version = policy_index + 1"""
+ if MockPolicyEngine2018._inited:
+ return
+ MockPolicyEngine2018._inited = True
+
+ MockPolicyEngine2018._policies = [
+ MockPolicyEngine2018._create_policy_body(
+ MockPolicyEngine2018.scope_prefix + policy_id, policy_index + 1)
+ for policy_id in MockPolicyEngine2018.LOREM_IPSUM
+ for policy_index in range(1 + MockPolicyEngine2018.LOREM_IPSUM.index(policy_id))]
+ _LOGGER.info("_policies: %s", json.dumps(MockPolicyEngine2018._policies))
+
+ @staticmethod
+ def get_config(policy_name):
+ """find policy the way the policy-engine finds"""
+ if not policy_name:
+ return []
+ return [copy.deepcopy(policy)
+ for policy in MockPolicyEngine2018._policies
+ if re.match(policy_name, policy[POLICY_NAME])]
+
+ @staticmethod
+ def get_configs_all():
+ """get all policies the way the policy-engine finds"""
+ policies = [copy.deepcopy(policy)
+ for policy in MockPolicyEngine2018._policies]
+ for policy in policies:
+ policy["config"] = MockPolicyEngine2018.LONG_TEXT
+ return policies
+
+ @staticmethod
+ def get_policy_id(policy_index):
+ """get the policy_id by policy_index"""
+ return (MockPolicyEngine2018.scope_prefix
+ + MockPolicyEngine2018.LOREM_IPSUM[
+ policy_index % len(MockPolicyEngine2018.LOREM_IPSUM)])
+
+ @staticmethod
+ def gen_policy_latest(policy_index, version_offset=0):
+ """generate the policy response from policy-handler by policy_index = version - 1"""
+ policy_id = MockPolicyEngine2018.get_policy_id(policy_index)
+ policy = {
+ POLICY_ID: policy_id,
+ POLICY_BODY: MockPolicyEngine2018._create_policy_body(
+ policy_id, policy_index + 1 - version_offset)
+ }
+ return policy_id, PolicyUtils.parse_policy_config(policy)
+
+ @staticmethod
+ def gen_all_policies_latest(version_offset=0):
+ """generate all latest policies"""
+ return dict(
+ MockPolicyEngine2018.gen_policy_latest(policy_index, version_offset=version_offset)
+ for policy_index in range(len(MockPolicyEngine2018.LOREM_IPSUM))
+ )
+
+ @staticmethod
+ def gen_policies_latest(match_to_policy_name):
+ """generate all latest policies"""
+ return dict((k, v)
+ for k, v in MockPolicyEngine2018.gen_all_policies_latest().items()
+ if re.match(match_to_policy_name, k))
+
+ @staticmethod
+ def _create_policy_body(policy_id, policy_version=1):
+ """returns a fake policy-body"""
+ prev_ver = str(policy_version - 1)
+ this_ver = str(policy_version)
+ config = {
+ "policy_updated_from_ver": prev_ver,
+ "policy_updated_to_ver": this_ver,
+ "policy_hello": "world!",
+ "updated_policy_id": policy_id
+ }
+ return {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ POLICY_NAME: "{0}.{1}.xml".format(policy_id, this_ver),
+ POLICY_VERSION: this_ver,
+ POLICY_CONFIG: json.dumps(config, sort_keys=True),
+ "matchingConditions": {
+ "ONAPName": "DCAE",
+ "ConfigName": "alex_config_name"
+ },
+ "responseAttributes": {},
+ "property": None
+ }
diff --git a/tests/pdp_api_v0/mock_websocket.py b/tests/pdp_api_v0/mock_websocket.py
new file mode 100644
index 0000000..17f3bbe
--- /dev/null
+++ b/tests/pdp_api_v0/mock_websocket.py
@@ -0,0 +1,90 @@
+# ============LICENSE_START=======================================================
+# Copyright (c) 2018-2019 AT&T Intellectual Property. 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=========================================================
+#
+"""mocking for the websocket - for testing of policy-engine"""
+
+import json
+import time
+
+from policyhandler.pdp_api_v0.pdp_consts import POLICY_NAME
+from policyhandler.pdp_api_v0.policy_listener import (LOADED_POLICIES,
+ POLICY_VER,
+ REMOVED_POLICIES)
+from policyhandler.utils import Utils
+
+from .mock_policy_engine import MockPolicyEngine2018
+
+_LOGGER = Utils.get_logger(__file__)
+
+class MockWebSocket(object):
+ """Mock websocket"""
+ on_message = None
+
+ @staticmethod
+ def send_notification(updated_indexes):
+ """fake notification through the web-socket"""
+ if not MockWebSocket.on_message:
+ return
+ message = {
+ LOADED_POLICIES: [
+ {POLICY_NAME: "{0}.{1}.xml".format(
+ MockPolicyEngine2018.get_policy_id(policy_index), policy_index + 1),
+ POLICY_VER: str(policy_index + 1)}
+ for policy_index in updated_indexes or []
+ ],
+ REMOVED_POLICIES : []
+ }
+ message = json.dumps(message)
+ _LOGGER.info("send_notification: %s", message)
+ MockWebSocket.on_message(None, message)
+
+ @staticmethod
+ def enableTrace(yes_no):
+ """ignore"""
+ pass
+
+ class MockSocket(object):
+ """Mock websocket"""
+ def __init__(self):
+ self.connected = True
+
+ class WebSocketApp(object):
+ """Mocked WebSocketApp"""
+ def __init__(self, web_socket_url,
+ on_open=None, on_message=None, on_close=None, on_error=None, on_pong=None):
+ self.web_socket_url = web_socket_url
+ self.on_open = on_open
+ self.on_message = MockWebSocket.on_message = on_message
+ self.on_close = on_close
+ self.on_error = on_error
+ self.on_pong = on_pong
+ self.sock = MockWebSocket.MockSocket()
+ _LOGGER.info("MockWebSocket for: %s", self.web_socket_url)
+
+ def run_forever(self, sslopt=None, ping_interval=None):
+ """forever in the loop"""
+ _LOGGER.info("MockWebSocket run_forever with sslopt=%s, ping_interval=%s...",
+ json.dumps(sslopt), ping_interval)
+ counter = 0
+ while self.sock.connected:
+ counter += 1
+ _LOGGER.info("MockWebSocket sleep %s...", counter)
+ time.sleep(5)
+ _LOGGER.info("MockWebSocket exit %s", counter)
+
+ def close(self):
+ """close socket"""
+ self.sock.connected = False
diff --git a/tests/pdp_api_v0/test_policy_rest.py b/tests/pdp_api_v0/test_policy_rest.py
new file mode 100644
index 0000000..67b06ae
--- /dev/null
+++ b/tests/pdp_api_v0/test_policy_rest.py
@@ -0,0 +1,47 @@
+# ============LICENSE_START=======================================================
+# Copyright (c) 2018-2019 AT&T Intellectual Property. 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=========================================================
+#
+"""test policy_rest methods directly"""
+
+import json
+
+import pytest
+
+from policyhandler import pdp_client
+from policyhandler.onap.audit import Audit
+from policyhandler.utils import Utils
+
+from ..mock_tracker import Tracker
+from .mock_policy_engine import MockPolicyEngine2018
+
+_LOGGER = Utils.get_logger(__file__)
+
+@pytest.mark.usefixtures("fix_pdp_api_v0", "fix_pdp_post")
+def test_get_policy_latest():
+ """test /policy_latest/<policy-id>"""
+ policy_id, expected_policy = MockPolicyEngine2018.gen_policy_latest(3)
+
+ audit = Audit(job_name="test_get_policy_latest",
+ req_message="get /policy_latest/{}".format(policy_id or ""))
+
+ policy_latest = pdp_client.PolicyRest.get_latest_policy((audit, policy_id, None, None)) or {}
+ audit.audit_done(result=json.dumps(policy_latest))
+
+ _LOGGER.info("expected_policy: %s", json.dumps(expected_policy))
+ _LOGGER.info("policy_latest: %s", json.dumps(policy_latest))
+ assert Utils.are_the_same(policy_latest, expected_policy)
+
+ Tracker.validate()
diff --git a/tests/pdp_api_v0/test_policyhandler.py b/tests/pdp_api_v0/test_policyhandler.py
new file mode 100644
index 0000000..2b2629b
--- /dev/null
+++ b/tests/pdp_api_v0/test_policyhandler.py
@@ -0,0 +1,280 @@
+# ============LICENSE_START=======================================================
+# Copyright (c) 2017-2019 AT&T Intellectual Property. 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=========================================================
+#
+
+"""test of the package for policy-handler of DCAE-Controller"""
+
+import json
+import time
+import uuid
+
+import cherrypy
+import pytest
+from cherrypy.test.helper import CPWebCase
+
+from policyhandler.config import Config
+from policyhandler.onap.audit import REQUEST_X_ECOMP_REQUESTID, Audit
+from policyhandler.pdp_api_v0.pdp_consts import POLICY_NAME
+from policyhandler.policy_consts import LATEST_POLICIES
+from policyhandler.policy_receiver import PolicyReceiver
+from policyhandler.utils import Utils
+from policyhandler.web_server import _PolicyWeb
+
+from ..mock_settings import MockSettings
+from ..mock_tracker import Tracker
+from .mock_policy_engine import MockPolicyEngine2018
+from .mock_websocket import MockWebSocket
+
+_LOGGER = Utils.get_logger(__file__)
+
+@pytest.mark.usefixtures(
+ "fix_pdp_api_v0",
+ "fix_pdp_post",
+ "fix_discovery"
+)
+class WebServer2018Test(CPWebCase):
+ """testing the web-server - runs tests in alphabetical order of method names"""
+ def setup_server():
+ """setup the web-server"""
+ cherrypy.tree.mount(_PolicyWeb(), '/')
+
+ setup_server = staticmethod(setup_server)
+
+ def test_web_healthcheck(self):
+ """test /healthcheck"""
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+ _LOGGER.info("got healthcheck: %s", self.body)
+ self.assertStatus('200 OK')
+
+ Tracker.validate()
+
+ def test_web_policy_latest(self):
+ """test /policy_latest/<policy-id>"""
+ policy_id, expected_policy = MockPolicyEngine2018.gen_policy_latest(3)
+
+ self.getPage("/policy_latest/{0}".format(policy_id or ""))
+ self.assertStatus('200 OK')
+
+ policy_latest = json.loads(self.body)
+
+ _LOGGER.info("policy_latest: %s", self.body)
+ _LOGGER.info("expected_policy: %s", json.dumps(expected_policy))
+ assert Utils.are_the_same(policy_latest, expected_policy)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ Tracker.validate()
+
+ @pytest.mark.usefixtures("fix_deploy_handler")
+ def test_web_all_policies_latest(self):
+ """test GET /policies_latest"""
+ expected_policies = MockPolicyEngine2018.gen_all_policies_latest()
+
+ result = self.getPage("/policies_latest")
+ _LOGGER.info("result: %s", result)
+ _LOGGER.info("body: %s", self.body)
+
+ if Config.is_pdp_api_default():
+ self.assertStatus('404 Not Found')
+ return
+
+ self.assertStatus('200 OK')
+
+ policies_latest = json.loads(self.body)
+ self.assertIn(LATEST_POLICIES, policies_latest)
+ policies_latest = policies_latest[LATEST_POLICIES]
+
+ _LOGGER.info("policies_latest: %s", json.dumps(policies_latest))
+ _LOGGER.info("expected_policies: %s", json.dumps(expected_policies))
+ assert Utils.are_the_same(policies_latest, expected_policies)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ Tracker.validate()
+
+ def test_web_policies_latest(self):
+ """test POST /policies_latest with policyName"""
+ match_to_policy_name = MockPolicyEngine2018.scope_prefix + "amet.*"
+ expected_policies = MockPolicyEngine2018.gen_policies_latest(match_to_policy_name)
+
+ body = json.dumps({POLICY_NAME: match_to_policy_name})
+ result = self.getPage("/policies_latest", method='POST',
+ body=body,
+ headers=[
+ (REQUEST_X_ECOMP_REQUESTID, str(uuid.uuid4())),
+ ("Content-Type", "application/json"),
+ ('Content-Length', str(len(body)))
+ ])
+ _LOGGER.info("result: %s", result)
+ _LOGGER.info("body: %s", self.body)
+
+ if Config.is_pdp_api_default():
+ self.assertStatus('404 Not Found')
+ return
+
+ self.assertStatus('200 OK')
+
+ policies_latest = json.loads(self.body)[LATEST_POLICIES]
+
+ _LOGGER.info("policies_latest: %s", json.dumps(policies_latest))
+ _LOGGER.info("expected_policies: %s", json.dumps(expected_policies))
+ assert Utils.are_the_same(policies_latest, expected_policies)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ Tracker.validate()
+
+ @pytest.mark.usefixtures("fix_deploy_handler", "fix_policy_receiver_websocket")
+ def test_zzz_policy_updates_and_catch_ups(self):
+ """test run policy handler with policy updates and catchups"""
+ if Config.is_pdp_api_default():
+ _LOGGER.info("passive for new PDP API")
+ return
+
+ _LOGGER.info("start policy_updates_and_catch_ups")
+ assert not PolicyReceiver.is_running()
+
+ audit = Audit(job_name="test_zzz_policy_updates_and_catch_ups",
+ req_message="start policy_updates_and_catch_ups")
+ PolicyReceiver.run(audit)
+
+ _LOGGER.info("sleep before send_notification...")
+ time.sleep(2)
+
+ MockWebSocket.send_notification([1, 3, 5])
+ _LOGGER.info("sleep after send_notification...")
+ time.sleep(3)
+
+ _LOGGER.info("sleep 10 before shutdown...")
+ time.sleep(10)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ PolicyReceiver.shutdown(audit)
+ time.sleep(1)
+ assert not PolicyReceiver.is_running()
+
+ Tracker.validate()
+
+ @pytest.mark.usefixtures("fix_deploy_handler", "fix_policy_receiver_websocket")
+ def test_zzz_catch_up_on_deploy_handler_changed(self):
+ """test run policy handler with deployment-handler changed underneath"""
+ if Config.is_pdp_api_default():
+ _LOGGER.info("passive for new PDP API")
+ return
+
+ _LOGGER.info("start zzz_catch_up_on_deploy_handler_changed")
+ assert not PolicyReceiver.is_running()
+ audit = Audit(job_name="test_zzz_catch_up_on_deploy_handler_changed",
+ req_message="start zzz_catch_up_on_deploy_handler_changed")
+ PolicyReceiver.run(audit)
+
+ _LOGGER.info("sleep before send_notification...")
+ time.sleep(2)
+
+ MockWebSocket.send_notification([1])
+ _LOGGER.info("sleep after send_notification...")
+ time.sleep(3)
+
+ MockSettings.deploy_handler_instance_uuid = str(uuid.uuid4())
+ _LOGGER.info("new deploy-handler uuid=%s", MockSettings.deploy_handler_instance_uuid)
+
+ MockWebSocket.send_notification([2, 4])
+ _LOGGER.info("sleep after send_notification...")
+ time.sleep(3)
+
+ _LOGGER.info("sleep 5 before shutdown...")
+ time.sleep(5)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ PolicyReceiver.shutdown(audit)
+ time.sleep(1)
+ assert not PolicyReceiver.is_running()
+
+ Tracker.validate()
+
+ @pytest.mark.usefixtures("fix_deploy_handler", "fix_policy_receiver_websocket")
+ def test_zzz_get_catch_up(self):
+ """test /catch_up"""
+ if Config.is_pdp_api_default():
+ _LOGGER.info("passive for new PDP API")
+ return
+
+ _LOGGER.info("start /catch_up")
+ assert not PolicyReceiver.is_running()
+ audit = Audit(job_name="test_zzz_get_catch_up", req_message="start /catch_up")
+ PolicyReceiver.run(audit)
+ time.sleep(5)
+ result = self.getPage("/catch_up")
+ _LOGGER.info("catch_up result: %s", result)
+ self.assertStatus('200 OK')
+ _LOGGER.info("got catch_up: %s", self.body)
+
+ _LOGGER.info("sleep 5 before shutdown...")
+ time.sleep(5)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ PolicyReceiver.shutdown(audit)
+ time.sleep(1)
+ assert not PolicyReceiver.is_running()
+
+ Tracker.validate()
+
+ @pytest.mark.usefixtures(
+ "fix_deploy_handler",
+ "fix_policy_receiver_websocket",
+ "fix_cherrypy_engine_exit")
+ def test_zzzzz_shutdown(self):
+ """test shutdown"""
+ _LOGGER.info("start shutdown")
+ assert not PolicyReceiver.is_running()
+ audit = Audit(job_name="test_zzzzz_shutdown", req_message="start shutdown")
+ PolicyReceiver.run(audit)
+
+ _LOGGER.info("sleep before send_notification...")
+ time.sleep(2)
+
+ MockWebSocket.send_notification([1, 3, 5])
+ _LOGGER.info("sleep after send_notification...")
+ time.sleep(3)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ WebServer2018Test.do_gc_test = False
+ _LOGGER.info("shutdown...")
+ audit.audit_done("shutdown")
+ result = self.getPage("/shutdown")
+ _LOGGER.info("shutdown result: %s", result)
+ self.assertStatus('200 OK')
+ _LOGGER.info("got shutdown: %s", self.body)
+ time.sleep(1)
+ assert not PolicyReceiver.is_running()
+
+ if Config.is_pdp_api_default():
+ _LOGGER.info("passive for new PDP API")
+ return
+
+ Tracker.validate()
diff --git a/tests/pdp_api_v0/test_pz_catch_up.py b/tests/pdp_api_v0/test_pz_catch_up.py
new file mode 100644
index 0000000..3b37af5
--- /dev/null
+++ b/tests/pdp_api_v0/test_pz_catch_up.py
@@ -0,0 +1,107 @@
+# ============LICENSE_START=======================================================
+# Copyright (c) 2018-2019 AT&T Intellectual Property. 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=========================================================
+#
+"""test policy catch_up methods directly"""
+
+import json
+import time
+
+import pytest
+
+from policyhandler.config import Config
+from policyhandler.onap.audit import Audit
+from policyhandler.policy_receiver import PolicyReceiver
+from policyhandler.utils import Utils
+
+from ..mock_tracker import Tracker
+
+_LOGGER = Utils.get_logger(__file__)
+
+@pytest.mark.usefixtures(
+ "fix_pdp_api_v0",
+ "fix_auto_catch_up",
+ "fix_discovery",
+ "fix_pdp_post_big",
+ "fix_deploy_handler_413",
+ "fix_policy_receiver_websocket"
+)
+def test_catch_up_failed_dh():
+ """test run policy handler with catchups and failed deployment-handler"""
+ if Config.is_pdp_api_default():
+ _LOGGER.info("passive for new PDP API")
+ return
+
+ _LOGGER.info("start test_catch_up_failed_dh")
+ assert not PolicyReceiver.is_running()
+ audit = Audit(job_name="test_catch_up_failed_dh",
+ req_message="start test_catch_up_failed_dh")
+ PolicyReceiver.run(audit)
+
+ _LOGGER.info("sleep 12 before shutdown...")
+ time.sleep(12)
+
+ health = audit.health(full=True)
+ audit.audit_done(result=json.dumps(health))
+
+ _LOGGER.info("healthcheck: %s", json.dumps(health))
+ assert bool(health)
+
+ PolicyReceiver.shutdown(audit)
+ time.sleep(1)
+ assert not PolicyReceiver.is_running()
+
+ health = audit.health(full=True)
+ _LOGGER.info("healthcheck: %s", json.dumps(health))
+
+ Tracker.validate()
+
+@pytest.mark.usefixtures(
+ "fix_pdp_api_v0",
+ "fix_auto_catch_up",
+ "fix_discovery",
+ "fix_pdp_post",
+ "fix_deploy_handler_404",
+ "fix_policy_receiver_websocket"
+)
+def test_catch_up_dh_404():
+ """test run policy handler with catchups and failed deployment-handler"""
+ if Config.is_pdp_api_default():
+ _LOGGER.info("passive for new PDP API")
+ return
+
+ _LOGGER.info("start test_catch_up_dh_404")
+ assert not PolicyReceiver.is_running()
+ audit = Audit(job_name="test_catch_up_dh_404",
+ req_message="start test_catch_up_dh_404")
+ PolicyReceiver.run(audit)
+
+ _LOGGER.info("sleep 12 before shutdown...")
+ time.sleep(12)
+
+ health = audit.health(full=True)
+ audit.audit_done(result=json.dumps(health))
+
+ _LOGGER.info("healthcheck: %s", json.dumps(health))
+ assert bool(health)
+
+ PolicyReceiver.shutdown(audit)
+ time.sleep(1)
+ assert not PolicyReceiver.is_running()
+
+ health = audit.health(full=True)
+ _LOGGER.info("healthcheck: %s", json.dumps(health))
+
+ Tracker.validate()
diff --git a/tests/pdp_api_v0/test_pz_pdp_boom.py b/tests/pdp_api_v0/test_pz_pdp_boom.py
new file mode 100644
index 0000000..effadc2
--- /dev/null
+++ b/tests/pdp_api_v0/test_pz_pdp_boom.py
@@ -0,0 +1,255 @@
+# ============LICENSE_START=======================================================
+# Copyright (c) 2018-2019 AT&T Intellectual Property. 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=========================================================
+#
+"""test policyhandler web-server when pdp booms = fails"""
+
+import json
+import time
+import uuid
+
+import cherrypy
+import pytest
+from cherrypy.test.helper import CPWebCase
+
+from policyhandler.config import Config
+from policyhandler.onap.audit import (REQUEST_X_ECOMP_REQUESTID, Audit,
+ AuditHttpCode)
+from policyhandler.pdp_api_v0.pdp_consts import POLICY_NAME
+from policyhandler.policy_receiver import PolicyReceiver
+from policyhandler.utils import Utils
+from policyhandler.web_server import _PolicyWeb
+
+from ..mock_settings import MockSettings
+from ..mock_tracker import Tracker
+from .mock_policy_engine import MockPolicyEngine2018
+from .mock_websocket import MockWebSocket
+
+_LOGGER = Utils.get_logger(__file__)
+
+@pytest.mark.usefixtures(
+ "fix_pdp_api_v0",
+ "fix_discovery",
+ "fix_pdp_post_boom"
+)
+class WebServerPDPBoom2018Test(CPWebCase):
+ """testing the web-server - runs tests in alphabetical order of method names"""
+ def setup_server():
+ """setup the web-server"""
+ cherrypy.tree.mount(_PolicyWeb(), '/')
+
+ setup_server = staticmethod(setup_server)
+
+ def test_web_healthcheck(self):
+ """test /healthcheck"""
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+ _LOGGER.info("got healthcheck: %s", self.body)
+ self.assertStatus('200 OK')
+
+ Tracker.validate()
+
+ def test_web_policy_latest(self):
+ """test /policy_latest/<policy-id>"""
+ policy_id, _ = MockPolicyEngine2018.gen_policy_latest(3)
+
+ self.getPage("/policy_latest/{0}".format(policy_id or ""))
+ self.assertStatus(AuditHttpCode.SERVER_INTERNAL_ERROR.value)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ Tracker.validate()
+
+ @pytest.mark.usefixtures("fix_deploy_handler")
+ def test_web_all_policies_latest(self):
+ """test GET /policies_latest"""
+ result = self.getPage("/policies_latest")
+ _LOGGER.info("result: %s", result)
+ _LOGGER.info("body: %s", self.body)
+
+ if Config.is_pdp_api_default():
+ self.assertStatus('404 Not Found')
+ return
+
+ self.assertStatus(AuditHttpCode.SERVER_INTERNAL_ERROR.value)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ Tracker.validate()
+
+ def test_web_policies_latest(self):
+ """test POST /policies_latest with policyName"""
+ match_to_policy_name = MockPolicyEngine2018.scope_prefix + "amet.*"
+
+ body = json.dumps({POLICY_NAME: match_to_policy_name})
+ result = self.getPage("/policies_latest", method='POST',
+ body=body,
+ headers=[
+ (REQUEST_X_ECOMP_REQUESTID, str(uuid.uuid4())),
+ ("Content-Type", "application/json"),
+ ('Content-Length', str(len(body)))
+ ])
+ _LOGGER.info("result: %s", result)
+ _LOGGER.info("body: %s", self.body)
+
+ if Config.is_pdp_api_default():
+ self.assertStatus('404 Not Found')
+ return
+
+ self.assertStatus(AuditHttpCode.SERVER_INTERNAL_ERROR.value)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ Tracker.validate()
+
+ @pytest.mark.usefixtures("fix_deploy_handler", "fix_policy_receiver_websocket")
+ def test_zzz_policy_updates_and_catch_ups(self):
+ """test run policy handler with policy updates and catchups"""
+ if Config.is_pdp_api_default():
+ _LOGGER.info("passive for new PDP API")
+ return
+
+ _LOGGER.info("start policy_updates_and_catch_ups")
+ assert not PolicyReceiver.is_running()
+ audit = Audit(job_name="test_zzz_policy_updates_and_catch_ups",
+ req_message="start policy_updates_and_catch_ups")
+ PolicyReceiver.run(audit)
+
+ _LOGGER.info("sleep before send_notification...")
+ time.sleep(2)
+
+ MockWebSocket.send_notification([1, 3, 5])
+ _LOGGER.info("sleep after send_notification...")
+ time.sleep(3)
+
+ _LOGGER.info("sleep 10 before shutdown...")
+ time.sleep(10)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ PolicyReceiver.shutdown(audit)
+ time.sleep(1)
+ assert not PolicyReceiver.is_running()
+
+ Tracker.validate()
+
+ @pytest.mark.usefixtures("fix_deploy_handler", "fix_policy_receiver_websocket")
+ def test_zzz_catch_up_on_deploy_handler_changed(self):
+ """test run policy handler with deployment-handler changed underneath"""
+ if Config.is_pdp_api_default():
+ _LOGGER.info("passive for new PDP API")
+ return
+
+ _LOGGER.info("start zzz_catch_up_on_deploy_handler_changed")
+ assert not PolicyReceiver.is_running()
+ audit = Audit(job_name="test_zzz_catch_up_on_deploy_handler_changed",
+ req_message="start zzz_catch_up_on_deploy_handler_changed")
+ PolicyReceiver.run(audit)
+
+ _LOGGER.info("sleep before send_notification...")
+ time.sleep(2)
+
+ MockWebSocket.send_notification([1])
+ _LOGGER.info("sleep after send_notification...")
+ time.sleep(3)
+
+ MockSettings.deploy_handler_instance_uuid = str(uuid.uuid4())
+ _LOGGER.info("new deploy-handler uuid=%s", MockSettings.deploy_handler_instance_uuid)
+
+ MockWebSocket.send_notification([2, 4])
+ _LOGGER.info("sleep after send_notification...")
+ time.sleep(3)
+
+ _LOGGER.info("sleep 5 before shutdown...")
+ time.sleep(5)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ PolicyReceiver.shutdown(audit)
+ time.sleep(1)
+ assert not PolicyReceiver.is_running()
+
+ Tracker.validate()
+
+ @pytest.mark.usefixtures("fix_deploy_handler", "fix_policy_receiver_websocket")
+ def test_zzz_get_catch_up(self):
+ """test /catch_up"""
+ if Config.is_pdp_api_default():
+ _LOGGER.info("passive for new PDP API")
+ return
+
+ _LOGGER.info("start /catch_up")
+ assert not PolicyReceiver.is_running()
+ audit = Audit(job_name="test_zzz_get_catch_up", req_message="start /catch_up")
+ PolicyReceiver.run(audit)
+ time.sleep(5)
+ result = self.getPage("/catch_up")
+ _LOGGER.info("catch_up result: %s", result)
+ self.assertStatus('200 OK')
+ _LOGGER.info("got catch_up: %s", self.body)
+
+ _LOGGER.info("sleep 5 before shutdown...")
+ time.sleep(5)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ PolicyReceiver.shutdown(audit)
+ time.sleep(1)
+ assert not PolicyReceiver.is_running()
+
+ Tracker.validate()
+
+ @pytest.mark.usefixtures(
+ "fix_deploy_handler",
+ "fix_policy_receiver_websocket",
+ "fix_cherrypy_engine_exit")
+ def test_zzzzz_shutdown(self):
+ """test shutdown"""
+ _LOGGER.info("start shutdown")
+ assert not PolicyReceiver.is_running()
+ audit = Audit(job_name="test_zzzzz_shutdown", req_message="start shutdown")
+ PolicyReceiver.run(audit)
+
+ _LOGGER.info("sleep before send_notification...")
+ time.sleep(2)
+
+ MockWebSocket.send_notification([1, 3, 5])
+ _LOGGER.info("sleep after send_notification...")
+ time.sleep(3)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ WebServerPDPBoom2018Test.do_gc_test = False
+ _LOGGER.info("shutdown...")
+ audit.audit_done("shutdown")
+ result = self.getPage("/shutdown")
+ _LOGGER.info("shutdown result: %s", result)
+ self.assertStatus('200 OK')
+ _LOGGER.info("got shutdown: %s", self.body)
+ time.sleep(1)
+ assert not PolicyReceiver.is_running()
+
+ if Config.is_pdp_api_default():
+ _LOGGER.info("passive for new PDP API")
+ return
+
+ Tracker.validate()
diff --git a/tests/pdp_api_v0/test_pz_ph_boom.py b/tests/pdp_api_v0/test_pz_ph_boom.py
new file mode 100644
index 0000000..4203110
--- /dev/null
+++ b/tests/pdp_api_v0/test_pz_ph_boom.py
@@ -0,0 +1,256 @@
+# ============LICENSE_START=======================================================
+# Copyright (c) 2018-2019 AT&T Intellectual Property. 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=========================================================
+#
+"""test policyhandler web-server when the policy-handler booms = fails"""
+
+import json
+import time
+import uuid
+
+import cherrypy
+import pytest
+from cherrypy.test.helper import CPWebCase
+
+from policyhandler.config import Config
+from policyhandler.onap.audit import (REQUEST_X_ECOMP_REQUESTID, Audit,
+ AuditHttpCode)
+from policyhandler.pdp_api_v0.pdp_consts import POLICY_NAME
+from policyhandler.policy_receiver import PolicyReceiver
+from policyhandler.utils import Utils
+from policyhandler.web_server import _PolicyWeb
+
+from ..mock_settings import MockSettings
+from ..mock_tracker import Tracker
+from .mock_policy_engine import MockPolicyEngine2018
+from .mock_websocket import MockWebSocket
+
+_LOGGER = Utils.get_logger(__file__)
+
+@pytest.mark.usefixtures(
+ "fix_pdp_api_v0",
+ "fix_discovery",
+ "fix_pdp_post",
+ "fix_select_latest_policies_boom"
+)
+class WebServerInternalBoom2018Test(CPWebCase):
+ """testing the web-server - runs tests in alphabetical order of method names"""
+ def setup_server():
+ """setup the web-server"""
+ cherrypy.tree.mount(_PolicyWeb(), '/')
+
+ setup_server = staticmethod(setup_server)
+
+ def test_web_healthcheck(self):
+ """test /healthcheck"""
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+ _LOGGER.info("got healthcheck: %s", self.body)
+ self.assertStatus('200 OK')
+
+ Tracker.validate()
+
+ def test_web_policy_latest(self):
+ """test /policy_latest/<policy-id>"""
+ policy_id, _ = MockPolicyEngine2018.gen_policy_latest(3)
+
+ self.getPage("/policy_latest/{0}".format(policy_id or ""))
+ self.assertStatus(AuditHttpCode.SERVER_INTERNAL_ERROR.value)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ Tracker.validate()
+
+ @pytest.mark.usefixtures("fix_deploy_handler")
+ def test_web_all_policies_latest(self):
+ """test GET /policies_latest"""
+ result = self.getPage("/policies_latest")
+ _LOGGER.info("result: %s", result)
+ _LOGGER.info("body: %s", self.body)
+
+ if Config.is_pdp_api_default():
+ self.assertStatus('404 Not Found')
+ return
+
+ self.assertStatus(AuditHttpCode.SERVER_INTERNAL_ERROR.value)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ Tracker.validate()
+
+ def test_web_policies_latest(self):
+ """test POST /policies_latest with policyName"""
+ match_to_policy_name = MockPolicyEngine2018.scope_prefix + "amet.*"
+
+ body = json.dumps({POLICY_NAME: match_to_policy_name})
+ result = self.getPage("/policies_latest", method='POST',
+ body=body,
+ headers=[
+ (REQUEST_X_ECOMP_REQUESTID, str(uuid.uuid4())),
+ ("Content-Type", "application/json"),
+ ('Content-Length', str(len(body)))
+ ])
+ _LOGGER.info("result: %s", result)
+ _LOGGER.info("body: %s", self.body)
+
+ if Config.is_pdp_api_default():
+ self.assertStatus('404 Not Found')
+ return
+
+ self.assertStatus(AuditHttpCode.SERVER_INTERNAL_ERROR.value)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ Tracker.validate()
+
+ @pytest.mark.usefixtures("fix_deploy_handler", "fix_policy_receiver_websocket")
+ def test_zzz_policy_updates_and_catch_ups(self):
+ """test run policy handler with policy updates and catchups"""
+ if Config.is_pdp_api_default():
+ _LOGGER.info("passive for new PDP API")
+ return
+
+ _LOGGER.info("start policy_updates_and_catch_ups")
+ assert not PolicyReceiver.is_running()
+ audit = Audit(job_name="test_zzz_policy_updates_and_catch_ups",
+ req_message="start policy_updates_and_catch_ups")
+ PolicyReceiver.run(audit)
+
+ _LOGGER.info("sleep before send_notification...")
+ time.sleep(2)
+
+ MockWebSocket.send_notification([1, 3, 5])
+ _LOGGER.info("sleep after send_notification...")
+ time.sleep(3)
+
+ _LOGGER.info("sleep 10 before shutdown...")
+ time.sleep(10)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ PolicyReceiver.shutdown(audit)
+ time.sleep(1)
+ assert not PolicyReceiver.is_running()
+
+ Tracker.validate()
+
+ @pytest.mark.usefixtures("fix_deploy_handler", "fix_policy_receiver_websocket")
+ def test_zzz_catch_up_on_deploy_handler_changed(self):
+ """test run policy handler with deployment-handler changed underneath"""
+ if Config.is_pdp_api_default():
+ _LOGGER.info("passive for new PDP API")
+ return
+
+ _LOGGER.info("start zzz_catch_up_on_deploy_handler_changed")
+ assert not PolicyReceiver.is_running()
+ audit = Audit(job_name="test_zzz_catch_up_on_deploy_handler_changed",
+ req_message="start zzz_catch_up_on_deploy_handler_changed")
+ PolicyReceiver.run(audit)
+
+ _LOGGER.info("sleep before send_notification...")
+ time.sleep(2)
+
+ MockWebSocket.send_notification([1])
+ _LOGGER.info("sleep after send_notification...")
+ time.sleep(3)
+
+ MockSettings.deploy_handler_instance_uuid = str(uuid.uuid4())
+ _LOGGER.info("new deploy-handler uuid=%s", MockSettings.deploy_handler_instance_uuid)
+
+ MockWebSocket.send_notification([2, 4])
+ _LOGGER.info("sleep after send_notification...")
+ time.sleep(3)
+
+ _LOGGER.info("sleep 5 before shutdown...")
+ time.sleep(5)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ PolicyReceiver.shutdown(audit)
+ time.sleep(1)
+ assert not PolicyReceiver.is_running()
+
+ Tracker.validate()
+
+ @pytest.mark.usefixtures("fix_deploy_handler", "fix_policy_receiver_websocket")
+ def test_zzz_get_catch_up(self):
+ """test /catch_up"""
+ if Config.is_pdp_api_default():
+ _LOGGER.info("passive for new PDP API")
+ return
+
+ _LOGGER.info("start /catch_up")
+ assert not PolicyReceiver.is_running()
+ audit = Audit(job_name="test_zzz_get_catch_up", req_message="start /catch_up")
+ PolicyReceiver.run(audit)
+ time.sleep(5)
+ result = self.getPage("/catch_up")
+ _LOGGER.info("catch_up result: %s", result)
+ self.assertStatus('200 OK')
+ _LOGGER.info("got catch_up: %s", self.body)
+
+ _LOGGER.info("sleep 5 before shutdown...")
+ time.sleep(5)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ PolicyReceiver.shutdown(audit)
+ time.sleep(1)
+ assert not PolicyReceiver.is_running()
+
+ Tracker.validate()
+
+ @pytest.mark.usefixtures(
+ "fix_deploy_handler",
+ "fix_policy_receiver_websocket",
+ "fix_cherrypy_engine_exit")
+ def test_zzzzz_shutdown(self):
+ """test shutdown"""
+ _LOGGER.info("start shutdown")
+ assert not PolicyReceiver.is_running()
+ audit = Audit(job_name="test_zzzzz_shutdown", req_message="start shutdown")
+ PolicyReceiver.run(audit)
+
+ _LOGGER.info("sleep before send_notification...")
+ time.sleep(2)
+
+ MockWebSocket.send_notification([1, 3, 5])
+ _LOGGER.info("sleep after send_notification...")
+ time.sleep(3)
+
+ result = self.getPage("/healthcheck")
+ _LOGGER.info("healthcheck result: %s", result)
+
+ WebServerInternalBoom2018Test.do_gc_test = False
+ _LOGGER.info("shutdown...")
+ audit.audit_done("shutdown")
+ result = self.getPage("/shutdown")
+ _LOGGER.info("shutdown result: %s", result)
+ self.assertStatus('200 OK')
+ _LOGGER.info("got shutdown: %s", self.body)
+ time.sleep(1)
+ assert not PolicyReceiver.is_running()
+
+ if Config.is_pdp_api_default():
+ _LOGGER.info("passive for new PDP API")
+ return
+
+ Tracker.validate()