Documentation
¶
Index ¶
- func CheckErrors(errChan chan error) error
- func Connect(_ context.Context, address string, caPath, certPath, keyPath string, ...) (*grpc.ClientConn, error)
- func IntToInt16(i int) (int16, error)
- func LoadFile(filePath string) (string, error)
- func NewIFMSimService(nodeStore Store, cfg *Config) northbound.Service
- func NewUUID(enUUID string) (string, error)
- type Cli
- func (c *Cli) PromptNodeCreate(_ interface{}) (interface{}, error)
- func (c *Cli) PromptNodeCreateMany(_ interface{}) (interface{}, error)
- func (c *Cli) PromptNodeDelete(arg interface{}) (interface{}, error)
- func (c *Cli) PromptNodeDeleteMany(arg interface{}) (interface{}, error)
- func (c *Cli) PromptNodeGet(arg interface{}) (interface{}, error)
- func (c *Cli) PromptNodeList(_ interface{}) (interface{}, error)
- func (c *Cli) PromptRoot() (interface{}, error)
- type CliCfg
- type Client
- type Config
- type EdgeNode
- func (en *EdgeNode) GetAgentsStates() ensim_agents.StateMap
- func (en *EdgeNode) GetAgentsStatus() map[ensimapi.StatusSource]*ensimapi.NodeStatus
- func (en *EdgeNode) SetAgentsStates(states map[ensim_agents.AgentType]ensim_agents.AgentState)
- func (en *EdgeNode) Start() error
- func (en *EdgeNode) StatsCollector()
- func (en *EdgeNode) Stop() error
- type EdgeNodes
- func (s *EdgeNodes) Add(en *EdgeNode) error
- func (s *EdgeNodes) Get(id UUID) (*EdgeNode, error)
- func (s *EdgeNodes) Len() (int, error)
- func (s *EdgeNodes) List() ([]*EdgeNode, error)
- func (s *EdgeNodes) Remove(id UUID) error
- func (s *EdgeNodes) Watch(ctx context.Context, ch chan<- Event, options ...WatchOptions) error
- type Event
- type EventChannel
- type Manager
- type NodeEvent
- type Server
- func (s *Server) CreateNode(_ context.Context, req *ensimapi.CreateNodeRequest) (*ensimapi.CreateNodeResponse, error)
- func (s *Server) CreateNodes(_ context.Context, req *ensimapi.CreateNodesRequest) (*ensimapi.CreateNodesResponse, error)
- func (s *Server) DeleteNode(_ context.Context, req *ensimapi.DeleteNodeRequest) (*ensimapi.DeleteNodeResponse, error)
- func (s *Server) DeleteNodes(_ context.Context, req *ensimapi.DeleteNodesRequest) (*ensimapi.DeleteNodesResponse, error)
- func (s *Server) GetNode(_ context.Context, req *ensimapi.GetNodeRequest) (*ensimapi.GetNodeResponse, error)
- func (s *Server) ListNodes(_ *ensimapi.ListNodesRequest, ...) error
- func (s *Server) UpdateNode(_ context.Context, req *ensimapi.UpdateNodeRequest) (*ensimapi.UpdateNodeResponse, error)
- func (s *Server) WatchNodes(req *ensimapi.WatchNodesRequest, ...) error
- type Service
- type Store
- type UUID
- type WatchOptions
- type Watcher
- type Watchers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckErrors ¶
func Connect ¶
func Connect( _ context.Context, address string, caPath, certPath, keyPath string, insec bool, opts ...grpc.DialOption, ) (*grpc.ClientConn, error)
connect creates a gRPC connection to a server.
func IntToInt16 ¶
IntToint16 safely converts int to int16. This is needed for 64bit systems where int is defined as a 64bit integer. Returns an error when the value is out of the range.
func NewIFMSimService ¶
func NewIFMSimService(nodeStore Store, cfg *Config) northbound.Service
NewService returns a new model Service.
Types ¶
type Cli ¶
type Cli struct {
// contains filtered or unexported fields
}
func (*Cli) PromptNodeCreate ¶
func (*Cli) PromptNodeCreateMany ¶
func (*Cli) PromptNodeDelete ¶
func (*Cli) PromptNodeDeleteMany ¶
func (*Cli) PromptNodeGet ¶
func (*Cli) PromptNodeList ¶
func (*Cli) PromptRoot ¶
type Client ¶
type Client interface {
Create(context.Context, string, *ensimapi.NodeCredentials, bool) error
// CreateNodes creates a number of nodes with the given credentials and teardown option.
// number is the total number of nodes to create, and batch is the number of nodes to create in each batch.
CreateNodes(context.Context, uint32, uint32, *ensimapi.NodeCredentials, bool) error
DeleteNodes(context.Context, uint32) error
Update(context.Context, string, map[ensimapi.AgentType]ensimapi.AgentState) error
Get(context.Context, string) (*ensimapi.Node, error)
List(context.Context) ([]*ensimapi.Node, error)
Delete(context.Context, string) error
Close() error
}
type Config ¶
type EdgeNode ¶
type EdgeNode struct {
UUID
// contains filtered or unexported fields
}
func NewEdgeNode ¶
func (*EdgeNode) GetAgentsStates ¶
func (en *EdgeNode) GetAgentsStates() ensim_agents.StateMap
func (*EdgeNode) GetAgentsStatus ¶
func (en *EdgeNode) GetAgentsStatus() map[ensimapi.StatusSource]*ensimapi.NodeStatus
func (*EdgeNode) SetAgentsStates ¶
func (en *EdgeNode) SetAgentsStates(states map[ensim_agents.AgentType]ensim_agents.AgentState)
func (*EdgeNode) StatsCollector ¶
func (en *EdgeNode) StatsCollector()
type EdgeNodes ¶
type EdgeNodes struct {
// contains filtered or unexported fields
}
EdgeNodes data structure for storing EdgeNode.
type Event ¶
type Event struct {
Key interface{}
Value interface{}
Type interface{}
}
Event store event data structure.
type EventChannel ¶
type EventChannel chan Event
EventChannel is a channel which can accept an Event.
type Manager ¶
func NewManager ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements the TrafficSim gRPC service for administrative facilities.
func (*Server) CreateNode ¶
func (s *Server) CreateNode( _ context.Context, req *ensimapi.CreateNodeRequest, ) (*ensimapi.CreateNodeResponse, error)
func (*Server) CreateNodes ¶
func (s *Server) CreateNodes( _ context.Context, req *ensimapi.CreateNodesRequest, ) (*ensimapi.CreateNodesResponse, error)
func (*Server) DeleteNode ¶
func (s *Server) DeleteNode( _ context.Context, req *ensimapi.DeleteNodeRequest, ) (*ensimapi.DeleteNodeResponse, error)
func (*Server) DeleteNodes ¶
func (s *Server) DeleteNodes( _ context.Context, req *ensimapi.DeleteNodesRequest, ) (*ensimapi.DeleteNodesResponse, error)
func (*Server) GetNode ¶
func (s *Server) GetNode(_ context.Context, req *ensimapi.GetNodeRequest) (*ensimapi.GetNodeResponse, error)
func (*Server) ListNodes ¶
func (s *Server) ListNodes(_ *ensimapi.ListNodesRequest, serv ensimapi.EdgeNodeModelService_ListNodesServer) error
func (*Server) UpdateNode ¶
func (s *Server) UpdateNode( _ context.Context, req *ensimapi.UpdateNodeRequest, ) (*ensimapi.UpdateNodeResponse, error)
func (*Server) WatchNodes ¶
func (s *Server) WatchNodes(req *ensimapi.WatchNodesRequest, serv ensimapi.EdgeNodeModelService_WatchNodesServer) error
type Service ¶
type Service struct {
northbound.Service
// contains filtered or unexported fields
}
Service is a Service implementation for administration.
type Store ¶
type Store interface {
// Add adds the specified edge-node
Add(en *EdgeNode) error
// Remove removes the specified edge-node
Remove(id UUID) error
// Get gets a edge-node based on a given UUID
Get(id UUID) (*EdgeNode, error)
// List lists edgeNodes
List() ([]*EdgeNode, error)
// Len number of edgeNodes
Len() (int, error)
// Watch watches the node inventory events using the supplied channel
Watch(ctx context.Context, ch chan<- Event, options ...WatchOptions) error
}
Store store interface.
type WatchOptions ¶
WatchOptions allows tailoring the WatchNodes behavior.
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher event watcher.
type Watchers ¶
type Watchers struct {
// contains filtered or unexported fields
}
Watchers stores the information about watchers.
func (*Watchers) AddWatcher ¶
AddWatcher adds a watcher.
func (*Watchers) RemoveWatcher ¶
RemoveWatcher removes a watcher.