openflow

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2016 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OF10_VERSION = 0x01
	OF13_VERSION = 0x04
)

Variables

View Source
var (
	ErrInvalidPacketLength   = errors.New("invalid packet length")
	ErrUnsupportedVersion    = errors.New("unsupported protocol version")
	ErrUnsupportedMessage    = errors.New("unsupported message type")
	ErrInvalidMACAddress     = errors.New("invalid MAC address")
	ErrInvalidIPAddress      = errors.New("invalid IP address")
	ErrUnsupportedIPProtocol = errors.New("unsupported IP protocol")
	ErrUnsupportedEtherType  = errors.New("unsupported Ethernet type")
	ErrMissingIPProtocol     = errors.New("missing IP protocol")
	ErrMissingEtherType      = errors.New("missing Ethernet type")
	ErrUnsupportedMatchType  = errors.New("unsupported flow match type")
)

Functions

This section is empty.

Types

type Action

type Action interface {
	DstMAC() (ok bool, mac net.HardwareAddr)
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
	Queue() (ok bool, queue uint32)
	// Error() returns last error message
	Error() error
	OutPort() OutPort
	SetDstMAC(mac net.HardwareAddr)
	SetQueue(queue uint32)
	SetOutPort(port OutPort)
	SetSrcMAC(mac net.HardwareAddr)
	SetVLANID(vid uint16)
	SrcMAC() (ok bool, mac net.HardwareAddr)
	VLANID() (ok bool, vid uint16)
}

type BarrierReply

type BarrierReply interface {
	Header
	encoding.BinaryUnmarshaler
}

type BarrierRequest

type BarrierRequest interface {
	Header
	encoding.BinaryMarshaler
}

type BaseAction

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

func NewBaseAction

func NewBaseAction() *BaseAction

func (*BaseAction) DstMAC

func (r *BaseAction) DstMAC() (ok bool, mac net.HardwareAddr)

func (*BaseAction) Error

func (r *BaseAction) Error() error

func (*BaseAction) OutPort

func (r *BaseAction) OutPort() OutPort

func (*BaseAction) Queue added in v0.9.0

func (r *BaseAction) Queue() (ok bool, queue uint32)

func (*BaseAction) SetDstMAC

func (r *BaseAction) SetDstMAC(mac net.HardwareAddr)

func (*BaseAction) SetOutPort

func (r *BaseAction) SetOutPort(port OutPort)

func (*BaseAction) SetQueue added in v0.9.0

func (r *BaseAction) SetQueue(queue uint32)

func (*BaseAction) SetSrcMAC

func (r *BaseAction) SetSrcMAC(mac net.HardwareAddr)

func (*BaseAction) SetVLANID added in v0.9.0

func (r *BaseAction) SetVLANID(vid uint16)

func (*BaseAction) SrcMAC

func (r *BaseAction) SrcMAC() (ok bool, mac net.HardwareAddr)

func (*BaseAction) VLANID added in v0.9.0

func (r *BaseAction) VLANID() (ok bool, vid uint16)

type BaseEcho

type BaseEcho struct {
	Message
	// contains filtered or unexported fields
}

func (*BaseEcho) Data

func (r *BaseEcho) Data() []byte

func (*BaseEcho) Error

func (r *BaseEcho) Error() error

func (*BaseEcho) MarshalBinary

func (r *BaseEcho) MarshalBinary() ([]byte, error)

func (*BaseEcho) SetData

func (r *BaseEcho) SetData(data []byte)

func (*BaseEcho) UnmarshalBinary

func (r *BaseEcho) UnmarshalBinary(data []byte) error

type BaseError

type BaseError struct {
	Message
	// contains filtered or unexported fields
}

func (*BaseError) Class

func (r *BaseError) Class() uint16

func (*BaseError) Code

func (r *BaseError) Code() uint16

func (*BaseError) Data

func (r *BaseError) Data() []byte

func (*BaseError) UnmarshalBinary

