Skip to content

Commit

Permalink
Fix broken build because of beehive's api change
Browse files Browse the repository at this point in the history
  • Loading branch information
soheilhy committed Oct 27, 2014
1 parent a827a5d commit c6e0f94
Show file tree
Hide file tree
Showing 29 changed files with 85 additions and 89 deletions.
4 changes: 2 additions & 2 deletions controller/ctrl.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package controller

import (
"github.com/soheilhy/beehive-netctrl/nom"
"github.com/soheilhy/beehive/bh"
"github.com/kandoo/beehive-netctrl/nom"
bh "github.com/kandoo/beehive"
)

func RegisterNOMController(h bh.Hive) {
Expand Down
2 changes: 1 addition & 1 deletion controller/dicts.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package controller
import (
"encoding/json"

"github.com/soheilhy/beehive-netctrl/nom"
"github.com/kandoo/beehive-netctrl/nom"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion controller/flow.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package controller

import "github.com/soheilhy/beehive/bh"
import bh "github.com/kandoo/beehive"

type addFlowHandler struct{}

Expand Down
12 changes: 6 additions & 6 deletions controller/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/golang/glog"

"github.com/soheilhy/beehive-netctrl/nom"
"github.com/soheilhy/beehive/bh"
bh "github.com/kandoo/beehive"
"github.com/kandoo/beehive-netctrl/nom"
)

type nodeConnectedHandler struct{}
Expand All @@ -15,7 +15,7 @@ func (h *nodeConnectedHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {
nc := msg.Data().(nom.NodeConnected)

dict := ctx.Dict(nodeDriversDict)
k := bh.Key(nc.Node.ID)
k := string(nc.Node.ID)
n := nodeDrivers{}
if err := nom.DictGet(dict, k, &n); err != nil {
n.Node = nc.Node
Expand All @@ -41,14 +41,14 @@ func (h *nodeConnectedHandler) Map(msg bh.Msg,
ctx bh.MapContext) bh.MappedCells {

nc := msg.Data().(nom.NodeConnected)
return bh.MappedCells{{nodeDriversDict, bh.Key(nc.Node.ID)}}
return bh.MappedCells{{nodeDriversDict, string(nc.Node.ID)}}
}

type nodeDisconnectedHandler struct{}

func (h *nodeDisconnectedHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {
nd := msg.Data().(nom.NodeDisconnected)
k := bh.Key(nd.Node.ID)
k := string(nd.Node.ID)
n := nodeDrivers{}
if err := ctx.Dict(nodeDriversDict).GetGob(k, &n); err != nil {
return fmt.Errorf("Driver %v disconnects from %v before connecting",
Expand All @@ -67,5 +67,5 @@ func (h *nodeDisconnectedHandler) Map(msg bh.Msg,
ctx bh.MapContext) bh.MappedCells {

nd := msg.Data().(nom.NodeDisconnected)
return bh.MappedCells{{nodeDriversDict, bh.Key(nd.Node.ID)}}
return bh.MappedCells{{nodeDriversDict, string(nd.Node.ID)}}
}
8 changes: 4 additions & 4 deletions controller/pkt.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package controller

import (
"github.com/soheilhy/beehive-netctrl/nom"
"github.com/soheilhy/beehive/bh"
bh "github.com/kandoo/beehive"
"github.com/kandoo/beehive-netctrl/nom"
)

type pktOutHandler struct{}

func (h *pktOutHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {
pkt := msg.Data().(nom.PacketOut)
d := ctx.Dict(nodeDriversDict)
k := bh.Key(pkt.Node)
k := string(pkt.Node)
var nd nodeDrivers
if err := d.GetGob(k, &nd); err != nil {
return err
Expand All @@ -23,6 +23,6 @@ func (h *pktOutHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {

func (h *pktOutHandler) Map(msg bh.Msg, ctx bh.MapContext) bh.MappedCells {
return bh.MappedCells{
{nodeDriversDict, bh.Key(msg.Data().(nom.PacketOut).Node)},
{nodeDriversDict, string(msg.Data().(nom.PacketOut).Node)},
}
}
8 changes: 4 additions & 4 deletions controller/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package controller
import (
"fmt"

"github.com/soheilhy/beehive-netctrl/nom"
"github.com/soheilhy/beehive/bh"
bh "github.com/kandoo/beehive"
"github.com/kandoo/beehive-netctrl/nom"
)

type portStatusHandler struct{}
Expand All @@ -16,7 +16,7 @@ func (h *portStatusHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {
// make sure we apply the log to the port status
data := msg.Data().(nom.PortStatusChanged)
dict := ctx.Dict(nodeDriversDict)
k := bh.Key(data.Port.Node)
k := string(data.Port.Node)
n := nodeDrivers{}
if err := dict.GetGob(k, &n); err != nil {
return fmt.Errorf("Node %v not found", data.Port.Node)
Expand All @@ -42,6 +42,6 @@ func (h *portStatusHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {

func (h *portStatusHandler) Map(msg bh.Msg, ctx bh.MapContext) bh.MappedCells {
return bh.MappedCells{
{nodeDriversDict, bh.Key(msg.Data().(nom.PortStatusChanged).Port.Node)},
{nodeDriversDict, string(msg.Data().(nom.PortStatusChanged).Port.Node)},
}
}
2 changes: 1 addition & 1 deletion controller/query.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package controller

import "github.com/soheilhy/beehive/bh"
import bh "github.com/kandoo/beehive"

type queryHandler struct{}

Expand Down
30 changes: 15 additions & 15 deletions discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"time"

"github.com/golang/glog"
"github.com/soheilhy/beehive-netctrl/net/ethernet"
"github.com/soheilhy/beehive-netctrl/nom"
"github.com/soheilhy/beehive/bh"
bh "github.com/kandoo/beehive"
"github.com/kandoo/beehive-netctrl/net/ethernet"
"github.com/kandoo/beehive-netctrl/nom"
)

type LinkDiscovered struct {
Expand Down Expand Up @@ -77,7 +77,7 @@ func (h *nodeJoinedHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {
joined := msg.Data().(nom.NodeJoined)
d := ctx.Dict(nodeDict)
n := nom.Node(joined)
k := bh.Key(n.UID())
k := string(n.UID())
var np nodePortsAndLinks
if err := d.GetGob(k, &np); err != nil {
glog.Warningf("%v rejoins", n)
Expand All @@ -89,7 +89,7 @@ func (h *nodeJoinedHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {

func (h *nodeJoinedHandler) Map(msg bh.Msg, ctx bh.MapContext) bh.MappedCells {
return bh.MappedCells{
{nodeDict, bh.Key(nom.Node(msg.Data().(nom.NodeJoined)).UID())},
{nodeDict, string(nom.Node(msg.Data().(nom.NodeJoined)).UID())},
}
}

Expand All @@ -98,7 +98,7 @@ type nodeLeftHandler struct{}
func (h *nodeLeftHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {
n := nom.Node(msg.Data().(nom.NodeLeft))
d := ctx.Dict(nodeDict)
k := bh.Key(n.UID())
k := string(n.UID())
if _, err := d.Get(k); err != nil {
return fmt.Errorf("%v is not joined", n)
}
Expand All @@ -108,7 +108,7 @@ func (h *nodeLeftHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {

func (h *nodeLeftHandler) Map(msg bh.Msg, ctx bh.MapContext) bh.MappedCells {
return bh.MappedCells{
{nodeDict, bh.Key(nom.Node(msg.Data().(nom.NodeLeft)).UID())},
{nodeDict, string(nom.Node(msg.Data().(nom.NodeLeft)).UID())},
}
}

Expand All @@ -117,7 +117,7 @@ type portUpdateHandler struct{}
func (h *portUpdateHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {
p := nom.Port(msg.Data().(nom.PortUpdated))
d := ctx.Dict(nodeDict)
k := bh.Key(p.Node)
k := string(p.Node)
var np nodePortsAndLinks
if err := d.GetGob(k, &np); err != nil {
glog.Warningf("%v added before its node", p)
Expand All @@ -138,7 +138,7 @@ func (h *portUpdateHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {

func (h *portUpdateHandler) Map(msg bh.Msg, ctx bh.MapContext) bh.MappedCells {
return bh.MappedCells{
{nodeDict, bh.Key(msg.Data().(nom.PortUpdated).Node)},
{nodeDict, string(msg.Data().(nom.PortUpdated).Node)},
}
}

Expand All @@ -148,9 +148,9 @@ type timeoutHandler struct{}

func (h *timeoutHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {
d := ctx.Dict(nodeDict)
d.ForEach(func(k bh.Key, v bh.Value) {
d.ForEach(func(k string, v []byte) {
var np nodePortsAndLinks
if err := nom.ObjGoDecode(&np, []byte(v)); err != nil {
if err := nom.ObjGoDecode(&np, v); err != nil {
glog.Errorf("Error in decoding value: %v", err)
return
}
Expand Down Expand Up @@ -180,7 +180,7 @@ func (h *pktInHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {
}

d := ctx.Dict(nodeDict)
k := bh.Key(pin.Node)
k := string(pin.Node)
var np nodePortsAndLinks
if err := d.GetGob(k, &np); err != nil {
return fmt.Errorf("Node %v not found", pin.Node)
Expand All @@ -207,7 +207,7 @@ func (h *pktInHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {

func (h *pktInHandler) Map(msg bh.Msg, ctx bh.MapContext) bh.MappedCells {
return bh.MappedCells{
{nodeDict, bh.Key(msg.Data().(nom.PacketIn).Node)},
{nodeDict, string(msg.Data().(nom.PacketIn).Node)},
}
}

Expand All @@ -219,7 +219,7 @@ func (h *newLinkHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {
l := nom.Link(msg.Data().(NewLink))
n, _ := nom.ParsePortUID(l.From)
d := ctx.Dict(nodeDict)
k := bh.Key(n)
k := string(n)
var np nodePortsAndLinks
if err := d.GetGob(k, &np); err != nil {
return err
Expand All @@ -241,7 +241,7 @@ func (h *newLinkHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {

func (h *newLinkHandler) Map(msg bh.Msg, ctx bh.MapContext) bh.MappedCells {
n, _ := nom.ParsePortUID(msg.Data().(NewLink).From)
return bh.MappedCells{{nodeDict, bh.Key(n)}}
return bh.MappedCells{{nodeDict, string(n)}}
}

// RegisterDiscovery registers the handlers for topology discovery on the hive.
Expand Down
6 changes: 3 additions & 3 deletions discovery/lldp.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package discovery
import (
"errors"

"github.com/soheilhy/beehive-netctrl/net/lldp"
"github.com/soheilhy/beehive-netctrl/nom"
"github.com/soheilhy/beehive/bh"
"github.com/kandoo/beehive-netctrl/net/lldp"
"github.com/kandoo/beehive-netctrl/nom"
bh "github.com/kandoo/beehive"
)

func sendLLDPPacket(n nom.Node, p nom.Port, ctx bh.RcvContext) {
Expand Down
2 changes: 1 addition & 1 deletion discovery/lldp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package discovery
import (
"testing"

"github.com/soheilhy/beehive-netctrl/nom"
"github.com/kandoo/beehive-netctrl/nom"
)

func TestLLDPEncode(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"os"
"runtime/pprof"

"github.com/soheilhy/beehive-netctrl/controller"
"github.com/soheilhy/beehive-netctrl/discovery"
"github.com/soheilhy/beehive-netctrl/openflow"
"github.com/soheilhy/beehive/bh"
"github.com/kandoo/beehive-netctrl/controller"
"github.com/kandoo/beehive-netctrl/discovery"
"github.com/kandoo/beehive-netctrl/openflow"
bh "github.com/kandoo/beehive"
)

var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
Expand Down
2 changes: 1 addition & 1 deletion net/lldp/lldp.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/packet/packet/src/go/packet"

"github.com/soheilhy/beehive-netctrl/net/ethernet"
"github.com/kandoo/beehive-netctrl/net/ethernet"
)

type LinkDiscoveryTLVType int
Expand Down
4 changes: 2 additions & 2 deletions net/meta/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ import (

"github.com/packet/packet/src/go/packet"

"github.com/soheilhy/beehive-netctrl/net/ethernet"
"github.com/soheilhy/beehive-netctrl/net/lldp"
"github.com/kandoo/beehive-netctrl/net/ethernet"
"github.com/kandoo/beehive-netctrl/net/lldp"
)
8 changes: 2 additions & 6 deletions nom/driver.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package nom

import (
"encoding/json"

"github.com/soheilhy/beehive/bh"
)
import "encoding/json"

// Driver represents the Bee that communicates with the actual networking
// element and adapts the southbound protocol for using in NOM.
type Driver struct {
BeeID bh.BeeID
BeeID uint64
Role DriverRole
}

Expand Down
6 changes: 3 additions & 3 deletions nom/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"reflect"

"github.com/golang/glog"
"github.com/soheilhy/beehive/bh"
"github.com/kandoo/beehive/state"
)

// Object is the interface of all structs in the network object model.
Expand Down Expand Up @@ -42,7 +42,7 @@ func ObjGoEncode(obj interface{}) ([]byte, error) {
return buf.Bytes(), nil
}

func DictGet(d bh.Dict, k bh.Key, obj Object) error {
func DictGet(d state.Dict, k string, obj Object) error {
v, err := d.Get(k)
if err != nil {
return err
Expand All @@ -57,7 +57,7 @@ func DictGet(d bh.Dict, k bh.Key, obj Object) error {
return nil
}

func DictPut(d bh.Dict, k bh.Key, obj Object) error {
func DictPut(d state.Dict, k string, obj Object) error {
v, err := obj.GoEncode()
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion openflow/bh.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/golang/glog"

"github.com/soheilhy/beehive/bh"
bh "github.com/kandoo/beehive"
)

// OFConfig stores the configuration of the OpenFlow driver.
Expand Down
6 changes: 3 additions & 3 deletions openflow/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"io"

"github.com/golang/glog"
"github.com/soheilhy/beehive-netctrl/nom"
"github.com/soheilhy/beehive-netctrl/openflow/of"
"github.com/soheilhy/beehive/bh"
"github.com/kandoo/beehive-netctrl/nom"
"github.com/kandoo/beehive-netctrl/openflow/of"
bh "github.com/kandoo/beehive"
)

type ofConnConfig struct {
Expand Down
2 changes: 1 addition & 1 deletion openflow/conv.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package openflow
import (
"strconv"

"github.com/soheilhy/beehive-netctrl/nom"
"github.com/kandoo/beehive-netctrl/nom"
)

func datapathIDToNodeID(dpID uint64) nom.NodeID {
Expand Down
Loading

0 comments on commit c6e0f94

Please sign in to comment.