cellular

package
v0.0.0-...-683b059 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Overview

Package cellular provides functions for testing Cellular connectivity.

Package cellular provides functions for testing Cellular connectivity.

Index

Constants

View Source
const AutoConnectCleanupTime = 1 * time.Second

AutoConnectCleanupTime provides enough time for a successful dbus operation. If a timeout occurs during cleanup, the operation will fail anyway.

View Source
const PropertyCleanupTime = 1 * time.Second

PropertyCleanupTime provides enough time for a successful dbus operation at the end of the test.

Variables

This section is empty.

Functions

func GetDeviceVariant

func GetDeviceVariant(ctx context.Context) (string, error)

GetDeviceVariant gets the variant of the device using cros config.

func GetModemFirmwareManifestPath

func GetModemFirmwareManifestPath() string

GetModemFirmwareManifestPath Get the path of the modem firmware manifest.

func GetModemFirmwarePath

func GetModemFirmwarePath() string

GetModemFirmwarePath Get the path where the modem firmware files are located.

func GetModemHelperManifestPath

func GetModemHelperManifestPath() string

GetModemHelperManifestPath Get the path of the modem helper manifest.

func GetModemHelperPath

func GetModemHelperPath() string

GetModemHelperPath Get the path where the modem helper files are located.

func ParseModemFirmwareManifest

func ParseModemFirmwareManifest(ctx context.Context) (*mfwd.FirmwareManifestV2, error)

ParseModemFirmwareManifest Parses the modem firmware manifest and returns the FirmwareManifestV2 proto object.

func ParseModemHelperManifest

func ParseModemHelperManifest(ctx context.Context) (*mfwd.HelperManifest, error)

ParseModemHelperManifest Parses the modem helper manifest and returns the HelperManifest proto object.

func SetServiceProvidersExclusiveOverride

func SetServiceProvidersExclusiveOverride(ctx context.Context, sourceFile string) (func(), error)

SetServiceProvidersExclusiveOverride adds an override MODB to shill. The function returns a closure to delete the override file.

Types

type Helper

type Helper struct {
	Manager *shill.Manager
	Device  *shill.Device
}

Helper fetches Cellular Device and Service properties.

func NewHelper

func NewHelper(ctx context.Context) (*Helper, error)

NewHelper creates a Helper object and ensures that a Cellular Device is present.

func (*Helper) BadPin

func (h *Helper) BadPin(ctx context.Context, currentPin string) (string, error)

BadPin obtains a pin that does not match the valid sim-pin.

func (*Helper) BadPuk

func (h *Helper) BadPuk(ctx context.Context, currentPuk string) (string, error)

BadPuk obtains a puk that does not match the valid sim-puk.

func (*Helper) CaptureDBusLogs

func (h *Helper) CaptureDBusLogs(ctx context.Context) error

CaptureDBusLogs - Capture DBus system logs Return nil if DBus log collection succeeds, else return error.

func (*Helper) ClearSIMLock

func (h *Helper) ClearSIMLock(ctx context.Context, pin, puk string) error

ClearSIMLock clears puk, pin lock if any of them enabled and locked.

func (*Helper) ConnectToDefault

func (h *Helper) ConnectToDefault(ctx context.Context) (time.Duration, error)

ConnectToDefault connects to the default Cellular Service.

func (*Helper) ConnectToService

func (h *Helper) ConnectToService(ctx context.Context, service *shill.Service) error

ConnectToService connects to a Cellular Service. It ensures that the connect attempt succeeds, repeating attempts if necessary. Otherwise an error is returned.

func (*Helper) ConnectToServiceWithTimeout

func (h *Helper) ConnectToServiceWithTimeout(ctx context.Context, service *shill.Service, timeout time.Duration) error

ConnectToServiceWithTimeout connects to a Cellular Service with a specified timeout. It ensures that the connect attempt succeeds, repeating attempts if necessary. Otherwise an error is returned.

func (*Helper) Disable

func (h *Helper) Disable(ctx context.Context) (time.Duration, error)

Disable calls Manager.DisableTechnology(cellular) and returns true if the disable succeeded, or an error otherwise.

func (*Helper) Disconnect

func (h *Helper) Disconnect(ctx context.Context) (time.Duration, error)

Disconnect from the Cellular Service and ensure that the disconnect succeeded, otherwise return an error.

func (*Helper) Enable

func (h *Helper) Enable(ctx context.Context) (time.Duration, error)

Enable calls Manager.EnableTechnology(cellular) and returns true if the enable succeeded, or an error otherwise.

func (*Helper) EnterIncorrectPin

func (h *Helper) EnterIncorrectPin(ctx context.Context, currentPin string) error

EnterIncorrectPin gets incorrect pin and tries to unlock.

func (*Helper) EnterIncorrectPuk

func (h *Helper) EnterIncorrectPuk(ctx context.Context, currentPuk string) error

EnterIncorrectPuk generates bad puk and tries to unlock.

func (*Helper) FindService

func (h *Helper) FindService(ctx context.Context) (*shill.Service, error)

