From f53e5e70d88d813fb84848538472c601914ec652 Mon Sep 17 00:00:00 2001 From: Alex Shatov Date: Thu, 11 Jan 2018 11:15:56 -0500 Subject: moved module docstring below the license text Change-Id: I2a3628cb67d15ab2828f6818764d111df13e795a Issue-ID: DCAEGEN2-249 Signed-off-by: Alex Shatov --- policyhandler/config.py | 4 ++-- policyhandler/deploy_handler.py | 4 ++-- policyhandler/discovery.py | 4 ++-- policyhandler/onap/CommonLogger.py | 27 ++++++++++++++------------- policyhandler/onap/audit.py | 18 +++++++++--------- policyhandler/onap/health.py | 4 ++-- policyhandler/policy_consts.py | 4 ++-- policyhandler/policy_handler.py | 5 +++-- policyhandler/policy_receiver.py | 20 ++++++++++---------- policyhandler/policy_rest.py | 4 ++-- policyhandler/policy_updater.py | 4 ++-- policyhandler/policy_utils.py | 4 ++-- policyhandler/web_server.py | 4 ++-- setup.py | 4 ++-- tests/test_policyhandler.py | 2 ++ 15 files changed, 58 insertions(+), 54 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 diff --git a/setup.py b/setup.py index 63c41a2..3493582 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,3 @@ -"""package for policy-handler of DCAE-Controller""" - # 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. +"""package for policy-handler of DCAE-Controller""" + from setuptools import setup setup( diff --git a/tests/test_policyhandler.py b/tests/test_policyhandler.py index c90e521..2530dd3 100644 --- a/tests/test_policyhandler.py +++ b/tests/test_policyhandler.py @@ -18,6 +18,8 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. +"""test of the package for policy-handler of DCAE-Controller""" + import copy import json import logging -- cgit 1.2.3-korg