From 49c1df2cb00dce118c02b381cc8b82761b44871e Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Sun, 9 May 2021 14:08:05 -0700 Subject: [PATCH] cv-dut: Improve options to configure DUT. And stop hard-coding the DUT position. Add start of ferndale ucentral testbed end-to-end example test script. Signed-off-by: Ben Greear --- py-json/cv_dut_profile.py | 21 ++++++--- py-scripts/create_chamberview_dut.py | 31 +++++++++---- py-scripts/cv_examples/ferndale_ucentral.bash | 46 +++++++++++++++++++ 3 files changed, 81 insertions(+), 17 deletions(-) create mode 100755 py-scripts/cv_examples/ferndale_ucentral.bash diff --git a/py-json/cv_dut_profile.py b/py-json/cv_dut_profile.py index e0aa0f39..0d991889 100644 --- a/py-json/cv_dut_profile.py +++ b/py-json/cv_dut_profile.py @@ -9,15 +9,19 @@ class cv_dut(LFCliBase): def __init__(self, lfclient_host="localhost", lfclient_port=8080, + sw_version="NA", + hw_version="NA", + serial_num="NA", + model_num="NA", ): super().__init__(_lfjson_host=lfclient_host, _lfjson_port=lfclient_port) self.cv_dut_name = "DUT" self.flags = "4098" - self.sw_version = "[BLANK]" - self.hw_version = "[BLANK]" - self.model_num = "[BLANK]" - self.serial_num = "[BLANK]" + self.sw_version = sw_version + self.hw_version = hw_version + self.model_num = model_num + self.serial_num = serial_num self.serial_port = "[BLANK]" self.wan_port = "[BLANK]" self.lan_port = "[BLANK]" @@ -35,7 +39,10 @@ class cv_dut(LFCliBase): bssid2="00:00:00:00:00:00", bssid3="00:00:00:00:00:00", mgt_ip="0.0.0.0", - eap_id="[BLANK]"): + eap_id="[BLANK]", + top_left_x="NA", + top_left_y="NA", + ): response_json = [] req_url = "/cli-json/add_dut" data = { @@ -64,8 +71,8 @@ class cv_dut(LFCliBase): "bssid1": bssid1, "bssid2": bssid2, "bssid3": bssid3, - "top_left_x": "0", - "top_left_y": "0", + "top_left_x": top_left_x, + "top_left_y": top_left_y, "eap_id": eap_id, } rsp = self.json_post(req_url, data, debug_=False, response_json_list_=response_json) diff --git a/py-scripts/create_chamberview_dut.py b/py-scripts/create_chamberview_dut.py index dd754f44..72e8fd6e 100755 --- a/py-scripts/create_chamberview_dut.py +++ b/py-scripts/create_chamberview_dut.py @@ -68,21 +68,23 @@ class DUT(dut): port="8080", dut_name="DUT", ssid=[], - password=[], - bssid=[], - security=[] + sw_version="NA", + hw_version="NA", + serial_num="NA", + model_num="NA", ): super().__init__( lfclient_host=lfmgr, lfclient_port=port, + sw_version=sw_version, + hw_version=hw_version, + serial_num=serial_num, + model_num=model_num, ) self.cv_dut_name = dut_name self.cv_test = cvtest(lfmgr, port) self.dut_name = dut_name self.ssid = ssid - self.password = password - self.bssid = bssid - self.security = security def setup(self): self.create_dut() @@ -150,11 +152,20 @@ def main(): parser.add_argument("-s", "--ssid", action='append', nargs=1, help="SSID", default=[]) + parser.add_argument("--sw_version", default="NA", help="DUT Software version.") + parser.add_argument("--hw_version", default="NA", help="DUT Hardware version.") + parser.add_argument("--serial_num", default="NA", help="DUT Serial number.") + parser.add_argument("--model_num", default="NA", help="DUT Model Number.") + args = parser.parse_args() - new_dut = DUT(args.lfmgr, - args.port, - args.dut_name, - args.ssid, + new_dut = DUT(lfmgr=args.lfmgr, + port=args.port, + dut_name=args.dut_name, + ssid=args.ssid, + sw_version = args.sw_version, + hw_version = args.hw_version, + serial_num = args.serial_num, + model_num = args.model_num, ) new_dut.setup() diff --git a/py-scripts/cv_examples/ferndale_ucentral.bash b/py-scripts/cv_examples/ferndale_ucentral.bash new file mode 100755 index 00000000..b24edec9 --- /dev/null +++ b/py-scripts/cv_examples/ferndale_ucentral.bash @@ -0,0 +1,46 @@ +#!/bin/bash + +# This bash script creates/updates a DUT, creates/updates a chamberview scenario, +# loads and builds that scenario, runs wifi capacity test, and saves the kpi.csv info +# into influxdb. As final step, it builds a grafana dashboard for the KPI information. + +# Define some common variables. This will need to be changed to match your own testbed. +# LANforge GUI machine +#MGR=192.168.100.209 +MGR=localhost +INFLUXTOKEN=-u_Wd-L8o992701QF0c5UmqEp7w7Z7YOMaWLxOMgmHfATJGnQbbmYyNxHBR9PgD6taM_tcxqJl6U8DjU1xINFQ== +TESTBED=Ferndale-01 +GRAFANATOKEN=eyJrIjoiVXVyZ0dQSXlNdGlQNGQ1R282S2p6SE1PZXJVOVpvM1UiLCJuIjoiYmVuLWdyYWZhbmEiLCJpZCI6MX0= +GROUPS=/tmp/lf_cv_rpt_filelocation.txt +DUT=linksys-8450 + +# Create/update new DUT. +#Replace my arguments with your setup. Separate your ssid arguments with spaces and ensure the names are lowercase +echo "Make new DUT" +./create_chamberview_dut.py --lfmgr ${MGR} --dut_name ${DUT} \ + --ssid "ssid_idx=0 ssid=Default-SSID-2g security=WPA2 password=12345678 bssid=c4:41:1e:f5:3f:24" \ + --ssid "ssid_idx=1 ssid=Default-SSID-5gl security=WPA2 password=12345678 bssid=c4:41:1e:f5:3f:25" \ + --sw_version "ucentral-01" --hw_version ea8450 --serial_num 1001 --model_num 8450 + +exit 0 + +# Create/update chamber view scenario and apply and build it. +echo "Build Chamber View Scenario" +#change the lfmgr to your system, set the radio to a working radio on your LANforge system, same with the ethernet port. +./create_chamberview.py --lfmgr ${MGR} --create_scenario DUT_TO_GRAFANA_SCENARIO \ +--line "Resource=1.1 Profile=default Amount=32 Uses-1=wiphy1 DUT=DUT_TO_GRAFANA_DUT Traffic=wiphy1 Freq=-1" \ +--line "Resource=1.1 Profile=upstream Amount=1 Uses-1=eth1 DUT=DUT_TO_GRAFANA_DUT Traffic=eth1 Freq=-1" + +# Run capacity test on the stations created by the chamber view scenario. +# Submit the KPI data into the influxdb. +#config_name doesn't matter, change the influx_host to your LANforge device, +echo "run wifi capacity test" +./lf_wifi_capacity_test.py --config_name Custom --create_stations --radio wiphy1 --pull_report --influx_host ${MGR} \ +--influx_port 8086 --influx_org Candela --influx_token ${INFLUXTOKEN} --influx_bucket lanforge --mgr ${MGR} \ +--instance_name testing --upstream eth1 --test_rig ${TESTBED} --graphgroups ${GROUPS} + +# Build grafana dashboard and graphs view for the KPI in the capacity test. +./grafana_profile.py --create_custom --title ${TESTBED} --influx_bucket lanforge --mgr 192.168.1.7 --grafana_token ${GRAFANATOKEN} \ +--grafana_host 192.168.1.7 --testbed ${TESTBED} --graph-groups ${GROUPS} --scripts Dataplane --scripts 'WiFi Capacity' + +rm ${GROUPS}