ap-auto: Add influxdb support.

And tweak base class to be a bit more friendly about
reporting on what the influxdb code is doing or not.

Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
Ben Greear
2021-04-18 15:33:50 -07:00
parent 582a23ecf4
commit 84f0c79f02
3 changed files with 35 additions and 9 deletions

View File

@@ -18,6 +18,12 @@ def cv_base_adjust_parser(args):
# TODO: In future, can use TestRig once that GUI update has propagated # TODO: In future, can use TestRig once that GUI update has propagated
args.set.append(["Test Rig ID:", args.test_rig]) args.set.append(["Test Rig ID:", args.test_rig])
if args.influx_host != "":
if (not args.pull_report):
print("Specified influx host without pull_report, will enabled pull_request.")
args.pull_report = True
def cv_add_base_parser(parser): def cv_add_base_parser(parser):
parser.add_argument("-m", "--mgr", type=str, default="localhost", parser.add_argument("-m", "--mgr", type=str, default="localhost",
help="address of the LANforge GUI machine (localhost is default)") help="address of the LANforge GUI machine (localhost is default)")
@@ -349,12 +355,15 @@ class cv_test(Realm):
def check_influx_kpi(self, args): def check_influx_kpi(self, args):
if self.report_dir == "": if self.report_dir == "":
# Nothing to report on. # Nothing to report on.
print("Not submitting to influx, no report-dir.\n")
return return
if args.influx_host == "": if args.influx_host == "":
# No influx configured, return. # No influx configured, return.
print("Not submitting to influx, influx_host not configured.\n")
return return
print("Creating influxdb connection.\n")
# lfjson_host would be if we are reading out of LANforge or some other REST # lfjson_host would be if we are reading out of LANforge or some other REST
# source, which we are not. So dummy those out. # source, which we are not. So dummy those out.
influxdb = RecordInflux(_lfjson_host = "", influxdb = RecordInflux(_lfjson_host = "",
@@ -365,7 +374,12 @@ class cv_test(Realm):
_influx_token = args.influx_token, _influx_token = args.influx_token,
_influx_bucket = args.influx_bucket) _influx_bucket = args.influx_bucket)
path = "%s/kpi.csv"%(self.report_dir)
print("Attempt to submit kpi: ", path)
csvtoinflux = CSVtoInflux(influxdb = influxdb, csvtoinflux = CSVtoInflux(influxdb = influxdb,
target_csv = "%s/kpi.csv"%(self.report_dir), target_csv = path,
_influx_tag = args.influx_tag) _influx_tag = args.influx_tag)
print("Posting to influx...\n")
csvtoinflux.post_to_influx() csvtoinflux.post_to_influx()
print("All done posting to influx.\n")

View File

