Documentation
¶
Index ¶
- Constants
- Variables
- func AddPrefix(collection, entity string) string
- func AppendUniqueStrings(des []string, src ...string) []string
- func BQTransientErrorRetries() retry.Factory
- func CheckPermission(ctx context.Context, perm realms.Permission, realm string) error
- func ContainsAnyStrings(list []string, inputs ...string) bool
- func CurrentUser(ctx context.Context) string
- func ExecuteRequest(ctx context.Context, hc *http.Client, req *http.Request, value proto.Message) error
- func FormatDHCPHostname(old string) string
- func FormatDHCPHostnames(names []string) []string
- func FormatDeploymentRecord(hostname, serialNumber string) *ufspb.MachineLSEDeployment
- func FormatIP(vlanName, ipAddress string, reserve, occupied bool) *ufspb.IP
- func FormatInputNames(names []string) []string
- func FormatResourceName(old string) string
- func GetATLLabName(raw string) string
- func GetBrowserLabName(raw string) string
- func GetCrOSLabName(raw string) string
- func GetDatastoreNamespace(ctx context.Context) string
- func GetDeployBBBuilderName(hostname string) string
- func GetDevboardType(b *ufspb.Devboard) string
- func GetHiveForDut(hostname string, hive string) string
- func GetHostnameWithNoHostPrefix(suffix string) string
- func GetIPName(vlanName, ipv4Str string) string
- func GetIncomingCtxNamespace(ctx context.Context) string
- func GetNamespaceFromCtx(ctx context.Context) string
- func GetNewNicNameForRenameMachine(oldNicName, oldMachineName, newMachineName string) string
- func GetNicNameForHost(hostname string) string
- func GetPageSize(pageSize int32) int32
- func GetPrefix(resourceName string) string
- func GetRackHostname(rackName string) string
- func GetResourcePrefix(message proto.Message) (string, error)
- func GetSatlabForPartnersRealm(zone string) string
- func GetStateDescription(state string) string
- func GetSuffixAfterSeparator(name, seprator string) string
- func GetValidRealmName(realm string) string
- func IPv4IntToStr(ipAddress uint32) string
- func IPv4StrToInt(ipAddress string) (uint32, error)
- func IPv4ToUint32(ip net.IP) (uint32, error)
- func Int32ToStr(v int32) string
- func Int64ToStr(v int64) string
- func IsAntennaConnection(antennaConnection string) bool
- func IsAssetType(assetType string) bool
- func IsAttachedDeviceType(deviceType string) bool
- func IsBrowserLegacyAsset(name string) bool
- func IsCableType(cableType string) bool
- func IsCameraType(cameraType string) bool
- func IsChameleonType(chameleonType string) bool
- func IsChromeLegacyHost(name string) bool
- func IsChromePerfHost(name string) bool
- func IsChromiumLegacyHost(name string) bool
- func IsClankHost(name string) bool
- func IsClientNamespace(namespace string) bool
- func IsDevboardType(deviceType string) bool
- func IsFacing(facing string) bool
- func IsInBrowserZone(name string) bool
- func IsInChromePerfPool(pools []string) bool
- func IsInChromePool(pools []string) bool
- func IsInChromiumPool(pools []string) bool
- func IsInOSZone(name string) bool
- func IsInternalError(err error) bool
- func IsLicenseType(licenseType string) bool
- func IsLight(light string) bool
- func IsLogicalZone(logicalZone string) bool
- func IsMacFormatValid(userMac string) error
- func IsModemType(modemType string) bool
- func IsNetworkType(networkType string) bool
- func IsNotFoundError(err error) bool
- func IsRPMType(rpmType string) bool
- func IsResourceType(resourceType string) bool
- func IsRouter(router string) bool
- func IsSFPZone(zone string) bool
- func IsSIMType(simType string) bool
- func IsSchedulingUnitExposeType(schedulingUnitExposeType string) bool
- func IsSchedulingUnitType(schedulingUnitType string) bool
- func IsUFSState(state string) bool
- func IsUFSZone(zone string) bool
- func LabToZone(lab string) ufspb.Zone
- func Min(a, b int) int
- func ParseATLTopology(data *sheets.Spreadsheet) (map[string]*ufspb.Vlan, []*ufspb.Vlan)
- func ParseMac(userMac string) (string, error)
- func ParseVlan(vlanName, cidr, freeStartIPStr, freeEndIPStr string) ([]*ufspb.IP, int, string, string, int, error)
- func ProtoEqual(i, j proto.Message) bool
- func PublishHaRTAssetInfoRequest(ctx context.Context, assets []string) (err error)
- func RemoveGivenPrefix(msg, prefix string) string
- func RemovePrefix(name string) string
- func RemoveStatePrefix(state string) string
- func RemoveStringEntry(slice []string, entry string) []string
- func RemoveZonePrefix(zone string) string
- func SchedulingUnitDutState(states []string) string
- func SetupDatastoreNamespace(ctx context.Context, namespace string) (context.Context, error)
- func StringifyIP(ip net.IP) string
- func ToAntennaConnection(antennaConnection string) chromeosLab.Wifi_AntennaConnection
- func ToAssetType(assetType string) ufspb.AssetType
- func ToCableType(cableType string) chromeosLab.CableType
- func ToCameraType(cameraType string) chromeosLab.CameraType
- func ToChameleonType(chameleonType string) chromeosLab.ChameleonType
- func ToFacing(facing string) chromeosLab.Camerabox_Facing
- func ToLicenseType(licenseType string) chromeosLab.LicenseType
- func ToLight(light string) chromeosLab.Camerabox_Light
- func ToLogicalZone(logicalZone string) ufspb.LogicalZone
- func ToModemType(modemType string) chromeosLab.ModemType
- func ToNetworkType(networkType string) chromeosLab.NetworkProvider
- func ToRPMType(rpmType string) chromeosLab.OSRPM_Type
- func ToResourceType(resourceType string) ufspb.ResourceType
- func ToRouter(router string) chromeosLab.Wifi_Router
- func ToSIMType(simType string) chromeosLab.SIMType
- func ToSchedulingUnitExposeType(schedulingUnitExposeType string) ufspb.SchedulingUnit_ExposeType
- func ToSchedulingUnitType(schedulingUnitType string) ufspb.SchedulingUnitType
- func ToUFSAttachedDeviceType(deviceType string) ufspb.AttachedDeviceType
- func ToUFSDeploymentEnv(env string) ufspb.DeploymentEnv
- func ToUFSDept(zone string) string
- func ToUFSDevicePhase(devicePhase string) ufsmfg.ManufacturingConfig_Phase
- func ToUFSDeviceType(devicetype string) ufspb.ChromeOSDeviceType
- func ToUFSRealm(zone string) string
- func ToUFSState(state string) ufspb.State
- func ToUFSZone(zone string) ufspb.Zone
- func Uint32Iter(start uint32, end uint32, f func(uint32) error) error
- func ValidAntennaConnectionStr() []string
- func ValidAssetTypeStr() []string
- func ValidAttachedDeviceTypeStr() []string
- func ValidCableTypeStr() []string
- func ValidCameraTypeStr() []string
- func ValidChameleonTypeStr() []string
- func ValidClientNamespaceStr() []string
- func ValidDeploymentEnvStr() []string
- func ValidDevboardTypeStr() []string
- func ValidDeviceTypeStr() []string
- func ValidFacingStr() []string
- func ValidLicenseTypeStr() []string
- func ValidLightStr() []string
- func ValidLogicalZoneStr() []string
- func ValidModemTypeStr() []string
- func ValidRPMTypeStr() []string
- func ValidResourceTypeStr() []string
- func ValidRouterStr() []string
- func ValidSchedulingUnitExposeTypeStr() []string
- func ValidSchedulingUnitTypeStr() []string
- func ValidSimTypeStr() []string
- func ValidStateStr() []string
- func ValidZoneStr() []string
- func ValidateTags(tags []string) bool
- type DHCPConf
- type HTTPError
- type Key
- type PSRequest
Constants ¶
const ( ColonSeparator string = ":" UnderscoreSeparator string = "_" Lab string = "lab" ATL string = "atl" ACS string = "acs" Browser string = "browser" CrOS string = "cros" // https://cloud.google.com/datastore/docs/concepts/limits OperationPageSize int = 500 // Version Key format of inventory TimestampBasedVersionKeyFormat string = "2006-01-02 15:04:05.000 UTC" // Prefix before zone enum string vals ZonePrefix string = "ZONE" // Prefix before all Satlab for Partner associated zones SfPPrefix string = "SFP" )
message for filtering
const ( // AssetCollection refers to the prefix of the corresponding resource. AssetCollection string = "assets" // MachineCollection refers to the prefix of the corresponding resource. MachineCollection string = "machines" // RackCollection refers to the prefix of the corresponding resource. RackCollection string = "racks" // VMCollection refers to the prefix of the corresponding resource. VMCollection string = "vms" // ChromePlatformCollection refers to the prefix of the corresponding resource. ChromePlatformCollection string = "chromeplatforms" // MachineLSECollection refers to the prefix of the corresponding resource. MachineLSECollection string = "machineLSEs" // MachineLSEDeploymentCollection refers to the prefix of the corresponding resource. MachineLSEDeploymentCollection string = "machineLSEDeployments" // HostCollection refers to the prefix of the corresponding resource. HostCollection string = "hosts" // RackLSECollection refers to the prefix of the corresponding resource. RackLSECollection string = "rackLSEs" // NicCollection refers to the prefix of the corresponding resource. NicCollection string = "nics" // KVMCollection refers to the prefix of the corresponding resource. KVMCollection string = "kvms" // RPMCollection refers to the prefix of the corresponding resource. RPMCollection string = "rpms" // DracCollection refers to the prefix of the corresponding resource. DracCollection string = "dracs" // SwitchCollection refers to the prefix of the corresponding resource. SwitchCollection string = "switches" // VlanCollection refers to the prefix of the corresponding resource. VlanCollection string = "vlans" // MachineLSEPrototypeCollection refers to the prefix of the corresponding resource. MachineLSEPrototypeCollection string = "machineLSEPrototypes" // RackLSEPrototypeCollection refers to the prefix of the corresponding resource. RackLSEPrototypeCollection string = "rackLSEPrototypes" // DHCPCollection refers to the prefix of the dhcp config id in change history DHCPCollection string = "dhcps" // IPCollection refers to the prefix of the ip id in change history IPCollection string = "ips" // StateCollection refers to the prefix of the states id in change history StateCollection string = "states" // CachingServiceCollection refers to the prefix of the CachingService. CachingServiceCollection string = "cachingservices" // DutStateCollection refers to the prefix of the DutStates id in change history DutStateCollection string = "dutstates" // SchedulingUnitCollection refers to the prefix of the SchedulingUnit. SchedulingUnitCollection string = "schedulingunits" // DefaultWifiCollection refers to the prefix of the DefaultWifi. DefaultWifiCollection string = "defaultwifis" // DeviceLabelsCollection refers to the prefix of the DeviceLabels. DeviceLabelsCollection string = "devicelabels" // MaxPageSize maximum page size for list operations MaxPageSize int32 = 1000 // NoHostPrefix is the prefix string for generating a fake non-existing hostname NoHostPrefix string = "no-host-yet-" )
const ( ChromiumPool = "chromium" ChromePool = "chrome" ChromiumNamePrefix = "chromium-" ChromeNamePrefix = "chrome-" ChromeClankPrefix = "chrome-clank-" ChromePerfNamePrefix = "chrome-perf-" ChromePerfWaterfallPrefix = "chrome-perf-waterfall-" ChromePerfPinpointPrefix = "chrome-perf-pinpoint-" )
Browser-related consts
const AcsLabAdminRealm = "@internal:ufs/os-acs"
AcsLabAdminRealm is the admin realm for acs lab.
const AtlLabAdminRealm = "@internal:ufs/os-atl"
AtlLabAdminRealm is the admin realm for atl lab.
const AtlLabChromiumAdminRealm = "@internal:ufs/os-atl-chromium"
AtlLabChromiumAdminRealm is the admin realm for chromium DUTs in atl lab.
const BrowserLabAdminRealm = "@internal:ufs/browser"
BrowserLabAdminRealm is the admin realm for browser lab.
const ChromeOSLUCIProject = "chromeos"
ChromeOSLUCIProject where ChromeOS LUCI infra lives
const OldBrowserLabAdminRealm = "chromium:ufs/browser-admin"
OldBrowserLabAdminRealm is the Old realm for browser lab
If a client sends this realm, replace it with BrowserLabAdminRealm
const SatLabInternalUserRealm = "@internal:ufs/satlab-internal-users"
SatLabInternalUserRealm is realm for satlab internal users.
Variables ¶
var ( ZoneFilterName string = "zone" ZonesFilterName string = "zones" RackFilterName string = "rack" MachineFilterName string = "machine" HostFilterName string = "host" NicFilterName string = "nic" DracFilterName string = "drac" KVMFilterName string = "kvm" KVMPortFilterName string = "kvmport" MacAddressFilterName string = "mac" RPMFilterName string = "rpm" RPMPortFilterName string = "rpmport" RPMTypeFilterName string = "rpmtype" SwitchFilterName string = "switch" SwitchPortFilterName string = "switchport" ServoFilterName string = "servo" ServoTypeFilterName string = "servotype" TagFilterName string = "tag" ChromePlatformFilterName string = "platform" MachinePrototypeFilterName string = "machineprototype" RackPrototypeFilterName string = "rackprototype" VlanFilterName string = "vlan" StateFilterName string = "state" IPV4FilterName string = "ipv4" IPV4StringFilterName string = "ipv4str" OccupiedFilterName string = "occupied" ManufacturerFilterName string = "man" FreeVMFilterName string = "free" ResourceTypeFilterName string = "resourcetype" OSVersionFilterName string = "osversion" OSFilterName string = "os" VirtualDatacenterFilterName string = "vdc" ModelFilterName string = "model" BuildTargetFilterName string = "target" BoardFilterName string = "board" DeviceTypeFilterName string = "devicetype" PhaseFilterName string = "phase" AssetTypeFilterName string = "assettype" SubnetsFilterName string = "subnets" PoolsFilterName string = "pools" DeploymentIdentifierFilterName string = "deploymentidentifier" DeploymentEnvFilterName string = "deploymentenv" MachineLSEsFilterName string = "duts" TypeFilterName string = "type" SerialNumberFilterName string = "serialnumber" BbnumFilterName string = "bbnum" AssetTagFilterName string = "assettag" CpuCoresFilterName string = "cpucores" MemoryFilterName string = "memory" StorageFilterName string = "storage" LogicalZoneFilterName string = "logicalzone" GPNFilterName string = "gpn" AssetType string = "assettype" CommittishFilterName string = "commitsh" HiveFilterName string = "hive" )
Filter names for indexed properties in datastore for different entities
var ( // OSNamespace os namespace to be set in client context metadata. OS data is stored in os namespace in the datastore. OSNamespace = "os" // BrowserNamespace browser namespace to be set in client context metadata. Browser data is stored in default namespace in the datastore. BrowserNamespace = "browser" // OSPartnerNamespace partner namespace to be set in client context metadata. Partner data is stored in partner namespace in the datastore. // This is expected to hold and be accessible to non-Google entities (subject to RPC and zone ACLs) working on ChromeOS. OSPartnerNamespace = "os-partner" // Namespace key in the incoming context metadata Namespace = "namespace" )
Namespace namespace to be set by clients in context metadata This will be used to set the actual datastore namespace in the context
var ( // ConfigurationsGet allows to get configuration resources. ConfigurationsGet = realms.RegisterPermission("ufs.configurations.get") // ConfigurationsList allows to list configuration resources. ConfigurationsList = realms.RegisterPermission("ufs.configurations.list") // ConfigurationsCreate allows to create configuration resources. ConfigurationsCreate = realms.RegisterPermission("ufs.configurations.create") // ConfigurationUpdate allows to update configuration resources. ConfigurationsUpdate = realms.RegisterPermission("ufs.configurations.update") // ConfigurationsDelete allows to delete configuration resources. ConfigurationsDelete = realms.RegisterPermission("ufs.configurations.delete") // RegistrationsGet allows to get registration resources. RegistrationsGet = realms.RegisterPermission("ufs.registrations.get") // RegistrationsList allows to list registration resources. RegistrationsList = realms.RegisterPermission("ufs.registrations.list") // RegistrationsCreate allows to create registration resources. RegistrationsCreate = realms.RegisterPermission("ufs.registrations.create") // RegistrationsUpdate allows to update registration resources. RegistrationsUpdate = realms.RegisterPermission("ufs.registrations.update") // RegistrationsDelete allows to delete registration resources. RegistrationsDelete = realms.RegisterPermission("ufs.registrations.delete") // InventoriesGet allows to get inventory resources. InventoriesGet = realms.RegisterPermission("ufs.inventories.get") // InventoriesList allows to list inventory resources. InventoriesList = realms.RegisterPermission("ufs.inventories.list") // InventoriesCreate allows to create inventory resources. InventoriesCreate = realms.RegisterPermission("ufs.inventories.create") // InventoriesUpdate allows to update inventory resources. InventoriesUpdate = realms.RegisterPermission("ufs.inventories.update") // InventoriesDelete allows to delete inventory resources. InventoriesDelete = realms.RegisterPermission("ufs.inventories.delete") // NetworksGet allows to get network resources. NetworksGet = realms.RegisterPermission("ufs.networks.get") // NetworksList allows to list network resources. NetworksList = realms.RegisterPermission("ufs.networks.list") // NetworksCreate allows to create network resources. NetworksCreate = realms.RegisterPermission("ufs.networks.create") // NetworksUpdate allows to update network resources. NetworksUpdate = realms.RegisterPermission("ufs.networks.update") // NetworksDelete allows to delete network resources. NetworksDelete = realms.RegisterPermission("ufs.networks.delete") // ResourcesImport allows to import resource resources. ResourcesImport = realms.RegisterPermission("ufs.resources.import") )
UFS registered permissions in process registry
var (
ChromePerfPools = []string{"chrome.tests.pinpoint", "chrome.tests.perf"}
)
var ClientToDatastoreNamespace = map[string]string{ BrowserNamespace: "", OSNamespace: OSNamespace, OSPartnerNamespace: OSPartnerNamespace, }
ClientToDatastoreNamespace refers a map between client namespace(set in context metadata) to actual datastore namespace
var PoolNameRegex = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9_-]*$`)
PoolNameRegex ensures that a pool name is valid.
var ServoV3HostnameRegex = regexp.MustCompile(`.*-servo`)
ServoV3HostnameRegex is used to identify servo V3 hosts.
var SkipRealmsCheck = false
SkipRealmsCheck flag to skip realms check
var StateToDescription = map[string]string{
"registered": "Needs deploy",
"deployed_pre_serving": "Deployed but not placed in prod",
"deployed_testing": "Deployed to the prod, but for testing",
"serving": "Deployed to the prod, serving",
"needs_reset": "Deployed to the prod, but required cleanup and verify",
"needs_repair": "Deployed to the prod, needs repair",
"repair_failed": "Deployed to the prod, failed to be repaired in previous step and requires new repair attempt",
"disabled": "Deployed to the prod, but disabled",
"reserved": "Deployed to the prod, but reserved (e.g. locked)",
"decommissioned": "Decommissioned from the prod, but still lives in UFS record",
"deploying": "Deploying the resource with required configs just before it is READY",
"ready": "Resource is ready for use or free to use",
"build": "Resource is in the process of being built out or assembled",
"missing": "Resource is not detected and has gone missing",
}
StateToDescription refers a map between a State to its description.
var StrToAntennaConnection = map[string]string{
"unknown": "CONN_UNKNOWN",
"conductive": "CONN_CONDUCTIVE",
"ota": "CONN_OTA",
}
StrToAntennaConnection refers a map between a string to a AntennaConnection map.
var StrToCableType = map[string]string{
"invalid": "CABLE_INVALID",
"audiojack": "CABLE_AUDIOJACK",
"usbaudio": "CABLE_USBAUDIO",
"usbprinting": "CABLE_USBPRINTING",
"hdmiaudio": "CABLE_HDMIAUDIO",
}
StrToCableType refers a map between a string to a CableType map.
var StrToCameraType = map[string]string{
"invalid": "CAMERA_INVALID",
"huddly": "CAMERA_HUDDLY",
"ptzpro2": "CAMERA_PTZPRO2",
}
StrToCameraType refers a map between a string to a CameraType map.
var StrToChameleonType = map[string]string{
"invalid": "CHAMELEON_TYPE_INVALID",
"dp": "CHAMELEON_TYPE_DP",
"hdmi": "CHAMELEON_TYPE_HDMI",
}
StrToChameleonType refers a map between a string to a ChameleonType map.
var StrToDevicePhase = map[string]string{ "INVALID": ufsmfg.ManufacturingConfig_PHASE_INVALID.String(), "EVT": ufsmfg.ManufacturingConfig_PHASE_EVT.String(), "EVT2": ufsmfg.ManufacturingConfig_PHASE_EVT2.String(), "DVT": ufsmfg.ManufacturingConfig_PHASE_DVT.String(), "DVT2": ufsmfg.ManufacturingConfig_PHASE_DVT2.String(), "PVT": ufsmfg.ManufacturingConfig_PHASE_PVT.String(), "PVT2": ufsmfg.ManufacturingConfig_PHASE_PVT2.String(), "PVT3": ufsmfg.ManufacturingConfig_PHASE_PVT3.String(), "MP": ufsmfg.ManufacturingConfig_PHASE_MP.String(), }
StrToDevicePhase refers to a map between a string and the ManufacturingConfig Phase type.
var StrToFacing = map[string]string{
"unknown": "FACING_UNKNOWN",
"back": "FACING_BACK",
"front": "FACING_FRONT",
"nocamera": "FACING_NOCAMERA",
}
StrToFacing refers a map between a string to a Facing map.
var StrToLicenseType = map[string]string{
"invalid": "LICENSE_TYPE_UNSPECIFIED",
"windows10pro": "LICENSE_TYPE_WINDOWS_10_PRO",
"msofficestd": "LICENSE_TYPE_MS_OFFICE_STANDARD",
}
StrToLicenseType refers a map between a string to a LicenseType map.
var StrToLight = map[string]string{
"unknown": "LIGHT_UNKNOWN",
"led": "LIGHT_LED",
"noled": "LIGHT_NOLED",
}
StrToLight refers a map between a string to a Light map.
var StrToLogicalZone = map[string]string{
"unspecified": "LOGICAL_ZONE_UNSPECIFIED",
"drillzone_sfo36": "LOGICAL_ZONE_DRILLZONE_SFO36",
}
StrToLogicalZone refers a map between a string to a LogicalZone map.
var StrToRPMType = map[string]string{
"unknown": "TYPE_UNKNOWN",
"sentry": "TYPE_SENTRY",
"ip9850": "TYPE_IP9850",
"cpi": "TYPE_CPI",
}
StrToRPMType refers a map between a string to a OSRPM_Type map.
var StrToResourceType = genStrToResourceType()
StrToResourceType refers a map between a string to a ResourceType map.
var StrToRouter = map[string]string{
"unspecified": "ROUTER_UNSPECIFIED",
"80211ax": "ROUTER_802_11AX",
}
StrToRouter refers a map between a string to a Router map.
var StrToSIMType = map[string]int32{
"SIM_UNKNOWN": 0,
"SIM_PHYSICAL": 1,
"SIM_DIGITAL": 2,
}
StrToSIMType refers a map between sim type and and enum value.
var StrToSchedulingUnitExposeType = map[string]string{
"default": "DEFAULT",
"default_plus_primary": "DEFAULT_PLUS_PRIMARY",
"strictly_primary_only": "STRICTLY_PRIMARY_ONLY",
}
StrToSchedulingUnitExposeType refers a map between a string to a UFS defined map.
var StrToSchedulingUnitType = map[string]string{
"invalid": "SCHEDULING_UNIT_TYPE_INVALID",
"all": "SCHEDULING_UNIT_TYPE_ALL",
"individual": "SCHEDULING_UNIT_TYPE_INDIVIDUAL",
}
StrToSchedulingUnitType refers a map between a string to a UFS defined map.
var StrToUFSAttachedDeviceType = map[string]string{
"unspecified": "ATTACHED_DEVICE_TYPE_UNSPECIFIED",
"apple_phone": "ATTACHED_DEVICE_TYPE_APPLE_PHONE",
"android_phone": "ATTACHED_DEVICE_TYPE_ANDROID_PHONE",
"apple_tablet": "ATTACHED_DEVICE_TYPE_APPLE_TABLET",
"android_tablet": "ATTACHED_DEVICE_TYPE_ANDROID_TABLET",
"devboard": "ATTACHED_DEVICE_TYPE_DEVBOARD",
"jetstream": "ATTACHED_DEVICE_TYPE_JETSTREAM",
}
StrToUFSAttachedDeviceType refers a map between a string to a UFS defined map.
var StrToUFSDevboardType = map[string]string{
"andreiboard": "unifiedfleet.api.v1.models.Andreiboard",
"icetower": "unifiedfleet.api.v1.models.Icetower",
"dragonclaw": "unifiedfleet.api.v1.models.Dragonclaw",
}
StrToUFSDevboardType refers a map between a string to a UFS defined map.
var StrToUFSDeviceType = map[string]string{
"chromebook": "DEVICE_CHROMEBOOK",
"labstation": "DEVICE_LABSTATION",
"servo": "DEVICE_SERVO",
"unspecified": "CHROME_OS_DEVICE_TYPE_UNSPECIFIED",
}
StrToUFSDeviceType refers a map between a string to a UFS defined map.
var StrToUFSState = map[string]string{
"registered": "STATE_REGISTERED",
"deployed_pre_serving": "STATE_DEPLOYED_PRE_SERVING",
"deployed_testing": "STATE_DEPLOYED_TESTING",
"serving": "STATE_SERVING",
"needs_reset": "STATE_NEEDS_RESET",
"needs_repair": "STATE_NEEDS_REPAIR",
"repair_failed": "STATE_REPAIR_FAILED",
"disabled": "STATE_DISABLED",
"reserved": "STATE_RESERVED",
"decommissioned": "STATE_DECOMMISSIONED",
"deploying": "STATE_DEPLOYING",
"ready": "STATE_READY",
"build": "STATE_BUILD",
"missing": "STATE_MISSING",
}
StrToUFSState refers a map between a string to a UFS defined state map.
var StrToUFSZone = genStrToUFSZone()
StrToUFSZone refers a map between a string to a UFS defined map.
Functions ¶
func AppendUniqueStrings ¶
AppendUniqueStrings returns a slice with unique elements such that all the des elements are appended to src.
func BQTransientErrorRetries ¶
BQTransientErrorRetries returns a retry.Factory to use on transient errors
func CheckPermission ¶
CheckPermission checks if the user has permission in the realm
return error if user doesnt have permission or unable to check permission in realm else returns nil
func ContainsAnyStrings ¶
ContainsAnyStrings returns true if at least one of the inputs is in list.
func CurrentUser ¶
CurrentUser returns the current user
func ExecuteRequest ¶
func FormatDHCPHostname ¶
FormatDHCPHostname formats a name which will be a dhcp host
func FormatDHCPHostnames ¶
FormatDHCPHostnames formats a given array of resource names which could be used as dhcp hostnames
func FormatDeploymentRecord ¶
func FormatDeploymentRecord(hostname, serialNumber string) *ufspb.MachineLSEDeployment
FormatDeploymentRecord initialize a MachineLSE deployment record object by hostname and given serial number.
func FormatInputNames ¶
FormatInputNames formats a given array of resource names
func FormatResourceName ¶
FormatResourceName formats the resource name
func GetATLLabName ¶
GetATLLabName returns a resource name with atl prefix and a given user-specified raw name.
func GetBrowserLabName ¶
GetBrowserLabName return a resource name with browser prefix and a given user-specified raw name.
func GetCrOSLabName ¶
GetCrOSLabName returns a resource name with ChromeOS prefix and a given user-specified raw name.
func GetDatastoreNamespace ¶
GetDatastoreNamespace returns the namespace used in context
func GetDeployBBBuilderName ¶
GetDeployBBBuilderName returns builder name for deployment based on configs.
The deploy builder is decided in https://source.corp.google.com/h/chrome-internal/chromeos/codesearch/+/main:infra/config/lab_platform/labpack/main.star;l=96;bpv=1 The name is different for different swarming pool, swarming pool is decided by bot prefix, and bot prefix is decided by hostname prefix.
func GetDevboardType ¶
GetDevboardType returns the board type string for a devboard.
func GetHiveForDut ¶
GetHiveForDut returns the hive value for a DUT.
if the hive is not store in UFS, hive value is derived from the DUT hostname. TODO(b:296635614) use UFS stored data instead of hostname to determine hive.
func GetHostnameWithNoHostPrefix ¶
GetHostnameWithNoHostPrefix generates a hostname with NoHostPrefix.
func GetIncomingCtxNamespace ¶
GetIncomingCtxNamespace parses namespace in incoming context passed to UFS
The user must explicitly specify a recognized namespace string for the corresponding namespace to be returned. An empty or unrecognized string will cause namespace=BrowserNamespace.
func GetNamespaceFromCtx ¶
GetNamespaceFromCtx parses namespace from ctx, either a normal context or an incoming context.
func GetNewNicNameForRenameMachine ¶
GetNewNicNameForRenameMachine returns new nic name for new machine name
func GetNicNameForHost ¶
GetNicNameForHost returns a nic name for a ChromeOS DUT
func GetPageSize ¶
GetPageSize gets the correct page size for List pagination
func GetRackHostname ¶
GetRackHostname returns a rack host name.
func GetResourcePrefix ¶
GetResourcePrefix gets the resource prefix given to the proto message.
Returns the resource prefix for a given proto message. See also: https://blog.golang.org/protobuf-apiv2
func GetSatlabForPartnersRealm ¶
GetSatlabForPartnersRealm determines the realm for zones that are formatted in a manner consistent with SfP naming conventions
func GetStateDescription ¶
GetStateDescription returns the description for the state
func GetSuffixAfterSeparator ¶
GetSuffixAfterSeparator extracts the string appearing after the separator
returns the suffix after the first found separator
func GetValidRealmName ¶
GetValidRealmName replaces the older Browser realm with newer realm
func IPv4IntToStr ¶
IPv4IntToStr returns a string ip address
func IPv4StrToInt ¶
IPv4StrToInt returns an uint32 address from the given ip address string.
func IPv4ToUint32 ¶
IPv4ToUint32 converts an IP to a uint32
func IsAntennaConnection ¶
IsAntennaConnection checks if a string refers to a valid AntennaConnection.
func IsAssetType ¶
IsAssetType checks if a strings is a valid asset type
func IsAttachedDeviceType ¶
IsAttachedDeviceType checks if a string refers to a valid AttachedDeviceType.
func IsBrowserLegacyAsset ¶
IsBrowserLegacyAsset returns if an asset is a legacy asset migrated from browser lab which doesn't have an assetTag
func IsCableType ¶
IsCableType checks if a string refers to a valid CableType.
func IsCameraType ¶
IsCameraType checks if a string refers to a valid CameraType.
func IsChameleonType ¶
IsChameleonType checks if a string refers to a valid ChameleonType.
func IsChromeLegacyHost ¶
IsChromeLegacyHost returns if a host is a legacy browser host used internally
func IsChromePerfHost ¶
IsChromePerfHost returns if a host is a legacy browser perf host used internally
func IsChromiumLegacyHost ¶
IsChromiumLegacyHost returns if a host is a legacy browser host used externally
func IsClankHost ¶
IsClankHost returns if a host is a DUT used for clank
func IsClientNamespace ¶
IsClientNamespace checks if a string refers to a valid client namespace.
func IsDevboardType ¶
IsDevboardType checks if a string refers to a valid Devboard type.
func IsInBrowserZone ¶
IsInBrowserZone check if a given name(resource or zone name) indicates it's in browser zone.
func IsInChromePerfPool ¶
IsInChromePerfPool checks if any chrome perf pool exist in the given pool labels
func IsInChromePool ¶
IsInChromePool checks if any chrome pool exist in the given pool labels.
func IsInChromiumPool ¶
IsInChromiumPool checks if any chromium pool exist in the given pool labels.
func IsInOSZone ¶
IsInOSZone check if a given name(resource or zone name) indicates it's in OS zone.
func IsInternalError ¶
IsInternalError checks if an error has code INTERNAL
func IsLicenseType ¶
IsLicenseType checks if a string refers to a valid LicenseType.
func IsLogicalZone ¶
IsLogicalZone checks if a string is a valid logical zone
func IsMacFormatValid ¶
IsMacFormatValid check if the given mac address is in valid format
TODO(gregorynisbet): only shivas uses this function, move it.
func IsModemType ¶
IsModemType checks if a string refers to a valid ModemType.
func IsNetworkType ¶
IsNetworkType checks if a string refers to a valid NetworkProvider.
func IsNotFoundError ¶
IsNotFoundError checks if an error has code NOT_FOUND
func IsResourceType ¶
IsResourceType checks if a string is a valid resource type
func IsSFPZone ¶
IsSFPZone checks if a given zone name indicates it's a SfP zone. This check looks for a string of format "ZONE_SFP_*"
func IsSchedulingUnitExposeType ¶
IsSchedulingUnitExposeType checks if a string refers to a valid SchedulingUnit_ExposeType.
func IsSchedulingUnitType ¶
IsSchedulingUnitType checks if a string refers to a valid SchedulingUnitType.
func IsUFSState ¶
IsUFSState checks if a string refers to a valid UFS state.
func ParseATLTopology ¶
ParseATLTopology parse the topology of ATL lab based on a Google sheet
func ParseVlan ¶
func ParseVlan(vlanName, cidr, freeStartIPStr, freeEndIPStr string) ([]*ufspb.IP, int, string, string, int, error)
ParseVlan parses vlan to a list of IPs
vlanName here is a full vlan name, e.g. browser:123 The first 10 and last 1 ip of this cidr block will be reserved and not returned to users for further operations
func ProtoEqual ¶
ProtoEqual compares the given protos i, j and returns true if Type(i) == Type(j) and one of the following holds 1. i == j == nil 2. For each exported field(proto message field) x in Type(i), i.Equal(j) or i.x == j.y. returns false otherwise.
func PublishHaRTAssetInfoRequest ¶
PublishHaRTAssetInfoRequest sends a request for asset info update for given assets
func RemoveGivenPrefix ¶
RemoveGivenPrefix removes the prefix from the string
func RemovePrefix ¶
RemovePrefix extracts string appearing after a "/"
func RemoveStatePrefix ¶
RemoveStatePrefix removes the "state_" prefix from the string
func RemoveStringEntry ¶
RemoveStringEntry removes string entry from the string slice
func RemoveZonePrefix ¶
RemoveZonePrefix removes the "zone_" prefix from the string
func SchedulingUnitDutState ¶
SchedulingUnitDutState calculates a weighted state based on all DUTs to represent the scheduling unit Copied from infra/go/src/infra/cmd/shivas/utils/schedulingunit/su_utility.go
func SetupDatastoreNamespace ¶
SetupDatastoreNamespace sets the datastore namespace in the context to access the correct namespace in the datastore
func StringifyIP ¶
StringifyIP stringifies an IP. The standard library makes the interesting choice of mapping an empty IP address object to "<nil>" rather than "".
Here we just return an empty string given an empty IP.
func ToAntennaConnection ¶
func ToAntennaConnection(antennaConnection string) chromeosLab.Wifi_AntennaConnection
ToAntennaConnection converts antennaConnection string to a Wifi_AntennaConnection enum.
func ToAssetType ¶
ToAssetType returns an AssetType object corresponding to string
func ToCableType ¶
func ToCableType(cableType string) chromeosLab.CableType
ToCableType converts cableType string to a Cable type enum.
func ToCameraType ¶
func ToCameraType(cameraType string) chromeosLab.CameraType
ToCameraType converts cameraType string to a Camera type enum.
func ToChameleonType ¶
func ToChameleonType(chameleonType string) chromeosLab.ChameleonType
ToChameleonType converts chameleonType string to a Chameleon type enum.
func ToFacing ¶
func ToFacing(facing string) chromeosLab.Camerabox_Facing
ToFacing converts facing string to a Camerabox_Facing enum.
func ToLicenseType ¶
func ToLicenseType(licenseType string) chromeosLab.LicenseType
ToLicenseType converts licenseType string to a License type enum.
func ToLight ¶
func ToLight(light string) chromeosLab.Camerabox_Light
ToLight converts light string to a Camerabox_Light enum.
func ToLogicalZone ¶
func ToLogicalZone(logicalZone string) ufspb.LogicalZone
ToLogicalZone returns an LogicalZone object corresponding to string
func ToModemType ¶
func ToModemType(modemType string) chromeosLab.ModemType
ToModemType converts modemType string to a Modem type enum.
func ToNetworkType ¶
func ToNetworkType(networkType string) chromeosLab.NetworkProvider
ToNetworkType converts Type string to a NetworkProvider type enum.
func ToRPMType ¶
func ToRPMType(rpmType string) chromeosLab.OSRPM_Type
ToRPMType converts rpmType string to a OSRPM_Type enum.
func ToResourceType ¶
func ToResourceType(resourceType string) ufspb.ResourceType
ToResourceType returns an ResourceType object corresponding to string
func ToRouter ¶
func ToRouter(router string) chromeosLab.Wifi_Router
ToRouter converts router string to a Wifi_Router enum.
func ToSIMType ¶
func ToSIMType(simType string) chromeosLab.SIMType
ToSIMType converts simType string to a Sim type enum.
func ToSchedulingUnitExposeType ¶
func ToSchedulingUnitExposeType(schedulingUnitExposeType string) ufspb.SchedulingUnit_ExposeType
ToSchedulingUnitExposeType converts SchedulingUnitExposeType string to a UFS SchedulingUnit_ExposeType enum.
func ToSchedulingUnitType ¶
func ToSchedulingUnitType(schedulingUnitType string) ufspb.SchedulingUnitType
ToSchedulingUnitType converts SchedulingUnitType string to a UFS SchedulingUnitType enum.
func ToUFSAttachedDeviceType ¶
func ToUFSAttachedDeviceType(deviceType string) ufspb.AttachedDeviceType
ToUFSAttachedDeviceType converts type string to a UFS attached device type enum.
func ToUFSDeploymentEnv ¶
func ToUFSDeploymentEnv(env string) ufspb.DeploymentEnv
ToUFSDeploymentEnv converts string to a UFS DeploymentEnv enum.
func ToUFSDevicePhase ¶
func ToUFSDevicePhase(devicePhase string) ufsmfg.ManufacturingConfig_Phase
ToUFSDevicePhase converts type string to a UFS attached device type enum.
func ToUFSDeviceType ¶
func ToUFSDeviceType(devicetype string) ufspb.ChromeOSDeviceType
ToUFSDeviceType converts devicetype string to a UFS devicetype enum.
func ToUFSRealm ¶
ToUFSRealm returns the realm name based on zone string.
func ToUFSState ¶
ToUFSState converts state string to a UFS state enum.
func Uint32Iter ¶
Uint32Iter runs a command over a range of Uint32's. Useful for iterating over IP addresses.
func ValidAntennaConnectionStr ¶
func ValidAntennaConnectionStr() []string
ValidAntennaConnectionStr returns a valid str list for AntennaConnection strings.
func ValidAssetTypeStr ¶
func ValidAssetTypeStr() []string
ValidAssetTypeStr returns a valid str list for AssetTypes
func ValidAttachedDeviceTypeStr ¶
func ValidAttachedDeviceTypeStr() []string
ValidAttachedDeviceTypeStr returns a valid str list for attached device type strings.
func ValidCableTypeStr ¶
func ValidCableTypeStr() []string
ValidCableTypeStr returns a valid str list for CableType strings.
func ValidCameraTypeStr ¶
func ValidCameraTypeStr() []string
ValidCameraTypeStr returns a valid str list for CameraType strings.
func ValidChameleonTypeStr ¶
func ValidChameleonTypeStr() []string
ValidChameleonTypeStr returns a valid str list for Chameleontype strings.
func ValidClientNamespaceStr ¶
func ValidClientNamespaceStr() []string
ValidClientNamespaceStr returns a valid str list for client namespace(set in incoming context metadata) strings.
func ValidDeploymentEnvStr ¶
func ValidDeploymentEnvStr() []string
ValidDeploymentEnvStr returns a valid str list for DeploymentEnv
func ValidDevboardTypeStr ¶
func ValidDevboardTypeStr() []string
ValidDevboardTypeStr returns a valid str list for attached device type strings.
func ValidDeviceTypeStr ¶
func ValidDeviceTypeStr() []string
ValidDeviceTypeStr returns a valid str list for devicetype strings.
func ValidFacingStr ¶
func ValidFacingStr() []string
ValidFacingStr returns a valid str list for Facing strings.
func ValidLicenseTypeStr ¶
func ValidLicenseTypeStr() []string
ValidLicenseTypeStr returns a valid str list for LicenseType strings.
func ValidLightStr ¶
func ValidLightStr() []string
ValidLightStr returns a valid str list for Light strings.
func ValidLogicalZoneStr ¶
func ValidLogicalZoneStr() []string
ValidLogicalZoneStr returns a valid str list for LogicalZone
func ValidModemTypeStr ¶
func ValidModemTypeStr() []string
ValidModemTypeStr returns a valid str list for ModemType strings.
func ValidRPMTypeStr ¶
func ValidRPMTypeStr() []string
ValidRPMTypeStr returns a valid str list for OSRPM_Type strings.
func ValidResourceTypeStr ¶
func ValidResourceTypeStr() []string
ValidResourceTypeStr returns a valid str list for ResourceType
func ValidRouterStr ¶
func ValidRouterStr() []string
ValidRouterStr returns a valid str list for Router strings.
func ValidSchedulingUnitExposeTypeStr ¶
func ValidSchedulingUnitExposeTypeStr() []string
ValidSchedulingUnitExposeTypeStr returns a valid str list for SchedulingUnit_ExposeType strings.
func ValidSchedulingUnitTypeStr ¶
func ValidSchedulingUnitTypeStr() []string
ValidSchedulingUnitTypeStr returns a valid str list for SchedulingUnitType strings.
func ValidSimTypeStr ¶
func ValidSimTypeStr() []string
ValidSimTypeStr returns a valid str list for SimType strings.
func ValidStateStr ¶
func ValidStateStr() []string
ValidStateStr returns a valid str list for state strings.
func ValidZoneStr ¶
func ValidZoneStr() []string
ValidZoneStr returns a valid str list for zone strings.
func ValidateTags ¶
ValidateTags checks if the tags contain only valid characters
Types ¶
type DHCPConf ¶
type DHCPConf struct { ValidVlans []*ufspb.Vlan ValidIPs []*ufspb.IP ValidDHCPs []*ufspb.DHCPConfig DHCPsWithoutVlan []*ufspb.DHCPConfig MismatchedVlans []*ufspb.Vlan DuplicatedVlans []*ufspb.Vlan DuplicatedIPs []*ufspb.IP }
DHCPConf defines the format of response after parsing a ChromeOS dhcp conf file
type Key ¶
type Key string
Key is a type for use in adding values to context. It is not recommended to use plain string as key.
type PSRequest ¶
type PSRequest struct { Msg struct { Data string `json:"data"` MessageID string `json:"messageId"` } `json:"message"` Sub string `json:"subscription"` }
PSRequest helps to unmarshall json data sent from pubsub
The format of the data sent by PubSub is described in https://cloud.google.com/pubsub/docs/push?hl=en#receiving_push_messages
func NewPSRequest ¶
NewPSRequest returns a PSRequest object constructed from http request
func (*PSRequest) DecodeMessage ¶
DecodeMessage decodes []byte pertaining to the request