-
Notifications
You must be signed in to change notification settings - Fork 24
/
main.go
39 lines (32 loc) · 841 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"flag"
"os"
"runtime/pprof"
bh "github.com/kandoo/beehive"
"github.com/kandoo/beehive-netctrl/controller"
"github.com/kandoo/beehive-netctrl/discovery"
"github.com/kandoo/beehive-netctrl/openflow"
"github.com/kandoo/beehive/Godeps/_workspace/src/github.com/golang/glog"
)
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
func main() {
flag.Parse()
if *cpuprofile != "" {
f, err := os.Create(*cpuprofile)
if err != nil {
glog.Fatal(err)
}
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
}
h := bh.NewHive()
openflow.StartOpenFlow(h)
controller.RegisterNOMController(h)
discovery.RegisterDiscovery(h)
// Register a switch:
// switching.RegisterSwitch(h, bh.Persistent(1))
// or a hub:
// switching.RegisterHub(h, bh.NonTransactional())
h.Start()
}