Skip to content

Commit f67a6d0

Browse files
committed
lf_interop_youtube.py: add Example CLI's
Signed-off-by: Narayana-CT <narayana.pinapatruni@candelatech.com>
1 parent e540d8c commit f67a6d0

1 file changed

Lines changed: 105 additions & 18 deletions

File tree

py-scripts/real_application_tests/youtube/lf_interop_youtube.py

Lines changed: 105 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
77
EXAMPLE-1:
88
Command Line Interface to run YouTube with the specified URL and duration:
9-
python3 lf_interop_youtube.py --mgr 192.168.214.219 --url "https://youtu.be/BHACKCNDMW8?si=psTEUzrc77p38aU1" --duration 1 --res 1080p --upstream_port 1.1.eth1
9+
python3 lf_interop_youtube.py \
10+
--mgr 192.168.214.219 \
11+
--url "https://youtu.be/BHACKCNDMW8?si=psTEUzrc77p38aU1" \
12+
--duration 1 \
13+
--res 1080p \
14+
--upstream_port 1.1.eth1
1015
1116
CASE-1:
1217
If the given duration is longer than the actual video duration, the video will loop.
@@ -16,13 +21,25 @@
1621
1722
EXAMPLE-2:
1823
Command Line Interface to run YouTube on multiple devices:
19-
python3 lf_interop_youtube.py --mgr 192.168.214.219 --url "https://youtu.be/BHACKCNDMW8?si=psTEUzrc77p38aU1" --duration 2 --res 1080p --upstream_port 1.1.eth1 --resources 1.13,1.14...
24+
python3 lf_interop_youtube.py \
25+
--mgr 192.168.214.219 \
26+
--url "https://youtu.be/BHACKCNDMW8?si=psTEUzrc77p38aU1" \
27+
--duration 2 \
28+
--res 1080p \
29+
--upstream_port 1.1.eth1 \
30+
--resources 1.13,1.14...
2031
2132
2233
EXAMPLE-3:
2334
Command Line Interface to run YouTube without post-cleanup of cross-connections:
24-
python3 lf_interop_youtube.py --mgr 192.168.214.219 --url "https://youtu.be/BHACKCNDMW8?si=psTEUzrc77p38aU1" --duration 2 --res 1080p
25-
--upstream_port 1.1.eth1 --resources 1.13,1.14... --no_post_cleanup
35+
python3 lf_interop_youtube.py \
36+
--mgr 192.168.214.219 \
37+
--url "https://youtu.be/BHACKCNDMW8?si=psTEUzrc77p38aU1" \
38+
--duration 2 \
39+
--res 1080p \
40+
--upstream_port 1.1.eth1 \
41+
--resources 1.13,1.14... \
42+
--no_post_cleanup
2643
2744
EXAMPLE-4:
2845
Command Line Interface to run YouTube with multiple groups and profiles:
@@ -44,6 +61,38 @@
4461
python3 lf_interop_youtube.py --mgr 192.168.207.78 --url https://youtu.be/BHACKCNDMW8?si=psTEUzrc77p38aU1 --duration 1
4562
--test_name Youtube --res 144p --upstream_port 192.168.200.191 --iot_test --iot_testname "youtubeIot" --iot_device_list "switch.smart_plug_1_socket_1"
4663
64+
Example-8:
65+
Command Line Interface to run the new Test at each coordinate with Robo
66+
67+
python3 lf_interop_youtube.py \
68+
--mgr 192.168.214.219 \
69+
--upstream_port 1.1.eth1 \
70+
--url "https://youtu.be/BHACKCNDMW8?si=psTEUzrc77p38aU1" \
71+
--duration 1 \
72+
--res 1080p \
73+
--resources 1.13,1.14 \
74+
--do_robo \
75+
--robo_ip 192.168.50.10 \
76+
--coordinates c1,c2,c3
77+
78+
79+
Example-9:
80+
Command Line Interface to run the new Test with Robo and rotating to user specified angles at each coordinate
81+
82+
python3 py-scripts/real_application_tests/youtube/lf_interop_youtube.py \
83+
--mgr 192.168.214.219 \
84+
--upstream_port 1.1.eth1 \
85+
--url "https://youtu.be/BHACKCNDMW8?si=psTEUzrc77p38aU1" \
86+
--duration 1 \
87+
--res 1080p \
88+
--resources 1.13,1.14 \
89+
--do_robo \
90+
--robo_ip 192.168.50.10 \
91+
--coordinates c1,c2,c3 \
92+
--rotations 0,90,180,270
93+
94+
95+
4796
4897
4998
SCRIPT CLASSIFICATION: Test
@@ -744,7 +793,7 @@ def youtube_stats():
744793
return jsonify({"message": "Stats updated"}), 200
745794

