mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 11:48:03 +00:00
cv-capacity: Support importing kpi.csv directly into influxdb
And update example command to what works for me on the c7-graphana instance. Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
import sys
|
||||
import os
|
||||
from pprint import pprint
|
||||
from influx2 import RecordInflux
|
||||
|
||||
if sys.version_info[0] != 3:
|
||||
print("This script requires Python 3")
|
||||
@@ -21,6 +22,15 @@ import argparse
|
||||
from realm import Realm
|
||||
import datetime
|
||||
|
||||
def influx_add_parser_args(parser):
|
||||
parser.add_argument('--influx_host', help='Hostname for the Influx database', default="")
|
||||
parser.add_argument('--influx_port', help='IP Port for the Influx database', default=8086)
|
||||
parser.add_argument('--influx_org', help='Organization for the Influx database', default="")
|
||||
parser.add_argument('--influx_token', help='Token for the Influx database', default="")
|
||||
parser.add_argument('--influx_bucket', help='Name of the Influx bucket', default="")
|
||||
parser.add_argument('--influx_tag', action='append', nargs=2,
|
||||
help='--influx_tag <key> <val> Can add more than one of these.', default=[])
|
||||
|
||||
|
||||
class CSVtoInflux(Realm):
|
||||
def __init__(self,
|
||||
@@ -125,27 +135,21 @@ python3 csv_to_influx.py --influx_host localhost --influx_org Candela --influx_t
|
||||
|
||||
''')
|
||||
|
||||
parser.add_argument('--influx_host', help='Hostname for the Influx database')
|
||||
parser.add_argument('--influx_port', help='IP Port for the Influx database', default=8086)
|
||||
parser.add_argument('--influx_org', help='Organization for the Influx database')
|
||||
parser.add_argument('--influx_token', help='Token for the Influx database')
|
||||
parser.add_argument('--influx_bucket', help='Name of the Influx bucket')
|
||||
parser.add_argument('--target_csv', help='CSV file to record to influx database', required=True)
|
||||
parser.add_argument('--influx_tag', action='append', nargs=2,
|
||||
help='--influx_tag <key> <val> Can add more than one of these.', default=[])
|
||||
influx_add_parser_args(parser)
|
||||
|
||||
# This argument is specific to this script, so not part of the generic influxdb parser args
|
||||
# method above.
|
||||
parser.add_argument('--target_csv', help='CSV file to record to influx database', default="")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
influxdb = None
|
||||
if args.influx_bucket is not None:
|
||||
from influx2 import RecordInflux
|
||||
influxdb = RecordInflux(_lfjson_host=lfjson_host,
|
||||
_lfjson_port=lfjson_port,
|
||||
_influx_host=args.influx_host,
|
||||
_influx_port=args.influx_port,
|
||||
_influx_org=args.influx_org,
|
||||
_influx_token=args.influx_token,
|
||||
_influx_bucket=args.influx_bucket)
|
||||
influxdb = RecordInflux(_lfjson_host=lfjson_host,
|
||||
_lfjson_port=lfjson_port,
|
||||
_influx_host=args.influx_host,
|
||||
_influx_port=args.influx_port,
|
||||
_influx_org=args.influx_org,
|
||||
_influx_token=args.influx_token,
|
||||
_influx_bucket=args.influx_bucket)
|
||||
|
||||
csvtoinflux = CSVtoInflux(influxdb=influxdb,
|
||||
target_csv=args.target_csv,
|
||||
|
||||
@@ -9,10 +9,16 @@ Note: To Run this script gui should be opened with
|
||||
|
||||
Note: This is a test file which will run a wifi capacity test.
|
||||
ex. on how to run this script (if stations are available in lanforge):
|
||||
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 \
|
||||
--instance_name this_inst --config_name test_con --upstream 1.1.eth1 --batch_size 1 --loop_iter 1 \
|
||||
--protocol UDP-IPv4 --duration 6000 --pull_report --stations 1.1.sta0000,1.1.sta0002 \
|
||||
--test_rig Testbed-01
|
||||
--instance_name this_inst --config_name test_con --upstream 1.1.eth1 --batch_size 1 --loop_iter 1 \
|
||||
--protocol UDP-IPv4 --duration 6000 --pull_report --stations 1.1.sta0000,1.1.sta0002 \
|
||||
--test_rig Testbed-01 \
|
||||
--influx_host c7-graphana --influx_port 8086 --influx_org Candela \
|
||||
--influx_token=-u_Wd-L8o992701QF0c5UmqEp7w7Z7YOMaWLxOMgmHfATJGnQbbmYyNxHBR9PgD6taM_tcxqJl6U8DjU1xINFQ== \
|
||||
--influx_bucket ben --rates_are_totals --side_a_min_bps=20000 --side_b_min_bps=300000000 \
|
||||
--influx_tag testbed Ferndale-01
|
||||
|
||||
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 \
|
||||
@@ -21,6 +27,7 @@ Note: This is a test file which will run a wifi capacity test.
|
||||
--create_stations --radio wiphy0 --ssid test-ssid --security open --paswd [BLANK] \
|
||||
--test_rig Testbed-01
|
||||
|
||||
|
||||
Note:
|
||||
--pull_report == If specified, this will pull reports from lanforge to your code directory,
|
||||
from where you are running this code
|
||||
@@ -529,6 +536,8 @@ def main():
|
||||
WFC_Test.setup()
|
||||
WFC_Test.run()
|
||||
|
||||
WFC_Test.check_influx_kpi(args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
import sys
|
||||
import os
|
||||
from pprint import pprint
|
||||
from csv_to_influx import *
|
||||
|
||||
if sys.version_info[0] != 3:
|
||||
print("This script requires Python 3")
|
||||
@@ -1095,13 +1096,7 @@ python3 test_l3_longevity.py --cisco_ctlr 192.168.100.112 --cisco_dfs True --mgr
|
||||
parser.add_argument('--attenuators', help='--attenuators, comma separated list of attenuator module eids: shelf.resource.atten-serno.atten-idx', default="")
|
||||
parser.add_argument('--atten_vals', help='--atten_vals, comma separated list of attenuator settings in ddb units (1/10 of db)', default="")
|
||||
|
||||
parser.add_argument('--influx_host', help='Hostname for the Influx database')
|
||||
parser.add_argument('--influx_port', help='IP Port for the Influx database', default=8086)
|
||||
parser.add_argument('--influx_org', help='Organization for the Influx database')
|
||||
parser.add_argument('--influx_token', help='Token for the Influx database')
|
||||
parser.add_argument('--influx_bucket', help='Name of the Influx bucket')
|
||||
parser.add_argument('--influx_tag', action='append', nargs=2, help='--influx_tag <key> <val> Can add more than one of these.')
|
||||
|
||||
influx_add_parser_args(parser)
|
||||
|
||||
parser.add_argument("--cap_ctl_out", help="--cap_ctl_out, switch the cisco controller output will be captured", action='store_true')
|
||||
parser.add_argument("--wait", help="--wait <time> , time to wait at the end of the test", default='0')
|
||||
|
||||
Reference in New Issue
Block a user