network

package
v0.0.0-...-cbcbf1e Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: GPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClosedDevice = errors.New("already closed device")
)

Functions

func ReservedIP

func ReservedIP(n net.IPNet) (net.IP, error)

ReservedIP returns the IP address reserved for the network.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewController

func NewController(db database) *Controller

func (*Controller) AddConnection

func (r *Controller) AddConnection(ctx context.Context, c net.Conn)

func (*Controller) SetEventListener

func (r *Controller) SetEventListener(l EventListener)

func (*Controller) String

func (r *Controller) String() string

type ControllerEventListener

type ControllerEventListener interface {
	OnPacketIn(Finder, *Port, *protocol.Ethernet) error
	OnPortUp(Finder, *Port) error
	OnPortDown(Finder, *Port) error
	OnDeviceUp(Finder, *Device) error
	OnDeviceDown(Finder, *Device) error
	OnFlowRemoved(Finder, openflow.FlowRemoved) error
}

type Descriptions

type Descriptions struct {
	Manufacturer string
	Hardware     string
	Software     string
	Serial       string
	Description  string
}

type Device

type Device struct {
	// contains filtered or unexported fields
}

func (*Device) Close

func (r *Device) Close()

func (*Device) Descriptions

func (r *Device) Descriptions() Descriptions

func (*Device) Factory

func (r *Device) Factory() openflow.Factory

func (*Device) Features

func (r *Device) Features() Features

func (*Device) ID

func (r *Device) ID() string

func (*Device) IsClosed

func (r *Device) IsClosed() bool

func (*Device) Port

func (r *Device) Port(num uint32) *Port

Port may return nil if there is no port whose number is num

func (*Device) Ports

func (r *Device) Ports() []*Port

func (*Device) SendMessage

func (r *Device) SendMessage(msg encoding.BinaryMarshaler) error

func (*Device) String

func (r *Device) String() string

func (*Device) Writer

func (r *Device) Writer() transceiver.Writer

type EventListener

type EventListener interface {
	ControllerEventListener
	TopologyEventListener
}

type Features

type Features struct {
	DPID       uint64
	NumBuffers uint32
	NumTables  uint8
}

type Finder

type Finder interface {
	Device(id string) *Device
	Devices() []*Device
	// IsEnabledBySTP returns whether p is disabled by spanning tree protocol
	IsEnabledBySTP(p *Port) bool
	// IsEdge returns whether p is an edge among two switches
	IsEdge(p *Port) bool
	Node(mac net.HardwareAddr) (*Node, LocationStatus, error)
	Path(srcDeviceID, dstDeviceID string) [][2]*Port
}

type LocationStatus

type LocationStatus int
const (
	// Unregistered MAC address.
	LocationUnregistered LocationStatus = iota
	// Registered MAC address, but we don't know its physical location yet.
	LocationUndiscovered
	// Registered MAC address, and we know its physical location.
	LocationDiscovered
)

type Node

type Node struct {
	// contains filtered or unexported fields
}

func NewNode

func NewNode(p *Port, mac net.HardwareAddr) *Node

func (*Node) MAC

func (r *Node) MAC() net.HardwareAddr

func (*Node) Port

func (r *Node) Port() *Port

func (*Node) String

func (r *Node) String() string

type Port

type Port struct {
	// contains filtered or unexported fields
}

Port represents a switch port and also implements the graph.Point interface.

func NewPort

func NewPort(d *Device, num uint32) *Port

func (*Port) Device

func (r *Port) Device() *Device

func (*Port) ID

func (r *Port) ID() string

func (*Port) Number

func (r *Port) Number() uint32

func (*Port) SetValue

func (r *Port) SetValue(p openflow.Port)

func (*Port) String

func (r *Port) String() string

func (*Port) Value

func (r *Port) Value() openflow.Port

func (*Port) Vertex

func (r *Port) Vertex() graph.Vertex

type TopologyEventListener

type TopologyEventListener interface {
	OnTopologyChange(Finder) error
}

Jump to

Keyboard shortcuts

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