Skip to content
Snippets Groups Projects
Commit f623f0e3 authored by Oliver Herms's avatar Oliver Herms
Browse files

Adding ISIS example

parent 31ddae45
No related branches found
No related tags found
No related merge requests found
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 {}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment