lf_dataplane_test.py : added influx config read from json

lf_influx_db.json : sample file - may need a place for sample files

The influx db configuration can be read from a passed in json file
--influx_json <file.json> , there is not error checking
on if the parameters are entered correctly.

Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
Chuck SmileyRekiere
2021-06-20 09:55:55 -06:00
parent 137471ef0a
commit e7b1a639c8
2 changed files with 34 additions and 1 deletions

View File

@@ -285,6 +285,7 @@ def main():
cv_add_base_parser(parser) # see cv_test_manager.py
parser.add_argument('--json', help="--json <config.json> json input file", default="")
parser.add_argument('--influx_json', help="--influx_json <influx_config.json> influx config json input file", default="")
parser.add_argument("-u", "--upstream", type=str, default="",
help="Upstream port for wifi capacity test ex. 1.1.eth2")
parser.add_argument("--station", type=str, default="",
@@ -311,7 +312,6 @@ def main():
except:
print("Error reading {}".format(args.json))
# json configuation takes presidence to command line
# TODO see if there is easier way to search presence, look at parser args
if "mgr" in json_data:
args.mgr = json_data["mgr"]
if "port" in json_data:
@@ -344,6 +344,27 @@ def main():
json_data_tmp = [[x] for x in json_data["raw_line"]]
args.raw_line = json_data_tmp
# use influx json config file
if args.influx_json != "":
try:
with open(args.influx_json, 'r') as influx_json_config:
influx_json_data = json.load(influx_json_config)
except:
print("Error reading {}".format(args.influx_json))
# json configuation takes presidence to command line
# influx DB configuration
if "influx_host" in influx_json_data:
args.influx_host = influx_json_data["influx_host"]
if "influx_port" in influx_json_data:
args.influx_port = influx_json_data["influx_port"]
if "influx_org" in influx_json_data:
args.influx_org = influx_json_data["influx_org"]
if "influx_token" in influx_json_data:
args.influx_token = influx_json_data["influx_token"]
if "influx_bucket" in influx_json_data:
args.influx_bucket = influx_json_data["influx_bucket"]
cv_base_adjust_parser(args)
CV_Test = DataplaneTest(lf_host = args.mgr,

View File

@@ -0,0 +1,12 @@
{
"influx_host":"192.168.100.201",
"influx_port": "8086",
"influx_org": "Candela",
"influx_token": "-u_Wd-L8o992701QF0c5UmqEp7w7Z7YOMaWLxOMgmHfATJGnQbbmYyNxHBR9PgD6taM_tcxqJl6U8DjU1xINFQ==",
"influx_bucket": "ben",
"influx_tag": "testbed Ferndale-01"
}