test

package
v3.16.8 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfig

func GetConfig() config.Config

GetConfig returns the test configuration.

func NewApplicationServerPool

func NewApplicationServerPool(client *ApplicationClient) asclient.Pool

NewApplicationServerPool create an application-server client pool which always returns the given client on Get.

Types

type ApplicationClient

type ApplicationClient struct {
	HandleDataUpErr                error
	HandleProprietaryUpErr         error
	HandleDownlinkACKErr           error
	HandleTxAckError               error
	SetDeviceStatusError           error
	SetDeviceLocationErrror        error
	ReEncryptDeviceQueueItemsError error

	HandleDataUpChan              chan as.HandleUplinkDataRequest
	HandleProprietaryUpChan       chan as.HandleProprietaryUplinkRequest
	HandleErrorChan               chan as.HandleErrorRequest
	HandleDownlinkACKChan         chan as.HandleDownlinkACKRequest
	HandleTxAckChan               chan as.HandleTxAckRequest
	HandleGatewayStatsChan        chan as.HandleGatewayStatsRequest
	SetDeviceStatusChan           chan as.SetDeviceStatusRequest
	SetDeviceLocationChan         chan as.SetDeviceLocationRequest
	ReEncryptDeviceQueueItemsChan chan as.ReEncryptDeviceQueueItemsRequest

	HandleDataUpResponse              empty.Empty
	HandleProprietaryUpResponse       empty.Empty
	HandleErrorResponse               empty.Empty
	HandleDownlinkACKResponse         empty.Empty
	HandleTxAckResponse               empty.Empty
	HandleGatewayStatsResponse        empty.Empty
	SetDeviceStatusResponse           empty.Empty
	SetDeviceLocationResponse         empty.Empty
	ReEncryptDeviceQueueItemsResponse as.ReEncryptDeviceQueueItemsResponse
}

ApplicationClient is an application client for testing.

func NewApplicationClient

func NewApplicationClient() *ApplicationClient

NewApplicationClient returns a new ApplicationClient.

func (*ApplicationClient) HandleDownlinkACK