746795
elif request.method == 'GET':
747-
return jsonify({"result": self.stats_api_response}), 200
796+
return jsonify(self.stats_api_response), 200
748797

749798
return jsonify({"error": "Invalid request"}), 400
750799

@@ -1306,7 +1355,7 @@ def check_gen_cx(self):
13061355

13071356
endp_status = generic_endpoint["endpoint"].get("status", "")
13081357

1309-
if endp_status not in ["Stopped", "WAITING", "NO-CX"]:
1358+
if endp_status not in ["Stopped", "WAITING", "NO-CX", "PHANTOM", "FTM_WAIT"]:
13101359
return False
13111360

13121361
return True
@@ -1822,7 +1871,7 @@ def add_buffer_health_graphs_to_report(self, hostname):
18221871
filtered_csv_files = [f for f in all_csv_files if f.endswith(f"{hostname}_youtube_stats_report.csv")]
18231872

18241873
if not filtered_csv_files:
1825-
logging.warning(f"No CSV files found for hostname: {hostname}")
1874+
logging.warning(f"No CSV files found for hostname {hostname} to create buffer health graph")
18261875
return
18271876

18281877
combined_data = pd.DataFrame()
@@ -1841,7 +1890,7 @@ def add_buffer_health_graphs_to_report(self, hostname):
18411890
try:
18421891
combined_data['TimeStamp'] = pd.to_datetime(combined_data['TimeStamp'], format="%H:%M:%S").dt.time
18431892
except Exception as e:
1844-
logging.error(f"Error converting timestamps: {e}")
1893+
logging.error(f"Error converting timestamps for hostname {hostname} while creating buffer health graph: {e}")
18451894
return
18461895

18471896
combined_data = combined_data.drop_duplicates(subset='TimeStamp', keep='first')
@@ -1955,6 +2004,12 @@ def add_frames_graphs_to_report(self, current_cord, current_angle):
19552004
else:
19562005
self.report.set_graph_title(f"Total Frames vs Dropped Frames at coordinate: {current_cord} and angle: {current_angle}°")
19572006
self.report.build_graph_title()
2007+
if not result_dict:
2008+
if self.rotations_enabled:
2009+
logging.info(f"No valid data found for coordinate: {current_cord} and angle: {current_angle}. Skipping Frames graph generation.")
2010+
else:
2011+
logging.info(f"No valid data found for coordinate: {current_cord}. Skipping Frames graph generation.")
2012+
return
19582013
x_fig_size = 25
19592014
y_fig_size = len(result_dict) * .5 + 4
19602015

@@ -1985,8 +2040,10 @@ def add_frames_graphs_to_report(self, current_cord, current_angle):
19852040
graph_image = graph.build_bar_graph_horizontal()
19862041
self.report.set_graph_image(graph_image)
19872042
self.report.build_graph()
1988-
1989-
self.report.set_table_title(f'Test Results for coordinate: {current_cord} and angle: {current_angle}°')
2043+
if self.rotations_enabled:
2044+
self.report.set_table_title(f'Test Results for coordinate: {current_cord} and angle: {current_angle}°')
2045+
else:
2046+
self.report.set_table_title(f'Test Results for coordinate: {current_cord}')
19902047
self.report.build_table_title()
19912048

