devices

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HexDecode

func HexDecode(pkt []byte) []byte

HexDecode converts the hex encoding to binary

Types

type DefaultExecutor added in v0.0.2

type DefaultExecutor struct{}

func (DefaultExecutor) Command added in v0.0.2

func (d DefaultExecutor) Command(name string, arg ...string) Runnable

type DyingGaspIndicationMessage

type DyingGaspIndicationMessage struct {
	PonPortID uint32
	OnuID     uint32
	Status    string
}

type Executor added in v0.0.2

type Executor interface {
	Command(name string, arg ...string) Runnable
}

type FlowAddSpy added in v0.0.5

type FlowAddSpy struct {
	CallCount int
	Calls     map[int]*openolt.Flow
}

type Message

type Message struct {
	Type MessageType
	Data interface{}
}

type MessageType

type MessageType int
const (
	OltIndication       MessageType = 0
	NniIndication       MessageType = 1
	PonIndication       MessageType = 2
	OnuDiscIndication   MessageType = 3
	OnuIndication       MessageType = 4
	OMCI                MessageType = 5
	FlowUpdate          MessageType = 6
	StartEAPOL          MessageType = 7
	StartDHCP           MessageType = 8
	OnuPacketOut        MessageType = 9
	DyingGaspIndication MessageType = 10

	// BBR messages
	OmciIndication MessageType = 11 // this are OMCI messages going from the OLT to VOLTHA
	SendEapolFlow  MessageType = 12
	SendDhcpFlow   MessageType = 13
	OnuPacketIn    MessageType = 14
)

func (MessageType) String

func (m MessageType) String() string

type NniIndicationMessage

type NniIndicationMessage struct {
	OperState OperState
	NniPortID uint32
}

type NniPort

type NniPort struct {
	// BBSIM Internals
	ID uint32

	// PON Attributes
	OperState *fsm.FSM
	Type      string
	// contains filtered or unexported fields
}

func CreateNNI

func CreateNNI(olt *OltDevice) (NniPort, error)

func (*NniPort) NewVethChan added in v0.0.7

func (n *NniPort) NewVethChan() (chan *types.PacketMsg, *pcap.Handle, error)

NewVethChan returns a new channel for receiving packets over the NNI interface

type OltDevice

type OltDevice struct {
	sync.Mutex

	// BBSIM Internals
	ID            int
	SerialNumber  string
	NumNni        int
	NumPon        int
	NumOnuPerPon  int
	InternalState *fsm.FSM

	Delay int

	Pons []*PonPort
	Nnis []*NniPort

	// OLT Attributes
	OperState *fsm.FSM
	// contains filtered or unexported fields
}

func CreateOLT

func CreateOLT(oltId int, nni int, pon int, onuPerPon int, sTag int, cTagInit int, auth bool, dhcp bool, delay int, isMock bool) *OltDevice

func GetOLT

func GetOLT() *OltDevice

func (OltDevice) ActivateOnu

func (o OltDevice) ActivateOnu(context context.Context, onu *openolt.Onu) (*openolt.Empty, error)

func (OltDevice) CollectStatistics

func (o OltDevice) CollectStatistics(context.Context, *openolt.Empty) (*openolt.Empty, error)

func (OltDevice) CreateTrafficQueues

func (s OltDevice) CreateTrafficQueues(context.Context, *tech_profile.TrafficQueues) (*openolt.Empty, error)

func (OltDevice) CreateTrafficSchedulers

func (s OltDevice) CreateTrafficSchedulers(context.Context, *tech_profile.TrafficSchedulers) (*openolt.Empty, error)

func (OltDevice) DeactivateOnu

func (o OltDevice) DeactivateOnu(context.Context, *openolt.Onu) (*openolt.Empty, error)

func (OltDevice) DeleteOnu

func (o OltDevice) DeleteOnu(context.Context, *openolt.Onu) (*openolt.Empty, error)

func (OltDevice) DisableOlt