func (r *BaseError) UnmarshalBinary(data []byte) error

type BaseHello

type BaseHello struct {
	Message
}

func (*BaseHello) MarshalBinary

func (r *BaseHello) MarshalBinary() ([]byte, error)

func (*BaseHello) UnmarshalBinary

func (r *BaseHello) UnmarshalBinary(data []byte) error

type Config

type Config interface {
	// Error() returns last error message
	Error() error
	Flags() ConfigFlag
	MissSendLength() uint16
	SetFlags(flags ConfigFlag)
	SetMissSendLength(length uint16)
}

type ConfigFlag

type ConfigFlag uint16
const (
	FragNormal ConfigFlag = iota
	FragDrop
	FragReasm
	FragMask
)

type DescReply

type DescReply interface {
	Header
	Manufacturer() string
	Hardware() string
	Software() string
	Serial() string
	Description() string
	encoding.BinaryUnmarshaler
}

Description reply

type DescRequest

type DescRequest interface {
	Header
	encoding.BinaryMarshaler
}

Description reqeust

type Echo

type Echo interface {
	Data() []byte
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
	// Error() returns last error message
	Error() error
	Header
	SetData(data []byte)
}

type EchoReply

type EchoReply interface {
	Echo
}

type EchoRequest

type EchoRequest interface {
	Echo
}

type Error

type Error interface {
	Header
	Class() uint16 // Error type
	Code() uint16
	Data() []byte
	encoding.BinaryUnmarshaler
}

type Factory

type Factory interface {
	NewAction() (Action, error)
	NewBarrierRequest() (BarrierRequest, error)
	NewBarrierReply() (BarrierReply, error)
	NewDescRequest() (DescRequest, error)
	NewDescReply() (DescReply, error)
	NewEchoRequest() (EchoRequest, error)
	NewEchoReply() (EchoReply, error)
	NewError() (Error, error)
	NewFeaturesRequest() (FeaturesRequest, error)
	NewFeaturesReply() (FeaturesReply, error)
	NewFlowMod(cmd FlowModCmd) (FlowMod, error)
	NewFlowRemoved() (FlowRemoved, error)
	NewFlowStatsRequest() (FlowStatsRequest, error)
	// TODO: NewFlowStatsReply() (FlowStatsReply, error)
	NewGetConfigRequest() (GetConfigRequest, error)
	NewGetConfigReply() (GetConfigReply, error)
	NewHello() (Hello, error)
	NewInstruction() (Instruction, error)
	NewMatch() (Match, error)
	NewPacketIn() (PacketIn, error)
	NewPacketOut() (PacketOut, error)
	NewPortDescRequest() (PortDescRequest, error)
	NewPortDescReply() (PortDescReply, error)
	NewPortStatus() (PortStatus, error)
	NewQueueGetConfigRequest() (QueueGetConfigRequest, error)
	NewSetConfig() (SetConfig, error)
	NewTableFeaturesRequest() (TableFeaturesRequest, error)
}

Abstract factory

type FeaturesReply

type FeaturesReply interface {
	Header
	DPID() uint64
	NumBuffers() uint32
	NumTables() uint8
	Capabilities() uint32
	Actions() uint32
	Ports() []Port
	AuxID() uint8
	encoding.BinaryUnmarshaler
}

type FeaturesRequest

type FeaturesRequest interface {
	Header
	encoding.BinaryMarshaler
}

type FlowMod

type FlowMod interface {
	Cookie() uint64
	CookieMask() uint64
	encoding.BinaryMarshaler
	Error() error
	FlowInstruction() Instruction
	FlowMatch() Match
	HardTimeout() uint16
	Header
	IdleTimeout() uint16
	OutPort() OutPort
	Priority() uint16
	SetCookie(cookie uint64)
	SetCookieMask(mask uint64)
	SetFlowInstruction(action Instruction)
	SetFlowMatch(match Match)
	SetHardTimeout(timeout uint16)
	SetIdleTimeout(timeout uint16)
	SetOutPort(port OutPort)
	SetPriority(priority uint16)
	SetTableID(id uint8)
	TableID() uint8
}

