Commit 88811475 authored by Pelayo Torres's avatar Pelayo Torres
Browse files

Merge branch 'REL18-Auditing' into 'OCF64-rel17-to-rel18'

REL18 Auditing Service

See merge request !56
parents da4e49da 70aca45e
Loading
Loading
Loading
Loading
Loading
+6 −5
Original line number Original line Diff line number Diff line
.dockerignore
.dockerignore
.gitignore
.gitignore
.openapi-generator-ignore
.travis.yml
.travis.yml
Dockerfile
Dockerfile
README.md
README.md
@@ -8,23 +9,23 @@ logs/__init__.py
logs/__main__.py
logs/__main__.py
logs/controllers/__init__.py
logs/controllers/__init__.py
logs/controllers/default_controller.py
logs/controllers/default_controller.py
logs/controllers/security_controller_.py
logs/controllers/security_controller.py
logs/encoder.py
logs/encoder.py
logs/models/__init__.py
logs/models/__init__.py
logs/models/base_model_.py
logs/models/base_model.py
logs/models/interface_description.py
logs/models/interface_description.py
logs/models/invalid_param.py
logs/models/invalid_param.py
logs/models/invocation_log.py
logs/models/invocation_log.py
logs/models/invocation_logs.py
logs/models/invocation_logs_retrieve_res.py
logs/models/log.py
logs/models/log.py
logs/models/operation.py
logs/models/operation.py
logs/models/operation_any_of.py
logs/models/problem_details.py
logs/models/problem_details.py
logs/models/protocol.py
logs/models/protocol.py
logs/models/protocol_any_of.py
logs/models/security_method.py
logs/models/security_method.py
logs/models/security_method_any_of.py
logs/openapi/openapi.yaml
logs/openapi/openapi.yaml
logs/test/__init__.py
logs/test/__init__.py
logs/test/test_default_controller.py
logs/typing_utils.py
logs/typing_utils.py
logs/util.py
logs/util.py
requirements.txt
requirements.txt
+1 −1
Original line number Original line Diff line number Diff line
5.3.0-SNAPSHOT
7.5.0
 No newline at end of file
+1 −1
Original line number Original line Diff line number Diff line
@@ -15,7 +15,7 @@ To run the server, please execute the following from the root directory:


```
```
pip3 install -r requirements.txt
pip3 install -r requirements.txt
python3 -m logs
python3 -m openapi_server
```
```


and open your browser to here:
and open your browser to here:
+3 −3
Original line number Original line Diff line number Diff line
#!/bin/sh
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"


git_user_id=$1
git_user_id=$1
git_repo_id=$2
git_repo_id=$2
@@ -38,14 +38,14 @@ git add .
git commit -m "$release_note"
git commit -m "$release_note"


# Sets the new remote
# Sets the new remote
git_remote=`git remote`
git_remote=$(git remote)
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$git_remote" = "" ]; then # git remote not defined


    if [ "$GIT_TOKEN" = "" ]; then
    if [ "$GIT_TOKEN" = "" ]; then
        echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
        echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
        git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
        git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
    else
    else
        git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
        git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
    fi
    fi


fi
fi
+26 −6
Original line number Original line Diff line number Diff line
import connexion
from typing import Dict
from typing import Tuple
from typing import Union

from logs.models.interface_description import InterfaceDescription  # noqa: E501
from logs.models.invocation_logs_retrieve_res import InvocationLogsRetrieveRes  # noqa: E501
from logs.models.operation import Operation  # noqa: E501
from logs.models.problem_details import ProblemDetails  # noqa: E501
from logs.models.protocol import Protocol  # noqa: E501
from logs import util


from ..util import deserialize_datetime
from ..util import deserialize_datetime
from ..core.auditoperations import AuditOperations
from ..core.auditoperations import AuditOperations
@@ -23,7 +34,7 @@ def api_invocation_logs_get(aef_id=None, api_invoker_id=None, time_range_start=N
    :type time_range_end: str
    :type time_range_end: str
    :param api_id: String identifying the API invoked.
    :param api_id: String identifying the API invoked.
    :type api_id: str
    :type api_id: str
    :param api_name: API name, it is set as {apiName} part of the URI structure as defined in subclause 4.4 of 3GPP TS 29.501.
    :param api_name: API name, it is set as {apiName} part of the URI structure as defined in clause 5.2.4 of 3GPP TS 29.122. 
    :type api_name: str
    :type api_name: str
    :param api_version: Version of the API which was invoked.
    :param api_version: Version of the API which was invoked.
    :type api_version: str
    :type api_version: str
@@ -36,13 +47,13 @@ def api_invocation_logs_get(aef_id=None, api_invoker_id=None, time_range_start=N
    :param resource_name: Name of the specific resource invoked.
    :param resource_name: Name of the specific resource invoked.
    :type resource_name: str
    :type resource_name: str
    :param src_interface: Interface description of the API invoker.
    :param src_interface: Interface description of the API invoker.
    :type src_interface: str
    :type src_interface: dict | bytes
    :param dest_interface: Interface description of the API invoked.
    :param dest_interface: Interface description of the API invoked.
    :type dest_interface: str
    :type dest_interface: dict | bytes
    :param supported_features: To filter irrelevant responses related to unsupported features
    :param supported_features: To filter irrelevant responses related to unsupported features
    :type supported_features: str
    :type supported_features: str


    :rtype: InvocationLog
    :rtype: Union[InvocationLogsRetrieveRes, Tuple[InvocationLogsRetrieveRes, int], Tuple[InvocationLogsRetrieveRes, int, Dict[str, str]]
    """
    """


    current_app.logger.info("Audit logs")
    current_app.logger.info("Audit logs")
@@ -52,8 +63,17 @@ def api_invocation_logs_get(aef_id=None, api_invoker_id=None, time_range_start=N
                                 cause="Mandatory parameters missing", invalid_params=[
                                 cause="Mandatory parameters missing", invalid_params=[
                {"param": "aef_id or api_invoker_id", "reason": "missing"}])
                {"param": "aef_id or api_invoker_id", "reason": "missing"}])


    time_range_start = deserialize_datetime(time_range_start)

    time_range_end = deserialize_datetime(time_range_end)
    time_range_start = util.deserialize_datetime(time_range_start)
    time_range_end = util.deserialize_datetime(time_range_end)
    if connexion.request.is_json:
        protocol =  Protocol.from_dict(connexion.request.get_json())  # noqa: E501
    if connexion.request.is_json:
        operation =  Operation.from_dict(connexion.request.get_json())  # noqa: E501
    if connexion.request.is_json:
        src_interface =  InterfaceDescription.from_dict(connexion.request.get_json())  # noqa: E501
    if connexion.request.is_json:
        dest_interface =  InterfaceDescription.from_dict(connexion.request.get_json())  # noqa: E501


    query_params = {"aef_id": aef_id,
    query_params = {"aef_id": aef_id,
                    "api_invoker_id": api_invoker_id,
                    "api_invoker_id": api_invoker_id,
Loading