Kmotiko / gofc

OpenFlow Controller written in go.
MIT License
56 stars 25 forks source link

Barrier Reply message is not received #29

Closed rutuja-clusters closed 2 years ago

rutuja-clusters commented 2 years ago

We have gofc running inside an application. It generates barrier requests using ofp13.NewOfpBarrierRequest(). However, we do not see any barrier reply from switch in the controller (HandleBarrierReply(hdr ofp13.OfpHeader, dp Datapath) method has been implemented). We are able to receive other msgs - HandleSwitchFeatures, etc.

On running ovs-ofctl snoop br0.uvms --pidfile , the barrier request, reply are visible in the shell output.

OFPT_BARRIER_REQUEST (OF1.3) (xid=0xbd): OFPT_BARRIER_REPLY (OF1.3) (xid=0xbd):

However, its not showing up in the controller. **OVS version - 2.14.2**

Can you please let us know, if we are missing something here?

Kmotiko commented 2 years ago

Hi @rutuja-clusters

I use ovs 2.13.5 on ubuntu 20.04 and my application receive OfpBarrierReply. Could you tell me your application implementation?

My application and execution command

I use following sample application.

$ cat gofc.go
package main

import (
        "fmt"

        "github.com/Kmotiko/gofc"
        "github.com/Kmotiko/gofc/ofprotocol/ofp13"
)

type SampleController struct {
        // add any paramter used in controller.
}

func NewSampleController() *SampleController {
        ofc := new(SampleController)
        return ofc
}

func (c *SampleController) HandleSwitchFeatures(msg *ofp13.OfpSwitchFeatures, dp *gofc.Datapath) {
        br := ofp13.NewOfpBarrierRequest()
        dp.Send(br)
}

func (c *SampleController) HandleBarrierReply(msg *ofp13.OfpHeader, dp *gofc.Datapath) {
        fmt.Println("Handle BarrierReply")
}

func main() {
        // regist app
        ofc := NewSampleController()
        gofc.GetAppManager().RegistApplication(ofc)

        // start server
        gofc.ServerLoop(gofc.DEFAULT_PORT)
}

Before running application, set controller to ovs.

$ sudo ovs-vsctl show
    ovs_version: "2.13.5"
$ sudo ovs-vsctl add-br br0
$ sudo ovs-vsctl set-controller br0 tcp:127.0.0.1:6653

Then execute my application and following messages is displayed indicating that the controller application has received aBarrierReply.

$ go run gofc.go 
recv SwitchFeatures
Handle BarrierReply
recv EchoReq
rutuja-clusters commented 2 years ago

Thank you for providing a sample application. I realized it was due to the incorrect implementation of the method 'HandleBarrierReply'. The barrier replies are being received now, thanks!