mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-31 10:48:02 +00:00 
			
		
		
		
	run dataplane_to_grafana from remote machine
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
		| @@ -336,9 +336,10 @@ class cv_test(Realm): | |||||||
|                 location = location.replace('\"Report Location:::', '') |                 location = location.replace('\"Report Location:::', '') | ||||||
|                 location = location.replace('\"', '') |                 location = location.replace('\"', '') | ||||||
|                 report = lf_rpt() |                 report = lf_rpt() | ||||||
|                 if graphgroupsfile: |                 print(graphgroupsfile) | ||||||
|                     filelocation=open(graphgroupsfile, 'w') |                 if graphgroupsfile is not None: | ||||||
|                     filelocation.write(location) |                     filelocation = open(graphgroupsfile, 'a') | ||||||
|  |                     filelocation.write(location + '/kpi.csv\n') | ||||||
|                     filelocation.close() |                     filelocation.close() | ||||||
|                 print(location) |                 print(location) | ||||||
|                 self.report_dir = location |                 self.report_dir = location | ||||||
| @@ -347,8 +348,9 @@ class cv_test(Realm): | |||||||
|                         print(lf_host) |                         print(lf_host) | ||||||
|                         report.pull_reports(hostname=lf_host, username=lf_user, password=lf_password, |                         report.pull_reports(hostname=lf_host, username=lf_user, password=lf_password, | ||||||
|                                             report_location=location) |                                             report_location=location) | ||||||
|                 except: |                 except Exception as e: | ||||||
|                     raise Exception("Could not find Reports") |                     print("SCP failed, user %s, password %s, dest %s", (lf_user, lf_password, lf_host)) | ||||||
|  |                     raise e#Exception("Could not find Reports") | ||||||
|                 break |                 break | ||||||
|  |  | ||||||
|             # Of if test stopped for some reason and could not generate report. |             # Of if test stopped for some reason and could not generate report. | ||||||
| @@ -372,7 +374,6 @@ class cv_test(Realm): | |||||||
|             else: |             else: | ||||||
|                 break |                 break | ||||||
|  |  | ||||||
|  |  | ||||||
|     # Takes cmd-line args struct or something that looks like it. |     # Takes cmd-line args struct or something that looks like it. | ||||||
|     # See csv_to_influx.py::influx_add_parser_args for options, or --help. |     # See csv_to_influx.py::influx_add_parser_args for options, or --help. | ||||||
|     def check_influx_kpi(self, args): |     def check_influx_kpi(self, args): | ||||||
| @@ -389,19 +390,20 @@ class cv_test(Realm): | |||||||
|         print("Creating influxdb connection.\n") |         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="", | ||||||
|                                 _lfjson_port = "", |                                 _lfjson_port="", | ||||||
|                                 _influx_host = args.influx_host, |                                 _influx_host=args.influx_host, | ||||||
|                                 _influx_port = args.influx_port, |                                 _influx_port=args.influx_port, | ||||||
|                                 _influx_org = args.influx_org, |                                 _influx_org=args.influx_org, | ||||||
|                                 _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) | ||||||
|  |  | ||||||
|         path = "%s/kpi.csv"%(self.report_dir) |  | ||||||
|         print("Attempt to submit kpi: ", path) |         print("Attempt to submit kpi: ", path) | ||||||
|         csvtoinflux = CSVtoInflux(influxdb = influxdb, |         csvtoinflux = CSVtoInflux(influxdb=influxdb, | ||||||
|                                   target_csv = path, |                                   target_csv=path, | ||||||
|                                   _influx_tag = args.influx_tag) |                                   _influx_tag=args.influx_tag) | ||||||
|         print("Posting to influx...\n") |         print("Posting to influx...\n") | ||||||
|         csvtoinflux.post_to_influx() |         csvtoinflux.post_to_influx() | ||||||
|  |  | ||||||
| @@ -483,4 +485,3 @@ class cv_test(Realm): | |||||||
|         if dialog[0]["LAST"]["response"] != "NO-DIALOG": |         if dialog[0]["LAST"]["response"] != "NO-DIALOG": | ||||||
|             print("Popup Dialog:\n") |             print("Popup Dialog:\n") | ||||||
|             print(dialog[0]["LAST"]["response"]) |             print(dialog[0]["LAST"]["response"]) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,11 +6,16 @@ Help() | |||||||
| { | { | ||||||
|   echo "This bash script creates a DUT, loads a scenario, runs a WiFi Capacity test, and saves it to Influx" |   echo "This bash script creates a DUT, loads a scenario, runs a WiFi Capacity test, and saves it to Influx" | ||||||
| } | } | ||||||
| MGR=192.168.1.7 | MGR=192.168.1.6 | ||||||
| INFLUXTOKEN=Tdxwq5KRbj1oNbZ_ErPL5tw_HUH2wJ1VR4dwZNugJ-APz__mEFIwnqHZdoobmQpt2fa1VdWMlHQClR8XNotwbg== | #INFLUXTOKEN=Tdxwq5KRbj1oNbZ_ErPL5tw_HUH2wJ1VR4dwZNugJ-APz__mEFIwnqHZdoobmQpt2fa1VdWMlHQClR8XNotwbg== | ||||||
| GRAFANATOKEN=eyJrIjoiZTJwZkZlemhLQVNpY3hiemRjUkNBZ3k2RWc3bWpQWEkiLCJuIjoibWFzdGVyIiwiaWQiOjF9 | #GRAFANATOKEN=eyJrIjoiZTJwZkZlemhLQVNpY3hiemRjUkNBZ3k2RWc3bWpQWEkiLCJuIjoibWFzdGVyIiwiaWQiOjF9 | ||||||
|  | INFLUXTOKEN=31N9QDhjJHBu4eMUlMBwbK3sOjXLRAhZuCzZGeO8WVCj-xvR8gZWWvRHOcuw-5RHeB7xBFnLs7ZV023k4koR1A== | ||||||
|  | GRAFANATOKEN=eyJrIjoiS1NGRU8xcTVBQW9lUmlTM2dNRFpqNjFqV05MZkM0dzciLCJuIjoibWF0dGhldyIsImlkIjoxfQ== | ||||||
| TESTBED=Stidmatt-01 | TESTBED=Stidmatt-01 | ||||||
| GROUPS=/tmp/lf_cv_rpt_filelocation.txt | GROUPS=/tmp/lf_cv_rpt_filelocation.txt | ||||||
|  | INFLUXBUCKET=stidmatt | ||||||
|  | INFLUX_MGR=192.168.100.201 | ||||||
|  |  | ||||||
| #Replace my arguments with your setup.  Separate your ssid arguments with spaces and ensure the names are lowercase | #Replace my arguments with your setup.  Separate your ssid arguments with spaces and ensure the names are lowercase | ||||||
| echo "Make new DUT" | echo "Make new DUT" | ||||||
| ./create_chamberview_dut.py --lfmgr ${MGR} --dut_name DUT_TO_GRAFANA_DUT --ssid "ssid_idx=0 ssid=lanforge security=WPA2 password=password bssid=04:f0:21:2c:41:84 traffic=wiphy1" | ./create_chamberview_dut.py --lfmgr ${MGR} --dut_name DUT_TO_GRAFANA_DUT --ssid "ssid_idx=0 ssid=lanforge security=WPA2 password=password bssid=04:f0:21:2c:41:84 traffic=wiphy1" | ||||||
| @@ -23,9 +28,9 @@ echo "Build Chamber View Scenario" #change the lfmgr to your system, set the rad | |||||||
| #config_name doesn't matter, change the influx_host to your LANforge device, | #config_name doesn't matter, change the influx_host to your LANforge device, | ||||||
| echo "run Dataplane test" | echo "run Dataplane test" | ||||||
| ./lf_dataplane_test.py --mgr ${MGR} --instance_name dataplane-instance --config_name test_config --upstream 1.1.eth1 \ | ./lf_dataplane_test.py --mgr ${MGR} --instance_name dataplane-instance --config_name test_config --upstream 1.1.eth1 \ | ||||||
| --station 1.1.14 --dut linksys-8450 --influx_host ${MGR} --influx_port 8086 --influx_org Candela --influx_token ${INFLUXTOKEN} \ | --station 1.1.14 --dut linksys-8450 --influx_host ${INFLUX_MGR} --influx_port 8086 --influx_org Candela --influx_token ${INFLUXTOKEN} \ | ||||||
| --influx_bucket lanforge --influx_tag testbed ${TESTBED} --graphgroups ${GROUPS} | --influx_bucket ${INFLUXBUCKET} --influx_tag testbed ${TESTBED} --graphgroups ${GROUPS} | ||||||
|  |  | ||||||
| ./grafana_profile.py --create_custom --title ${TESTBED} --influx_bucket lanforge --mgr 192.168.1.7 --grafana_token ${GRAFANATOKEN} \ | ./grafana_profile.py --create_custom --title ${TESTBED} --influx_bucket ${INFLUXBUCKET} --mgr ${MGR} --grafana_token ${GRAFANATOKEN} \ | ||||||
| --grafana_host 192.168.1.7 --testbed ${TESTBED} --graph-groups ${GROUPS} \ | --grafana_host ${INFLUX_MGR} --testbed ${TESTBED} --graph-groups ${GROUPS} \ | ||||||
| --scripts Dataplane --scripts 'WiFi Capacity' | --scripts Dataplane --scripts 'WiFi Capacity' | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ import subprocess | |||||||
| def main(): | def main(): | ||||||
|     print("Installing Script Python3 Dependencies") |     print("Installing Script Python3 Dependencies") | ||||||
|     packages = ['pandas', 'plotly', 'numpy', 'cryptography', 'paramiko', 'bokeh','pyarrow', 'websocket-client', 'xlsxwriter',\ |     packages = ['pandas', 'plotly', 'numpy', 'cryptography', 'paramiko', 'bokeh','pyarrow', 'websocket-client', 'xlsxwriter',\ | ||||||
|          'pyshark', 'influxdb', 'influxdb-client', 'matplotlib', 'pdfkit', 'pip-search', 'pyserial', 'pexpect-serial' ] |          'pyshark', 'influxdb', 'influxdb-client', 'matplotlib', 'pdfkit', 'pip-search', 'pyserial', 'pexpect-serial' ,'scp'] | ||||||
|     packages_installed = [] |     packages_installed = [] | ||||||
|     packages_failed =[] |     packages_failed =[] | ||||||
|     for package in packages: |     for package in packages: | ||||||
|   | |||||||
| @@ -5,11 +5,15 @@ | |||||||
| # into influxdb.  As final step, it builds a grafana dashboard for the KPI information. | # 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. | # Define some common variables.  This will need to be changed to match your own testbed. | ||||||
| MGR=192.168.1.7 | MGR=192.168.1.6 | ||||||
| INFLUXTOKEN=Tdxwq5KRbj1oNbZ_ErPL5tw_HUH2wJ1VR4dwZNugJ-APz__mEFIwnqHZdoobmQpt2fa1VdWMlHQClR8XNotwbg== | INFLUX_MGR=192.168.100.201 | ||||||
|  | #INFLUXTOKEN=Tdxwq5KRbj1oNbZ_ErPL5tw_HUH2wJ1VR4dwZNugJ-APz__mEFIwnqHZdoobmQpt2fa1VdWMlHQClR8XNotwbg== | ||||||
|  | INFLUXTOKEN=31N9QDhjJHBu4eMUlMBwbK3sOjXLRAhZuCzZGeO8WVCj-xvR8gZWWvRHOcuw-5RHeB7xBFnLs7ZV023k4koR1A== | ||||||
| TESTBED=Stidmatt-01 | TESTBED=Stidmatt-01 | ||||||
| GRAFANATOKEN=eyJrIjoiZTJwZkZlemhLQVNpY3hiemRjUkNBZ3k2RWc3bWpQWEkiLCJuIjoibWFzdGVyIiwiaWQiOjF9 | INFLUXBUCKET=stidmatt | ||||||
| GROUPS=/tmp/lf_cv_rpt_filelocation.txt | #GRAFANATOKEN=eyJrIjoiZTJwZkZlemhLQVNpY3hiemRjUkNBZ3k2RWc3bWpQWEkiLCJuIjoibWFzdGVyIiwiaWQiOjF9 | ||||||
|  | GRAFANATOKEN=eyJrIjoiS1NGRU8xcTVBQW9lUmlTM2dNRFpqNjFqV05MZkM0dzciLCJuIjoibWF0dGhldyIsImlkIjoxfQ== | ||||||
|  | GROUPS=lf_cv_rpt_filelocation.txt | ||||||
|  |  | ||||||
| # Create/update new DUT. | # Create/update new DUT. | ||||||
| #Replace my arguments with your setup.  Separate your ssid arguments with spaces and ensure the names are lowercase | #Replace my arguments with your setup.  Separate your ssid arguments with spaces and ensure the names are lowercase | ||||||
| @@ -21,19 +25,26 @@ echo "Make new DUT" | |||||||
| echo "Build Chamber View Scenario" | 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. | #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 \ | ./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=default Amount=4 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" | --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. | # Run capacity test on the stations created by the chamber view scenario. | ||||||
| # Submit the KPI data into the influxdb. | # Submit the KPI data into the influxdb. | ||||||
| #config_name doesn't matter, change the influx_host to your LANforge device, | #config_name doesn't matter, change the influx_host to your LANforge device, | ||||||
| echo "run wifi capacity test" | echo "run wifi capacity test" | ||||||
| ./lf_wifi_capacity_test.py --config_name Custom --create_stations --radio wiphy1 --pull_report --influx_host ${MGR} \ | ./lf_wifi_capacity_test.py --config_name Custom --create_stations --radio wiphy1 --pull_report --influx_host ${INFLUX_MGR} \ | ||||||
| --influx_port 8086 --influx_org Candela --influx_token  ${INFLUXTOKEN} --influx_bucket lanforge --mgr ${MGR} \ | --influx_port 8086 --influx_org Candela --influx_token  ${INFLUXTOKEN} --influx_bucket ${INFLUXBUCKET} --mgr ${MGR} \ | ||||||
| --instance_name testing --upstream eth1 --test_rig ${TESTBED} --graphgroups ${GROUPS} | --instance_name testing --upstream eth1 --test_rig ${TESTBED} --graphgroups lf_cv_rpt_filelocation.txt --lf_password lanforgepassword | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #config_name doesn't matter, change the influx_host to your LANforge device, | ||||||
|  | echo "run Dataplane test" | ||||||
|  | ./lf_dataplane_test.py --mgr ${MGR} --instance_name dataplane-instance --config_name test_config --upstream 1.1.eth1 \ | ||||||
|  | --station 1.1.06 --dut linksys-8450 --influx_host ${INFLUX_MGR} --influx_port 8086 --influx_org Candela --influx_token ${INFLUXTOKEN} \ | ||||||
|  | --influx_bucket ${INFLUXBUCKET} --influx_tag testbed ${TESTBED} --graphgroups lf_cv_rpt_filelocation.txt | ||||||
|  |  | ||||||
| # Build grafana dashboard and graphs view for the KPI in the capacity test. | # 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_profile.py --create_custom --title ${TESTBED} --influx_bucket ${INFLUXBUCKET} --mgr ${MGR} --grafana_token ${GRAFANATOKEN} \ | ||||||
| --grafana_host 192.168.1.7 --testbed ${TESTBED} --graph-groups  ${GROUPS} --scripts Dataplane --scripts 'WiFi Capacity' | --grafana_host ${INFLUX_MGR} --testbed ${TESTBED} --graph-groups  lf_cv_rpt_filelocation.txt --scripts Dataplane --scripts 'WiFi Capacity' | ||||||
|  |  | ||||||
| rm ${GROUPS} | #rm ${GROUPS} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Matthew Stidham
					Matthew Stidham