type FlowModCmd

type FlowModCmd uint8
const (
	FlowAdd FlowModCmd = iota
	FlowModify
	FlowDelete
)

type FlowRemoved

type FlowRemoved interface {
	Header
	Cookie() uint64
	Priority() uint16
	Reason() uint8
	TableID() uint8
	DurationSec() uint32
	DurationNanoSec() uint32
	IdleTimeout() uint16
	HardTimeout() uint16
	PacketCount() uint64
	ByteCount() uint64
	Match() Match
	encoding.BinaryUnmarshaler
}

type FlowStatsRequest

type FlowStatsRequest interface {
	Cookie() uint64
	CookieMask() uint64
	encoding.BinaryMarshaler
	Error() error
	Header
	Match() Match
	SetCookie(cookie uint64)
	SetCookieMask(mask uint64)
	SetMatch(match Match)
	// 0xFF means all table
	SetTableID(id uint8)
	TableID() uint8
}

type GetConfigReply

type GetConfigReply interface {
	Header
	Config
	encoding.BinaryUnmarshaler
}

type GetConfigRequest

type GetConfigRequest interface {
	Header
	encoding.BinaryMarshaler
}
type Header interface {
	Version() uint8
	Type() uint8
	TransactionID() uint32
	SetTransactionID(xid uint32)
}

type InPort

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

func NewInPort

func NewInPort() InPort

func (*InPort) IsController

func (r *InPort) IsController() bool

func (*InPort) SetController

func (r *InPort) SetController()

func (*InPort) SetValue

func (r *InPort) SetValue(port uint32)

func (*InPort) Value

func (r *InPort) Value() uint32

type Instruction

type Instruction interface {
	ApplyAction(act Action)
	encoding.BinaryMarshaler
	Error() error
	GotoTable(tableID uint8)
	WriteAction(act Action)
}

type Match

type Match interface {
	DstIP() *net.IPNet
	DstMAC() (wildcard bool, mac net.HardwareAddr)
	// DstPort returns protocol (TCP or UDP) destination port number
	DstPort() (wildcard bool, port uint16)
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
	Error() error
	EtherType() (wildcard bool, etherType uint16)
	// InPort returns switch port number
	InPort() (wildcard bool, inport InPort)
	IPProtocol() (wildcard bool, protocol uint8)
	SetDstIP(ip *net.IPNet)
	SetDstMAC(mac net.HardwareAddr)
	// SetDstPort sets protocol (TCP or UDP) destination port number
	SetDstPort(p uint16)
	SetEtherType(t uint16)
	// SetInPort sets switch port number
	SetInPort(port InPort)
	SetIPProtocol(p uint8)
	SetSrcIP(ip *net.IPNet)
	SetSrcMAC(mac net.HardwareAddr)
	// SetSrcPort sets protocol (TCP or UDP) source port number
	SetSrcPort(p uint16)
	SetVLANID(id uint16)
	SetVLANPriority(p uint8)
	SetWildcardEtherType()
	SetWildcardDstMAC()
	// SetWildcardDstPort sets protocol (TCP or UDP) destination port number as a wildcard
	SetWildcardDstPort()
	SetWildcardSrcMAC()
	// SetWildcardSrcPort sets protocol (TCP or UDP) source port number as a wildcard
	SetWildcardSrcPort()
	// SetWildcardInPort sets switch port number as a wildcard
	SetWildcardInPort()
	SetWildcardIPProtocol()
	SetWildcardVLANID()
	SetWildcardVLANPriority()
	SrcIP() *net.IPNet
	SrcMAC() (wildcard bool, mac net.HardwareAddr)
	// SrcPort returns protocol (TCP or UDP) source port number
	SrcPort() (wildcard bool, port uint16)
	VLANID() (wildcard bool, vlanID uint16)
	VLANPriority() (wildcard bool, priority uint8)
}

