Merge "spec for Container based network service/function"
authorBin Hu <bh526r@att.com>
Mon, 5 Mar 2018 06:39:55 +0000 (06:39 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 5 Mar 2018 06:39:55 +0000 (06:39 +0000)
docs/specs/logging_enablement.rst [new file with mode: 0644]
docs/specs/multicloud_resource_capacity_check.rst
multivimbroker/multivimbroker/pub/config/config.py
multivimbroker/multivimbroker/pub/utils/share_lock.py [deleted file]

diff --git a/docs/specs/logging_enablement.rst b/docs/specs/logging_enablement.rst
new file mode 100644 (file)
index 0000000..5fb639e
--- /dev/null
@@ -0,0 +1,83 @@
+..
+ This work is licensed under a Creative Commons Attribution 4.0
+ International License.
+
+=================
+Multi-Vim logging
+=================
+
+The purpose of logging is to generate machine-readable, indexable output logs and support to trace
+requests through sub-component, it need to ship logs to logging enhancement project a centralized
+logging analysis system capturing diagnostic information.
+
+
+
+Problem Description
+===================
+
+So far the logging of multi-vim is not able to support customer configuration, handler context specific logging like
+MDC[MDC_Document]_, also it dose't propagate transaction-ID in REST headers which is critical to tracing request.
+There are 4 python containers in oom project need to configure filebeat container for shipping logs.
+
+.. [MDC_Document] https://wiki.onap.org/display/DW/ONAP+Application+Logging+Guidelines+v1.1#ONAPApplicationLoggingGuidelinesv1.1-MDCs
+
+In addition the current logging is very difficult to understand behavior and performance.
+
+
+Proposed Change
+===============
+
+The proposed change will include three parts.
+
+Filebeat container
+------------------
+
+Logging architecture[Log_Architecture]_ use Filebeat collects logs from multi-vim containers and ships them to the
+centralized logging stack. To enable this feature it need to add Filebeat container in multi-vim pod that was
+deployed by OOM, as well Yaml file will be used to configure Filebeat.
+
+.. [Log_Architecture] https://wiki.onap.org/display/DW/Logging+Architecture
+
+Tracing ID
+----------
+
+ONAP logging uses a global unique "RequestID"[RequestID_Document]_ in logging to track the processing of each request
+across all the components, multi-vim will receive this id from http header by vary "X-TransactionID", then record it
+in logs.
+Meanwhile single component should generate a InvocationID that records the relationship between RequestID
+and InvocationID for proper tracing. So Mulit-vim will set unique InvocationID for each single request,also output it
+in logs.
+
+.. [RequestID_Document] https://wiki.onap.org/pages/viewpage.action?pageId=20087036#ONAPApplicationLoggingGuidelinesv1.2(Beijing)-MDC-RequestID
+
+
+python AOP logging library
+--------------------------
+
+Currently logging enhancement project just has java AOP logging library, For multi-vim which based on python need
+a python version. The basic feature of AOP logging library could provide customer configuration include retention
+policy、output location、text output format、message level and so on, support MDC context specific logging, able to
+change configuration at runtime, and make logging quite fast.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
index 9fddb85..58c2468 100644 (file)
@@ -98,4 +98,10 @@ Work Items
 
 #. Work with ESR team for location inport form.
 #. Add check_vim_capacity API to MultiCloud Broker.
-#. Add check_vim_capacity API to each MultiCloud Plugins.
\ No newline at end of file
+#. Add check_vim_capacity API to each MultiCloud Plugins.
+
+Tests
+=====
+
+#. Unit Tests with tox
+#. CSIT Tests, the input/ouput of broker and each plugin see API design above.
index a3fafa7..8fba115 100644 (file)
@@ -32,11 +32,6 @@ AAI_PASSWORD = 'AAI'
 ROOT_PATH = os.path.dirname(
     os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
-# [REDIS]
-REDIS_HOST = '127.0.0.1'
-REDIS_PORT = '6379'
-REDIS_PASSWD = ''
-
 # [register]
 REG_TO_MSB_WHEN_START = False
 REG_TO_MSB_REG_URL = "/api/microservices/v1/services"
diff --git a/multivimbroker/multivimbroker/pub/utils/share_lock.py b/multivimbroker/multivimbroker/pub/utils/share_lock.py
deleted file mode 100755 (executable)
index e8eef8a..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# Copyright (c) 2017 Wind River Systems, Inc.
-# Copyright (c) 2017-2018 VMware, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-
-import time
-
-import redis
-
-from multivimbroker.pub.config.config import REDIS_HOST
-from multivimbroker.pub.config.config import REDIS_PORT
-from multivimbroker.pub.config.config import REDIS_PASSWD
-
-
-class SharedLock:
-    def __init__(self, lock_key, host=REDIS_HOST, port=REDIS_PORT,
-                 password=REDIS_PASSWD, db=9, lock_timeout=5 * 60):
-        self.lock_key = lock_key
-        self.lock_timeout = lock_timeout
-        self.redis = redis.Redis(host=host, port=port,
-                                 db=db, password=password)
-        self.acquire_time = -1
-
-    def acquire(self):
-        begin = now = int(time.time())
-        while (now - begin) < self.lock_timeout:
-
-            result = self.redis.setnx(self.lock_key, now +
-                                      self.lock_timeout + 1)
-            if result == 1 or result is True:
-                self.acquire_time = now
-                return True
-
-            current_lock_timestamp = self.redis.get(self.lock_key)
-            if not current_lock_timestamp:
-                time.sleep(1)
-                continue
-
-            current_lock_timestamp = int(current_lock_timestamp)
-
-            if now > current_lock_timestamp:
-                next_lock_timestamp = self.redis.getset(self.lock_key, now +
-                                                        self.lock_timeout + 1)
-                if not next_lock_timestamp:
-                    time.sleep(1)
-                    continue
-                next_lock_timestamp = int(next_lock_timestamp)
-
-                if next_lock_timestamp == current_lock_timestamp:
-                    self.acquire_time = now
-                    return True
-            else:
-                time.sleep(1)
-                continue
-        return False
-
-    def release(self):
-        now = int(time.time())
-        if now > self.acquire_time + self.lock_timeout:
-            # key expired, do nothing and let other clients handle it
-            return
-        self.acquire_time = None
-        self.redis.delete(self.lock_key)
-
-
-def do_biz_with_share_lock(lock_name, callback):
-    lock = SharedLock(lock_name)
-    try:
-        if not lock.acquire():
-            raise Exception(lock_name + " timeout")
-        callback()
-    except Exception as e:
-        raise e
-    finally:
-        lock.release()