mock

package
v3.13.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GatewayServer

type GatewayServer struct {
	*component.Component
	Downlink chan *ttnpb.DownlinkMessage
}

GatewayServer is a mock Gateway Server.

func NewGatewayServer

func NewGatewayServer(c *component.Component) (*GatewayServer, error)

NewGatewayServer returns a new GatewayServer.

func (*GatewayServer) Publish

Publish publishes the given message to Packet Broker Agent in the cluster.

func (*GatewayServer) RegisterHandlers

func (gs *GatewayServer) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn)

RegisterHandlers implements rpcserver.Registerer.

func (*GatewayServer) RegisterServices

func (gs *GatewayServer) RegisterServices(s *grpc.Server)

RegisterServices implements rpcserver.Registerer.

func (*GatewayServer) Roles

func (gs *GatewayServer) Roles() []ttnpb.ClusterRole

Roles implements rpcserver.Registerer.

ScheduleDownlink implements ttnpb.NsGsServer.

type NetworkServer

type NetworkServer struct {
	*component.Component
	Uplink chan *ttnpb.UplinkMessage
	TxAck  chan *ttnpb.GatewayTxAcknowledgment
}

NetworkServer is a mock Network Server.

func NewNetworkServer

func NewNetworkServer(c *component.Component) (*NetworkServer, error)

NewNetworkServer returns a new NetworkServer.

func (ns *NetworkServer) HandleUplink(ctx context.Context, req *ttnpb.UplinkMessage) (*pbtypes.Empty, error)

HandleUplink implements ttnpb.GsNsServer.

func (*NetworkServer) Publish

func (ns *NetworkServer) Publish(ctx context.Context, down *ttnpb.DownlinkMessage) error

Publish publishes the given message to Packet Broker Agent in the cluster.

func (*NetworkServer) RegisterHandlers

func (ns *NetworkServer) RegisterHandlers(s *runtime.ServeMux, conn *grpc.ClientConn)

RegisterHandlers implements rpcserver.Registerer.

func (*NetworkServer) RegisterServices

func (ns *NetworkServer) RegisterServices(s *grpc.Server)

RegisterServices implements rpcserver.Registerer.

func (*NetworkServer) ReportTxAcknowledgment added in v3.12.0

func (ns *NetworkServer) ReportTxAcknowledgment(_ context.Context, req *ttnpb.GatewayTxAcknowledgment) (*pbtypes.Empty, error)

ReportTxAcknowledgment implements ttnpb.GsNsServer.

func (*NetworkServer) Roles

func (ns *NetworkServer) Roles() []ttnpb.ClusterRole

Roles implements rpcserver.Registerer.

type PBControlPlane added in v3.12.0

type PBControlPlane struct {
	*grpc.Server
	ListDefaultPoliciesHandler     func(ctx context.Context, req *routingpb.ListDefaultPoliciesRequest) (*routingpb.ListDefaultPoliciesResponse, error)
	GetDefaultPolicyHandler        func(ctx context.Context, req *routingpb.GetDefaultPolicyRequest) (*routingpb.GetPolicyResponse, error)
	SetDefaultPolicyHandler        func(ctx context.Context, req *routingpb.SetPolicyRequest) (*pbtypes.Empty, error)
	ListHomeNetworkPoliciesHandler func(ctx context.Context, req *routingpb.ListHomeNetworkPoliciesRequest) (*routingpb.ListHomeNetworkPoliciesResponse, error)
	GetHomeNetworkPolicyHandler    func(ctx context.Context, req *routingpb.GetHomeNetworkPolicyRequest) (*routingpb.GetPolicyResponse, error)
	SetHomeNetworkPolicyHandler    func(ctx context.Context, req *routingpb.SetPolicyRequest) (*pbtypes.Empty, error)
	ListEffectivePoliciesHandler   func(ctx context.Context, req *routingpb.ListEffectivePoliciesRequest) (*routingpb.ListEffectivePoliciesResponse, error)
	ListNetworksWithPolicyHandler  func(ctx context.Context, req *routingpb.ListNetworksWithPolicyRequest) (*routingpb.ListNetworksResponse, error)
}