FindService returns the first connectable Cellular Service. If no such Cellular Service is available, returns a nil service and an error.

func (*Helper) FindServiceForDevice

func (h *Helper) FindServiceForDevice(ctx context.Context) (*shill.Service, error)

FindServiceForDevice returns the first connectable Cellular Service matching the Device ICCID. If no such Cellular Service is available, returns a nil service and an error. The default timeout is used for waiting for the service to appear.

func (*Helper) FindServiceForDeviceWithTimeout

func (h *Helper) FindServiceForDeviceWithTimeout(ctx context.Context, timeout time.Duration) (*shill.Service, error)

FindServiceForDeviceWithTimeout returns the first connectable Cellular Service matching the Device ICCID. If no such Cellular Service is available, returns a nil service and an error. |timeout| specifies how long to wait for a service to appear.

func (*Helper) GetCellularLastAttachAPN

func (h *Helper) GetCellularLastAttachAPN(ctx context.Context) (map[string]string, error)

GetCellularLastAttachAPN gets Cellular.LastAttachAPN dictionary from shill properties.

func (*Helper) GetCellularLastGoodAPN

func (h *Helper) GetCellularLastGoodAPN(ctx context.Context) (map[string]string, error)

GetCellularLastGoodAPN gets Cellular.LastAttachAPN dictionary from shill properties.

func (*Helper) GetCellularSIMLockStatus

func (h *Helper) GetCellularSIMLockStatus(ctx context.Context) (map[string]interface{}, error)

GetCellularSIMLockStatus dict gets Cellular.SIMLockStatus dictionary from shill properties.

func (*Helper) GetRetriesLeft

func (h *Helper) GetRetriesLeft(ctx context.Context) (int32, error)

GetRetriesLeft helps to get modem property UnlockRetries value.

func (*Helper) GetUUIDFromShill

func (h *Helper) GetUUIDFromShill(ctx context.Context) (string, error)

GetUUIDFromShill gets the current carrier's UUID from shill.

func (*Helper) InitDeviceProperty

func (h *Helper) InitDeviceProperty(ctx context.Context, prop string, value interface{}) (func(ctx context.Context), error)

InitDeviceProperty sets a device property and returns a function to restore the initial value.

func (*Helper) InitServiceProperty

func (h *Helper) InitServiceProperty(ctx context.Context, prop string, value interface{}) (func(ctx context.Context), error)

InitServiceProperty sets a service property and returns a function to restore the initial value.

func (*Helper) IsSimLockEnabled

func (h *Helper) IsSimLockEnabled(ctx context.Context) bool

IsSimLockEnabled returns lockenabled value.

func (*Helper) IsSimPinLocked

func (h *Helper) IsSimPinLocked(ctx context.Context) bool

IsSimPinLocked returns true if locktype value is 'sim-pin' locktype value is 'sim-pin2' for QC and 'none' when not locked.

func (*Helper) IsSimPukLocked

func (h *Helper) IsSimPukLocked(ctx context.Context) bool

IsSimPukLocked returns true if locktype value is 'sim-puk' locktype value is 'sim-pin2' for QC and value 'none' when not locked.

func (*Helper) PinLockSim

func (h *Helper) PinLockSim(ctx context.Context, newPin string) error

PinLockSim is a helper method to pin-lock a sim, assuming nothing bad happens.

func (*Helper) PukLockSim

func (h *Helper) PukLockSim(ctx context.Context, currentPin string) error

PukLockSim is a helper method to puk-lock a SIM, assuming nothing bad happens.

func (*Helper) ResetModem

func (h *Helper) ResetModem(ctx context.Context) (time.Duration, error)

ResetModem calls Device.ResetModem(cellular) and returns true if the reset succeeded, or an error otherwise.

func (*Helper) ResetShill

func (h *Helper) ResetShill(ctx context.Context) []error

ResetShill restarts shill and clears all profiles.

func (*Helper) RestartModemManager

func (h *Helper) RestartModemManager(ctx context.Context, enableDebugLogs bool) error

RestartModemManager - restart modemmanager with debug logs enabled/disabled. Return nil if restart succeeds, else return error.

func (*Helper) SetDeviceProperty

func (h *Helper) SetDeviceProperty(ctx context.Context, prop string, value interface{}, timeout time.Duration) error

SetDeviceProperty sets a Device property and waits for the property to be set.

func (*Helper) SetServiceAutoConnect

func (h *Helper) SetServiceAutoConnect(ctx context.Context, autoConnect bool) (bool, error)

SetServiceAutoConnect sets the AutoConnect property of the Cellular Service associated with the Cellular Device to |autoConnect| if the current value does not match |autoConnect|. Returns true when Service.AutoConnect is set and the operation succeeds. Returns an error if any operation fails.

func (*Helper) UnlockDut

func (h *Helper) UnlockDut(ctx context.Context, currentPin, currentPuk string) error

UnlockDut is to unlock sim pin before every test.

func (*Helper) WaitForEnabledState

func (h *Helper) WaitForEnabledState(ctx context.Context, expected bool) error

WaitForEnabledState polls for the specified enable state for cellular.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL