Skip to content

Commit f9a032e

Browse files
chulsprofmonniots-gatti
authored
[Camera/Tests] Makes PushAV reference server session-oriented and updates TC_PAVSTI_X (project-chip#42965)
* New session logic when uploading files to record operations track name update via session mechanism load sessions from disk on startup list sessions as an API fix file_path in errors python 3.12 has built-in union symbol docs raise and return HTTPExceptions support for sessions in the UI + save crt paths remove some streams code that have been moved to sessions Start work on manifest lifecycle validation fix deprecated usage re-introduce stream as a top level primitive Mostly because that's what matter use. Sessions are now a subresource of a stream. Not fully finished though, lots of moving pieces still in flux. Improvement to the stream list UI re-use server cert if possible This should save us some "accept risk" button clicking Fix a couple of warnings + add a couple of TODOs to investigate Fix path regex Fix upload segment update order Fix segment_download parameter order Use dicts and not sets Validate DASH manifest is uploaded to correct path Add some details when ffprobe fails stream's details isn't a thing anymore Explain why session.id First pass at not overriding files uploaded on same endpoint few logs Fix the regexes (again) Handle stream not created yet UI is now three levels: overview, stream, file don't rely on file ordering based on gemini suggestion Restyled by ruff Restyled by autopep8 Restyled by isort remove obsolete TODO Fix fastapi not knowing how to encode dict_values Signed-off-by: Charles Kim <chulspro.kim@samsung.com> * Update error list to have unique errors and add a valid upload list to show in Test Harness UI Signed-off-by: s-gatti <s.gatti@samsung.com> Signed-off-by: Charles Kim <chulspro.kim@samsung.com> * Fix TC_PAVSTI_X to work with updated push av server and fix formatting Signed-off-by: s-gatti <s.gatti@samsung.com> Signed-off-by: Charles Kim <chulspro.kim@samsung.com> * Address gemini review Signed-off-by: s-gatti <s.gatti@samsung.com> Signed-off-by: Charles Kim <chulspro.kim@samsung.com> * Fix TC_PAVST_X CI failures Signed-off-by: s-gatti <s.gatti@samsung.com> Signed-off-by: Charles Kim <chulspro.kim@samsung.com> --------- Signed-off-by: Charles Kim <chulspro.kim@samsung.com> Signed-off-by: s-gatti <s.gatti@samsung.com> Co-authored-by: François <francois.monniot@smartthings.com> Co-authored-by: s-gatti <s.gatti@samsung.com>
1 parent 8379759 commit f9a032e

19 files changed

Lines changed: 454 additions & 195 deletions

src/python_testing/TC_PAVSTI_1_1.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
from mobly import asserts
4343
from TC_AVSMTestBase import AVSMTestBase
44-
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess
44+
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess, SupportedIngestInterface
4545

4646
import matter.clusters as Clusters
4747
from matter.clusters import Globals
@@ -204,6 +204,10 @@ def steps_TC_PAVSTI_1_1(self) -> list[TestStep]:
204204
def default_endpoint(self) -> int:
205205
return 1
206206

207+
@property
208+
def default_timeout(self) -> int:
209+
return 4 * 60 # 4 minutes
210+
207211
@async_test_body
208212
async def test_TC_PAVSTI_1_1(self):
209213
PICS_PRIVACY = "AVSM.S.F03"
@@ -218,7 +222,7 @@ async def test_TC_PAVSTI_1_1(self):
218222
await self.precondition_one_allocated_video_stream(streamUsage=Globals.Enums.StreamUsageEnum.kRecording)
219223
await self.precondition_one_allocated_audio_stream(streamUsage=Globals.Enums.StreamUsageEnum.kRecording)
220224
tlsEndpointId, _ = await self.precondition_provision_tls_endpoint(endpoint=endpoint, server=self.server, host_ip=self.host_ip)
221-
uploadStreamId = self.server.create_stream()
225+
uploadStreamId = self.server.create_stream(SupportedIngestInterface.dash.value)
222226

223227
self.step(1)
224228
currentConnections = await self.read_single_attribute_check_success(
@@ -298,7 +302,7 @@ async def test_TC_PAVSTI_1_1(self):
298302
"containerFormat": pushavCluster.Enums.ContainerFormatEnum.kCmaf,
299303
"containerOptions": {
300304
"containerType": pushavCluster.Enums.ContainerFormatEnum.kCmaf,
301-
"CMAFContainerOptions": {"CMAFInterface": 0, "segmentDuration": 4000, "chunkDuration": 2000, "sessionGroup": 1, "trackName": trackName},
305+
"CMAFContainerOptions": {"CMAFInterface": pushavCluster.Enums.CMAFInterfaceEnum.kInterface2DASH, "segmentDuration": 4000, "chunkDuration": 2000, "sessionGroup": 1, "trackName": trackName},
302306
},
303307
}
304308
allocatePushTransportResponse = await self.send_single_cmd(

src/python_testing/TC_PAVSTI_1_2.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
from mobly import asserts
4242
from TC_AVSMTestBase import AVSMTestBase
43-
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess
43+
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess, SupportedIngestInterface
4444

4545
import matter.clusters as Clusters
4646
from matter.clusters import Globals
@@ -72,6 +72,10 @@ async def setup_class(self):
7272
)
7373
super().setup_class()
7474

75+
@property
76+
def default_timeout(self) -> int:
77+
return 4 * 60 # 4 minutes
78+
7579
def teardown_class(self):
7680
if self.server is not None:
7781
self.server.terminate()
@@ -172,7 +176,7 @@ async def test_TC_PAVSTI_1_2(self):
172176
await self.precondition_one_allocated_video_stream(streamUsage=Globals.Enums.StreamUsageEnum.kRecording)
173177
await self.precondition_one_allocated_audio_stream(streamUsage=Globals.Enums.StreamUsageEnum.kRecording)
174178
tlsEndpointId, _ = await self.precondition_provision_tls_endpoint(endpoint=endpoint, server=self.server, host_ip=self.host_ip)
175-
uploadStreamId = self.server.create_stream()
179+
uploadStreamId = self.server.create_stream(SupportedIngestInterface.dash.value)
176180

177181
self.step(1)
178182
currentConnections = await self.read_single_attribute_check_success(
@@ -255,7 +259,7 @@ async def test_TC_PAVSTI_1_2(self):
255259
"containerFormat": pushavCluster.Enums.ContainerFormatEnum.kCmaf,
256260
"containerOptions": {
257261
"containerType": pushavCluster.Enums.ContainerFormatEnum.kCmaf,
258-
"CMAFContainerOptions": {"CMAFInterface": 0, "segmentDuration": 4000, "chunkDuration": 2000, "sessionGroup": 1, "trackName": trackName},
262+
"CMAFContainerOptions": {"CMAFInterface": pushavCluster.Enums.CMAFInterfaceEnum.kInterface2DASH, "segmentDuration": 4000, "chunkDuration": 2000, "sessionGroup": 1, "trackName": trackName},
259263
},
260264
}
261265
),

