1// Copyright 2023 The ChromiumOS Authors 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5syntax = "proto3"; 6 7package chromiumos.test.api; 8 9option go_package = "go.chromium.org/chromiumos/config/go/test/api"; 10 11import "chromiumos/test/api/provision.proto"; 12import "chromiumos/test/api/test_suite.proto"; 13import "chromiumos/test/api/test_case_metadata.proto"; 14import "chromiumos/build/api/container_metadata.proto"; 15import "chromiumos/test/lab/api/dut.proto"; 16import "google/protobuf/any.proto"; 17import "google/protobuf/duration.proto"; 18import "chromiumos/test/api/test_execution_metadata.proto"; 19import "chromiumos/test/api/trv2_dynamic_updates.proto"; 20 21// CrosTestPlatform2 ... 22service CTPv2Service { 23 rpc RequestResolver(CTPv2Request) 24 returns (CTPv2Response); 25} 26 27// GenericFilter is what all the filters will implement as their RPC. 28service GenericFilterService { 29 rpc Execute(InternalTestplan) 30 returns (InternalTestplan); 31 32 rpc ExecuteStream(stream InternalTestplanFragment) 33 returns (stream InternalTestplanFragment); 34} 35 36// CTPv2Request ... 37// next value = 9; 38message CTPv2Request { 39 // TODO(b/319981532): Support multiple suite runs in ctpv2. Deprecate the 40 // fields below (1-7) when implementation is complete. 41 SuiteRequest suite_request = 1 [deprecated = true]; 42 repeated Targets targets = 2 [deprecated = true]; 43 repeated CTPFilter karbon_filters = 3 [deprecated = true]; 44 repeated CTPFilter koffee_filters = 4 [deprecated = true]; 45 string pool = 5 [deprecated = true]; 46 google.protobuf.Any scheduke_metadata = 6 [deprecated = true]; 47 repeated ScheduleTargets schedule_targets = 7 [deprecated = true]; 48 49 repeated CTPRequest requests = 8; 50} 51 52// Single CTPv2Request with one suite defining one or more targets. Filters 53// are build versioned so each suite will be capable of defining it's own 54// filters to execute. 55message CTPRequest { 56 SuiteRequest suite_request = 1; 57 // will be deprecated when #11 field is in use 100% 58 repeated ScheduleTargets schedule_targets = 2; 59 // Grouped targets allow setting and/or relationship between targets. 60 // inner i.e. {a, b} is OR relationship: a or b 61 // outer i.e. {a}, {b} is AND relationship: a and b 62 // [{shedTarget1, schedTarget2}, {shedTarget3, schedTarget4}] 63 // --> (shedTarget1 OR schedTarget2) AND (shedTarget3 OR schedTarget4) 64 repeated GroupedScheduleTargets grouped_schedule_targets = 11; 65 string pool = 7; 66 67 repeated CTPFilter karbon_filters = 3; 68 repeated CTPFilter koffee_filters = 4; 69 70 SchedulerInfo scheduler_info = 5; 71 72 google.protobuf.Any scheduler_metadata = 6; 73 74 // Instruct ctpv2 to construct a dynamic trv2 request object 75 // instead of a CftTestRequest (non-dynamic). 76 bool run_dynamic = 8; 77 78 // If true then the request is an AL type run in CTPv2 and TRv2. 79 bool is_al_run = 9; 80 81 // Encoded test job message that will be provided by ATP. 82 // CTP will use this to construct ctpv2 request. 83 // is_al_run must be set to true for this. 84 string encoded_atp_test_job_msg = 10; 85} 86 87message SchedulerInfo { 88 enum Scheduler { 89 // UNSPECIFIED scheduler 90 UNSPECIFIED = 0; 91 // Quota Scheduler 92 QSCHEDULER = 1; 93 // Scheduke 94 SCHEDUKE = 2; 95 // Will only be used for debugging and local mode. The BB requests will be 96 // printed to luci log but won't be scheduled. 97 PRINT_REQUEST_ONLY = 3; 98 } 99 100 Scheduler scheduler = 1; 101 102 // Will only be used when scheduler type is QSCHEDULER. 103 string qs_account = 2; 104} 105 106message SuiteRequest { 107 oneof suite_request { 108 TestSuite test_suite = 1; 109 Reserved hierarchical_plan = 2; 110 } 111 112 // Maximum duration for the entire request to be handled. 113 google.protobuf.Duration maximum_duration = 3; 114 // suite level test args. 115 string test_args = 4; 116 // Identifying suite name for analytics. 117 string analytics_name = 5; 118 // The total number of tests allowed to be used in a shard. 119 int64 max_in_shard = 6; 120 // Should run the suite via 3d or not. Default false. 121 bool ddd_suite = 7; 122 // The total number of retries that should be done to failed test(s). 123 // By default it will be 0 which means no retry. 124 int64 retry_count = 8; 125 // tags gives us a location to store decorations from the v1 proto without 126 // requiring a proto addition each time. 127 repeated string tags = 9; 128} 129 130message KeyValue { 131 string key = 1; 132 string value = 2; 133} 134 135message GroupedScheduleTargets { 136 repeated ScheduleTargets grouped_targets = 1; 137} 138 139// ScheduleTargets represents groups of targets for CTPv2. 140// Multi-DUT by design with targets length of 1 being single-dut. 141message ScheduleTargets { 142 repeated Targets targets = 1; 143} 144 145message Targets { 146 HWTarget hw_target = 1; 147 repeated SWTarget sw_targets = 2 [deprecated = true]; 148 SWTarget sw_target = 3; 149} 150 151message HWTarget { 152 oneof target { 153 LegacyHW legacy_hw = 1; 154 DDDHW ddd_hw = 2; 155 } 156} 157 158message SWTarget { 159 oneof sw_target { 160 LegacySW legacy_sw = 1; 161 DDDSW ddd_sw = 2; 162 } 163} 164 165message LegacySW { 166 string build = 1; 167 string gcs_path = 2; 168 repeated KeyValue key_values = 3; 169 string variant = 4; 170 171} 172 173// DDDSW is not yet defined. 174message DDDSW {} 175 176message LegacyHW { 177 string board = 1; 178 string model = 2; 179 // In the process of deprecation. Do not set. 180 string variant = 3 [deprecated = true]; 181 // In the process of deprecation. Do not set. 182 MultiDut multi_dut = 4 [deprecated = true]; 183 string pool = 5[deprecated = true];; 184 repeated string swarming_dimensions = 6; 185} 186 187message DDDHW{} 188 189message Pair { 190 string primary = 1; 191 string secondary = 2; 192} 193 194message MultiDut{ 195 Pair boards = 1; 196 Pair model = 2; 197} 198 199message CTPFilter { 200 // will be deprecated. do not set. 201 chromiumos.build.api.ContainerImageInfo container = 1 [deprecated = true]; 202 // will be deprecated. do not set. 203 repeated chromiumos.build.api.ContainerImageInfo dependent_containers = 2 [deprecated = true]; 204 205 google.protobuf.Any container_metadata = 3; 206 ContainerInfo container_info = 4; 207 // Dependent Containers signal that a container has a need to be networked with 208 // another. For example the filter is "container1", but needs to use "container2", 209 // as part of its execution. 210 ContainerInfo dependent_containers_info = 5; 211 212} 213 214message ContainerInfo { 215 chromiumos.build.api.ContainerImageInfo container = 1; 216 // binary name that will be used to invoke grpc endpoint of the container. 217 string binary_name = 2; 218 // binary args that act as configuration settings for the container. 219 repeated string binary_args = 3; 220} 221 222message Reserved {} 223 224message InternalTestplan { 225 repeated CTPTestCase test_cases = 1; 226 SuiteInfo suite_info = 2; 227} 228 229message InternalTestplanFragment { 230 bytes fragment = 1; 231} 232 233// Information to be populated by the filters. 234message CTPTestCase { 235 string name = 1; 236 TestCaseMetadata metadata = 2; 237 238 // HWRequirements are an AND field 239 repeated HWRequirements hw_requirements = 3 [deprecated = true]; 240 241 // SWRequirement impl is still tbd. 242 repeated SWRequirements sw_requirements = 4 [deprecated = true]; 243 repeated SchedulingUnitOptions scheduling_unit_options = 5; 244} 245 246message SuiteInfo { 247 SuiteMetadata suite_metadata = 1; 248 SuiteRequest suite_request = 2; 249} 250 251// Everything by CTPv2, less provision_info. 252// next value = 10; 253message SuiteMetadata { 254 repeated TargetRequirements target_requirements = 1[deprecated = true]; 255 repeated ScheduleTargetRequirements schedule_target_requirements = 4[deprecated = true]; 256 repeated string channels = 2; 257 string pool = 3; 258 chromiumos.test.api.ExecutionMetadata execution_metadata = 5; 259 // Scheduler info for this suite 260 SchedulerInfo scheduler_info = 6; 261 // Updates for the dynamic TRv2 request object. Updates to be applied 262 // after the default request generation occurs, and before scheduling. 263 // 264 // Note: Applied updates in order given. 265 repeated UserDefinedDynamicUpdate dynamic_updates = 7; 266 // will be deprecated when field #9 is being used in all filters 267 repeated SchedulingUnit scheduling_units = 8; 268 repeated SchedulingUnitOptions scheduling_unit_options = 9; 269} 270 271// ScheduleTargets represents groups of target requirements for CTPv2. 272// Multi-DUT by design with target requirements length of 1 being single-dut. 273message ScheduleTargetRequirements { 274 repeated TargetRequirements target_requirements = 1; 275} 276 277message TargetRequirements { 278 HWRequirements hw_requirements = 1; 279 // One HW, can have multiple SW configs., eg Cros + Lacros + FW + Kernel. 280 repeated LegacySW sw_requirements = 2 [deprecated = true]; 281 LegacySW sw_requirement = 3; 282 283} 284 285message SchedulingUnitOptions { 286 repeated SchedulingUnit scheduling_units = 1; 287 enum State { 288 REQUIRED = 0; 289 OPTIONAL = 1; 290 PREFERRED = 2; 291 BANNED = 3; 292 ONEOF = 4; 293 } 294 State state = 6; 295 repeated PublishKey publish_keys = 7; 296} 297 298message HWRequirements { 299 repeated SwarmingDefinition hw_definition = 1; 300 enum State { 301 REQUIRED = 0; 302 OPTIONAL = 1; 303 PREFERRED = 2; 304 BANNED = 3; 305 ONEOF = 4; 306 } 307 State state = 6; 308} 309 310message SchedulingUnit { 311 Target primary_target = 1; 312 repeated Target companion_targets = 2; 313 314 // Lookup Table for resolving placeholders set within the dynamic updates 315 // found under the suite metadata. Stores provision/DUT related 316 // information in regards to an entire SchedulingUnit. 317 map<string, string> dynamic_update_lookup_table = 3; 318 // Updates for the dynamic TRv2 request object. Updates to be applied 319 // after the SuiteMetadata dynamic updates are applied, and before scheduling. 320 // To be used only for specific situations in which normal dynamic updates 321 // won't work due to conflicting scenarios between SchedulingUnits. 322 // i.e. VM leasing requires no provisioning but needs a vm cache-server 323 // and a vm-dut container. 324 // 325 // Note: Applied updates in order given. 326 repeated UserDefinedDynamicUpdate secondary_dynamic_updates = 4; 327} 328 329message SWRequirements{} 330message ProvisionInfo { 331 // Should this be a generic string? Then we don't have to touch proto when new provision comes. 332 enum Type { 333 CROS = 0; 334 ANDROID = 1; 335 ROFW = 2; 336 } 337 InstallRequest install_request = 1; 338 string identifier = 2; 339 Type type = 3; 340} 341 342message Target { 343 SwarmingDefinition swarming_def =1; 344 LegacySW sw_req =2; 345} 346 347message SwarmingDefinition { 348 // This is effectively the UFS proto. This will be the universal language spoken by all filters. 349 chromiumos.test.lab.api.Dut dut_info = 1; 350 repeated ProvisionInfo provision_info = 2; 351 repeated string swarming_labels = 3; 352 string variant = 4; 353 // Lookup Table for resolving placeholders set within the dynamic updates 354 // found under the suite metadata. 355 map<string, string> dynamic_update_lookup_table = 5[deprecated = true]; 356}; 357 358// CTPv2Response... 359message CTPv2Response { 360 repeated CrosTestRunnerRequest test_requests = 1; 361} 362 363message CrosTestRunnerRequest {} 364 365message PublishKey { 366 string subject = 1; 367 map<string, string> key_values = 2; 368} 369