type Message

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

func NewMessage

func NewMessage(version uint8, msgType uint8, xid uint32) Message

func (*Message) MarshalBinary

func (r *Message) MarshalBinary() ([]byte, error)

func (*Message) Payload

func (r *Message) Payload() []byte

func (*Message) SetPayload

func (r *Message) SetPayload(payload []byte)

func (*Message) SetTransactionID

func (r *Message) SetTransactionID(xid uint32)

func (*Message) TransactionID

func (r *Message) TransactionID() uint32

func (*Message) Type

func (r *Message) Type() uint8

func (*Message) UnmarshalBinary

func (r *Message) UnmarshalBinary(data []byte) error

func (*Message) Version

func (r *Message) Version() uint8

type OutPort

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

func NewOutPort

func NewOutPort() OutPort

NewOutPort returns output port whose default value is FLOOD

func (*OutPort) IsAll

func (r *OutPort) IsAll() bool

func (*OutPort) IsController

func (r *OutPort) IsController() bool

func (*OutPort) IsFlood

func (r *OutPort) IsFlood() bool

func (*OutPort) IsInPort added in v0.9.0

func (r *OutPort) IsInPort() bool

func (*OutPort) IsNone

func (r *OutPort) IsNone() bool

func (*OutPort) IsTable

func (r *OutPort) IsTable() bool

func (*OutPort) SetAll

func (r *OutPort) SetAll()

func (*OutPort) SetController

func (r *OutPort) SetController()

func (*OutPort) SetFlood

func (r *OutPort) SetFlood()

func (*OutPort) SetInPort added in v0.9.0

func (r *OutPort) SetInPort()

func (*OutPort) SetNone

func (r *OutPort) SetNone()

func (*OutPort) SetTable

func (r *OutPort) SetTable()

func (*OutPort) SetValue

func (r *OutPort) SetValue(port uint32)

func (*OutPort) Value

func (r *OutPort) Value() uint32

type PacketIn

type PacketIn interface {
	Header
	BufferID() uint32
	Length() uint16
	InPort() uint32
	TableID() uint8
	Reason() uint8
	Cookie() uint64
	Data() []byte
	encoding.BinaryUnmarshaler
}

type PacketOut

type PacketOut interface {
	Action() Action
	Data() []byte
	encoding.BinaryMarshaler
	Error() error
	Header
	InPort() InPort
	SetAction(action Action)
	SetData(data []byte)
	SetInPort(port InPort)
}

type Port

type Port interface {
	Number() uint32
	MAC() net.HardwareAddr
	Name() string
	IsPortDown() bool // Is the port Administratively down?
	IsLinkDown() bool // Is a physical link on the port down?
	IsCopper() bool
	IsFiber() bool
	IsAutoNego() bool
	// Speed returns current link speed in MB
	Speed() uint64
	encoding.BinaryUnmarshaler
}

type PortDescReply

type PortDescReply interface {
	Header
	Ports() []Port
	encoding.BinaryUnmarshaler
}

type PortDescRequest

type PortDescRequest interface {
	Header
	encoding.BinaryMarshaler
}

type PortReason

type PortReason uint8
const (
	PortAdded PortReason = iota
	PortDeleted
	PortModified
)

type PortStatus

type PortStatus interface {
	Header
	Reason() PortReason
	Port() Port
	encoding.BinaryUnmarshaler
}

type QueueGetConfigRequest added in v0.9.0

type QueueGetConfigRequest interface {
	Header
	Port() OutPort
	SetPort(OutPort)
	encoding.BinaryMarshaler
}

type SetConfig

type SetConfig interface {
	Header
	Config
	encoding.BinaryMarshaler
}

type TableFeaturesRequest

type TableFeaturesRequest interface {
	Header
	encoding.BinaryMarshaler
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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