func (o OltDevice) DisableOlt(context.Context, *openolt.Empty) (*openolt.Empty, error)

func (OltDevice) DisablePonIf

func (o OltDevice) DisablePonIf(context.Context, *openolt.Interface) (*openolt.Empty, error)

func (*OltDevice) Enable

Enable implements the OpenOLT EnableIndicationServer functionality

func (*OltDevice) EnableIndication

func (o *OltDevice) EnableIndication(_ *openolt.Empty, stream openolt.Openolt_EnableIndicationServer) error

func (OltDevice) EnablePonIf

func (OltDevice) FindOnuById added in v0.0.2

func (o OltDevice) FindOnuById(intfId uint32, onuId uint32) (*Onu, error)

returns an ONU with a given interface/Onu Id

func (OltDevice) FindOnuByMacAddress added in v0.0.2

func (o OltDevice) FindOnuByMacAddress(mac net.HardwareAddr) (*Onu, error)

returns an ONU with a given Mac Address

func (OltDevice) FindOnuBySn added in v0.0.2

func (o OltDevice) FindOnuBySn(serialNumber string) (*Onu, error)

returns an ONU with a given Serial Number

func (OltDevice) FlowAdd

func (o OltDevice) FlowAdd(ctx context.Context, flow *openolt.Flow) (*openolt.Empty, error)

func (OltDevice) FlowRemove

func (o OltDevice) FlowRemove(context.Context, *openolt.Flow) (*openolt.Empty, error)

func (OltDevice) GetDeviceInfo

func (o OltDevice) GetDeviceInfo(context.Context, *openolt.Empty) (*openolt.DeviceInfo, error)

func (OltDevice) GetOnuInfo

func (o OltDevice) GetOnuInfo(context context.Context, packet *openolt.Onu) (*openolt.OnuIndication, error)

func (OltDevice) GetPonById added in v0.0.2

func (o OltDevice) GetPonById(id uint32) (*PonPort, error)

func (OltDevice) GetPonIf

func (o OltDevice) GetPonIf(context context.Context, packet *openolt.Interface) (*openolt.IntfIndication, error)

func (OltDevice) HeartbeatCheck

func (o OltDevice) HeartbeatCheck(context.Context, *openolt.Empty) (*openolt.Heartbeat, error)

func (*OltDevice) InitOlt added in v0.0.7

func (o *OltDevice) InitOlt() error

func (OltDevice) OmciMsgOut

func (o OltDevice) OmciMsgOut(ctx context.Context, omci_msg *openolt.OmciMsg) (*openolt.Empty, error)

func (OltDevice) OnuPacketOut

func (o OltDevice) OnuPacketOut(ctx context.Context, onuPkt *openolt.OnuPacket) (*openolt.Empty, error)

func (OltDevice) Reboot

func (OltDevice) ReenableOlt

func (o OltDevice) ReenableOlt(context.Context, *openolt.Empty) (*openolt.Empty, error)

func (OltDevice) RemoveTrafficQueues

func (s OltDevice) RemoveTrafficQueues(context.Context, *tech_profile.TrafficQueues) (*openolt.Empty, error)

func (OltDevice) RemoveTrafficSchedulers

func (s OltDevice) RemoveTrafficSchedulers(context.Context, *tech_profile.TrafficSchedulers) (*openolt.Empty, error)

func (*OltDevice) RestartOLT added in v0.0.7

func (o *OltDevice) RestartOLT() error

func (*OltDevice) StopOltServer added in v0.0.8

func (o *OltDevice) StopOltServer() error

StopOltServer stops the OpenOLT grpc server

func (OltDevice) UplinkPacketOut

func (o OltDevice) UplinkPacketOut(context context.Context, packet *openolt.UplinkPacket) (*openolt.Empty, error)

type OltIndicationMessage

type OltIndicationMessage struct {
	OperState OperState
}

type OmciIndicationMessage added in v0.0.2

type OmciIndicationMessage struct {
	OnuSN   *openolt.SerialNumber
	OnuID   uint32
	OmciInd *openolt.OmciIndication
}