src/python_testing/TC_PAVSTI_Utils.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import random
2222
import shutil
2323
import tempfile
24+
from enum import Enum
2425
from typing import Optional
2526

2627
import psutil
@@ -35,6 +36,12 @@
3536
log = logging.getLogger(__name__)
3637

3738

39+
class SupportedIngestInterface(str, Enum):
40+
cmaf = "cmaf-ingest" # Interface 1
41+
dash = "dash" # Interface 2, DASH version
42+
hls = "hls" # Interface 2, HLS version
43+
44+
3845
class PushAvServerProcess(Subprocess):
3946
"""Class for starting Push AV Server in a subprocess"""
4047

@@ -127,17 +134,17 @@ def sign_csr(self, csr_der: bytes, device_name: str = "DUT") -> dict:
127134
csr_pem = csr.public_bytes(serialization.Encoding.PEM).decode("utf-8")
128135
return self._post_json(f"/certs/{device_name}/sign", {"csr": csr_pem})
129136

130-
def create_stream(self) -> str:
137+
def create_stream(self, interface: SupportedIngestInterface) -> str:
131138
"""Request the server to create a new stream."""
132-
response = self._post_json("/streams")
133-
return response["stream_id"]
139+
response = self._post_json(f"/streams?interface={interface}")
140+
return response["id"]
134141

135142
def update_track_name(self, stream_id: str, trackName: str) -> None:
136143
"""
137144
Request the server to add a track name associated with stream_id.
138145
This is required to validate trackName of the segments that are uploaded.
139146
"""
140-
self._post_json(endpoint=f"/streams/{stream_id}/trackName", data={"trackName": trackName})
147+
self._post_json(endpoint=f"/streams/{stream_id}/trackName", data={"track_name": trackName})
141148

142149

143150
class PAVSTIUtils:

src/python_testing/TC_PAVST_2_10.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
import logging
4141

4242
from mobly import asserts
43-
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess
43+
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess, SupportedIngestInterface
4444
from TC_PAVSTTestBase import PAVSTTestBase
4545

4646
import matter.clusters as Clusters
@@ -149,7 +149,7 @@ async def test_TC_PAVST_2_10(self):
149149
)
150150

