1// Copyright 2021 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_state.proto"; 12 13// NEXT TAG: 8 14// DutAttribute defines how attributes of a DUT are encoded into key-value pairs 15// for use in test coverage rules. 16message DutAttribute { 17 // Globally unique identifier for the attribute. Value must match: 18 // ^([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+$ 19 // 20 // That is, valid identifiers are alphanumberic strings with - joining them. 21 // 22 // Examples: 23 // valid 24 // attr-device-model 25 // attr-label-2 26 // 27 // invalid 28 // attr_device_model 29 // _attr-device-model 30 // attr-device-model- 31 message Id { 32 string value = 1; 33 } 34 Id id = 1; 35 36 // Alternate names to make the label available under (for migration and 37 // backwards compatibility support). No restrictions on name format. 38 repeated string aliases = 2; 39 40 // Definition of the attribute source data 41 oneof data_source { 42 FlatConfigSource flat_config_source = 3; 43 HwidSource hwid_source = 4; 44 TleSource tle_source = 7; 45 } 46 47 // Optional values and excluded values. 48 // If these are specified then if the attribute matches _any_ value in 49 // allowed_values and _zero_ values in exclude_values, the attribute is 50 // exposed with a True value and otherwise it is exposed with a False value. 51 // 52 // Values are compared case insensitively. 53 // 54 // Example: 55 // { 56 // "id" : { 57 // "value": "starts-with-a-but-not-atlas" 58 // }, 59 // "static_field" : { 60 // "field_specs" : ["program.platform.soc_arch"] 61 // }, 62 // "allowed_values" : ["asuka", "asurada"], 63 // "exclude_values" : ["atlas"] 64 // } 65 repeated string allowed_values = 5; 66 repeated string exclude_values = 6; 67 68 // A field spec is a chain of field names ending in a scalar or enum, excluding 69 // floating point values. 70 // eg: 'program.platform.soc_arch' 71 message FieldSpec { 72 string path = 1; 73 } 74 75 // FlatConfigSource specifies an attribute value that comes directly from the 76 // FlatConfig payload. Fields are tried in-order, taking the first one that 77 // matches. 78 message FlatConfigSource { 79 repeated FieldSpec fields = 1; 80 } 81 82 // HwidSource specifies an attribute value that's mediated by HWID server 83 // Fields are tried in-order, taking the first one that matches. 84 message HwidSource { 85 string component_type = 1; 86 repeated FieldSpec fields = 2; 87 } 88 89 // TleSource specifies the information for querying attribute values based on 90 // the definition provided at the TLE level. 91 message TleSource {} 92} 93 94message DutAttributeList { 95 repeated DutAttribute dut_attributes = 1; 96} 97 98// DutCriterion describes a groups of DUTs, based on DUT attributes. 99message DutCriterion { 100 // ID of the DUT attribute that must meet the criterion. 101 DutAttribute.Id attribute_id = 1; 102 103 // List of ANY acceptable values to match (OR logic is applied). 104 // Values are compared as simple strings case insensitively. 105 repeated string values = 2; 106} 107 108// DutTarget is a list of DutCriterion that must be met by the DUT executing 109// tests. All criteria must be met (AND logic is applied) by the DUT. 110message DutTarget { 111 repeated DutCriterion criteria = 1; 112 113 // Provisioning configuration for this device 114 ProvisionConfig provision_config = 2; 115} 116