JIRA: BOTTLENECK-116
This patch fix the bug that bottlenecks project can't establish
dashboard, error message is elasticsearch is not install.
after install elasticsearch, the error message is can't get ip.
to fix this bug, change file requriment.txt and dashboard file.
Change-Id: Ibad0dc46ab44d500b799bbf67e169d76c59e7199
Signed-off-by: liyin <liyin11@huawei.com>
warlock==1.2.0
wrapt==1.10.6
pyroute2==0.4.10
warlock==1.2.0
wrapt==1.10.6
pyroute2==0.4.10
##############################################################################
import ConfigParser
from elasticsearch import Elasticsearch
##############################################################################
import ConfigParser
from elasticsearch import Elasticsearch
+from pyroute2 import IPDB
config = ConfigParser.ConfigParser()
config = ConfigParser.ConfigParser()
-file_str = "testcase_cfg/posca_factor_system_bandwidth.yaml"
+file_str = "/home/opnfv/bottlenecks/testsuites/posca/testcase_cfg/posca_factor_system_bandwidth.yaml"
with open(file_str, "rd") as cfgfile:
config.readfp(cfgfile)
ES_ip_a = config.get("config", "ES_ip")
with open(file_str, "rd") as cfgfile:
config.readfp(cfgfile)
ES_ip_a = config.get("config", "ES_ip")
+with IPDB() as ip:
+ GATEWAY_IP = ip.routes['default'].gateway
+ if ES_ip_a is "":
+ ES_ip_a = GATEWAY_IP+":9200"
+ print("ES_ip is null get local ip is %s" %(ES_ip_a))
+
es_ip = ES_ip_a.split(':')
es = Elasticsearch([{'host':es_ip[0]}])
doc={
es_ip = ES_ip_a.split(':')
es = Elasticsearch([{'host':es_ip[0]}])
doc={
}
res = es.index(index=".kibana",doc_type="index-pattern",id="bottlenecks",body=doc)
}
res = es.index(index=".kibana",doc_type="index-pattern",id="bottlenecks",body=doc)
+if res['created']=="True":
+ print("bottlenecks index-pattern has created")
+else:
+ print("bottlenecks index-pattern has existed")
"version": 1,
}
res = es.index(index=".kibana",doc_type="search",id="system_bandwidth",body=doc)
"version": 1,
}
res = es.index(index=".kibana",doc_type="search",id="system_bandwidth",body=doc)
+if res['created']=="True":
+ print("system_bandwidth search has created")
+else:
+ print("system_bandwidth search has existed")
doc = {
"title": "system_bandwidth_line-date",
doc = {
"title": "system_bandwidth_line-date",
}
res = es.index(
index=".kibana", doc_type="visualization", id="system_bandwidth_line-date", body=doc)
}
res = es.index(
index=".kibana", doc_type="visualization", id="system_bandwidth_line-date", body=doc)
+if res['created']=="True":
+ print("system_bandwidth_line-date visualization has created")
+else:
+ print("system_bandwidth_line-date visualization has existed")
doc = {
"title": "system_bandwidth_line-char",
doc = {
"title": "system_bandwidth_line-char",
res = es.index(
index=".kibana", doc_type="visualization", id="system_bandwidth_line-char", body=doc)
res = es.index(
index=".kibana", doc_type="visualization", id="system_bandwidth_line-char", body=doc)
+if res['created']=="True":
+ print("system_bandwidth_line-char visualization has created")
+else:
+ print("system_bandwidth_line-char visualization has existed")
doc = {
"title": "system_bandwidth_terms_data",
doc = {
"title": "system_bandwidth_terms_data",
res = es.index(
index=".kibana", doc_type="visualization", id="system_bandwidth_terms_data", body=doc)
res = es.index(
index=".kibana", doc_type="visualization", id="system_bandwidth_terms_data", body=doc)
+if res['created']=="True":
+ print("system_bandwidth_terms_data visualization has created")
+else:
+ print("system_bandwidth_terms_data visualization has existed")
doc = {
"title": "system_bandwidth_dashboard",
doc = {
"title": "system_bandwidth_dashboard",
res = es.index(
index=".kibana", doc_type="dashboard", id="system_bandwidth_dashboard", body=doc)
res = es.index(
index=".kibana", doc_type="dashboard", id="system_bandwidth_dashboard", body=doc)
+if res['created']=="True":
+ print("system_bandwidth dashboard has created")
+else:
+ print("system_bandwidth dashboard has existed")
cmd = '/home/opnfv/bottlenecks/testsuites/posca/testcase_dashboard/\
system_bandwidth.py'
pargs = [INTERPRETER, cmd]
cmd = '/home/opnfv/bottlenecks/testsuites/posca/testcase_dashboard/\
system_bandwidth.py'
pargs = [INTERPRETER, cmd]
- print("Begin to establish dashboard, False means already exist.\n")
+ print("\nBegin to establish dashboard.")
sub_result = subprocess.Popen(pargs)
sub_result.wait()
print("System Bandwidth testing time : %s" %(endtime - starttime))
sub_result = subprocess.Popen(pargs)
sub_result.wait()
print("System Bandwidth testing time : %s" %(endtime - starttime))