Documentation ¶
Overview ¶
Package common includes common logic used across multiple router implementations.
Index ¶
- Constants
- func CollectLogs(ctx context.Context, r support.Router, logCollectors map[string]*log.Collector, ...) error
- func HostFileContentsMatch(ctx context.Context, host *ssh.Conn, remoteFilePath, matchRegex string) (bool, error)
- func HostFileExists(ctx context.Context, host *ssh.Conn, remoteFilePath string) (bool, error)
- func HostTestPath(ctx context.Context, host *ssh.Conn, testFlag, remotePath string) (bool, error)
- func StartLogCollectors(ctx context.Context, host *ssh.Conn, logsToCollect []string, ...) (map[string]*log.Collector, error)
- func StopLogCollectors(ctx context.Context, logCollectors map[string]*log.Collector) error
- type IfaceManager
- func (im *IfaceManager) Create(ctx context.Context, phyName string, phyID int, t iw.IfType) (*iw.NetDev, error)
- func (im *IfaceManager) IsPhyBusy(phyID int, t iw.IfType) bool
- func (im *IfaceManager) IsPhyBusyAny(phyID int) bool
- func (im *IfaceManager) Remove(ctx context.Context, iface string) error
- func (im *IfaceManager) RemoveAll(ctx context.Context) error
- func (im *IfaceManager) SetAvailable(iface string)
- func (im *IfaceManager) SetBusy(iface string)
Constants ¶
const ( // AutotestWorkdirGlob is the path that grabs all autotest outputs. AutotestWorkdirGlob = "/tmp/autotest-*" // WorkingDir is the tast-test's working directory. WorkingDir = "/tmp/tast-test/" )
const ( // VethPrefix is the prefix for the veth interface. VethPrefix = "vethA" // VethPeerPrefix is the prefix for the peer's veth interface. VethPeerPrefix = "vethB" // BridgePrefix is the prefix for the bridge interface. BridgePrefix = "tastbr" )
const RouterCloseContextDuration = 5 * time.Second
RouterCloseContextDuration is a shorter context.Context duration is used for running things before Router.Close to reserve time for it to run.
Variables ¶
This section is empty.
Functions ¶
func CollectLogs ¶
func CollectLogs(ctx context.Context, r support.Router, logCollectors map[string]*log.Collector, logsToCollect []string, suffix string) error
CollectLogs downloads log files from router to $OutDir/debug/$r.Name with suffix appended to the filenames.
func HostFileContentsMatch ¶
func HostFileContentsMatch(ctx context.Context, host *ssh.Conn, remoteFilePath, matchRegex string) (bool, error)
HostFileContentsMatch checks if the file at remoteFilePath on the remote host exists and that its contents match using the regex string matchRegex.
Returns true if the file exists and its contents matches. Returns false with a nil error if the file does not exist.
func HostFileExists ¶
HostFileExists checks the host for the file at remoteFilePath and returns true if remoteFilePath exists and is a regular file.
func HostTestPath ¶
HostTestPath runs "test <testFlag> <remoteFilePath>" on the host and returns true if the test passes and false if the test fails.
Types ¶
type IfaceManager ¶
type IfaceManager struct { // Available is a map from the interface name to iw.NetDev for available interfaces. Available map[string]*iw.NetDev // Busy is a map from the interface name to iw.NetDev for busy interfaces. Busy map[string]*iw.NetDev // contains filtered or unexported fields }
IfaceManager manages WiFi ifaces on a controller router and tracks their availability.
func NewRouterIfaceManager ¶
func NewRouterIfaceManager(r support.Router, iwr *iw.Runner) *IfaceManager
NewRouterIfaceManager creates a new IfaceManager
func (*IfaceManager) Create ¶
func (im *IfaceManager) Create(ctx context.Context, phyName string, phyID int, t iw.IfType) (*iw.NetDev, error)
Create creates an interface on phy of type t and returns the name of created interface.
func (*IfaceManager) IsPhyBusy ¶
func (im *IfaceManager) IsPhyBusy(phyID int, t iw.IfType) bool
IsPhyBusy returns true if the phyID is occupied by a busy interface of type t.
func (*IfaceManager) IsPhyBusyAny ¶
func (im *IfaceManager) IsPhyBusyAny(phyID int) bool
IsPhyBusyAny returns true if the phyID is occupied by a busy interface of any type.
func (*IfaceManager) Remove ¶
func (im *IfaceManager) Remove(ctx context.Context, iface string) error
Remove removes the given iface with the iw command.
func (*IfaceManager) RemoveAll ¶
func (im *IfaceManager) RemoveAll(ctx context.Context) error
RemoveAll removes all WiFi interfaces.
func (*IfaceManager) SetAvailable ¶
func (im *IfaceManager) SetAvailable(iface string)
SetAvailable marks iface as available.
func (*IfaceManager) SetBusy ¶
func (im *IfaceManager) SetBusy(iface string)
SetBusy marks iface as busy.
Directories ¶
Path | Synopsis |
---|---|
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. |