3 # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
10 Resources to handle environment related requests
13 from flask import jsonify
15 from functest.api.base import ApiResource
16 from functest.cli.commands.cli_env import Env
17 import functest.utils.functest_utils as ft_utils
20 class V1Envs(ApiResource):
21 """ V1Envs Resource class"""
23 def get(self): # pylint: disable=no-self-use
24 """ Get environment """
25 environment_show = Env().show()
26 return jsonify(environment_show)
29 """ Used to handle post request """
30 return self._dispatch_post()
32 def prepare(self, args): # pylint: disable=no-self-use, unused-argument
33 """ Prepare environment """
34 ft_utils.execute_command("prepare_env start")