aboutsummaryrefslogtreecommitdiffstats
path: root/docs/com/img/Functest-CI.png
diff options
context:
space:
mode:
authorCiprian Barbu <ciprian.barbu@enea.com>2016-07-25 14:43:00 +0300
committerJose Lausuch <jose.lausuch@ericsson.com>2016-07-28 11:28:28 +0000
commit748b183ff97ad7ad259a76dcef348a7b2c2fc00a (patch)
treef3ac2a7f83632cfd455bf737cb5ff03923dbc621 /docs/com/img/Functest-CI.png
parenteee36c744f0c40b1da7009a24784142f4e8b6ba5 (diff)
Add configure options for healthcheck
The healthcheck tier used hard-coded x86 image for testing glance and nova. This breaks functest for ARM based pods, because x86 instances cannot run on ARM and even more, if healthcheck fails no other testcases are executed. Change-Id: I8a4cc754569a26d98bff57470574ed28eebbf2da Signed-off-by: Ciprian Barbu <ciprian.barbu@enea.com>
Diffstat (limited to 'docs/com/img/Functest-CI.png')
0 files changed, 0 insertions, 0 deletions
0 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#!/usr/bin/env python

# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0

"""
The base class to dispatch request

"""

import logging

from flask import request
from flask_restful import Resource

from functest.api.common import api_utils


LOGGER = logging.getLogger(__name__)


class ApiResource(Resource):
    """ API Resource class"""

    def __init__(self):
        super(ApiResource, self).__init__()

    def _post_args(self):  # pylint: disable=no-self-use
        # pylint: disable=maybe-no-member
        """ Return action and args after parsing request """

        data = request.json if request.json else {}
        params = api_utils.change_to_str_in_dict(data)
        action = params.get('action', request.form.get('action', ''))
        args = params.get('args', {})
        try:
            args['file'] = request.files['file']
        except KeyError:
            pass
        LOGGER.debug('Input args are: action: %s, args: %s', action, args)

        return action, args

    def _get_args(self):  # pylint: disable=no-self-use
        """ Convert the unicode to string for request.args """
        args = api_utils.change_to_str_in_dict(request.args)
        return args

    def _dispatch_post(self):
        """ Dispatch request """
        action, args = self._post_args()
        return self._dispatch(args, action)

    def _dispatch(self, args, action):
        """
        Dynamically load the classes with reflection and
        obtain corresponding methods
        """
        try:
            return getattr(self, action)(args)
        except AttributeError:
            api_utils.result_handler(status=1, data='No such action')


# Import modules from package "functest.api.resources"
# and append them into sys.modules
api_utils.import_modules_from_package("functest.api.resources")