summaryrefslogtreecommitdiffstats
path: root/policyhandler
diff options
context:
space:
mode:
Diffstat (limited to 'policyhandler')
-rw-r--r--policyhandler/config.py4
-rw-r--r--policyhandler/deploy_handler.py4
-rw-r--r--policyhandler/discovery.py4
-rw-r--r--policyhandler/onap/CommonLogger.py27
-rw-r--r--policyhandler/onap/audit.py18
-rw-r--r--policyhandler/onap/health.py4
-rw-r--r--policyhandler/policy_consts.py4
-rw-r--r--policyhandler/policy_handler.py5
-rw-r--r--policyhandler/policy_receiver.py20
-rw-r--r--policyhandler/policy_rest.py4
-rw-r--r--policyhandler/policy_updater.py4
-rw-r--r--policyhandler/policy_utils.py4
-rw-r--r--policyhandler/web_server.py4
13 files changed, 54 insertions, 52 deletions
diff --git a/policyhandler/config.py b/policyhandler/config.py
index a36f032..12b5d05 100644
--- a/policyhandler/config.py
+++ b/policyhandler/config.py
@@ -1,5 +1,3 @@
-"""read and use the config"""
-
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
@@ -19,6 +17,8 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+"""read and use the config"""
+
import os
import json
import copy
diff --git a/policyhandler/deploy_handler.py b/policyhandler/deploy_handler.py
index a641a95..0dc86b9 100644
--- a/policyhandler/deploy_handler.py
+++ b/policyhandler/deploy_handler.py
@@ -1,5 +1,3 @@
-""" send notification to deploy-handler"""
-
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
@@ -19,6 +17,8 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+""" send notification to deploy-handler"""
+
import logging
import json
import requests
diff --git a/policyhandler/discovery.py b/policyhandler/discovery.py
index 33c3265..bfb4e9a 100644
--- a/policyhandler/discovery.py
+++ b/policyhandler/discovery.py
@@ -1,5 +1,3 @@
-"""client to talk to consul at the standard port 8500"""
-
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
@@ -19,6 +17,8 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+"""client to talk to consul at the standard port 8500"""
+
import logging
import json
import base64
diff --git a/policyhandler/onap/CommonLogger.py b/policyhandler/onap/CommonLogger.py
index a70ca28..0ab64e4 100644
--- a/policyhandler/onap/CommonLogger.py
+++ b/policyhandler/onap/CommonLogger.py
@@ -1,15 +1,5 @@
#!/usr/bin/python
# -*- indent-tabs-mode: nil -*- vi: set expandtab:
-"""ECOMP Common Logging library in Python.
-
-CommonLogger.py
-
-Original Written by: Terry Schmalzried
-Date written: October 1, 2015
-Last updated: December 1, 2016
-
-version 0.8
-"""
# org.onap.dcae
# ================================================================================
@@ -30,6 +20,17 @@ version 0.8
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+"""ECOMP Common Logging library in Python.
+
+CommonLogger.py
+
+Original Written by: Terry Schmalzried
+Date written: October 1, 2015
+Last updated: December 1, 2016
+
+version 0.8
+"""
+
from __future__ import print_function
import os, sys, getopt, logging, logging.handlers, time, re, uuid, socket, threading, collections
@@ -203,7 +204,7 @@ class CommonLogger:
self._logHandler = logging.handlers.RotatingFileHandler(self._logFile, \
mode=self._sizeRotateMode, maxBytes=self._sizeMaxBytes, \
backupCount=self._backupCount, encoding=None, delay=False)
-
+
else:
self._logHandler = logging.handlers.WatchedFileHandler(self._logFile, \
mode=self._sizeRotateMode, \
@@ -860,7 +861,7 @@ if __name__ == "__main__":
parser.add_argument("-k", "--keeplogs", help="Keep the log files after finishing the tests", action="store_true")
parser.add_argument("-v", "--verbose", help="Print debugging messages", action="store_true")
args = parser.parse_args()
-
+
spid = str(os.getpid())
if args.keeplogs:
spid = ""
@@ -878,7 +879,7 @@ if __name__ == "__main__":
os.remove(f)
except:
pass
- if not args.keeplogs:
+ if not args.keeplogs:
atexit.register(cleanupTmps)
with open(logcfg, "w") as o:
diff --git a/policyhandler/onap/audit.py b/policyhandler/onap/audit.py
index c338b76..8fd5ed3 100644
--- a/policyhandler/onap/audit.py
+++ b/policyhandler/onap/audit.py
@@ -1,12 +1,3 @@
-"""generic class to keep track of request handling
- from receiving it through reponse and log all the activities
-
- call Audit.init("component-name", "path/to/config_file") to init the loggers before any requests
-
- start each outside request with creation of the Audit object
- audit = Audit(request_id=None, headers=None, msg=None)
-"""
-
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
@@ -26,6 +17,15 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+"""generic class to keep track of request handling
+ from receiving it through reponse and log all the activities
+
+ call Audit.init("component-name", "path/to/config_file") to init the loggers before any requests
+
+ start each outside request with creation of the Audit object
+ audit = Audit(request_id=None, headers=None, msg=None)
+"""
+
import os
import sys
import json
diff --git a/policyhandler/onap/health.py b/policyhandler/onap/health.py
index eefa7d2..4475575 100644
--- a/policyhandler/onap/health.py
+++ b/policyhandler/onap/health.py
@@ -1,5 +1,3 @@
-"""generic class to keep track of app health"""
-
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
@@ -19,6 +17,8 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+"""generic class to keep track of app health"""
+
import uuid
from threading import Lock
from datetime import datetime
diff --git a/policyhandler/policy_consts.py b/policyhandler/policy_consts.py
index 30fe9b2..f6a1a9e 100644
--- a/policyhandler/policy_consts.py
+++ b/policyhandler/policy_consts.py
@@ -1,5 +1,3 @@
-"""contants of policy-handler"""
-
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
@@ -19,6 +17,8 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+"""contants of policy-handler"""
+
POLICY_ID = 'policy_id'
POLICY_VERSION = "policyVersion"
POLICY_NAME = "policyName"
diff --git a/policyhandler/policy_handler.py b/policyhandler/policy_handler.py
index 1cd62db..f838d34 100644
--- a/policyhandler/policy_handler.py
+++ b/policyhandler/policy_handler.py
@@ -1,5 +1,3 @@
-"""run as server: python -m policyhandler/policy_handler"""
-
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
@@ -18,6 +16,9 @@
# ============LICENSE_END=========================================================
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
+"""run as server: python -m policyhandler/policy_handler"""
+
import os
import sys
import logging
diff --git a/policyhandler/policy_receiver.py b/policyhandler/policy_receiver.py
index ec25987..080f544 100644
--- a/policyhandler/policy_receiver.py
+++ b/policyhandler/policy_receiver.py
@@ -1,13 +1,3 @@
-"""
-policy-receiver communicates with policy-engine
-thru web-socket to receive push notifications
-on updates and removal of policies.
-
-on receiving the policy-notifications, the policy-receiver
-filters them out by the policy scope(s) provided in policy-handler config
-and passes the notifications to policy-updater
-"""
-
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
@@ -27,6 +17,16 @@ and passes the notifications to policy-updater
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+"""
+policy-receiver communicates with policy-engine
+thru web-socket to receive push notifications
+on updates and removal of policies.
+
+on receiving the policy-notifications, the policy-receiver
+filters them out by the policy scope(s) provided in policy-handler config
+and passes the notifications to policy-updater
+"""
+
import json
import logging
import re
diff --git a/policyhandler/policy_rest.py b/policyhandler/policy_rest.py
index 1e50693..57dcfae 100644
--- a/policyhandler/policy_rest.py
+++ b/policyhandler/policy_rest.py
@@ -1,5 +1,3 @@
-"""policy-client communicates with policy-engine thru REST API"""
-
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
@@ -19,6 +17,8 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+"""policy-client communicates with policy-engine thru REST API"""
+
import logging
import json
import copy
diff --git a/policyhandler/policy_updater.py b/policyhandler/policy_updater.py
index 9732f69..0e06f2c 100644
--- a/policyhandler/policy_updater.py
+++ b/policyhandler/policy_updater.py
@@ -1,5 +1,3 @@
-"""policy-updater thread"""
-
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
@@ -19,6 +17,8 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+"""policy-updater thread"""
+
import logging
import json
from Queue import Queue
diff --git a/policyhandler/policy_utils.py b/policyhandler/policy_utils.py
index d664b21..4623eba 100644
--- a/policyhandler/policy_utils.py
+++ b/policyhandler/policy_utils.py
@@ -1,5 +1,3 @@
-"""policy-client communicates with policy-engine thru REST API"""
-
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
@@ -19,6 +17,8 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+"""policy-client communicates with policy-engine thru REST API"""
+
import logging
import json
import re
diff --git a/policyhandler/web_server.py b/policyhandler/web_server.py
index 3d2503a..4a6dee2 100644
--- a/policyhandler/web_server.py
+++ b/policyhandler/web_server.py
@@ -1,5 +1,3 @@
-"""web-service for policy_handler"""
-
# org.onap.dcae
# ================================================================================
# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
@@ -19,6 +17,8 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+"""web-service for policy_handler"""
+
import logging
import json
from datetime import datetime