def setup_logging(args): """ Configure logging. """ log_level = logging.INFO # get loglevel from environment or --loglevel log_level_str = os.environ.get("LOGLEVEL", "INFO") if args.log_level: # overwrite if present log_level_str = args.log_level # parse log_level_str = str(log_level_str).lower() if log_level_str == "debug": log_level = logging.DEBUG elif log_level_str == "info": log_level = logging.INFO elif log_level_str == "warning": log_level = logging.WARNING elif log_level_str == "error": log_level = logging.ERROR else: LOG.info("Loglevel '{}' unknown.".format(log_level_str)) # if "-v" is there set to debug if args.verbose: log_level = logging.DEBUG # select logging mode log_json = os.environ.get("LOGJSON", args.logjson) # configure all TangoLoggers TangoLogger.reconfigure_all_tango_loggers( log_level=log_level, log_json=log_json)
def __init__(self, name): self._name = name self._LOG = TangoLogger.getLogger(name) self._events = dict() # load events config self._eventdict = self.load_eventcfg()
# # This work has also been performed in the framework of the 5GTANGO project, # funded by the European Commission under Grant number 761493 through # the Horizon 2020 and 5G-PPP programmes. The authors would like to # acknowledge the contributions of their colleagues of the SONATA # partner consortium (www.5gtango.eu). import logging import coloredlogs import os from tngsdk.validation import cli, rest from tngsdk.validation.validator import Validator from tngsdk.validation.logger import TangoLogger LOG = TangoLogger.getLogger(os.path.basename(__file__)) def setup_logging(args): """ Configure logging. """ log_level = logging.INFO # get loglevel from environment or --loglevel log_level_str = os.environ.get("LOGLEVEL", "INFO") if args.log_level: # overwrite if present log_level_str = args.log_level # parse log_level_str = str(log_level_str).lower() if log_level_str == "debug": log_level = logging.DEBUG elif log_level_str == "info":
# partner consortium (www.sonata-nfv.eu). import logging import coloredlogs import validators import os import yaml import jsonschema import requests from requests.exceptions import RequestException from jsonschema import SchemaError from jsonschema import ValidationError from tngsdk.validation.logger import TangoLogger LOG = TangoLogger.getLogger(__name__) class SchemaValidator(object): # ID of schema templates SCHEMA_PACKAGE_DESCRIPTOR = 'PD' SCHEMA_SERVICE_DESCRIPTOR = 'NSD' SCHEMA_FUNCTION_DESCRIPTOR = 'VNFD' SCHEMA_TEST_DESCRIPTOR = 'TSTD' SCHEMA_SLICE_DESCRIPTOR = 'NSTD' SCHEMA_SLA_DESCRIPTOR = 'SLAD' SCHEMA_RP_DESCRIPTOR = 'RPD' def __init__(self, workspace, preload=False): # Assign parameters