Documentation
¶
Overview ¶
Package wificell provides utilities for accessing or controlling companion devices in the wificell environment.
Index ¶
- Constants
- func DefaultOpenNetworkAPOptions() []hostapd.Option
- type APIface
- func (h *APIface) ChangeSubnetIdx(ctx context.Context) (retErr error)
- func (h *APIface) Config() *hostapd.Config
- func (h *APIface) DeauthenticateClient(ctx context.Context, clientMAC string) error
- func (h *APIface) Interface() string
- func (h *APIface) ListSTA(ctx context.Context) ([]string, error)
- func (h *APIface) ReserveForStop(ctx context.Context) (context.Context, context.CancelFunc)
- func (h *APIface) Router() router.Base
- func (h *APIface) STAInfo(ctx context.Context, staMAC string) (*hostapd.STAInfo, error)
- func (h *APIface) SendBSSTMRequest(ctx context.Context, clientMAC string, params hostapd.BSSTMReqParams) error
- func (h *APIface) SendBeaconRequest(ctx context.Context, clientMAC string, params hostapd.BeaconReqParams) error
- func (h *APIface) ServerIP() net.IP
- func (h *APIface) ServerSubnet() *net.IPNet
- func (h *APIface) Set(ctx context.Context, prop hostapd.Property, val string) error
- func (h *APIface) StartChannelSwitch(ctx context.Context, count, channel int, opts ...hostapd.CSOption) error
- func (h *APIface) Stop(ctx context.Context) error
- type DisconnectedEvent
- type RoamEvent
- type ScanResultsEvent
- type SetWakeOnWifiOption
- type ShillProperty
- type SupplicantEvent
- type TFFeatures
- type TFOption
- func TFAttenuator(target string) TFOption
- func TFCapture(b bool) TFOption
- func TFHostUsers(hostUsers map[string]string) TFOption
- func TFLogLevel(level int) TFOption
- func TFLogTags(tags []string) TFOption
- func TFPcap(target string) TFOption
- func TFPcapType(rtype support.RouterType) TFOption
- func TFRouter(targets ...string) TFOption
- func TFRouterAsCapture() TFOption
- func TFRouterType(rtype support.RouterType) TFOption
- func TFSetLogging(b bool) TFOption
- func TFWithUI() TFOption
- type TestFixture
- func (tf *TestFixture) ArpingFromDUT(ctx context.Context, serverIP string, ops ...arping.Option) error
- func (tf *TestFixture) ArpingFromRouterID(ctx context.Context, idx int, serverIface string, ops ...arping.Option) error
- func (tf *TestFixture) ArpingFromServer(ctx context.Context, serverIface string, ops ...arping.Option) error
- func (tf *TestFixture) AssertNoDisconnect(ctx context.Context, f func(context.Context) error) error
- func (tf *TestFixture) Attenuator() *attenuator.Attenuator
- func (tf *TestFixture) AxRouter() (*ax.Router, error)
- func (tf *TestFixture) Capturer(ap *APIface) (*pcap.Capturer, bool)
- func (tf *TestFixture) CleanDisconnectWifi(ctx context.Context) error
- func (tf *TestFixture) ClearBSSIDIgnoreDUT(ctx context.Context) error
- func (tf *TestFixture) ClientHardwareAddr(ctx context.Context) (string, error)
- func (tf *TestFixture) ClientIPv4Addrs(ctx context.Context) ([]net.IP, error)
- func (tf *TestFixture) ClientInterface(ctx context.Context) (string, error)
- func (tf *TestFixture) Close(ctx context.Context) error
- func (tf *TestFixture) CollectLogs(ctx context.Context) error
- func (tf *TestFixture) ConfigureAP(ctx context.Context, ops []hostapd.Option, fac security.ConfigFactory) (ret *APIface, retErr error)
- func (tf *TestFixture) ConfigureAPOnRouterID(ctx context.Context, idx int, ops []hostapd.Option, fac security.ConfigFactory) (ret *APIface, retErr error)
- func (tf *TestFixture) ConnectWifi(ctx context.Context, ssid string, options ...dutcfg.ConnOption) (*wifi.ConnectResponse, error)
- func (tf *TestFixture) ConnectWifiAP(ctx context.Context, ap *APIface, options ...dutcfg.ConnOption) (*wifi.ConnectResponse, error)
- func (tf *TestFixture) DeconfigAP(ctx context.Context, ap *APIface) error
- func (tf *TestFixture) DeconfigAllAPs(ctx context.Context) error
- func (tf *TestFixture) DefaultOpenNetworkAP(ctx context.Context) (*APIface, error)
- func (tf *TestFixture) DisablePowersaveMode(ctx context.Context) (shortenCtx context.Context, restore func() error, err error)
- func (tf *TestFixture) DisconnectWifi(ctx context.Context) error
- func (tf *TestFixture) LegacyPcap() (*legacy.Router, error)
- func (tf *TestFixture) LegacyRouter() (*legacy.Router, error)
- func (tf *TestFixture) OpenWrtPcap() (*openwrt.Router, error)
- func (tf *TestFixture) OpenWrtRouter() (*openwrt.Router, error)
- func (tf *TestFixture) Pcap() router.Base
- func (tf *TestFixture) PingFromDUT(ctx context.Context, targetIP string, opts ...ping.Option) error
- func (tf *TestFixture) PingFromRouterID(ctx context.Context, idx int, opts ...ping.Option) error
- func (tf *TestFixture) PingFromServer(ctx context.Context, opts ...ping.Option) error
- func (tf *TestFixture) RPC() *rpc.Client
- func (tf *TestFixture) Reinit(ctx context.Context) error
- func (tf *TestFixture) ReserveForClose(ctx context.Context) (context.Context, context.CancelFunc)
- func (tf *TestFixture) ReserveForCollectLogs(ctx context.Context) (context.Context, context.CancelFunc)
- func (tf *TestFixture) ReserveForDeconfigAP(ctx context.Context, ap *APIface) (context.Context, context.CancelFunc)
- func (tf *TestFixture) ReserveForDisconnect(ctx context.Context) (context.Context, context.CancelFunc)
- func (tf *TestFixture) Router() router.Base
- func (tf *TestFixture) RouterByID(idx int) router.Base
- func (tf *TestFixture) SendChannelSwitchAnnouncement(ctx context.Context, ap *APIface, maxRetry, alternateChannel int) error
- func (tf *TestFixture) SetWakeOnWifi(ctx context.Context, ops ...SetWakeOnWifiOption) (shortenCtx context.Context, cleanupFunc func() error, retErr error)
- func (tf *TestFixture) StandardRouter() (router.Standard, error)
- func (tf *TestFixture) StandardRouterWithBridgeAndVethSupport() (router.StandardWithBridgeAndVeth, error)
- func (tf *TestFixture) StandardRouterWithFrameSenderSupport() (router.StandardWithFrameSender, error)
- func (tf *TestFixture) StartWPAMonitor(ctx context.Context) (wpaMonitor *WPAMonitor, stop func(), newCtx context.Context, retErr error)
- func (tf *TestFixture) VerifyConnection(ctx context.Context, ap *APIface) error
- func (tf *TestFixture) WaitWifiConnected(ctx context.Context, guid string) error
- func (tf *TestFixture) WifiClient() *WifiClient
- type WPAMonitor
- type WifiClient
- func (cli *WifiClient) AssureDisconnect(ctx context.Context, servicePath string, timeout time.Duration) error
- func (cli *WifiClient) CurrentTime(ctx context.Context) (time.Time, error)
- func (cli *WifiClient) DisableMACRandomize(ctx context.Context) (shortenCtx context.Context, cleanupFunc func() error, retErr error)
- func (cli *WifiClient) DisconnectReason(ctx context.Context) (func() (int32, error), error)
- func (cli *WifiClient) DiscoverBSSID(ctx context.Context, bssid, iface string, ssid []byte) error
- func (cli *WifiClient) EAPAuthSkipped(ctx context.Context) (func() (bool, error), error)
- func (cli *WifiClient) ExpectShillProperty(ctx context.Context, objectPath string, props []*ShillProperty, ...) (func() ([]protoutil.ShillPropertyHolder, error), error)
- func (cli *WifiClient) FlushBSS(ctx context.Context, iface string, age time.Duration) error
- func (cli *WifiClient) Interface(ctx context.Context) (string, error)
- func (cli *WifiClient) QueryService(ctx context.Context) (*wifi.QueryServiceResponse, error)
- func (cli *WifiClient) Reassociate(ctx context.Context, iface string, timeout time.Duration) error
- func (cli *WifiClient) RequestRoam(ctx context.Context, iface, bssid string, timeout time.Duration) error
- func (cli *WifiClient) SetWakeOnWifi(ctx context.Context, ops ...SetWakeOnWifiOption) (shortenCtx context.Context, cleanupFunc func() error, retErr error)
- func (cli *WifiClient) SetWifiEnabled(ctx context.Context, enabled bool) error
- func (cli *WifiClient) Suspend(ctx context.Context, wakeUpTimeout time.Duration) error
- func (cli *WifiClient) SuspendAssertConnect(ctx context.Context, wakeUpTimeout time.Duration) (time.Duration, error)
- func (cli *WifiClient) TurnOffBgscan(ctx context.Context) (context.Context, func() error, error)
- func (cli *WifiClient) WatchDarkResume(ctx context.Context) (func() (*wifi.WatchDarkResumeResponse, error), error)
Constants ¶
const ( // TFFeaturesNone represents a default value. TFFeaturesNone TFFeatures = 0 // TFFeaturesCapture is a feature that spawns packet capturer in TestFixture. TFFeaturesCapture = 1 << iota // TFFeaturesRouters allows to configure more than one router. TFFeaturesRouters // TFFeaturesAttenuator feature facilitates attenuator handling. TFFeaturesAttenuator // TFFeaturesRouterAsCapture configures the router as a capturer as well. TFFeaturesRouterAsCapture // TFFeaturesEnroll enrolls Chrome. TFFeaturesEnroll )
const TFServiceName = "tast.cros.wifi.ShillService"
TFServiceName is the service needed by TestFixture.
Variables ¶
This section is empty.
Functions ¶
func DefaultOpenNetworkAPOptions ¶
DefaultOpenNetworkAPOptions returns the Options for an common 802.11n open wifi. The function is useful to allow common logic shared between the default setting and customized setting.
Types ¶
type APIface ¶
type APIface struct {
// contains filtered or unexported fields
}
APIface is the handle object of an instance of hostapd service managed by a router. It is comprised of a hostapd and a dhcpd. The DHCP server is assigned with the subnet 192.168.$subnetIdx.0/24.
func StartAPIface ¶
func StartAPIface(ctx context.Context, r router.Base, name string, conf *hostapd.Config) (_ *APIface, retErr error)
StartAPIface starts the service. After started, the caller should call h.Stop() at the end, and use the shortened ctx (provided by h.ReserveForStop()) before h.Stop() to reserve time for h.Stop() to run.
func (*APIface) ChangeSubnetIdx ¶
ChangeSubnetIdx restarts the dhcp server with a different subnet index. On failure, the APIface object will keep holding the old index, but the states of the dhcp server and WiFi interface are not guaranteed and a call of Stop is still needed.
func (*APIface) Config ¶
Config returns the config of hostapd. NOTE: Caller should not modify the returned object.
func (*APIface) DeauthenticateClient ¶
DeauthenticateClient deauthenticates client with specified MAC address.
func (*APIface) ReserveForStop ¶
ReserveForStop returns a shortened ctx with its cancel function. The shortened ctx is used for running things before h.Stop() to reserve time for it to run.
func (*APIface) SendBSSTMRequest ¶
func (h *APIface) SendBSSTMRequest(ctx context.Context, clientMAC string, params hostapd.BSSTMReqParams) error
SendBSSTMRequest sends a BSS Transition Management Request to the specified client.
func (*APIface) SendBeaconRequest ¶
func (h *APIface) SendBeaconRequest(ctx context.Context, clientMAC string, params hostapd.BeaconReqParams) error
SendBeaconRequest sends a Beacon Request to the specified client.
func (*APIface) ServerSubnet ¶
ServerSubnet returns the subnet whose ip has been masked.
type DisconnectedEvent ¶
DisconnectedEvent defines data of CTRL-EVENT-DISCONNECTED event.
func (*DisconnectedEvent) ToLogString ¶
func (e *DisconnectedEvent) ToLogString() string
ToLogString formats the event data to string suitable for logging
type RoamEvent ¶
type RoamEvent struct { CurBSSID string CurFreq int CurLevel int CurEstThroughput int SelBSSID string SelFreq int SelLevel int SelEstThroughput int Skip bool }
RoamEvent defines data of CTRL-EVENT-DO-ROAM and CTRL-EVENT-SKIP-ROAM events.
func (*RoamEvent) ToLogString ¶
ToLogString formats the event data to string suitable for logging.
type ScanResultsEvent ¶
type ScanResultsEvent struct { }
ScanResultsEvent defines data of CTRL-EVENT-SCAN-RESULTS event.
func (*ScanResultsEvent) ToLogString ¶
func (e *ScanResultsEvent) ToLogString() string
ToLogString formats the event data to string suitable for logging.
type SetWakeOnWifiOption ¶
type SetWakeOnWifiOption func(*wifi.WakeOnWifiConfig)
SetWakeOnWifiOption is the type of options of SetWakeOnWifi method of TestFixture.
func WakeOnWifiFeatures ¶
func WakeOnWifiFeatures(features string) SetWakeOnWifiOption
WakeOnWifiFeatures returns a option for SetWakeOnWifi to modify the WakeOnWiFiFeaturesEnabled property.
func WakeOnWifiNetDetectScanPeriod ¶
func WakeOnWifiNetDetectScanPeriod(seconds uint32) SetWakeOnWifiOption
WakeOnWifiNetDetectScanPeriod returns an option for SetWakeOnWifi to modify the NetDetectScanPeriodSeconds property.
type ShillProperty ¶
type ShillProperty struct { Property string ExpectedValues []interface{} UnexpectedValues []interface{} Method wifi.ExpectShillPropertyRequest_CheckMethod }
ShillProperty holds a shill service property with it's expected and unexpected values.
type SupplicantEvent ¶
type SupplicantEvent interface {
ToLogString() string
}
SupplicantEvent defines functions common for all wpa_supplicant events.
type TFFeatures ¶
type TFFeatures uint8
TFFeatures is an enum type for extra features needed for Tast fixture. Note that features can be combined using bitwise OR, e.g. TFFeaturesCapture | TFFeaturesRouters.
func (TFFeatures) String ¶
func (enum TFFeatures) String() string
String returns name component corresponding to enum value(s).
type TFOption ¶
type TFOption func(*TestFixture)
TFOption is the function signature used to modify TextFixutre.
func TFAttenuator ¶
TFAttenuator sets the attenuator hostname to use in the test fixture.
func TFHostUsers ¶
TFHostUsers saves the mapping of hostname to username. This is used to figure out what username to log in with for a given hostname. If a username entry is not found for a given hostname, the default username, root, will be used.
func TFLogLevel ¶
TFLogLevel sets the logging level to use in the test fixture.
func TFPcapType ¶
func TFPcapType(rtype support.RouterType) TFOption
TFPcapType sets the router type of the pcap capturing device. The pcap device in our testbeds is a router.
func TFRouterAsCapture ¶
func TFRouterAsCapture() TFOption
TFRouterAsCapture sets if the router should be used as a capturer. If there are multiple routers, the first one is used.
func TFRouterType ¶
func TFRouterType(rtype support.RouterType) TFOption
TFRouterType sets the router type used in the test fixture.
type TestFixture ¶
type TestFixture struct {
// contains filtered or unexported fields
}
TestFixture sets up the context for a basic WiFi test.
func NewTestFixture ¶
func NewTestFixture(fullCtx, daemonCtx context.Context, d *dut.DUT, rpcHint *testing.RPCHint, ops ...TFOption) (ret *TestFixture, retErr error)
NewTestFixture creates a TestFixture. The TestFixture contains a gRPC connection to the DUT and a SSH connection to the router. The method takes two context: ctx and daemonCtx, the first one is the context for the operation and daemonCtx is for the spawned daemons. Noted that if routerHostname is empty, it uses the default router hostname based on the DUT's hostname. After the caller gets the TestFixture instance, it should reserve time for Close() the TestFixture:
tf, err := NewTestFixture(ctx, ...) if err != nil {...} defer tf.Close(ctx) ctx, cancel := tf.ReserveForClose(ctx) defer cancel() ...
func (*TestFixture) ArpingFromDUT ¶
func (tf *TestFixture) ArpingFromDUT(ctx context.Context, serverIP string, ops ...arping.Option) error
ArpingFromDUT tests that DUT can send the broadcast packets to server.
func (*TestFixture) ArpingFromRouterID ¶
func (tf *TestFixture) ArpingFromRouterID(ctx context.Context, idx int, serverIface string, ops ...arping.Option) error
ArpingFromRouterID tests that DUT can receive the broadcast packets from server.
func (*TestFixture) ArpingFromServer ¶
func (tf *TestFixture) ArpingFromServer(ctx context.Context, serverIface string, ops ...arping.Option) error
ArpingFromServer tests that DUT can receive the broadcast packets from server. Kept for backwards-compatibility.
func (*TestFixture) AssertNoDisconnect ¶
AssertNoDisconnect runs the given routine and verifies that no disconnection event is captured in the same duration.
func (*TestFixture) Attenuator ¶
func (tf *TestFixture) Attenuator() *attenuator.Attenuator
Attenuator returns the Attenuator object in the fixture.
func (*TestFixture) AxRouter ¶
func (tf *TestFixture) AxRouter() (*ax.Router, error)
AxRouter returns the Router as an ax.Router.
func (*TestFixture) Capturer ¶
func (tf *TestFixture) Capturer(ap *APIface) (*pcap.Capturer, bool)
Capturer returns the auto-spawned Capturer for the APIface instance.
func (*TestFixture) CleanDisconnectWifi ¶
func (tf *TestFixture) CleanDisconnectWifi(ctx context.Context) error
CleanDisconnectWifi asks the DUT to disconnect from current WiFi service and removes the configuration.
func (*TestFixture) ClearBSSIDIgnoreDUT ¶
func (tf *TestFixture) ClearBSSIDIgnoreDUT(ctx context.Context) error
ClearBSSIDIgnoreDUT clears the BSSID_IGNORE list on DUT.
func (*TestFixture) ClientHardwareAddr ¶
func (tf *TestFixture) ClientHardwareAddr(ctx context.Context) (string, error)
ClientHardwareAddr returns the HardwareAddr for the network interface.
func (*TestFixture) ClientIPv4Addrs ¶
ClientIPv4Addrs returns the IPv4 addresses for the network interface.
func (*TestFixture) ClientInterface ¶
func (tf *TestFixture) ClientInterface(ctx context.Context) (string, error)
ClientInterface returns the client interface name.
func (*TestFixture) Close ¶
func (tf *TestFixture) Close(ctx context.Context) error
Close closes the connections created by TestFixture.
func (*TestFixture) CollectLogs ¶
func (tf *TestFixture) CollectLogs(ctx context.Context) error
CollectLogs downloads related log files to OutDir.
func (*TestFixture) ConfigureAP ¶
func (tf *TestFixture) ConfigureAP(ctx context.Context, ops []hostapd.Option, fac security.ConfigFactory) (ret *APIface, retErr error)
ConfigureAP configures the router to provide a WiFi service with the options specified. Note that after getting an APIface, ap, the caller should defer tf.DeconfigAP(ctx, ap) and use tf.ReserveForClose(ctx, ap) to reserve time for the deferred call.
func (*TestFixture) ConfigureAPOnRouterID ¶
func (tf *TestFixture) ConfigureAPOnRouterID(ctx context.Context, idx int, ops []hostapd.Option, fac security.ConfigFactory) (ret *APIface, retErr error)
ConfigureAPOnRouterID is an extended version of ConfigureAP, allowing to choose router to establish the AP on.
func (*TestFixture) ConnectWifi ¶
func (tf *TestFixture) ConnectWifi(ctx context.Context, ssid string, options ...dutcfg.ConnOption) (*wifi.ConnectResponse, error)
ConnectWifi asks the DUT to connect to the specified WiFi.
func (*TestFixture) ConnectWifiAP ¶
func (tf *TestFixture) ConnectWifiAP(ctx context.Context, ap *APIface, options ...dutcfg.ConnOption) (*wifi.ConnectResponse, error)
ConnectWifiAP asks the DUT to connect to the WiFi provided by the given AP.
func (*TestFixture) DeconfigAP ¶
func (tf *TestFixture) DeconfigAP(ctx context.Context, ap *APIface) error
DeconfigAP stops the WiFi service on router.
func (*TestFixture) DeconfigAllAPs ¶
func (tf *TestFixture) DeconfigAllAPs(ctx context.Context) error
DeconfigAllAPs facilitates deconfiguration of all APs established for this test fixture.
func (*TestFixture) DefaultOpenNetworkAP ¶
func (tf *TestFixture) DefaultOpenNetworkAP(ctx context.Context) (*APIface, error)
DefaultOpenNetworkAP configures the router to provide an 802.11n open wifi.
func (*TestFixture) DisablePowersaveMode ¶
func (tf *TestFixture) DisablePowersaveMode(ctx context.Context) (shortenCtx context.Context, restore func() error, err error)
DisablePowersaveMode disables power saving mode (if it's enabled) and return a function to restore it's initial mode.
func (*TestFixture) DisconnectWifi ¶
func (tf *TestFixture) DisconnectWifi(ctx context.Context) error
DisconnectWifi asks the DUT to disconnect from current WiFi service.
func (*TestFixture) LegacyPcap ¶
func (tf *TestFixture) LegacyPcap() (*legacy.Router, error)
LegacyPcap returns the Pcap as a legacy.Router.
func (*TestFixture) LegacyRouter ¶
func (tf *TestFixture) LegacyRouter() (*legacy.Router, error)
LegacyRouter returns the Router as a legacy.Router.
func (*TestFixture) OpenWrtPcap ¶
func (tf *TestFixture) OpenWrtPcap() (*openwrt.Router, error)
OpenWrtPcap returns the Pcap as an openwrt.Router.
func (*TestFixture) OpenWrtRouter ¶
func (tf *TestFixture) OpenWrtRouter() (*openwrt.Router, error)
OpenWrtRouter returns the Router as an openwrt.Router.
func (*TestFixture) Pcap ¶
func (tf *TestFixture) Pcap() router.Base
Pcap returns the pcap device in the fixture.
func (*TestFixture) PingFromDUT ¶
PingFromDUT tests the connectivity between DUT and target IP.
func (*TestFixture) PingFromRouterID ¶
PingFromRouterID tests the connectivity between DUT and router through currently connected WiFi service.
func (*TestFixture) PingFromServer ¶
PingFromServer calls PingFromRouterID for router 0. Kept for backwards-compatibility.
func (*TestFixture) RPC ¶
func (tf *TestFixture) RPC() *rpc.Client
RPC returns the gRPC connection of the DUT.
func (*TestFixture) Reinit ¶
func (tf *TestFixture) Reinit(ctx context.Context) error
Reinit reinitialize the TestFixture. This can be used in precondition or between testcases to guarantee a cleaner state.
func (*TestFixture) ReserveForClose ¶
func (tf *TestFixture) ReserveForClose(ctx context.Context) (context.Context, context.CancelFunc)
ReserveForClose returns a shorter ctx and cancel function for tf.Close().
func (*TestFixture) ReserveForCollectLogs ¶
func (tf *TestFixture) ReserveForCollectLogs(ctx context.Context) (context.Context, context.CancelFunc)
ReserveForCollectLogs returns a shorter ctx and cancel function for tf.CollectLogs.
func (*TestFixture) ReserveForDeconfigAP ¶
func (tf *TestFixture) ReserveForDeconfigAP(ctx context.Context, ap *APIface) (context.Context, context.CancelFunc)
ReserveForDeconfigAP returns a shorter ctx and cancel function for tf.DeconfigAP().
func (*TestFixture) ReserveForDisconnect ¶
func (tf *TestFixture) ReserveForDisconnect(ctx context.Context) (context.Context, context.CancelFunc)
ReserveForDisconnect returns a shorter ctx and cancel function for tf.DisconnectWifi.
func (*TestFixture) Router ¶
func (tf *TestFixture) Router() router.Base
Router returns the router with id 0 in the fixture as the generic router.Base.
func (*TestFixture) RouterByID ¶
func (tf *TestFixture) RouterByID(idx int) router.Base
RouterByID returns the respective router object in the fixture.
func (*TestFixture) SendChannelSwitchAnnouncement ¶
func (tf *TestFixture) SendChannelSwitchAnnouncement(ctx context.Context, ap *APIface, maxRetry, alternateChannel int) error
SendChannelSwitchAnnouncement sends a CSA frame and waits for Client_Disconnection, or Channel_Switch event.
func (*TestFixture) SetWakeOnWifi ¶
func (tf *TestFixture) SetWakeOnWifi(ctx context.Context, ops ...SetWakeOnWifiOption) (shortenCtx context.Context, cleanupFunc func() error, retErr error)
SetWakeOnWifi sets properties related to wake on WiFi. DEPRECATED: Use tf.WifiClient().SetWakeOnWifi instead.
func (*TestFixture) StandardRouter ¶
func (tf *TestFixture) StandardRouter() (router.Standard, error)
StandardRouter returns the Router as a router.Standard.
func (*TestFixture) StandardRouterWithBridgeAndVethSupport ¶
func (tf *TestFixture) StandardRouterWithBridgeAndVethSupport() (router.StandardWithBridgeAndVeth, error)
StandardRouterWithBridgeAndVethSupport returns the Router as a router.StandardWithBridgeAndVeth.
func (*TestFixture) StandardRouterWithFrameSenderSupport ¶
func (tf *TestFixture) StandardRouterWithFrameSenderSupport() (router.StandardWithFrameSender, error)
StandardRouterWithFrameSenderSupport returns the Router as a router.StandardWithFrameSender.
func (*TestFixture) StartWPAMonitor ¶
func (tf *TestFixture) StartWPAMonitor(ctx context.Context) (wpaMonitor *WPAMonitor, stop func(), newCtx context.Context, retErr error)
StartWPAMonitor configures and starts wpa_supplicant events monitor newCtx is ctx shortened for the stop function, which should be deferred by the caller.
func (*TestFixture) VerifyConnection ¶
func (tf *TestFixture) VerifyConnection(ctx context.Context, ap *APIface) error
VerifyConnection verifies that the AP is reachable by pinging, and we have the same frequency and subnet as AP's.
func (*TestFixture) WaitWifiConnected ¶
func (tf *TestFixture) WaitWifiConnected(ctx context.Context, guid string) error
WaitWifiConnected waits until WiFi is connected to the SHILL profile with specific GUID.
func (*TestFixture) WifiClient ¶
func (tf *TestFixture) WifiClient() *WifiClient
WifiClient returns the gRPC ShillServiceClient of the DUT.
type WPAMonitor ¶
type WPAMonitor struct {
// contains filtered or unexported fields
}
WPAMonitor holds internal context of the WPA monitor.
func (*WPAMonitor) ClearEvents ¶
func (w *WPAMonitor) ClearEvents(ctx context.Context)
ClearEvents clears all buffered output from wpa_cli, discarding events collected so far. Some events may still be in i/o buffers, these won't be cleared. Timeout (1s) is used in case of events flood.
func (*WPAMonitor) Start ¶
Start initializes the wpa_supplicant monitor. It starts wpa_cli process in background and creates a thread collecting its output. Both need to be stopped with a call to w.Stop().
func (*WPAMonitor) Stop ¶
func (w *WPAMonitor) Stop(ctx context.Context) error
Stop sends quit command to wpa_cli and waits until the process exits (or context deadline passes).
func (*WPAMonitor) WaitForEvent ¶
func (w *WPAMonitor) WaitForEvent(ctx context.Context) (event SupplicantEvent, firstErr error)
WaitForEvent waits for any event in wpa_cli stdout, as defined in @eventDefs. It includes events already buffered in since last call to WaitForEvent or to ClearEvents. It returns event = nil when context deadline is exceeded. In case of successful match and error in parsing the fields, the event is returned (incomplete) and firstErr contains the first parsing error that occurred.
type WifiClient ¶
type WifiClient struct {
wifi.ShillServiceClient
}
WifiClient is a wrapper of ShillServiceClient to simplify gRPC calls e.g. handle complex streaming gRPCs, hide gRPC request/response, etc. Users can still access the raw gRPC with WifiClient.ShillServiceClient.
func (*WifiClient) AssureDisconnect ¶
func (cli *WifiClient) AssureDisconnect(ctx context.Context, servicePath string, timeout time.Duration) error
AssureDisconnect assures that the WiFi service has disconnected within timeout.
func (*WifiClient) CurrentTime ¶
CurrentTime returns the current time on DUT.
func (*WifiClient) DisableMACRandomize ¶
func (cli *WifiClient) DisableMACRandomize(ctx context.Context) (shortenCtx context.Context, cleanupFunc func() error, retErr error)
DisableMACRandomize disables MAC randomization on DUT if supported, this is useful for tests verifying probe requests from DUT. On success, a shortened context and cleanup function is returned.
func (*WifiClient) DisconnectReason ¶
DisconnectReason is a wrapper for the streaming gRPC call DisconnectReason. It returns a function that waits for the wpa_supplicant DisconnectReason property change, and returns the disconnection reason code.
func (*WifiClient) DiscoverBSSID ¶
DiscoverBSSID discovers a service with the given properties.
func (*WifiClient) EAPAuthSkipped ¶
EAPAuthSkipped is a wrapper for the streaming gRPC call EAPAuthSkipped. It returns a function that waits and verifies the EAP authentication is skipped or not in the next connection.
func (*WifiClient) ExpectShillProperty ¶
func (cli *WifiClient) ExpectShillProperty(ctx context.Context, objectPath string, props []*ShillProperty, monitorProps []string) (func() ([]protoutil.ShillPropertyHolder, error), error)
ExpectShillProperty is a wrapper for the streaming gRPC call ExpectShillProperty. It takes an array of ShillProperty, an array of shill properties to monitor, and a shill service path. It returns a function that waites for the expected property changes and returns the monitor results.
func (*WifiClient) FlushBSS ¶
FlushBSS flushes BSS entries over the specified age from wpa_supplicant's cache.
func (*WifiClient) Interface ¶
func (cli *WifiClient) Interface(ctx context.Context) (string, error)
Interface returns the WiFi interface name of the DUT.
func (*WifiClient) QueryService ¶
func (cli *WifiClient) QueryService(ctx context.Context) (*wifi.QueryServiceResponse, error)
QueryService queries shill information of selected service.
func (*WifiClient) Reassociate ¶
Reassociate triggers reassociation with the current AP and waits until it has reconnected or the timeout expires.
func (*WifiClient) RequestRoam ¶
func (cli *WifiClient) RequestRoam(ctx context.Context, iface, bssid string, timeout time.Duration) error
RequestRoam requests DUT to roam to the specified BSSID and waits until the DUT has roamed.
func (*WifiClient) SetWakeOnWifi ¶
func (cli *WifiClient) SetWakeOnWifi(ctx context.Context, ops ...SetWakeOnWifiOption) (shortenCtx context.Context, cleanupFunc func() error, retErr error)
SetWakeOnWifi sets properties related to wake on WiFi.
func (*WifiClient) SetWifiEnabled ¶
func (cli *WifiClient) SetWifiEnabled(ctx context.Context, enabled bool) error
SetWifiEnabled persistently enables/disables Wifi via shill.
func (*WifiClient) Suspend ¶
Suspend suspends the DUT for wakeUpTimeout seconds through gRPC. This call will fail when the DUT wake up early. If the caller expects the DUT to wake up early, please use the Suspend gRPC to specify the detailed options.
func (*WifiClient) SuspendAssertConnect ¶
func (cli *WifiClient) SuspendAssertConnect(ctx context.Context, wakeUpTimeout time.Duration) (time.Duration, error)
SuspendAssertConnect suspends the DUT for wakeUpTimeout seconds through gRPC and returns the duration from resume to connect.
func (*WifiClient) TurnOffBgscan ¶
TurnOffBgscan turns off the DUT's background scan, and returns a shortened ctx and a restoring function.
func (*WifiClient) WatchDarkResume ¶
func (cli *WifiClient) WatchDarkResume(ctx context.Context) (func() (*wifi.WatchDarkResumeResponse, error), error)
WatchDarkResume is a wrapper for the streaming gRPC call WatchDarkResume, which watches dark resumes before next full resume. It returns a function that waits for the response of the gRPC call.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package attenuator controls of the Mini-Circuits RC4DAT programmable attenuator.
|
Package attenuator controls of the Mini-Circuits RC4DAT programmable attenuator. |
Package dhcp provides utilities for controlling DHCP server.
|
Package dhcp provides utilities for controlling DHCP server. |
Package dutcfg provides utilities for controlling the DUT.
|
Package dutcfg provides utilities for controlling the DUT. |
Package fileutil provides utilities for operating files in remote wifi tests.
|
Package fileutil provides utilities for operating files in remote wifi tests. |
Package framesender provides utilities to send management frames.
|
Package framesender provides utilities to send management frames. |
Package hostapd provides utilities for controlling hostapd.
|
Package hostapd provides utilities for controlling hostapd. |
Package log provides utilities to collect logs.
|
Package log provides utilities to collect logs. |
Package pcap provides utilities to capture WiFi packets.
|
Package pcap provides utilities to capture WiFi packets. |
Package router provides utilities for accessing or controlling different routers.
|
Package router provides utilities for accessing or controlling different routers. |
ax
Package ax provides utilities for accessing or controlling AX enabled routers.
|
Package ax provides utilities for accessing or controlling AX enabled routers. |
common
Package common includes common logic used across multiple router implementations.
|
Package common includes common logic used across multiple router implementations. |
common/support
Package support identifies the different common features routers may support through interfaces that each router may or may not support.
|
Package support identifies the different common features routers may support through interfaces that each router may or may not support. |
legacy
Package legacy provides utilities for accessing or controlling legacy router architecture.
|
Package legacy provides utilities for accessing or controlling legacy router architecture. |
openwrt
Package openwrt provides utilities for accessing and controlling Router routers.
|
Package openwrt provides utilities for accessing and controlling Router routers. |
openwrt/uci
Package uci contains utility functions to wrap around the uci program.
|
Package uci contains utility functions to wrap around the uci program. |
Package verifier is a framework for running verification function in parallel to the actual test with option to re-run verification function in a loop until the primary test is finished.
|
Package verifier is a framework for running verification function in parallel to the actual test with option to re-run verification function in a loop until the primary test is finished. |
Package wifipeer builds and controls peer Chrome OS devices for Wi-Fi tests.
|
Package wifipeer builds and controls peer Chrome OS devices for Wi-Fi tests. |
Package wifiutil provides helper functions for the wificell package.
|
Package wifiutil provides helper functions for the wificell package. |