Newer
Older
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package main
import (
"fmt"
"os"
"time"
"github.com/bio-routing/bio-rd/config"
"github.com/bio-routing/bio-rd/protocols/device"
"github.com/bio-routing/bio-rd/protocols/isis/server"
"github.com/bio-routing/bio-rd/protocols/isis/types"
log "github.com/sirupsen/logrus"
)
func main() {
cfg := &config.ISISConfig{
NETs: []config.NET{
{
AFI: 0x49,
AreaID: types.AreaID{0, 0x01, 0, 0x10},
SystemID: types.SystemID{10, 20, 30, 40, 50, 60},
SEL: 0x00,
},
},
Interfaces: []config.ISISInterfaceConfig{
{
Name: "virbr2",
Passive: false,
P2P: true,
ISISLevel2Config: &config.ISISLevelConfig{
HelloInterval: 9,
HoldTime: 27,
Metric: 10,
Priority: 0,
},
},
{
Name: "lo",
Passive: true,
P2P: true,
ISISLevel2Config: &config.ISISLevelConfig{},
},
},
TrafficEngineeringRouterID: [4]byte{10, 20, 30, 40},
}
ds, err := device.New()
if err != nil {
log.Errorf("Unable to get device server: %v", err)
os.Exit(1)
}
err = ds.Start()
if err != nil {
log.Errorf("Unable to start device server: %v", err)
os.Exit(1)
}
s := server.New(cfg, ds, log.New())
s.AddInterface(&config.ISISInterfaceConfig{
Name: "virbr2",
Passive: false,
P2P: true,
ISISLevel2Config: &config.ISISLevelConfig{
HelloInterval: 9,
HoldTime: 27,
Metric: 10,
Priority: 0,
},
})
go func() {
t := time.NewTicker(time.Second * 10)
for {
<-t.C
for _, lsp := range s.GetDatabase() {
fmt.Printf("LSP: %v\n", lsp)
}
}
}()
select {}
}