added first test for ipv4 with bird 2.x

This commit is contained in:
Daniel Czerwonk 2018-01-18 09:21:32 +01:00
parent 3b1a6d4e4f
commit c710518e9d
3 changed files with 54 additions and 8 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ birdwatcher-*
DIST/
*.local.*
debug.test

View File

@ -40,8 +40,16 @@ func TestParseBgpRoutes(t *testing.T) {
}
func TestParseRoutesAll(t *testing.T) {
f, err := openFile("routes_bird1_ipv4.sample")
func TestParseRoutesAllIpv4Bird1(t *testing.T) {
runTestForIpv4WithFile("routes_bird1_ipv4.sample", t)
}
func TestParseRoutesAllIpv4Bird2(t *testing.T) {
runTestForIpv4WithFile("routes_bird2_ipv4.sample", t)
}
func runTestForIpv4WithFile(file string, t *testing.T) {
f, err := openFile(file)
if err != nil {
t.Error(err)
}
@ -50,7 +58,7 @@ func TestParseRoutesAll(t *testing.T) {
result := parseRoutes(f)
routes, ok := result["routes"].([]Parsed)
if !ok {
t.Error("Error getting routes")
t.Fatal("Error getting routes")
}
if len(routes) != 4 {
@ -127,15 +135,15 @@ func TestParseRoutesAll(t *testing.T) {
}, routes[3], "Route 4", t)
}
func TestParseRoutesAllBird1(t *testing.T) {
runTestForIpv6WithTemplate("routes_bird1_ipv6.sample", t)
func TestParseRoutesAllIpv6Bird1(t *testing.T) {
runTestForIpv6WithFile("routes_bird1_ipv6.sample", t)
}
func TestParseRoutesAllBird2(t *testing.T) {
runTestForIpv6WithTemplate("routes_bird2_ipv6.sample", t)
func TestParseRoutesAllIpv6Bird2(t *testing.T) {
runTestForIpv6WithFile("routes_bird2_ipv6.sample", t)
}
func runTestForIpv6WithTemplate(file string, t *testing.T) {
func runTestForIpv6WithFile(file string, t *testing.T) {
f, err := openFile(file)
if err != nil {
t.Error(err)

View File

@ -0,0 +1,37 @@
BIRD 1.6.3 ready.
16.0.0.0/24 unicast [ID8503_AS1340 2017-06-21 08:17:33] * (100) [AS1340i]
via 1.2.3.16 on eno7
Type: BGP univ
BGP.origin: IGP
BGP.as_path: 1340
BGP.next_hop: 1.2.3.16
BGP.local_pref: 100
BGP.community: (65011,3) (9033,3251)
BGP.large_community: (9033, 65666, 12) (9033, 65666, 9)
200.0.0.0/24 unicast [ID8497_AS1339 2017-06-21 08:17:31] * (100) [AS1339i]
via 1.2.3.15 on eno7
Type: BGP univ
BGP.origin: IGP
BGP.as_path: 1339
BGP.next_hop: 1.2.3.15
BGP.local_pref: 100
BGP.community: (65011,40) (9033,3251)
BGP.large_community: (9033, 65666, 12) (9033, 65666, 9)
unicast [ID8503_AS1340 2017-06-21 08:17:33] (100/?) [AS1340i]
via 1.2.3.16 on eno7
Type: BGP univ
BGP.origin: IGP
BGP.as_path: 1340
BGP.next_hop: 1.2.3.16
BGP.local_pref: 100
BGP.community: (65011,3) (9033,3251)
BGP.large_community: (9033, 65666, 12) (9033, 65666, 9)
16.0.0.0/24 unicast [ID8503_AS1340 2017-06-21 08:17:33] * (100) [AS1340i]
via 1.2.3.16 on eno7 [
Type: BGP univ
BGP.origin: IGP
BGP.as_path: 1340
BGP.next_hop: 1.2.3.16
BGP.local_pref: 100
BGP.community: (65011,3) (9033,3251)
BGP.large_community: (9033, 65666, 12) (9033, 65666, 9)