@@ -23,7 +23,11 @@ the options and how best to input data.
--set 'Skip 2.4Ghz Tests' 1 --set 'Skip 5Ghz Tests' 1 \ --set 'Skip 2.4Ghz Tests' 1 --set 'Skip 5Ghz Tests' 1 \
--set 'Throughput vs Pkt Size' 0 --set 'Capacity' 0 --set 'Stability' 0 --set 'Band-Steering' 0 \ --set 'Throughput vs Pkt Size' 0 --set 'Capacity' 0 --set 'Stability' 0 --set 'Band-Steering' 0 \
--set 'Multi-Station Throughput vs Pkt Size' 0 --set 'Long-Term' 0 \ --set 'Multi-Station Throughput vs Pkt Size' 0 --set 'Long-Term' 0 \
--test_bed Testbed-01 --test_rig Testbed-01 --pull_report \
--influx_host c7-graphana --influx_port 8086 --influx_org Candela \
--influx_token=-u_Wd-L8o992701QF0c5UmqEp7w7Z7YOMaWLxOMgmHfATJGnQbbmYyNxHBR9PgD6taM_tcxqJl6U8DjU1xINFQ== \
--influx_bucket ben \
--influx_tag testbed Ferndale-01
Note: Note:
--enable [option] will attempt to select any checkbox of that name to true. --enable [option] will attempt to select any checkbox of that name to true.
@@ -303,7 +307,11 @@ def main():
--set 'Skip 2.4Ghz Tests' 1 --set 'Skip 5Ghz Tests' 1 \ --set 'Skip 2.4Ghz Tests' 1 --set 'Skip 5Ghz Tests' 1 \
--set 'Throughput vs Pkt Size' 0 --set 'Capacity' 0 --set 'Stability' 0 --set 'Band-Steering' 0 \ --set 'Throughput vs Pkt Size' 0 --set 'Capacity' 0 --set 'Stability' 0 --set 'Band-Steering' 0 \
--set 'Multi-Station Throughput vs Pkt Size' 0 --set 'Long-Term' 0 \ --set 'Multi-Station Throughput vs Pkt Size' 0 --set 'Long-Term' 0 \
--test_rig Testbed-01 --test_rig Testbed-01 --pull_report \
--influx_host c7-graphana --influx_port 8086 --influx_org Candela \
--influx_token=-u_Wd-L8o992701QF0c5UmqEp7w7Z7YOMaWLxOMgmHfATJGnQbbmYyNxHBR9PgD6taM_tcxqJl6U8DjU1xINFQ== \
--influx_bucket ben \
--influx_tag testbed Ferndale-01
""" """
) )
cv_add_base_parser(parser) # see cv_test_manager.py cv_add_base_parser(parser) # see cv_test_manager.py
@@ -356,6 +364,7 @@ def main():
CV_Test.setup() CV_Test.setup()
CV_Test.run() CV_Test.run()
CV_Test.check_influx_kpi(args)
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@@ -12,17 +12,16 @@ Note: This is a test file which will run a wifi capacity test.
The influx part can be skipped if you are not using influx/graphana. The influx part can be skipped if you are not using influx/graphana.
./lf_wifi_capacity_test.py --mgr localhost --port 8080 --lf_user lanforge --lf_password lanforge \ ./lf_wifi_capacity_test.py --mgr localhost --port 8080 --lf_user lanforge --lf_password lanforge \
--instance_name this_inst --config_name test_con --upstream 1.1.eth1 --batch_size 1 --loop_iter 1 \ --instance_name this_inst --config_name test_con --upstream 1.1.eth2 --batch_size 1,5,25,50,100 --loop_iter 1 \
--protocol UDP-IPv4 --duration 6000 --pull_report --stations 1.1.sta0000,1.1.sta0002 \ --protocol UDP-IPv4 --duration 6000 --pull_report \
--test_rig Testbed-01 \ --test_rig Testbed-01 \
--influx_host c7-graphana --influx_port 8086 --influx_org Candela \ --influx_host c7-graphana --influx_port 8086 --influx_org Candela \
--influx_token=-u_Wd-L8o992701QF0c5UmqEp7w7Z7YOMaWLxOMgmHfATJGnQbbmYyNxHBR9PgD6taM_tcxqJl6U8DjU1xINFQ== \ --influx_token=-u_Wd-L8o992701QF0c5UmqEp7w7Z7YOMaWLxOMgmHfATJGnQbbmYyNxHBR9PgD6taM_tcxqJl6U8DjU1xINFQ== \
--influx_bucket ben --rates_are_totals --side_a_min_bps=20000 --side_b_min_bps=300000000 \ --influx_bucket ben --influx_tag testbed Ferndale-01
--influx_tag testbed Ferndale-01
ex. on how to run this script (to create new stations): ex. on how to run this script (to create new stations):
./lf_wifi_capacity_test.py --mgr localhost --port 8080 --lf_user lanforge --lf_password lanforge \ ./lf_wifi_capacity_test.py --mgr localhost --port 8080 --lf_user lanforge --lf_password lanforge \
--instance_name wct_instance --config_name wifi_config --upstream 1.1.eth1 --batch_size 1 --loop_iter 1 \ --instance_name wct_instance --config_name wifi_config --upstream 1.1.eth1 --batch_size 1,5,25 --loop_iter 1 \
--protocol UDP-IPv4 --duration 6000 --pull_report --stations 1.1.sta0000,1.1.sta0001 \ --protocol UDP-IPv4 --duration 6000 --pull_report --stations 1.1.sta0000,1.1.sta0001 \
--create_stations --radio wiphy0 --ssid test-ssid --security open --paswd [BLANK] \ --create_stations --radio wiphy0 --ssid test-ssid --security open --paswd [BLANK] \
--test_rig Testbed-01 --test_rig Testbed-01
@@ -468,7 +467,11 @@ def main():
--instance_name wct_instance --config_name wifi_config --upstream 1.1.eth1 --batch_size 1 --loop_iter 1 \ --instance_name wct_instance --config_name wifi_config --upstream 1.1.eth1 --batch_size 1 --loop_iter 1 \
--protocol UDP-IPv4 --duration 6000 --pull_report --stations 1.1.sta0000,1.1.sta0001 \ --protocol UDP-IPv4 --duration 6000 --pull_report --stations 1.1.sta0000,1.1.sta0001 \
--create_stations --radio wiphy0 --ssid test-ssid --security open --paswd [BLANK] \ --create_stations --radio wiphy0 --ssid test-ssid --security open --paswd [BLANK] \
--test_rig Testbed-01 --test_rig Testbed-01 \
--influx_host c7-graphana --influx_port 8086 --influx_org Candela \
--influx_token=-u_Wd-L8o992701QF0c5UmqEp7w7Z7YOMaWLxOMgmHfATJGnQbbmYyNxHBR9PgD6taM_tcxqJl6U8DjU1xINFQ== \
--influx_bucket ben \
--influx_tag testbed Ferndale-01
""") """)
cv_add_base_parser(parser) # see cv_test_manager.py cv_add_base_parser(parser) # see cv_test_manager.py