151151
# Define invalid URL cases
152-
stream_id = self.server.create_stream()
152+
stream_id = self.server.create_stream(SupportedIngestInterface.cmaf.value)
153153
invalid_cases = [
154154
("non‑https scheme", f"http://{host_ip}:1234/streams/{stream_id}/"),
155155
("fragment", f"https://{host_ip}:1234/streams/{stream_id}#/frag"),

src/python_testing/TC_PAVST_2_11.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import logging
4242

4343
from mobly import asserts
44-
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess
44+
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess, SupportedIngestInterface
4545
from TC_PAVSTTestBase import PAVSTTestBase
4646

4747
import matter.clusters as Clusters
@@ -172,7 +172,7 @@ async def test_TC_PAVST_2_11(self):
172172
host_ip = self.user_params.get("host_ip", None)
173173
tlsEndpointId, host_ip = await self.precondition_provision_tls_endpoint(
174174
endpoint=endpoint, server=self.server, host_ip=host_ip)
175-
uploadStreamId = self.server.create_stream()
175+
uploadStreamId = self.server.create_stream(SupportedIngestInterface.cmaf.value)
176176

177177
# Step 1: Reads CurrentConnections attribute
178178
self.step(1)
@@ -322,7 +322,7 @@ async def test_TC_PAVST_2_11(self):
322322

323323
# Step 13: Try to allocate transport with invalid URL
324324
self.step(13)
325-
stream_id = self.server.create_stream()
325+
stream_id = self.server.create_stream(SupportedIngestInterface.cmaf.value)
326326
status = await self.allocate_one_pushav_transport(
327327
endpoint,
328328
url=f"http://{host_ip}:1234/streams/{stream_id}/",

src/python_testing/TC_PAVST_2_12.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import time
4444

4545
from mobly import asserts
46-
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess
46+
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess, SupportedIngestInterface
4747
from TC_PAVSTTestBase import PAVSTTestBase
4848

4949
import matter.clusters as Clusters
@@ -193,7 +193,7 @@ async def test_TC_PAVST_2_12(self):
193193
self.step("precondition")
194194
host_ip = self.user_params.get("host_ip", None)
195195
tlsEndpointId, host_ip = await self.precondition_provision_tls_endpoint(endpoint=endpoint, server=self.server, host_ip=host_ip)
196-
uploadStreamId = self.server.create_stream()
196+
uploadStreamId = self.server.create_stream(SupportedIngestInterface.cmaf.value)
197197

198198
self.step(1)
199199
# Commission DUT - already done

src/python_testing/TC_PAVST_2_13.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import time
4444

4545
from mobly import asserts
46-
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess
46+
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess, SupportedIngestInterface
4747
from TC_PAVSTTestBase import PAVSTTestBase
4848

4949
import matter.clusters as Clusters
@@ -213,7 +213,7 @@ async def test_TC_PAVST_2_13(self):
213213
self.step("precondition")
214214
host_ip = self.user_params.get("host_ip", None)
215215
tlsEndpointId, host_ip = await self.precondition_provision_tls_endpoint(endpoint=endpoint, server=self.server, host_ip=host_ip)
216-
uploadStreamId = self.server.create_stream()
216+
uploadStreamId = self.server.create_stream(SupportedIngestInterface.cmaf.value)
217217

218218
self.step(1)
219219
# Commission DUT - already done

src/python_testing/TC_PAVST_2_2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
# === END CI TEST ARGUMENTS ===
3939

4040
from mobly import asserts
41-
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess
41+
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess, SupportedIngestInterface
4242
from TC_PAVSTTestBase import PAVSTTestBase
4343

4444
import matter.clusters as Clusters
@@ -100,7 +100,7 @@ async def test_TC_PAVST_2_2(self):
100100
self.step("precondition")
101101
host_ip = self.user_params.get("host_ip", None)
102102
tlsEndpointId, host_ip = await self.precondition_provision_tls_endpoint(endpoint=endpoint, server=self.server, host_ip=host_ip)
103-
uploadStreamId = self.server.create_stream()
103+
uploadStreamId = self.server.create_stream(SupportedIngestInterface.cmaf.value)
104104

105105
self.step(1)
106106
status = await self.check_and_delete_all_push_av_transports(endpoint, pvattr)

src/python_testing/TC_PAVST_2_3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
import logging
4141

4242
from mobly import asserts
43-
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess
43+
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess, SupportedIngestInterface
4444
from TC_PAVSTTestBase import PAVSTTestBase
4545

4646
import matter.clusters as Clusters
@@ -171,7 +171,7 @@ async def test_TC_PAVST_2_3(self):
171171
self.step("precondition")
172172
host_ip = self.user_params.get("host_ip", None)
173173
tlsEndpointId, host_ip = await self.precondition_provision_tls_endpoint(endpoint=endpoint, server=self.server, host_ip=host_ip)
174-
uploadStreamId = self.server.create_stream()
174+
uploadStreamId = self.server.create_stream(SupportedIngestInterface.cmaf.value)
175175

176176
self.step(1)
177177
status = await self.check_and_delete_all_push_av_transports(endpoint, pvattr)

src/python_testing/TC_PAVST_2_4.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
# === END CI TEST ARGUMENTS ===
3939

4040
from mobly import asserts
41-
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess
41+
from TC_PAVSTI_Utils import PAVSTIUtils, PushAvServerProcess, SupportedIngestInterface
4242
from TC_PAVSTTestBase import PAVSTTestBase
4343

4444
import matter.clusters as Clusters
@@ -121,7 +121,7 @@ async def test_TC_PAVST_2_4(self):
121121
self.step("precondition")
122122
host_ip = self.user_params.get("host_ip", None)
123123
tlsEndpointId, host_ip = await self.precondition_provision_tls_endpoint(endpoint=endpoint, server=self.server, host_ip=host_ip)
124-
uploadStreamId = self.server.create_stream()
124+
uploadStreamId = self.server.create_stream(SupportedIngestInterface.cmaf.value)
125125

126126
self.step(1)
127127
# Commission DUT - already done

0 commit comments

Comments
 (0)