type OmciMessage

type OmciMessage struct {
	OnuSN *openolt.SerialNumber
	OnuID uint32
	// contains filtered or unexported fields
}

type Onu

type Onu struct {
	ID                  uint32
	PonPortID           uint32
	PonPort             PonPort
	STag                int
	CTag                int
	Auth                bool // automatically start EAPOL if set to true
	Dhcp                bool // automatically start DHCP if set to true
	HwAddress           net.HardwareAddr
	InternalState       *fsm.FSM
	DiscoveryRetryDelay time.Duration

	// ONU State
	// PortNo comes with flows and it's used when sending packetIndications,
	// There is one PortNo per UNI Port, for now we're only storing the first one
	// FIXME add support for multiple UNIs
	PortNo           uint32
	DhcpFlowReceived bool

	OperState    *fsm.FSM
	SerialNumber *openolt.SerialNumber

	Channel chan Message // this Channel is to track state changes OMCI messages, EAPOL and DHCP packets

	HasGemPort bool

	DoneChannel chan bool // this channel is used to signal once the onu is complete (when the struct is used by BBR)
	// contains filtered or unexported fields
}

func CreateONU

func CreateONU(olt OltDevice, pon PonPort, id uint32, sTag int, cTag int, auth bool, dhcp bool) *Onu

func (Onu) NewSN

func (o Onu) NewSN(oltid int, intfid uint32, onuid uint32) *openolt.SerialNumber

func (*Onu) ProcessOnuMessages added in v0.0.2

func (o *Onu) ProcessOnuMessages(ctx context.Context, stream openolt.Openolt_EnableIndicationServer, client openolt.OpenoltClient)

ProcessOnuMessages starts indication channel for each ONU

func (*Onu) SetID added in v0.0.7

func (o *Onu) SetID(id uint32)

func (*Onu) Sn

func (o *Onu) Sn() string

func (*Onu) StartOmci added in v0.0.2

func (o *Onu) StartOmci(client openolt.OpenoltClient)

TODO move this method in responders/omcisim

type OnuDiscIndicationMessage

type OnuDiscIndicationMessage struct {
	OperState OperState
	Onu       *Onu
}

type OnuFlowUpdateMessage

type OnuFlowUpdateMessage struct {
	PonPortID uint32
	OnuID     uint32
	Flow      *openolt.Flow
}

type OnuIndicationMessage

type OnuIndicationMessage struct {
	OperState OperState
	PonPortID uint32
	OnuID     uint32
	OnuSN     *openolt.SerialNumber
}

type OnuPacketMessage added in v0.0.2

type OnuPacketMessage struct {
	IntfId uint32
	OnuId  uint32
	Packet gopacket.Packet
	Type   packetHandlers.PacketType
}

type OperState

type OperState int
const (
	UP   OperState = iota
	DOWN           // The device has been discovered, but not yet activated
)

func (OperState) String

func (m OperState) String() string

type PacketMessage

type PacketMessage struct {
	PonPortID uint32
	OnuID     uint32
}

type PonIndicationMessage

type PonIndicationMessage struct {
	OperState OperState
	PonPortID uint32
}

type PonPort

type PonPort struct {
	// BBSIM Internals
	ID     uint32
	NumOnu int
	Onus   []*Onu
	Olt    OltDevice

	// PON Attributes
	OperState *fsm.FSM
	Type      string
}

func CreatePonPort added in v0.0.10

func CreatePonPort(olt OltDevice, id uint32) *PonPort

CreatePonPort creates pon port object

func (PonPort) GetOnuById added in v0.0.2

func (p PonPort) GetOnuById(id uint32) (*Onu, error)

func (PonPort) GetOnuBySn added in v0.0.2

func (p PonPort) GetOnuBySn(sn *openolt.SerialNumber) (*Onu, error)

type Runnable added in v0.0.2

type Runnable interface {
	Run() error
}

Jump to

Keyboard shortcuts

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