func (t *ApplicationClient) HandleDownlinkACK(ctx context.Context, in *as.HandleDownlinkACKRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleDownlinkACK method.

func (*ApplicationClient) HandleError

func (t *ApplicationClient) HandleError(ctx context.Context, in *as.HandleErrorRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleError method.

func (*ApplicationClient) HandleGatewayStats

func (t *ApplicationClient) HandleGatewayStats(ctx context.Context, in *as.HandleGatewayStatsRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleGatewayStats method.

func (t *ApplicationClient) HandleProprietaryUplink(ctx context.Context, in *as.HandleProprietaryUplinkRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleProprietaryUplink method.

func (*ApplicationClient) HandleTxAck

func (t *ApplicationClient) HandleTxAck(ctx context.Context, in *as.HandleTxAckRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleTxAck method.

func (*ApplicationClient) HandleUplinkData

func (t *ApplicationClient) HandleUplinkData(ctx context.Context, in *as.HandleUplinkDataRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleUplinkData method.

func (*ApplicationClient) ReEncryptDeviceQueueItems

ReEncryptDeviceQueueItems method.

func (*ApplicationClient) SetDeviceLocation

func (t *ApplicationClient) SetDeviceLocation(ctx context.Context, in *as.SetDeviceLocationRequest, opts ...grpc.CallOption) (*empty.Empty, error)

SetDeviceLocation method.

func (*ApplicationClient) SetDeviceStatus

func (t *ApplicationClient) SetDeviceStatus(ctx context.Context, in *as.SetDeviceStatusRequest, opts ...grpc.CallOption) (*empty.Empty, error)

SetDeviceStatus method.

type ApplicationServerPool

type ApplicationServerPool struct {
	Client      as.ApplicationServerServiceClient
	GetHostname string
}

ApplicationServerPool is an application-server pool for testing.

func (*ApplicationServerPool) Get

func (p *ApplicationServerPool) Get(hostname string, caCert, tlsCert, tlsKey []byte) (as.ApplicationServerServiceClient, error)

Get returns the Client.

type BackendClient

type BackendClient struct {
	SenderID            string
	ReceiverID          string
	Async               bool
	RandomTransactionID uint32

	PRStartReqChan  chan backend.PRStartReqPayload
	PRStopReqChan   chan backend.PRStopReqPayload
	XmitDataReqChan chan backend.XmitDataReqPayload
	ProfileReqChan  chan backend.ProfileReqPayload
	HomeNSReqChan   chan backend.HomeNSReqPayload

	PRStartAns  backend.PRStartAnsPayload
	PRStopAns   backend.PRStopAnsPayload
	XmitDataAns backend.XmitDataAnsPayload
	ProfileAns  backend.ProfileAnsPayload
	HomeNSAns   backend.HomeNSAnsPayload
}

BackendClient is a LoRaWAN Backend Interfaces client for testing.

func NewBackendClient

func NewBackendClient() *BackendClient

NewBackendClient creates a new BackendClient.

func (*BackendClient) GetRandomTransactionID

func (c *BackendClient) GetRandomTransactionID() uint32

GetRandomTransactionID returns a random transaction id.

func (*BackendClient) GetReceiverID

func (c *BackendClient) GetReceiverID() string

GetReceiverID returns the ReceiverID.

func (*BackendClient) GetSenderID

func (c *BackendClient) GetSenderID() string

GetSenderID returns the SenderID.

func (*BackendClient) HandleAnswer

func (c *BackendClient) HandleAnswer(context.Context, backend.Answer) error

HandleAnswer handles an async answer.

func (*BackendClient) HomeNSReq

HomeNSReq method.

func (*BackendClient) IsAsync

func (c *BackendClient) IsAsync() bool

IsAsync returns a bool indicating if the client is async.

func (*BackendClient) PRStartReq

PRStartReq method.

func (*BackendClient) PRStopReq

PRStopReq method.

func (*BackendClient) ProfileReq

ProfileReq method.

func (*BackendClient) SendAnswer

func (c *BackendClient) SendAnswer(context.Context, backend.Answer) error

SendAnswer sends the async answer.

func (*BackendClient) XmitDataReq

XmitDataReq method.

type GatewayBackend

type GatewayBackend struct {
	TXPacketChan            chan gw.DownlinkFrame
	GatewayConfigPacketChan chan gw.GatewayConfiguration
	// contains filtered or unexported fields
}

GatewayBackend is a test gateway backend.

func NewGatewayBackend

func NewGatewayBackend() *GatewayBackend

NewGatewayBackend returns a new GatewayBackend.

func (*GatewayBackend) Close

func (b *GatewayBackend) Close() error

Close method.

func (*GatewayBackend) DownlinkTXAckChan

func (b *GatewayBackend) DownlinkTXAckChan() chan gw.DownlinkTXAck

DownlinkTXAckChan method.

func (*GatewayBackend) RXPacketChan

func (b *GatewayBackend) RXPacketChan() chan gw.UplinkFrame

RXPacketChan method.

func (*GatewayBackend) SendGatewayConfigPacket

func (b *GatewayBackend) SendGatewayConfigPacket(config gw.GatewayConfiguration) error

SendGatewayConfigPacket method.

func (*GatewayBackend) SendTXPacket

func (b *GatewayBackend) SendTXPacket(txPacket gw.DownlinkFrame) error

SendTXPacket method.

func (*GatewayBackend) StatsPacketChan

func (b *GatewayBackend) StatsPacketChan() chan gw.GatewayStats

StatsPacketChan method.

type NetworkControllerClient

type NetworkControllerClient struct {
	HandleUplinkMetaDataChan         chan nc.HandleUplinkMetaDataRequest
	HandleDownlinkMetaDataChan       chan nc.HandleDownlinkMetaDataRequest
	HandleDataUpMACCommandChan       chan nc.HandleUplinkMACCommandRequest
	HandleRejectedUplinkFrameSetChan chan nc.HandleRejectedUplinkFrameSetRequest
}

NetworkControllerClient is a network-controller client for testing.

func NewNetworkControllerClient

func NewNetworkControllerClient() *NetworkControllerClient

NewNetworkControllerClient returns a new NetworkControllerClient.

func (*NetworkControllerClient) HandleDownlinkMetaData

func (t *NetworkControllerClient) HandleDownlinkMetaData(ctx context.Context, in *nc.HandleDownlinkMetaDataRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleDownlinkMetaData method.

func (*NetworkControllerClient) HandleRejectedUplinkFrameSet

func (t *NetworkControllerClient) HandleRejectedUplinkFrameSet(ctx context.Context, in *nc.HandleRejectedUplinkFrameSetRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleRejectedUplinkFrameSet method.

func (*NetworkControllerClient) HandleUplinkMACCommand

func (t *NetworkControllerClient) HandleUplinkMACCommand(ctx context.Context, in *nc.HandleUplinkMACCommandRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleUplinkMACCommand method.

func (*NetworkControllerClient) HandleUplinkMetaData

func (t *NetworkControllerClient) HandleUplinkMetaData(ctx context.Context, in *nc.HandleUplinkMetaDataRequest, opts ...grpc.CallOption) (*empty.Empty, error)

HandleUplinkMetaData method.

Jump to

Keyboard shortcuts

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