PBControlPlane is a mock Packet Broker Control Plane.

func NewPBControlPlane added in v3.12.0

func NewPBControlPlane(tb testing.TB) *PBControlPlane

NewPBControlPlane instantiates a new mock Packet Broker Control Plane.

func (*PBControlPlane) GetDefaultPolicy added in v3.12.0

func (*PBControlPlane) GetHomeNetworkPolicy added in v3.12.0

func (*PBControlPlane) ListDefaultPolicies added in v3.12.0

func (*PBControlPlane) ListEffectivePolicies added in v3.12.0

func (*PBControlPlane) ListHomeNetworkPolicies added in v3.12.0

func (*PBControlPlane) ListNetworksWithPolicy added in v3.13.0

func (*PBControlPlane) SetDefaultPolicy added in v3.12.0

func (s *PBControlPlane) SetDefaultPolicy(ctx context.Context, req *routingpb.SetPolicyRequest) (*pbtypes.Empty, error)

func (*PBControlPlane) SetHomeNetworkPolicy added in v3.12.0

func (s *PBControlPlane) SetHomeNetworkPolicy(ctx context.Context, req *routingpb.SetPolicyRequest) (*pbtypes.Empty, error)

type PBDataPlane

type PBDataPlane struct {
	*grpc.Server
	ForwarderUp              chan *packetbroker.RoutedUplinkMessage
	ForwarderDown            chan *packetbroker.RoutedDownlinkMessage
	ForwarderDownStateChange chan *packetbroker.DownlinkMessageDeliveryStateChange
	HomeNetworkDown          chan *packetbroker.RoutedDownlinkMessage
	HomeNetworkUp            chan *packetbroker.RoutedUplinkMessage
	HomeNetworkUpStateChange chan *packetbroker.UplinkMessageDeliveryStateChange
}

PBDataPlane is a mock Packet Broker Data Plane.

func NewPBDataPlane

func NewPBDataPlane(cert tls.Certificate, clientCAs *x509.CertPool) *PBDataPlane

NewPBDataPlane instantiates a new mock Packet Broker Data Plane.

type PBIAM added in v3.12.0

type PBIAM struct {
	*grpc.Server
	Registry struct {
		ListNetworksHandler  func(ctx context.Context, req *iampb.ListNetworksRequest) (*iampb.ListNetworksResponse, error)
		CreateNetworkHandler func(ctx context.Context, req *iampb.CreateNetworkRequest) (*iampb.CreateNetworkResponse, error)
		GetNetworkHandler    func(ctx context.Context, req *iampb.NetworkRequest) (*iampb.GetNetworkResponse, error)
		UpdateNetworkHandler func(ctx context.Context, req *iampb.UpdateNetworkRequest) (*pbtypes.Empty, error)
		DeleteNetworkHandler func(ctx context.Context, req *iampb.NetworkRequest) (*pbtypes.Empty, error)
		ListTenantsHandler   func(ctx context.Context, req *iampb.ListTenantsRequest) (*iampb.ListTenantsResponse, error)
		CreateTenantHandler  func(ctx context.Context, req *iampb.CreateTenantRequest) (*iampb.CreateTenantResponse, error)
		GetTenantHandler     func(ctx context.Context, req *iampb.TenantRequest) (*iampb.GetTenantResponse, error)
		UpdateTenantHandler  func(ctx context.Context, req *iampb.UpdateTenantRequest) (*pbtypes.Empty, error)
		DeleteTenantHandler  func(ctx context.Context, req *iampb.TenantRequest) (*pbtypes.Empty, error)
	}
	Catalog struct {
		ListNetworksHandler     func(ctx context.Context, req *iampbv2.ListNetworksRequest) (*iampbv2.ListNetworksResponse, error)
		ListHomeNetworksHandler func(ctx context.Context, req *iampbv2.ListNetworksRequest) (*iampbv2.ListNetworksResponse, error)
	}
}

PBIAM is a mock Packet Broker IAM.

func NewPBIAM added in v3.12.0

func NewPBIAM(tb testing.TB) *PBIAM

NewPBIAM instantiates a new mock Packet Broker IAM.

Jump to

Keyboard shortcuts

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