| 1 | package parserscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.25 testing/" |
| 5 | |
| 6 | "github.com/czerwonk/testutils/assertscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/" |
| 7 | ) |
| 8 | |
| 9 | func TestOSPFAreascip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/TestOSPFArea().(t *testingscip-go gomod github.com/golang/go/src go1.25 testing/.Tscip-go gomod github.com/golang/go/src go1.25 testing/T#) { |
| 10 | data := "ospf1:\n" + |
| 11 | "RFC1583 compatibility: disabled\n" + |
| 12 | "Stub router: No\n" + |
| 13 | "RT scheduler tick: 1\n" + |
| 14 | "Number of areas: 2\n" + |
| 15 | "Number of LSAs in DB: 33\n" + |
| 16 | " Area: 0.0.0.0 (0) [BACKBONE]\n" + |
| 17 | " Stub: No\n" + |
| 18 | " NSSA: No\n" + |
| 19 | " Transit: No\n" + |
| 20 | " Number of interfaces: 3\n" + |
| 21 | " Number of neighbors: 2\n" + |
| 22 | " Number of adjacent neighbors: 1\n" + |
| 23 | " Area: 0.0.0.1 (1)\n" + |
| 24 | " Stub: No\n" + |
| 25 | " NSSA: No\n" + |
| 26 | " Transit: No\n" + |
| 27 | " Number of interfaces: 4\n" + |
| 28 | " Number of neighbors: 6\n" + |
| 29 | " Number of adjacent neighbors: 5\n" |
| 30 | a := ParseOSPFscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/parser`/ParseOSPF().([]byte(data)) |
| 31 | assertscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/.IntEqualscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/IntEqual().("areas", 2, len(a), t) |
| 32 | |
| 33 | a1 := a[0] |
| 34 | assertscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/.StringEqualscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/StringEqual().("Area1 Name", "0", a1.Namescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/OSPFArea#Name., t) |
| 35 | assertscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/.Int64Equalscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/Int64Equal().("Area1 InterfaceCount", 3, a1.InterfaceCountscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/OSPFArea#InterfaceCount., t) |
| 36 | assertscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/.Int64Equalscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/Int64Equal().("Area1 NeighborCount", 2, a1.NeighborCountscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/OSPFArea#NeighborCount., t) |
| 37 | assertscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/.Int64Equalscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/Int64Equal().("Area1 NeighborAdjacentCount", 1, a1.NeighborAdjacentCountscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/OSPFArea#NeighborAdjacentCount., t) |
| 38 | |
| 39 | a2 := a[1] |
| 40 | assertscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/.StringEqualscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/StringEqual().("Area2 Name", "1", a2.Namescip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/OSPFArea#Name., t) |
| 41 | assertscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/.Int64Equalscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/Int64Equal().("Area2 InterfaceCount", 4, a2.InterfaceCountscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/OSPFArea#InterfaceCount., t) |
| 42 | assertscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/.Int64Equalscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/Int64Equal().("Area2 NeighborCount", 6, a2.NeighborCountscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/OSPFArea#NeighborCount., t) |
| 43 | assertscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/.Int64Equalscip-go gomod github.com/czerwonk/testutils dd9dabe360d4 `github.com/czerwonk/testutils/assert`/Int64Equal().("Area2 NeighborAdjacentCount", 5, a2.NeighborAdjacentCountscip-go gomod github.com/czerwonk/bird_exporter . `github.com/czerwonk/bird_exporter/protocol`/OSPFArea#NeighborAdjacentCount., t) |
| 44 | } |