Skip to content

Commit d6b9d68

Browse files
aravindhan-niAravindhan Palanisamy
andauthored
feat: add DUT filter and DUT serial number fields in test plans models (#151)
Co-authored-by: Aravindhan Palanisamy <[email protected]>
1 parent 77021d3 commit d6b9d68

File tree

8 files changed

+80
-50
lines changed

8 files changed

+80
-50
lines changed

examples/test_plan/test_plan_templates.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
test_program="TP-INT-002",
3030
estimated_duration_in_seconds=86400,
3131
system_filter="os:linux AND arch:x64",
32+
dut_Filter="modelName = 'cRIO-9045' AND serialNumber = '01E82ED0'",
3233
execution_actions=[
3334
ManualExecution(action="boot", type="MANUAL"),
3435
JobExecution(

examples/test_plan/test_plans.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@
3232
properties={"env": "staging", "priority": "high"},
3333
part_number="px40482",
3434
dut_id="Sample-Dut_Id",
35+
dut_serial_number="serial_number_123",
3536
test_program="TP-Integration-001",
3637
system_filter="os:linux AND arch:x64",
38+
dut_Filter="modelName = 'cRIO-9045' AND serialNumber = '01E82ED0'",
3739
workspace="your_workspace_id",
3840
file_ids_from_template=["file1", "file2"],
3941
dashboard=Dashboard(

nisystemlink/clients/test_plan/models/_create_test_plan_request.py

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,53 @@ class CreateTestPlanRequest(JsonModel):
1212
name: Optional[str] = None
1313
"""The name of the test plan."""
1414

15-
template_id: Optional[str] = None
16-
"""The ID of the template to use for the test plan."""
17-
1815
state: Optional[str] = None
1916
"""The state of the test plan."""
2017

18+
template_id: Optional[str] = None
19+
"""The ID of the template to use for the test plan."""
20+
2121
description: Optional[str] = None
2222
"""A description of the test plan."""
2323

2424
assigned_to: Optional[str] = None
2525
"""The user or group assigned to the test plan."""
2626

27-
work_order_id: Optional[str] = None
28-
"""The work order ID associated with the test plan."""
29-
30-
estimated_duration_in_seconds: Optional[int] = None
31-
"""The estimated duration of the test plan in seconds."""
32-
33-
properties: Optional[Dict[str, str]] = None
34-
"""Additional properties for the test plan."""
35-
3627
part_number: Optional[str] = None
3728
"""The part number associated with the test plan."""
3829

3930
dut_id: Optional[str] = None
4031
"""The Device Under Test (DUT) ID."""
4132

33+
dut_serial_number: Optional[str] = None
34+
"""The Device Under Test (DUT) serial number."""
35+
4236
test_program: Optional[str] = None
4337
"""The test program associated with the test plan."""
4438

39+
work_order_id: Optional[str] = None
40+
"""The work order ID associated with the test plan."""
41+
42+
estimated_duration_in_seconds: Optional[int] = None
43+
"""The estimated duration of the test plan in seconds."""
44+
4545
system_filter: Optional[str] = None
4646
"""The system filter to apply."""
4747

48-
workspace: Optional[str] = None
49-
"""The workspace associated with the test plan."""
48+
dut_filter: Optional[str] = None
49+
"""The DUT filter to apply."""
50+
51+
execution_actions: Optional[List[ExecutionDefinition]] = None
52+
"""List of execution actions for the test plan."""
5053

5154
file_ids_from_template: Optional[List[str]] = None
5255
"""List of file IDs from the template."""
5356

57+
workspace: Optional[str] = None
58+
"""The workspace associated with the test plan."""
59+
60+
properties: Optional[Dict[str, str]] = None
61+
"""Additional properties for the test plan."""
62+
5463
dashboard: Optional[Dashboard] = None
5564
"""The dashboard associated with the test plan."""
56-
57-
execution_actions: Optional[List[ExecutionDefinition]] = None
58-
"""List of execution actions for the test plan."""

nisystemlink/clients/test_plan/models/_query_test_plan_templates_request.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class TestPlanTemplateField(str, Enum):
2929
TEST_PROGRAM = "TEST_PROGRAM"
3030
ESTIMATED_DURATION_IN_SECONDS = "ESTIMATED_DURATION_IN_SECONDS"
3131
SYSTEM_FILTER = "SYSTEM_FILTER"
32+
DUT_FILTER = "DUT_FILTER"
3233
EXECUTION_ACTIONS = "EXECUTION_ACTIONS"
3334
FILE_IDS = "FILE_IDS"
3435
WORKSPACE = "WORKSPACE"
@@ -60,6 +61,7 @@ class QueryTestPlanTemplatesRequest(WithPaging):
6061
`testProgram`: String representing the test program name of the test plan created from this
6162
template.
6263
`systemFilter`: String representing the LINQ filter used to filter the potential list of systems
64+
`dutFilter`: String representing the LINQ filter used to filter the potential list of DUTs
6365
capable of executing test plans created from this template.
6466
`workspace`: String representing the workspace where the test plan template belongs.
6567
`createdBy`: String representing the user who created the test plan template.

nisystemlink/clients/test_plan/models/_query_test_plans_request.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,28 @@ class TestPlanField(enum.Enum):
2020
ASSIGNED_TO = "ASSIGNED_TO"
2121
WORK_ORDER_ID = "WORK_ORDER_ID"
2222
WORK_ORDER_NAME = "WORK_ORDER_NAME"
23-
WORKSPACE = "WORKSPACE"
24-
CREATED_BY = "CREATED_BY"
25-
UPDATED_BY = "UPDATED_BY"
26-
CREATED_AT = "CREATED_AT"
27-
UPDATED_AT = "UPDATED_AT"
28-
PROPERTIES = "PROPERTIES"
2923
PART_NUMBER = "PART_NUMBER"
3024
DUT_ID = "DUT_ID"
25+
DUT_SERIAL_NUMBER = "DUT_SERIAL_NUMBER"
3126
TEST_PROGRAM = "TEST_PROGRAM"
27+
WORKSPACE = "WORKSPACE"
28+
CREATED_BY = "CREATED_BY"
29+
UPDATED_BY = "UPDATED_BY"
3230
SYSTEM_ID = "SYSTEM_ID"
3331
FIXTURE_IDS = "FIXTURE_IDS"
34-
SYSTEM_FILTER = "SYSTEM_FILTER"
3532
PLANNED_START_DATE_TIME = "PLANNED_START_DATE_TIME"
3633
ESTIMATED_END_DATE_TIME = "ESTIMATED_END_DATE_TIME"
3734
ESTIMATED_DURATION_IN_SECONDS = "ESTIMATED_DURATION_IN_SECONDS"
35+
SYSTEM_FILTER = "SYSTEM_FILTER"
36+
DUT_FILTER = "DUT_FILTER"
37+
CREATED_AT = "CREATED_AT"
38+
UPDATED_AT = "UPDATED_AT"
39+
PROPERTIES = "PROPERTIES"
3840
FILE_IDS_FROM_TEMPLATE = "FILE_IDS_FROM_TEMPLATE"
41+
DASHBOARD = "DASHBOARD"
3942
EXECUTION_ACTIONS = "EXECUTION_ACTIONS"
4043
EXECUTION_HISTORY = "EXECUTION_HISTORY"
4144
DASHBOARD_URL = "DASHBOARD_URL"
42-
DASHBOARD = "DASHBOARD"
4345
WORKFLOW = "WORKFLOW"
4446

4547

nisystemlink/clients/test_plan/models/_test_plan.py

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,42 +41,33 @@ class TestPlan(JsonModel):
4141
work_order_name: Optional[str] = None
4242
"""The name of the associated work order."""
4343

44-
workspace: Optional[str] = None
45-
"""The workspace to which the test plan belongs."""
46-
47-
created_by: Optional[str] = None
48-
"""The user who created the test plan."""
49-
50-
updated_by: Optional[str] = None
51-
"""The user who last updated the test plan."""
52-
53-
created_At: Optional[datetime] = None
54-
"""The date and time when the test plan was created."""
55-
56-
updated_at: Optional[datetime] = None
57-
"""The date and time when the test plan was last updated."""
58-
59-
properties: Optional[Dict[str, str]] = None
60-
"""Additional properties associated with the test plan."""
61-
6244
part_number: Optional[str] = None
6345
"""The part number associated with the test plan."""
6446

6547
dut_id: Optional[str] = None
6648
"""The identifier of the device under test (DUT)."""
6749

50+
dut_serial_number: Optional[str] = None
51+
"""The serial number of the device under test (DUT)."""
52+
6853
test_program: Optional[str] = None
6954
"""The test program associated with the test plan."""
7055

56+
workspace: Optional[str] = None
57+
"""The workspace to which the test plan belongs."""
58+
59+
created_by: Optional[str] = None
60+
"""The user who created the test plan."""
61+
62+
updated_by: Optional[str] = None
63+
"""The user who last updated the test plan."""
64+
7165
system_id: Optional[str] = None
7266
"""The identifier of the system used for the test plan."""
7367

7468
fixture_ids: Optional[List[str]] = None
7569
"""The list of fixture identifiers associated with the test plan."""
7670

77-
system_filter: Optional[str] = None
78-
"""The filter used to select systems for the test plan."""
79-
8071
planned_start_date_time: Optional[datetime] = None
8172
"""The planned start date and time for the test plan."""
8273

@@ -86,9 +77,27 @@ class TestPlan(JsonModel):
8677
estimated_duration_in_seconds: Optional[float] = None
8778
"""The estimated duration of the test plan in seconds."""
8879

80+
system_filter: Optional[str] = None
81+
"""The filter used to select systems for the test plan."""
82+
83+
dut_filter: Optional[str] = None
84+
"""The filter used to select DUTs for the test plan."""
85+
86+
created_at: Optional[datetime] = None
87+
"""The date and time when the test plan was created."""
88+
89+
updated_at: Optional[datetime] = None
90+
"""The date and time when the test plan was last updated."""
91+
92+
properties: Optional[Dict[str, str]] = None
93+
"""Additional properties associated with the test plan."""
94+
8995
file_ids_from_template: Optional[List[str]] = None
9096
"""The list of file identifiers inherited from the template."""
9197

98+
dashboard: Optional[DashboardUrl] = None
99+
"""The dashboard data related to the test plan."""
100+
92101
execution_actions: Optional[List[ExecutionDefinition]] = None
93102
"""The execution actions defined for the test plan."""
94103

@@ -97,6 +106,3 @@ class TestPlan(JsonModel):
97106

98107
dashboard_url: Optional[Dict[str, str]] = None
99108
"""The URLs for dashboards related to the test plan."""
100-
101-
dashboard: Optional[DashboardUrl] = None
102-
"""The dashboard data related to the test plan."""

nisystemlink/clients/test_plan/models/_test_plan_templates.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ class TestPlanTemplateBase(JsonModel):
3939
systems capable of executing test plans created from this template.
4040
"""
4141

42+
dut_filter: Optional[str] = None
43+
"""The LINQ filter string is used to filter the potential list of
44+
DUTs capable of executing test plans created from this template.
45+
"""
46+
4247
execution_actions: Optional[List[ExecutionDefinition]] = None
4348
"""Defines the executions that will be used for test plan actions
4449
created from this template.

tests/integration/test_plan/test_test_plan_client.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ class TestTestPlanClient:
131131
properties={"env": "staging", "priority": "high"},
132132
part_number="px40482",
133133
dut_id="Sample-Dut_Id",
134+
dut_serial_number="Sample-Dut_serial_number",
134135
test_program="TP-Integration-001",
135136
system_filter="os:linux AND arch:x64",
137+
dut_Filter="modelName = 'cRIO-9045' AND serialNumber = '01E82ED0'",
136138
workspace=_workspace,
137139
file_ids_from_template=["file1", "file2"],
138140
dashboard=_dashboard,
@@ -152,6 +154,7 @@ class TestTestPlanClient:
152154
test_program="TP-INT-002",
153155
estimated_duration_in_seconds=86400,
154156
system_filter="os:linux AND arch:x64",
157+
dut_Filter="modelName = 'cRIO-9045' AND serialNumber = '01E82ED0'",
155158
execution_actions=_execution_actions,
156159
file_ids=["file1", "file2"],
157160
workspace=_workspace,
@@ -330,13 +333,15 @@ def test__query_test_plans_with_projections__returns_the_test_plans_with_project
330333
and test_plan.workspace is None
331334
and test_plan.created_by is None
332335
and test_plan.updated_at is None
333-
and test_plan.created_At is None
336+
and test_plan.created_at is None
334337
and test_plan.updated_by is None
335338
and test_plan.properties is None
336339
and test_plan.part_number is None
337340
and test_plan.dut_id is None
341+
and test_plan.dut_serial_number is None
338342
and test_plan.test_program is None
339343
and test_plan.system_filter is None
344+
and test_plan.dut_filter is None
340345
and test_plan.fixture_ids is None
341346
and test_plan.system_id is None
342347
and test_plan.planned_start_date_time is None
@@ -459,6 +464,7 @@ def test__query_test_plan_templates_with_projections__returns_test_plan_template
459464
and test_plan_template.test_program is None
460465
and test_plan_template.estimated_duration_in_seconds is None
461466
and test_plan_template.system_filter is None
467+
and test_plan_template.dut_filter is None
462468
and test_plan_template.execution_actions is None
463469
and test_plan_template.file_ids is None
464470
and test_plan_template.workspace is None

0 commit comments

Comments
 (0)