Skip to content

nightrune/ogo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status GoDoc

Ogo

An OpenFlow Network Controller written in Go.

A Basic Application

Register

To process OpenFlow messages register a function that returns a pointer to an existing or new Application struct.

func NewDemoInstance() interface{} {
  return &DemoInstance{}
}
controller.RegisterApplication(NewDemoInstance)

Receive

To receive OpenFlow messages, applications should implement the interfaces found in protocol/ofp10/interface.go or protocol/ofp13/interface.go.

func (b *DemoInstance) ConnectionUp(dpid net.HardwareAddr) {
  log.Println("Switch connected:", dpid)
}

func (b *DemoInstance) ConnectionDown(dpid net.HardwareAddr) {
  log.Println("Switch disconnected:", dpid)
}

func (b *DemoInstance) PacketIn(dpid net.HardwareAddr, pkt *ofp10.PacketIn) {
  log.Println("PacketIn message received from:", dpid)
}

Send

Any struct that implements util.Message can be sent to the switch. Only OpenFlow messages should be sent using OFSwitch.Send(m util.Message).

req := ofp10.NewEchoRequest()

// If switch dpid is known, returns its OFPSwitch struct. The
// switch is not guaranteed to have an active connection.
if sw, ok := ogo.Switch(dpid string); ok {
  sw.Send(req)
}

About

An OpenFlow Network Controller in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%