1// Copyright 2019 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.config.api.test.tls; 8 9option go_package = "go.chromium.org/chromiumos/config/go/api/test/tls"; 10 11import "google/protobuf/empty.proto"; 12 13import "chromiumos/config/api/test/tls/dependencies/longrunning/operations.proto"; 14 15// Common lab services implemented on top of the wiring APIs. 16// 17// The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL 18// NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and 19// "OPTIONAL" in this document are to be interpreted as described in 20// RFC 2119. 21// 22// All clients SHOULD pass the gRPC metadata key request_trace_id with one 23// value. The value is a unique string that is associated with the method call 24// in metrics. Clients that do not pass request_trace_id MAY be rejected so that 25// they can be fixed. 26service Common { 27 // ExecDutCommand runs a command on a DUT. 28 // 29 // The working directory is /. 30 // A tty is not spawned for the command. 31 // The user and group is root. 32 // All signals have their default dispositions and are not masked. 33 // The umask is set to 0. 34 // 35 // The environment contains: 36 // 37 // TERM=dumb 38 // PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin 39 // LANG=en_US.UTF-8 40 // USER=root 41 // HOME=/root 42 // 43 // The environment MAY also contain SSH client variables. 44 // The environment SHALL NOT contain variables not mentioned above. 45 // 46 // If the stream is interrupted, the implementation MAY attempt to 47 // stop the command by sending SIGINT, SIGHUP, SIGTERM, or SIGKILL. 48 rpc ExecDutCommand(ExecDutCommandRequest) 49 returns (stream ExecDutCommandResponse); 50 51 // ProvisionDut installs a specified version of Chrome OS on the DUT, along 52 // with any specified DLCs. 53 // 54 // If the DUT is already on the specified version of Chrome OS, the OS will 55 // not be provisioned. 56 // 57 // If the DUT already has the specified list of DLCs, only the missing DLCs 58 // will be provisioned. 59 rpc ProvisionDut(ProvisionDutRequest) returns (google.longrunning.Operation) { 60 option (google.longrunning.operation_info) = { 61 response_type: "ProvisionDutResponse", 62 metadata_type: "ProvisionDutMetadata" 63 }; 64 } 65 66 // ProvisionLacros installs a specified version of Lacros on the DUT. 67 // 68 // If the DUT already has the specified version of Lacros, Lacros will not be 69 // provisioned. 70 rpc ProvisionLacros(ProvisionLacrosRequest) returns (google.longrunning.Operation) { 71 option (google.longrunning.operation_info) = { 72 response_type: "ProvisionLacrosResponse", 73 metadata_type: "ProvisionLacrosMetadata" 74 }; 75 } 76 77 // ProvisionAsh installs a specific version of AshChrome on the DUT. 78 // 79 rpc ProvisionAsh(ProvisionAshRequest) returns (google.longrunning.Operation) { 80 option (google.longrunning.operation_info) = { 81 response_type: "ProvisionAshResponse", 82 metadata_type: "ProvisionAshMetadata" 83 }; 84 } 85 86 // FetchCrashes gets a stream of all crash reports currently on the DUT. 87 // 88 // The stream returned may split up a crash over multiple 89 // `FetchCrashesResponse` protos. See the definition of that proto for 90 // details. 91 // 92 // This call is read-only: it doesn't delete the crashes that it reads. 93 rpc FetchCrashes(FetchCrashesRequest) returns (stream FetchCrashesResponse); 94 95 // CreateFakeOmaha starts a fake Omaha service on TLS and exposes the 96 // listened port to the DUT. 97 rpc CreateFakeOmaha(CreateFakeOmahaRequest) returns (FakeOmaha); 98 // DeleteFakeOmaha deletes the specified fake Omaha resource created by 99 // CreateFakeOmaha. 100 rpc DeleteFakeOmaha(DeleteFakeOmahaRequest) returns (google.protobuf.Empty); 101} 102 103message ExecDutCommandRequest { 104 // name is the resource name for the DUT. 105 // The DUT name is passed to the RTD when the RTD is started. 106 // It is not specified whether the name is the DUT hostname. 107 string name = 1; 108 // command is the command to run. 109 // If this contains no slashes, it is resolved using PATH. 110 // If this starts with /, it is used as an absolute path to the 111 // program to run. 112 // Otherwise, this is treated as a path relative to the working 113 // directory. 114 string command = 2; 115 // args are the arguments to pass to the command. 116 repeated string args = 3; 117 // stdin is passed to the command as the program's stdin. 118 // The stream does not support seeking. 119 // An empty bytes is not treated specially; if the command reads 120 // from stdin, it will receive zero bytes. 121 bytes stdin = 4; 122 // stdout indicates how to handle the command's stdout. 123 Output stdout = 5; 124 // stderr indicates how to handle the command's stderr. 125 Output stderr = 6; 126} 127message ExecDutCommandResponse { 128 message ExitInfo { 129 // status provides information about how the command process 130 // terminated. 131 // 132 // If the command failed to start, status is set to an arbitrary 133 // non-zero value. 134 // 135 // If signaled is set, status is set to the signal that caused 136 // the command to terminate. 137 // 138 // Otherwise, status is set to the exit status of the process. 139 // Exit statuses outside of 0 to 255 inclusive are not supported; 140 // they will be mapped to an arbitrary non-zero value. 141 // 142 // status is zero if and only if the process was successfully 143 // started and exited with a zero status. 144 int32 status = 1; 145 // signaled indicates whether the command exited due to a signal. 146 // If set, status contains the signal. 147 bool signaled = 2; 148 // started indicates whether the command was started. 149 bool started = 3; 150 // error_message provides a human readable explanation for some errors. 151 // This MUST NOT be inspected by programs. 152 string error_message = 4; 153 } 154 // exit_info contains exit information. 155 // This is set when the command has exited or failed to start. 156 // This is set on the last message in the response stream. 157 ExitInfo exit_info = 1; 158 // stdout contains the shell command's stdout output since the last 159 // response in the stream. 160 // The implementation MAY batch or delay output to later 161 // responses in the stream. 162 bytes stdout = 2; 163 // stderr contains the shell command's stderr output since the last 164 // response in the stream. 165 // The implementation MAY batch or delay output to later 166 // responses in the stream. 167 bytes stderr = 3; 168} 169 170// Output enumeration for ExecDutCommandRequest. 171enum Output { 172 // OUTPUT_PIPE means to collect output and return it. 173 OUTPUT_PIPE = 0; 174 // OUTPUT_STDOUT is a special value for stderr which means to merge stderr 175 // into stdout. 176 OUTPUT_STDOUT = 1; 177} 178 179message ProvisionDutRequest { 180 // name is the resource name for the DUT. 181 // The DUT name is passed to the RTD when the RTD is started. 182 // It is not specified whether the name is the DUT hostname. 183 string name = 1; 184 185 // TODO(crbug.com/1155247) Deprecate this nested message and replace with 186 // top level ChromeOsImage. 187 message ChromeOSImage { 188 option deprecated = true; 189 oneof path_oneof { 190 // gs_path_prefix is the GS path to where kernel, rootfs, and stateful 191 // images are located. If DLCs are to be provisioned, it must be a GS path 192 // that also has the dlc directory. 193 // Only gs://chromeos-image-archive bucket is supported. 194 // For example the format should be: 195 // - gs://chromeos-image-archive/eve-release/R86-13380.0.0 196 string gs_path_prefix = 1; 197 } 198 } 199 // image specifies the Chrome OS image with which to provision the DUT. 200 ChromeOSImage image = 2 [deprecated = true]; 201 202 // Reference DLCs developer documentation: 203 // https://source.corp.google.com/chromeos_public/src/platform2/dlcservice/docs/developer.md 204 message DLCSpec { 205 // id is the DLC ID which is a unique identifier. 206 // The DLC ID must follow a specific format that can be found in the DLC 207 // developer doc below. 208 string id = 1; 209 } 210 // dlc_specs specifies which DLCs to install on the DUT after provisioning. 211 repeated DLCSpec dlc_specs = 3; 212 // preserve_stateful specifies whether the stateful partition should be preserved during 213 // provisioning. If preserve_stateful is not set to true, the stateful partition is 214 // block-level wiped and reset during provisioning. 215 bool preserve_stateful = 4; 216 217 // target_build is the ChromeOS build to provision to. 218 ChromeOsImage target_build = 5; 219 220 // force_provision_os will always provision the OS. 221 bool force_provision_os = 6; 222 223 // prevent_reboot will skip all attempts to reboot during provision the OS. 224 bool prevent_reboot = 7; 225 226 // update_firmware will update OS bundled firmware during the provision. 227 // Please note this firmware update only update firmware that built in 228 // the target_build OS image and it is different from firmware provision 229 // which download and update a separate firmware image based on request. 230 bool update_firmware = 8; 231 232 // only_googler_ssh_keys controls if we provision googler ssh key only. 233 // If true, provision will only enable googler ssh key on the DUT. 234 // If false, provision will enable external & googler ssh key on the DUT. 235 bool only_googler_ssh_keys = 9; 236} 237 238message ProvisionDutResponse { 239 // When the status code is other than OK, details in Status message should be 240 // parsed for ErrorInfo message with the following Reasons as the reason. 241 enum Reason { 242 // status code: INVALID_ARGUMENT 243 REASON_INVALID_REQUEST = 0; 244 // status code: FAILED_PRECONDITION 245 REASON_DUT_UNREACHABLE_PRE_PROVISION = 1; 246 // status code: FAILED_PRECONDITION 247 REASON_DOWNLOADING_IMAGE_FAILED = 2; 248 // status code: DEADLINE_EXCEEDED 249 REASON_PROVISIONING_TIMEDOUT = 3; 250 // status code: ABORTED 251 REASON_PROVISIONING_FAILED = 4; 252 // status code: ABORTED 253 REASON_DUT_UNREACHABLE_POST_PROVISION = 5; 254 // status code: ABORTED 255 REASON_UPDATE_FIRMWARE_FAILED = 6; 256 // status code: ABORTED 257 REASON_FIRMWARE_MISMATCH_POST_FIRMWARE_UPDATE = 7; 258 // status code: ABORTED 259 REASON_DUT_UNREACHABLE_POST_FIRMWARE_UPDATE = 8; 260 } 261} 262 263message ProvisionDutMetadata { 264} 265 266message ProvisionLacrosRequest { 267 // name is the resource name for the DUT. 268 // The DUT name is passed to the RTD when the RTD is started. 269 // It is not specified whether the name is the DUT hostname. 270 string name = 1; 271 272 message LacrosImage { 273 oneof path_oneof { 274 // gs_path_prefix is the GS path prefix to where Lacros is located. 275 string gs_path_prefix = 1; 276 277 // device_file_prefix is the file URL in which Lacros is located on the 278 // DUT. This can refer to a local file for Lacros autoupdate testing. 279 string device_file_prefix = 2; 280 } 281 } 282 // image specifies the Lacros image with which to provision the DUT. 283 LacrosImage image = 2; 284 285 // override_version is the Lacros version string used to override when Lacros 286 // is provisioned from the image source in the |LacrosImage| to the component 287 // path. This is useful for simulating any desired version of Lacros for 288 // autoupdate testing. 289 // By default, if not specified, the actual version in the |LacrosImage| is 290 // used. 291 string override_version = 3; 292 293 // override_install_path changes the install location from the default 294 // imageloader component path. 295 // If not specified, it defaults to the imageloader component path. 296 string override_install_path = 4; 297} 298 299message ProvisionLacrosResponse { 300 // When the status code is other than OK, details in Status message should be 301 // parsed for ErrorInfo message with the following Reasons as the reason. 302 enum Reason { 303 // Failed as the ProvisionLacros request is invalid. 304 REASON_INVALID_REQUEST = 0; 305 // Failed to connect to the DUT prior to provisioning Lacros. 306 REASON_DUT_UNREACHABLE_PRE_PROVISION = 1; 307 // Failed to download the Lacros image or a timeout during download. 308 REASON_DOWNLOADING_IMAGE_FAILED = 2; 309 // Failed due to a timeout during the main Lacros provisioning. 310 // Excludes timeout during other steps. 311 REASON_PROVISIONING_TIMEDOUT = 3; 312 // General failure in Lacros provisioning. 313 REASON_PROVISIONING_FAILED = 4; 314 } 315} 316 317message ProvisionLacrosMetadata { 318} 319 320message ProvisionAshRequest { 321 // name is the resource name for the DUT. 322 // The DUT name is passed to the RTD when the RTD is started. 323 // It is not specified whether the name is the DUT hostname. 324 string name = 1; 325 326 message AshBundle { 327 oneof path_oneof { 328 // gs_bundle_path is the GS path to where AshChrome bundle is located. 329 string gs_bundle_path = 1; 330 } 331 } 332 // image specifies the Lacros image with which to provision the DUT. 333 AshBundle bundle = 2; 334} 335 336message ProvisionAshResponse { 337 // When the status code is other than OK, details in Status message should be 338 // parsed for ErrorInfo message with the following Reasons as the reason. 339 enum Reason { 340 // Failed as the ProvisionAsh request is invalid. 341 REASON_INVALID_REQUEST = 0; 342 // Failed to connect to the DUT prior to provisioning Ash. 343 REASON_DUT_UNREACHABLE_PRE_PROVISION = 1; 344 // Failed to download the Ash bundle or a timeout during download. 345 REASON_DOWNLOADING_BUNDLE_FAILED = 2; 346 // Failed due to a timeout during the main Ash provisioning. 347 // Excludes timeout during other steps. 348 REASON_PROVISIONING_TIMEDOUT = 3; 349 // General failure in Ash provisioning. 350 REASON_PROVISIONING_FAILED = 4; 351 } 352} 353 354message ProvisionAshMetadata { 355} 356 357message FetchCrashesRequest { 358 // dut is the resource name for the DUT from which to fetch crashes. 359 // The DUT name is passed to the RTD when the RTD is started. 360 // It is not specified whether the name is the DUT hostname. 361 string dut = 1; 362 // If true, fetch the core file. 363 // For uploads to the crash server, that should generally be false. 364 // If the crash file is likely to be used for manual debugging (e.g. on 365 // a manually-invoked test suite run), this might be true. 366 // Coredumps can be extremely large (even gigabytes), so if resource usage 367 // is a concern, this should probably be false. 368 bool fetch_core = 2; 369} 370 371// When this response is streamed, the first proto with a given crash ID will 372// always contain the CrashInfo. 373// Files and core dumps (if present) may be streamed. If they are, 374// subsequent protos with the same crash ID will follow, each containing a chunk 375// of file/coredump. To reassemble these, concatenate the bytes received from 376// each subsequent proto with a matching crash_id (concatenate blobs that have 377// matching crash_ids and keys). 378// Additional crashes may be reported in the same stream with a new crash ID. 379message FetchCrashesResponse { 380 // Crash id. unique only within responses to a single FetchCrashes request. 381 // Used to assemble multiple streamed |FetchCrashesResponse| protos into a 382 // single crash report. 383 int64 crash_id = 1; 384 oneof data { 385 // Full details of crash report. 386 CrashInfo crash = 2; 387 // Misc file (e.g. minidump, large binary log, etc) 388 CrashBlob blob = 3; 389 // Coredump. Present iff fetch_core was true in FetchCrashesRequest and 390 // the crash has a coredump. (kernel warnings, for example, do not have 391 // one). 392 bytes core = 4; 393 } 394} 395 396// The data in this proto matches the metadata from crash-reporter's meta files. 397// Sender::CreateCrashFormData puts this data into crash upload POST requests. 398// (See src/platform2/crash-reporter/crash_sender_util.cc.) 399// The names in this proto MUST match the names that crash-reporter uses so 400// that, when crashes are uploaded to the crash server, they are interpreted 401// as they are when crash-reporter uploads them. 402// Similarly, when this proto is converted into a POST request to send to the 403// crash server, the names must not be altered. 404message CrashInfo { 405 // Name of executable that crashed (e.g. "chrome") 406 string exec_name = 1; 407 // Product name (e.g. "Chrome_ChromeOS" or "ChromeOS") 408 string prod = 2; 409 // Product version (e.g. "12345.0.0") 410 string ver = 3; 411 // Crash signature (may not be populated for all crashes) 412 string sig = 4; 413 // The name of the integration test that was running when this crash 414 // happened, if any. 415 string in_progress_integration_test = 5; 416 // The name of the collector (e.g. chrome_collector, arc_collector) 417 string collector = 6; 418 // Additional key-value pairs of metadata (e.g. "crash_loop_mode = true"). 419 // These should be included in any POSTs to the crash server in a standard 420 // POST form, as seen in CreateCrashFormData. 421 // (despite the fact that this message is a subfield, it should be a flat 422 // structure in any POSTs). 423 repeated CrashMetadata fields = 7; 424} 425 426// Arbitrary text-only key-value pair corresponding to the key-value pairs in 427// crash report metadata files. 428message CrashMetadata { 429 // This value is a UTF8, human-readable, description of the data. 430 string key = 1; 431 // The value will be a human-readable string (e.g. "12345.0.0"), which must 432 // be valid UTF-8. 433 string text = 2; 434}; 435 436// Arbitrary non-UTF8 key-value pair from crash report metadata files. 437message CrashBlob { 438 // This value is a UTF8, human-readable, description of the data. 439 // This should be passed as the 'name' to the crash server. 440 // For instance, upload_file_fake_payload 441 string key = 1; 442 // The value is a blob (e.g. a file from sysfs or a minidump), which need 443 // not be valid UTF-8, and may be large. 444 bytes blob = 2; 445 // The basename of the file. Must be specified as the filename in data 446 // uploaded to the crash server. 447 // e.g. foo_binary.20201027.102345.0.dmp 448 string filename = 3; 449}; 450 451message ChromeOsImage { 452 oneof path_oneof { 453 // gs_path_prefix is the GS path to where the payloads are located. For 454 // example the format MAY be: 455 // gs://chromeos-image-archive/eve-release/R86-13380.0.0 456 string gs_path_prefix = 1; 457 } 458} 459 460message FakeOmaha { 461 // name is the resource name of the fake Omaha service. 462 // Format: fakeOmaha/{fake-omaha-id} 463 // The implementation MUST set it after creating the fake Omaha service. 464 // Clients SHOULD NOT set it. 465 string name = 1; 466 // dut is the resource name for the DUT. 467 // The DUT name is passed to the RTD when the RTD is started. 468 // It is not specified whether the name is the DUT hostname. 469 string dut = 2; 470 471 // target_build is the ChromeOS build that the fake Omaha service will serve 472 // payloads for. 473 ChromeOsImage target_build = 3; 474 475 message Payload { 476 enum Type { 477 TYPE_UNSPECIFIED = 0; 478 FULL = 1; 479 DELTA = 2; 480 } 481 // id is the id of the payload. It MAY be "ROOTFS" or a DLC id, etc. 482 string id = 1; 483 // type is the payload type, e.g. TYPE_FULL or TYPE_DELTA. 484 Type type = 2; 485 } 486 // payloads is the payloads can be served by the fake Omaha service. 487 repeated Payload payloads = 4; 488 // exposed_via_proxy indicates that the fake Omaha service is exposed to a 489 // DUT via a proxy server, instead of exposing to the DUT directly. So the 490 // service exposing won't be impacted by rebooting the DUT, disconnecting the 491 // DUT network, etc. 492 bool exposed_via_proxy = 5; 493 // critical_update instructs the fake Omaha created that the update is 494 // critical if set. 495 bool critical_update = 6; 496 // return_noupdate_starting indicates from which update check to start returning noupdate. 497 // It MUST be 0 or greater. 498 // When set to 0 (the default value), disables returning noupdate. 499 // If set to positive N, returns noupdate for the Nth check and for every 500 // check thereafter. 501 // For example, if set to 1, returns noupdate starting from the first check, 502 // i.e., always returns noupdate. 503 int32 return_noupdate_starting = 7; 504 // omaha_url is the current fake Omaha service URL which is reachable from 505 // the specified DUT. 506 // The URL can be used as input of the update engine client of the DUT. 507 // The implementation MUST set it after creating the fake Omaha service. 508 // Clients SHOULD NOT set it. 509 string omaha_url = 8; 510} 511 512message CreateFakeOmahaRequest { 513 // fake_omaha is the fake omaha service to be created. 514 FakeOmaha fake_omaha = 1; 515} 516 517message DeleteFakeOmahaRequest { 518 // The resource name of the fake Omaha service to stop. 519 // Format: fakeOmahaServices/{fake-omaha-id} 520 string name = 1; 521} 522