cntlr

package
v0.0.0-...-1242a22 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

README

Message Transfer Protocol Manager

N4 Networks's MTP Manager is an architectural block of USP Controller. This handles all transport related data and message processing. This cloud native application consists of one or many containers managed by Kubernetes deployment framework.

Introduction

USP (User Service Platform) supports various message transfer protocols and mechanism to create communication paths between Controller and Agent or two Endpoints. These protocols are mainly at application level and use UDP or TCP as transport protocols underneath.

Protocol Binding Mechanisms

While USP supports message brokers and various other client server protocols to cater to the devices having small form-factors (e.g. IoT devices etc.) N4 Controller does support TR-069 based network devices. The default MTP of TR-069 is HTTP/HTTPS.

  • CoAP: Constrained Application Protocol
  • STOMP: Simple Text-Oriented Messaging Protocol
  • MQTT: MQ Telemetry Transport
  • WebSocket: Self explainatory
  • HTTP: Hyper Text Transfer Protocol
CoAP

Message Encoding and Decoding

Configuration

Even though it was designed to take configuration files from mtt.yaml in yaml format but few parameters like port and addresses etc. are taken from environment varibles to support ConfigMap kind of deployment

Environment variables
  1. STOMP_ADDR. Ex: STOMP_ADDR=172.17.0.4:61613 where 61613 is the port of activemq server. If not set it would take default as ":61613"
  2. DB_ADDR. Ex: DB_ADDR=172.17.0.3:27017. If not set it would take default as ":27017".
  3. AGENT_ID. Ex. AGENT_ID=1234-N4-221133. If not set it and if mtp is running in CLI mode (-c) it would given error
Run Options (command line opts)
  1. MTP is designed to be running a deamon but it does support command line cli. To run in cli mode use -c option (Ex: ./mtp -c).
  2. You can provide a config file by giving -f option. Ex. ./mtp -f myconfig.yaml, default is mtp.yaml
gRPC Support

MTP provides a set of GRPC call to send messages to agent. Please refer to pb/mtpgrpc/mtpgrpc.proto for more details

Documentation

Index

Constants

View Source
const (
	SERVER_MODE_NORMAL = iota
	SERVER_MODE_TLS
	SERVER_MODE_NORMAL_AND_TLS
)
View Source
const (
	COAP_SERVER = iota
	GRPC_SERVER
	COAP_SERVER_DTLS
	STOMP_SERVER_TLS
)
View Source
const SetLogHelp = "setlog <on|off> <all|date|time|long|short>"

Variables

View Source
var (
	DmObjAccessString = map[int32]string{
		0: "OBJ_READ_ONLY",
		1: "OBJ_ADD_DELETE",
		2: "OBJ_ADD_ONLY",
		3: "OBJ_DELETE_ONLY",
	}
	DmObjAccessInt = map[string]int32{
		"OBJ_READ_ONLY":   0,
		"OBJ_ADD_DELETE":  1,
		"OBJ_ADD_ONLY":    2,
		"OBJ_DELETE_ONLY": 3,
	}
	DmParamAccessString = map[int32]string{
		0: "PARAM_READ_ONLY",
		1: "PARAM_READ_WRITE",
		2: "PARAM_WRITE_ONLY",
	}
	DmParamAccessInt = map[string]int32{
		"PARAM_READ_ONLY":  0,
		"PARAM_READ_WRITE": 1,
		"PARAM_WRITE_ONLY": 2,
	}
)

Functions

This section is empty.

Types

type CError

type CError struct {
	Code uint32
	Msg  string
}

type CInstance

type CInstance struct {
	Path        string
	UniqueKeys  map[string]string
	OpIsSuccess bool
	OpErrStr    string
}

type CParamSetResult

type CParamSetResult struct {
	Path        string
	OpIsSuccess bool
	OpErrStr    string
}

type Cntlr

type Cntlr struct {
	cntlrgrpc.UnimplementedGrpcServer
	// contains filtered or unexported fields
}

func (*Cntlr) AddInstanceReq

func (*Cntlr) Cli

func (c *Cntlr) Cli()

func (*Cntlr) DeleteInstanceReq

func (c *Cntlr) DeleteInstanceReq(ctx context.Context, p *cntlrgrpc.DeleteInstanceReqData) (*cntlrgrpc.ReqResult, error)

func (*Cntlr) GetDatamodelReq

func (c *Cntlr) GetDatamodelReq(ctx context.Context, p *cntlrgrpc.GetDatamodelReqData) (*cntlrgrpc.ReqResult, error)

func (*Cntlr) GetInfo

func (c *Cntlr) GetInfo(ctx context.Context, p *cntlrgrpc.None) (*cntlrgrpc.InfoData, error)

func (*Cntlr) GetInstancesReq

func (c *Cntlr) GetInstancesReq(ctx context.Context, p *cntlrgrpc.GetInstancesReqData) (*cntlrgrpc.ReqResult, error)

func (*Cntlr) GetParamReq

func (c *Cntlr) GetParamReq(ctx context.Context, p *cntlrgrpc.GetParamReqData) (*cntlrgrpc.ReqResult, error)

USP releated services

func (*Cntlr) GrpcServerThread

func (c *Cntlr) GrpcServerThread(port string, exit chan int32)

func (*Cntlr) Init

func (c *Cntlr) Init() error

func (*Cntlr) MtpReceiveThread

func (c *Cntlr) MtpReceiveThread()

func (*Cntlr) MtpStart

func (c *Cntlr) MtpStart() error

func (*Cntlr) OperateReq

func (*Cntlr) Run

func (c *Cntlr) Run() (chan int32, error)

func (*Cntlr) SetParamReq

func (*Cntlr) WaitForExit

func (c *Cntlr) WaitForExit(exit chan int32)

type MsgType

type MsgType byte
const (
	MsgTypeNotify MsgType = iota
	MsgTypeGet
	MsgTypeSet
	MsgTypeOperate
	MsgTypeAdd
	MsgTypeDel
	MsgTypeGetDm
)

type NotifyType

type NotifyType byte
const (
	NotifyEvent NotifyType = iota
	NotifyValueChange
	NotifyObjCreation
	NotifyObjDeletion
	NotifyOpComplete
	NotifyOnBoardReq
)

Jump to

Keyboard shortcuts

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