Add API and command support for yardstick env prepare
[yardstick.git] / yardstick / cmd / commands / env.py
1 ##############################################################################
2 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
3 #
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
8 ##############################################################################
9 import logging
10
11 from yardstick.common.httpClient import HttpClient
12 from yardstick.common import constants
13
14 logger = logging.getLogger(__name__)
15 logger.setLevel(logging.DEBUG)
16
17
18 class EnvCommand(object):
19     '''
20
21         Set of commands to prepare environment
22     '''
23     def do_influxdb(self, args):
24         url = constants.YARDSTICK_ENV_ACTION_API
25         data = {'action': 'createInfluxDBContainer'}
26         HttpClient().post(url, data)
27         logger.debug('Now creating and configing influxdb')
28
29     def do_grafana(self, args):
30         url = constants.YARDSTICK_ENV_ACTION_API
31         data = {'action': 'createGrafanaContainer'}
32         HttpClient().post(url, data)
33         logger.debug('Now creating and configing grafana')
34
35     def do_prepare(self, args):
36         url = constants.YARDSTICK_ENV_ACTION_API
37         data = {'action': 'prepareYardstickEnv'}
38         HttpClient().post(url, data)
39         logger.debug('Now preparing environment')