mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-31 18:58:01 +00:00 
			
		
		
		
	Fixes in test_wanlink, fix formatting in ipv4_variable_time
Signed-off-by: Matthew Stidham <stidmatt@protonmail.com>
This commit is contained in:
		| @@ -12,29 +12,45 @@ if 'py-json' not in sys.path: | ||||
| import argparse | ||||
| from LANforge.lfcli_base import LFCliBase | ||||
| from LANforge.LFUtils import * | ||||
| import realm | ||||
| from realm import Realm | ||||
| import time | ||||
|  | ||||
| class LANtoWAN(LFCliBase): | ||||
|     def __init__(self, host, port, ssid, security, password, lan_port="eth2", wan_port="eth3", _debug_on=False, | ||||
| class LANtoWAN(Realm): | ||||
|     def __init__(self, host, port, ssid, security, password, | ||||
|                  lan_port="eth2", | ||||
|                  wan_port="eth3", | ||||
|                  prefix='sta', | ||||
|                  number_template="00000", | ||||
|                  radio="wiphy0", | ||||
|                  sta_list = [], | ||||
|                  side_a_min_rate=56, side_a_max_rate=0, | ||||
|                  side_b_min_rate=56, side_b_max_rate=0, | ||||
|                  upstream = None, | ||||
|                  _debug_on=False, | ||||
|                  _exit_on_error=False, | ||||
|                  _exit_on_fail=False): | ||||
|         super().__init__(host, port, _debug=_debug_on, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail) | ||||
|         super().__init__(host, port) | ||||
|         self.upstream = upstream | ||||
|         self.host = host | ||||
|         self.port = port | ||||
|         self.ssid = ssid | ||||
|         self.radio = radio | ||||
|         self.sta_list = sta_list | ||||
|         self.security = security | ||||
|         self.password = password | ||||
|         self.timeout = 120 | ||||
|         self.lan_port = lan_port | ||||
|         self.wan_port = wan_port | ||||
|         self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port) | ||||
|         self.profile = realm.StationProfile(self.lfclient_url, ssid=self.ssid, ssid_pass=self.password, | ||||
|                                             security=self.security, number_template_=self.prefix, mode=0, up=True, dhcp=True, | ||||
|                                             debug_=False) | ||||
|         self.cxProfile = realm.new_l3_cx_profile() | ||||
|         self.prefix = prefix | ||||
|         self.number_template = number_template | ||||
|         self.station_profile = self.new_station_profile() | ||||
|         self.cx_profile = self.new_l3_cx_profile() | ||||
|  | ||||
|     def run_test(self): pass | ||||
|  | ||||
|         self.cx_profile.side_a_min_bps = side_a_min_rate | ||||
|         self.cx_profile.side_a_max_bps = side_a_max_rate | ||||
|         self.cx_profile.side_b_min_bps = side_b_min_rate | ||||
|         self.cx_profile.side_b_max_bps = side_b_max_rate | ||||
|  | ||||
|     def create_wanlinks(self, shelf=1, resource=1, latency=20, max_rate=1544000): | ||||
|         print("Creating wanlinks") | ||||
| @@ -83,121 +99,16 @@ class LANtoWAN(LFCliBase): | ||||
|         time.sleep(.05) | ||||
|  | ||||
|     def run(self): | ||||
|         self.profile.use_wpa2(True, self.ssid, self.password) | ||||
|         self.profile.create(resource=1, radio="wiphy0", num_stations=3, debug=False) | ||||
|         self.cx_profile.use_wpa2(True, self.ssid, self.password) | ||||
|         self.station_profile.create(radio="wiphy0", num_stations=3, debug=False) | ||||
|  | ||||
|     def cleanup(self): pass | ||||
|  | ||||
|  | ||||
| def main(): | ||||
|     parser = LFCliBase.create_basic_argparse( | ||||
|         prog='test_ipv4_variable_time.py', | ||||
|         formatter_class=argparse.RawTextHelpFormatter, | ||||
|         epilog='''\ | ||||
|             Create stations to test connection and traffic on VAPs of varying security types (WEP, WPA, WPA2, WPA3, Open) | ||||
|             ''', | ||||
|  | ||||
|         description='''\ | ||||
| test_ipv4_variable_time.py: | ||||
| -------------------- | ||||
| Generic command layout: | ||||
|  | ||||
| python3 ./test_ipv4_variable_time.py | ||||
|     --upstream_port eth1 | ||||
|     --radio wiphy0 | ||||
|     --num_stations 32 | ||||
|     --security {open|wep|wpa|wpa2|wpa3} | ||||
|     --mode   1 | ||||
|         {"auto"   : "0", | ||||
|         "a"      : "1", | ||||
|         "b"      : "2", | ||||
|         "g"      : "3", | ||||
|         "abg"    : "4", | ||||
|         "abgn"   : "5", | ||||
|         "bgn"    : "6", | ||||
|         "bg"     : "7", | ||||
|         "abgnAC" : "8", | ||||
|         "anAC"   : "9", | ||||
|         "an"     : "10", | ||||
|         "bgnAC"  : "11", | ||||
|         "abgnAX" : "12", | ||||
|         "bgnAX"  : "13"} | ||||
|     --ssid netgear | ||||
|     --password admin123 | ||||
|     --test_duration 2m (default) | ||||
|     --a_min 3000 | ||||
|     --b_min 1000 | ||||
|     --ap "00:0e:8e:78:e1:76" | ||||
|     --output_format csv | ||||
|     --report_file ~/Documents/results.csv                       (Example of csv file output  - please use another extension for other file formats) | ||||
|     --compared_report ~/Documents/results_prev.csv              (Example of csv file retrieval - please use another extension for other file formats) - UNDER CONSTRUCTION | ||||
|     --col_names 'name','tx bytes','rx bytes','dropped'          (column names from the GUI to print on report -  please read below to know what to put here according to preferences) | ||||
|     --debug | ||||
| =============================================================================== | ||||
|  ** FURTHER INFORMATION ** | ||||
|     Using the col_names flag: | ||||
|  | ||||
|     Currently the output function does not support inputting the columns in col_names the way they are displayed in the GUI. This quirk is under construction. To output | ||||
|     certain columns in the GUI in your final report, please match the according GUI column display to it's counterpart to have the columns correctly displayed in | ||||
|     your report. | ||||
|  | ||||
|     GUI Column Display       Col_names argument to type in (to print in report) | ||||
|  | ||||
|     Name                |  'name' | ||||
|     EID                 |  'eid' | ||||
|     Run                 |  'run' | ||||
|     Mng                 |  'mng' | ||||
|     Script              |  'script' | ||||
|     Tx Rate             |  'tx rate' | ||||
|     Tx Rate (1 min)     |  'tx rate (1 min)' | ||||
|     Tx Rate (last)      |  'tx rate (last)' | ||||
|     Tx Rate LL          |  'tx rate ll' | ||||
|     Rx Rate             |  'rx rate' | ||||
|     Rx Rate (1 min)     |  'rx rate (1 min)' | ||||
|     Rx Rate (last)      |  'rx rate (last)' | ||||
|     Rx Rate LL          |  'rx rate ll' | ||||
|     Rx Drop %           |  'rx drop %' | ||||
|     Tx PDUs             |  'tx pdus' | ||||
|     Tx Pkts LL          |  'tx pkts ll' | ||||
|     PDU/s TX            |  'pdu/s tx' | ||||
|     Pps TX LL           |  'pps tx ll' | ||||
|     Rx PDUs             |  'rx pdus' | ||||
|     Rx Pkts LL          |  'pps rx ll' | ||||
|     PDU/s RX            |  'pdu/s tx' | ||||
|     Pps RX LL           |  'pps rx ll' | ||||
|     Delay               |  'delay' | ||||
|     Dropped             |  'dropped' | ||||
|     Jitter              |  'jitter' | ||||
|     Tx Bytes            |  'tx bytes' | ||||
|     Rx Bytes            |  'rx bytes' | ||||
|     Replays             |  'replays' | ||||
|     TCP Rtx             |  'tcp rtx' | ||||
|     Dup Pkts            |  'dup pkts' | ||||
|     Rx Dup %            |  'rx dup %' | ||||
|     OOO Pkts            |  'ooo pkts' | ||||
|     Rx OOO %            |  'rx ooo %' | ||||
|     RX Wrong Dev        |  'rx wrong dev' | ||||
|     CRC Fail            |  'crc fail' | ||||
|     RX BER              |  'rx ber' | ||||
|     CX Active           |  'cx active' | ||||
|     CX Estab/s          |  'cx estab/s' | ||||
|     1st RX              |  '1st rx' | ||||
|     CX TO               |  'cx to' | ||||
|     Pattern             |  'pattern' | ||||
|     Min PDU             |  'min pdu' | ||||
|     Max PDU             |  'max pdu' | ||||
|     Min Rate            |  'min rate' | ||||
|     Max Rate            |  'max rate' | ||||
|     Send Buf            |  'send buf' | ||||
|     Rcv Buf             |  'rcv buf' | ||||
|     CWND                |  'cwnd' | ||||
|     TCP MSS             |  'tcp mss' | ||||
|     Bursty              |  'bursty' | ||||
|     A/B                 |  'a/b' | ||||
|     Elapsed             |  'elapsed' | ||||
|     Destination Addr    |  'destination addr' | ||||
|     Source Addr         |  'source addr' | ||||
|             ''') | ||||
|         prog='test_wanlink.py', | ||||
|         formatter_class=argparse.RawTextHelpFormatter) | ||||
|     for group in parser._action_groups: | ||||
|         if group.title == "required arguments": | ||||
|             required_args=group | ||||
| @@ -218,13 +129,17 @@ python3 ./test_ipv4_variable_time.py | ||||
|             break | ||||
|     #if optional_args is not None: | ||||
|     args = parser.parse_args() | ||||
|     num_sta=4 | ||||
|     station_list = portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000, | ||||
|                                           radio=args.radio) | ||||
|     ltw=LANtoWAN(host=args.mgr, | ||||
|                  port=args.mgr_port, | ||||
|                  ssid=args.ssid, | ||||
|                  sta_list=station_list, | ||||
|                  security=args.security, | ||||
|                  password=args.passwd, | ||||
|                  lan_port=args.lanport, | ||||
|                  wan_port=args.wanport,) | ||||
|                  wan_port=args.wanport) | ||||
|     ltw.create_wanlinks() | ||||
|     ltw.run() | ||||
|     ltw.cleanup() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Matthew Stidham
					Matthew Stidham