improved message to deployment-handler and on API

* added errored_scopes and scope_prefixes to the message
              to deployment-handler - to prevent erroneous
              removal of policies
* hardcoded condition for scope not found 404 at policy-engine
     to separate it from error on the scope retrieval 400
* adjusting the web API message in sync with notification
        to deployment-handler
* unit test coverage 74%

Change-Id: Ie736a1b7aee0631b6785669c6b765bd240dd77b8
Issue-ID: DCAEGEN2-249
Signed-off-by: Alex Shatov <alexs@att.com>
diff --git a/policyhandler/deploy_handler.py b/policyhandler/deploy_handler.py
index 0dc86b9..306a637 100644
--- a/policyhandler/deploy_handler.py
+++ b/policyhandler/deploy_handler.py
@@ -1,6 +1,6 @@
 # org.onap.dcae
 # ================================================================================
-# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2018 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.
@@ -63,33 +63,20 @@
         DeployHandler._logger.info("DeployHandler url(%s)", DeployHandler._url)
 
     @staticmethod
-    def policy_update(audit, latest_policies, removed_policies=None,
-                      errored_policies=None, catch_up=False):
+    def policy_update(audit, message):
         """post policy_updated message to deploy-handler"""
-        if not latest_policies and not removed_policies and not catch_up:
+        if not message:
             return
 
-        latest_policies = latest_policies or {}
-        removed_policies = removed_policies or {}
-        errored_policies = errored_policies or {}
-
         DeployHandler._lazy_init()
-        msg = {
-            "catch_up" : catch_up,
-            "latest_policies" : latest_policies,
-            "removed_policies" : removed_policies,
-            "errored_policies" : errored_policies
-        }
         sub_aud = Audit(aud_parent=audit, targetEntity=DeployHandler._target_entity,
                         targetServiceName=DeployHandler._url_path)
         headers = {REQUEST_X_ECOMP_REQUESTID : sub_aud.request_id}
 
-        msg_str = json.dumps(msg)
+        msg_str = json.dumps(message)
         headers_str = json.dumps(headers)
 
-        DeployHandler._logger.info(
-            "catch_up(%s) latest_policies[%s], removed_policies[%s], errored_policies[%s]",
-            catch_up, len(latest_policies), len(removed_policies), len(errored_policies))
+        DeployHandler._logger.info("message: %s", msg_str)
         log_line = "post to deployment-handler {0} msg={1} headers={2}".format(
             DeployHandler._url_path, msg_str, headers_str)
 
@@ -107,7 +94,7 @@
         res = None
         try:
             res = DeployHandler._requests_session.post(
-                DeployHandler._url_path, json=msg, headers=headers
+                DeployHandler._url_path, json=message, headers=headers
             )
         except requests.exceptions.RequestException as ex:
             error_msg = "failed to post to deployment-handler {0} {1} msg={2} headers={3}" \