Create a flag which makes it easier to automate lf_sniff by adding a custom name and add a test to regression

Signed-off-by: Matthew Stidham <stidmatt@protonmail.com>
This commit is contained in:
Matthew Stidham
2021-03-23 13:41:04 -07:00
parent 2341f57b39
commit 7462684520
2 changed files with 12 additions and 7 deletions

View File

@@ -80,6 +80,7 @@ def main():
parser.add_argument("--duration", type=float, help="Duration to sniff, in minutes")
parser.add_argument("--moni_flags", type=str, help="Monitor port flags, see LANforge CLI help for set_wifi_monitor. Default enables 160Mhz")
parser.add_argument("--upstreams", type=str, help="Upstream ports to sniff (1.eth1 ...)")
parser.add_argument("--moni_idx", type=str, help="Optional monitor number", default=None)
args = None
try:
@@ -213,11 +214,13 @@ def main():
"--show_port", "Port"], stdout=PIPE, stderr=PIPE);
pss = port_stats.stdout.decode('utf-8', 'ignore');
moni_idx = "0"
for line in pss.splitlines():
m = re.search('Port:\s+(.*)', line)
if (m != None):
moni_idx = m.group(1)
moni_idx = args.moni_idx
if args.moni_idx is None:
for line in pss.splitlines():
m = re.search('Port:\s+(.*)', line)
if (m != None):
moni_idx = m.group(1)
# Create monitor interface
mname = "moni%sa"%(moni_idx);
@@ -259,7 +262,7 @@ def main():
print("Starting sniffer on port %s.%s for %s seconds, saving to file %s.pcap on resource %s\n"%(r, m, dur, m, r))
subprocess.run(["./lf_portmod.pl", "--manager", lfmgr,
"--cli_cmd", "sniff_port 1 %s %s NA %s %s.pcap %i"%(r, m, sflags, m, int(dur))]);
"--cli_cmd", "sniff_port 1 %s %s NA %s %s.pcap %i"%(r, m, sflags, m, float(dur))]);
idx = idx + 1
# Start sniffing on all upstream ports
@@ -273,7 +276,7 @@ def main():
print("Starting sniffer on upstream port %s.%s for %s seconds, saving to file %s.pcap on resource %s\n"%(u_resource, u_name, dur, u_name, u_resource))
subprocess.run(["./lf_portmod.pl", "--manager", lfmgr,
"--cli_cmd", "sniff_port 1 %s %s NA %s %s.pcap %i"%(u_resource, u_name, sflags, u_name, int(dur))]);
"--cli_cmd", "sniff_port 1 %s %s NA %s %s.pcap %i"%(u_resource, u_name, sflags, u_name, float(dur))]);
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
if __name__ == '__main__':

View File

@@ -105,6 +105,7 @@ if [[ $MGRLEN -gt 0 ]]; then
"./create_qvlan.py --first_qvlan_ip 192.168.1.50"
"./create_station.py --radio wiphy1 --ssid $SSID_USED --passwd $PASSWD_USED --security $SECURITY --debug --mgr $MGR"
"./create_vap.py --radio wiphy1 --ssid $SSID_USED --passwd $PASSWD_USED --security $SECURITY --debug --mgr $MGR"
"./create_vr.py --vr_name 2.vr0 --ports 2.br0,2.vap2 --services"
"./wlan_capacity_calculator.py -sta 11abg -t Voice -p 48 -m 106 -e WEP -q Yes -b 1 2 5.5 11 -pre Long -s N/A -co G.711 -r Yes -c Yes --mgr $MGR"
"./wlan_capacity_calculator.py -sta 11n -t Voice -d 17 -ch 40 -gu 800 -high 9 -e WEP -q Yes -ip 5 -mc 42 -b 6 9 12 24 -m 1538 -co G.729 -pl Greenfield -cw 15 -r Yes -c Yes --mgr $MGR"
"./wlan_capacity_calculator.py -sta 11ac -t Voice -d 9 -spa 3 -ch 20 -gu 800 -high 1 -e TKIP -q Yes -ip 3 -mc 0 -b 6 12 24 54 -m 1518 -co Greenfield -cw 15 -rc Yes --mgr $MGR"
@@ -163,6 +164,7 @@ else
"./create_macvlan.py --radio wiphy1 --macvlan_parent eth1 --debug"
"./create_station.py --radio wiphy1 --ssid $SSID_USED --passwd $PASSWD_USED --security $SECURITY --debug"
"./create_vap.py --radio wiphy1 --ssid $SSID_USED --passwd $PASSWD_USED --security $SECURITY --debug"
"./create_vr.py --vr_name 2.vr0 --ports 2.br0,2.vap2 --services"
"./create_qvlan.py --radio wiphy1 --qvlan_parent eth1"
"./wlan_capacity_calculator.py -sta 11abg -t Voice -p 48 -m 106 -e WEP -q Yes -b 1 2 5.5 11 -pre Long -s N/A -co G.711 -r Yes -c Yes"
"./wlan_capacity_calculator.py -sta 11n -t Voice -d 17 -ch 40 -gu 800 -high 9 -e WEP -q Yes -ip 5 -mc 42 -b 6 9 12 24 -m 1538 -co G.729 -pl Greenfield -cw 15 -r Yes -c Yes"