7c894b88aede2a50426ce0f059152fb9f629f8a4
[bottlenecks.git] / testsuites / posca / testcase_dashboard / posca_vnf_scale_out.py
1 #!/usr/bin/python
2 ##############################################################################
3 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 import ConfigParser
11 from elasticsearch import Elasticsearch
12 import os
13 import utils.logger as log
14 from utils.parser import Parser as conf_parser
15
16 LOG = log.Logger(__name__).getLogger()
17 config = ConfigParser.ConfigParser()
18 es = Elasticsearch()
19 dashboard_path = os.path.join(conf_parser.test_dir,
20                               "posca",
21                               "testcase_dashboard")
22 dashboard_dir = dashboard_path + "/"
23
24
25 def dashboard_send_data(runner_config, test_data):
26     global es
27     # es_ip = runner_config['dashboard_ip'].split(':')
28     es = Elasticsearch([{'host': "172.17.0.5"}])
29     for i in test_data:
30         res = es.index(index="bottlenecks",
31                        doc_type="vnf_scale_out",
32                        body=i)
33         if res['created'] == "False":
34             LOG.error("date send to kibana have errors ",
35                       test_data["data_body"])