1// Copyright 2022 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/longrunning/operations.proto"; 12import "chromiumos/storage_path.proto"; 13import "chromiumos/test/lab/api/dut.proto"; 14import "chromiumos/test/lab/api/ip_endpoint.proto"; 15import "google/protobuf/any.proto"; 16 17// Generic provisioning interface for CFT. Intended to be interchangeable across 18// services 19service GenericProvisionService { 20 // StartUp prepares the provision service by providing 21 // necessary input values for initialization prior to 22 // calling any other provision related service calls. 23 rpc StartUp(ProvisionStartupRequest) 24 returns (ProvisionStartupResponse); 25 26 // Install installs a specified OS on the DUT. 27 // It is intended to be a generic installation grpc that may be used by all 28 // OS flavors. 29 rpc Install(InstallRequest) 30 returns (longrunning.Operation) { 31 option (longrunning.operation_info) = { 32 response_type: "InstallResponse", 33 metadata_type: "InstallMetadata" 34 }; 35 } 36} 37 38 39// ProvisionStartupRequest provides a generic form for initializing 40// the provision services. This provides an alternative route for 41// the initialization rather than using the CLI arguments that 42// are used for starting the gRPC server. 43message ProvisionStartupRequest { 44 chromiumos.test.lab.api.Dut dut = 1; 45 chromiumos.test.lab.api.IpEndpoint dut_server = 2; 46 // Specific metadata to the individual provision services. 47 google.protobuf.Any metadata = 3; 48 // Address where servoNexus cft service can be reached. 49 chromiumos.test.lab.api.IpEndpoint servo_nexus_addr = 4; 50} 51 52// ProvisionStartupResponse provides a status message to signal 53// what the result of the startup call was. 54message ProvisionStartupResponse { 55 enum Status { 56 // In proto3, zero value fields are indistinguishable from unset fields, 57 // by design. They are not sent on the wire either. 58 // SHOULD NOT BE USED. 59 STATUS_UNSPECIFIED = 0; 60 STATUS_SUCCESS = 1; 61 STATUS_INVALID_REQUEST = 2; 62 STATUS_STARTUP_FAILED = 3; 63 } 64 Status status = 1; 65} 66 67message InstallResponse { 68 // When the status code is other than SUCCESS, details in Status message should be 69 // parsed for ErrorInfo message with the following Reasons as the reason. 70 enum Status { 71 // In proto3, zero value fields are indistinguishable from unset fields, 72 // by design. They are not sent on the wire either. 73 STATUS_UNSPECIFIED = 0; 74 // status code: INVALID_ARGUMENT 75 STATUS_INVALID_REQUEST = 1; 76 // status code: FAILED_PRECONDITION 77 STATUS_DUT_UNREACHABLE_PRE_PROVISION = 2; 78 // status code: FAILED_PRECONDITION 79 STATUS_DOWNLOADING_IMAGE_FAILED = 3; 80 // status code: DEADLINE_EXCEEDED 81 STATUS_PROVISIONING_TIMEDOUT = 4; 82 // status code: ABORTED 83 STATUS_PROVISIONING_FAILED = 5; 84 // status code: ABORTED 85 STATUS_DUT_UNREACHABLE_POST_PROVISION = 6; 86 // status code: ABORTED 87 STATUS_UPDATE_FIRMWARE_FAILED = 7; 88 // status code: ABORTED 89 STATUS_FIRMWARE_MISMATCH_POST_FIRMWARE_UPDATE = 8; 90 // status code: ABORTED 91 STATUS_DUT_UNREACHABLE_POST_FIRMWARE_UPDATE = 9; 92 // status code: ABORTED 93 STATUS_UPDATE_MINIOS_FAILED = 10; 94 // status code: ABORTED 95 STATUS_POST_PROVISION_SETUP_FAILED = 11; 96 // status code: ABORTED 97 STATUS_CLEAR_TPM_FAILED = 12; 98 // status code: ABORTED 99 STATUS_STABLIZE_DUT_FAILED = 13; 100 // status code: ABORTED 101 STATUS_INSTALL_DLC_FAILED = 14; 102 // status code: ABORTED 103 STATUS_PRE_PROVISION_SETUP_FAILED = 15; 104 // status code: ABORTED 105 STATUS_CIPD_PACKAGE_LOOKUP_FAILED = 16; 106 // status code: ABORTED 107 STATUS_CIPD_PACKAGE_FETCH_FAILED = 17; 108 // status code: ABORTED 109 STATUS_GS_UPLOAD_FAILED = 18; 110 // status code: ABORTED 111 STATUS_GS_DOWNLOAD_FAILED = 19; 112 // status code: SUCCESS 113 STATUS_SUCCESS = 20; 114 // status code: ABORTED 115 STATUS_IMAGE_MISMATCH_POST_PROVISION_UPDATE = 21; 116 } 117 Status status = 1; 118 119 // OS flavor specific metadata 120 google.protobuf.Any metadata = 2; 121 122 // Error/other messages to accompany the status 123 string message = 3; 124} 125 126// Metadata for long running operation 127message InstallMetadata { 128} 129 130message InstallRequest { 131 // Local or remote path to where the OS to be installed lives. 132 StoragePath image_path = 1; 133 // Prevents device reboot during system image provisioning. 134 bool prevent_reboot = 2; 135 // Provides a possible tar file to overwrite current install files. 136 StoragePath overwrite_payload = 3; 137 // Specific metadata to the install flavor. May be ignored if unneeded. 138 google.protobuf.Any metadata = 4; 139 // Provides partner specific metadata for install request. 140 PartnerMetadata partner_metadata = 5; 141 // Provides kernel prebuilts to replace the OS image's kernel. 142 KernelPrebuilts kernel_prebuilts = 6; 143} 144 145// PartnerMetadata determines any configuration around Partner settings. 146message PartnerMetadata { 147 // Account ID for the partner. 148 int64 account_id = 1; 149 // The bucket with the partner images and artifacts 150 string partner_gcs_bucket = 2; 151} 152 153// KernelPrebuilts contains paths to kernel artifacts to provision, replacing 154// the OS image's kernel. 155message KernelPrebuilts { 156 // PartitionImage defines an image to flash onto an OS partition. 157 message PartitionImage { 158 // The name of the OS partition to flash onto. 159 string partition_name = 1; 160 // Path to the new image file for that partition. 161 StoragePath image_path = 2; 162 } 163 repeated PartitionImage partition_images = 1; 164 // TODO: b/392692756 - Add whatever info is necessary for flashing specific 165 // modules onto the ramdisk. 166} 167