aboutsummaryrefslogtreecommitdiffstats
path: root/policyhandler/policy_handler.py
diff options
context:
space:
mode:
authorAlex Shatov <alexs@att.com>2018-01-10 11:00:50 -0500
committerAlex Shatov <alexs@att.com>2018-01-10 11:07:30 -0500
commit1369bea8b3c24ef063799acefbfc01659878f034 (patch)
tree95fa3e5580f62be9c1e1d630ed0c6496b9fb03a2 /policyhandler/policy_handler.py
parentdc5da5bf63ae4a4ac11b4b5c46407e58da16fbfe (diff)
variable collection of policies per component
* new feature variable collection of policies per component in DCAE * massive refactoring * dissolved the external PolicyEngine.py into policy_receiver.py - kept only the web-socket communication to PolicyEngine * new /healthcheck - shows some stats of service running * Unit Test coverage 75% Change-Id: I816b7d5713ae0dd88fa73d3656f272b4f3e7946e Issue-ID: DCAEGEN2-249 Signed-off-by: Alex Shatov <alexs@att.com>
Diffstat (limited to 'policyhandler/policy_handler.py')
-rw-r--r--policyhandler/policy_handler.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/policyhandler/policy_handler.py b/policyhandler/policy_handler.py
index 50d59bc..1cd62db 100644
--- a/policyhandler/policy_handler.py
+++ b/policyhandler/policy_handler.py
@@ -18,14 +18,14 @@
# ============LICENSE_END=========================================================
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-
+import os
import sys
import logging
from policyhandler.config import Config
from policyhandler.onap.audit import Audit
from policyhandler.web_server import PolicyWeb
-from policyhandler.policy_engine import PolicyEngineClient
+from policyhandler.policy_receiver import PolicyReceiver
class LogWriter(object):
"""redirect the standard out + err to the logger"""
@@ -52,13 +52,16 @@ def run_policy_handler():
sys.stderr = LogWriter(logger.error)
logger.info("========== run_policy_handler ==========")
- Audit.init(Config.get_system_name(), Config.LOGGER_CONFIG_FILE_PATH)
+ policy_handler_version = os.getenv("APP_VER")
+ logger.info("policy_handler_version %s", policy_handler_version)
+ Audit.init(Config.get_system_name(), policy_handler_version, Config.LOGGER_CONFIG_FILE_PATH)
logger.info("starting policy_handler with config:")
logger.info(Audit.log_json_dumps(Config.config))
- PolicyEngineClient.run()
- PolicyWeb.run()
+ audit = Audit(req_message="start policy handler")
+ PolicyReceiver.run(audit)
+ PolicyWeb.run_forever(audit)
if __name__ == "__main__":
run_policy_handler()