19922049
test_results = {
@@ -2016,12 +2073,12 @@ def add_live_view_images_to_report(self):
20162073
it's added to the report on a new page; otherwise, it's skipped.
20172074
"""
20182075
url_image_path = os.path.join(self.ui_report_dir, "live_view_images", f"yt_{self.test_name}_1.png")
2019-
timeout = 60
2076+
timeout = 120 # seconds
20202077
start_time = time.time()
20212078

20222079
while not os.path.exists(url_image_path):
20232080
if time.time() - start_time > timeout:
2024-
logging.info("Timeout: Images not found within 60 seconds.")
2081+
logging.info(f"Live view Images not found in the respective folder {url_image_path} within 120 seconds. Skipping live view image addition to the report.")
20252082
break
20262083
time.sleep(1)
20272084
if os.path.exists(url_image_path):
@@ -2091,6 +2148,36 @@ def main():
20912148
python3 lf_interop_youtube.py --mgr 192.168.204.74 --url "https://youtu.be/BHACKCNDMW8?si=psTEUzrc77p38aU1" --duration 1
20922149
--ssid NETGEAR_2g_wpa2 --passwd Password@123 --encryp wpa2 --upstream_port 1.1.eth1 --config
20932150
2151+
Example-6:
2152+
Command Line Interface to run the new Test at each coordinate with Robo
2153+
2154+
python3 lf_interop_youtube.py \
2155+
--mgr 192.168.214.219 \
2156+
--upstream_port 1.1.eth1 \
2157+
--url "https://youtu.be/BHACKCNDMW8?si=psTEUzrc77p38aU1" \
2158+
--duration 1 \
2159+
--res 1080p \
2160+
--resources 1.13,1.14 \
2161+
--do_robo \
2162+
--robo_ip 192.168.50.10 \
2163+
--coordinates c1,c2,c3
2164+
2165+
2166+
Example-7:
2167+
Command Line Interface to run the new Test with Robo and rotating to user specified angles at each coordinate
2168+
2169+
python3 py-scripts/real_application_tests/youtube/lf_interop_youtube.py \
2170+
--mgr 192.168.214.219 \
2171+
--upstream_port 1.1.eth1 \
2172+
--url "https://youtu.be/BHACKCNDMW8?si=psTEUzrc77p38aU1" \
2173+
--duration 1 \
2174+
--res 1080p \
2175+
--resources 1.13,1.14 \
2176+
--do_robo \
2177+
--robo_ip 192.168.50.10 \
2178+
--coordinates c1,c2,c3 \
2179+
--rotations 0,90,180,270
2180+
20942181
20952182
SCRIPT CLASSIFICATION: Test
20962183
@@ -2486,12 +2573,6 @@ def main():
24862573
iot_summary = json.load(f)
24872574

24882575
logging.info('Stopping the test')
2489-
if args.do_robo and not args.do_bandsteering:
2490-
youtube.create_robo_report()
2491-
elif do_webUI:
2492-
youtube.create_report(youtube.stats_api_response, youtube.ui_report_dir, iot_summary=iot_summary)
2493-
else:
2494-
youtube.create_report(youtube.stats_api_response, '', iot_summary=iot_summary)
24952576

24962577
# Perform post-test cleanup if not skipped
24972578
if not args.no_post_cleanup:
@@ -2505,6 +2586,12 @@ def main():
25052586
if args.do_webUI:
25062587
youtube.stop_webui_test()
25072588
youtube.stop()
2589+
if args.do_robo and not args.do_bandsteering:
2590+
youtube.create_robo_report()
2591+
elif args.do_webUI:
2592+
youtube.create_report(youtube.stats_api_response, youtube.ui_report_dir, iot_summary=iot_summary)
2593+
else:
2594+
youtube.create_report(youtube.stats_api_response, '', iot_summary=iot_summary)
25082595
logging.info("Waiting for Cleanup of Browsers in Devices")
25092596
time.sleep(10)
25102597

0 commit comments

Comments
 (0)