Browse Source

Updated bgpdump.go to reflect naming changes in github.com/osrg/gobgp.

Keelan Lightfoot 8 years ago
parent
commit
c0dd863fb7
1 changed files with 9 additions and 7 deletions
  1. 9
    7
      bgpdump.go

+ 9
- 7
bgpdump.go View File

16
 	"github.com/davecgh/go-spew/spew"
16
 	"github.com/davecgh/go-spew/spew"
17
 	"github.com/garyburd/redigo/redis"
17
 	"github.com/garyburd/redigo/redis"
18
 	"github.com/osrg/gobgp/packet/bgp"
18
 	"github.com/osrg/gobgp/packet/bgp"
19
+	"github.com/osrg/gobgp/packet/mrt"
20
+
19
 )
21
 )
20
 
22
 
21
 // RefreshBGPDump ensures that the latest dump available is the one which is installed.
23
 // RefreshBGPDump ensures that the latest dump available is the one which is installed.
147
 		return n, fmt.Errorf("couldn't create gzip reader: %v", err)
149
 		return n, fmt.Errorf("couldn't create gzip reader: %v", err)
148
 	}
150
 	}
149
 	scanner := bufio.NewScanner(gzipReader)
151
 	scanner := bufio.NewScanner(gzipReader)
150
-	scanner.Split(bgp.SplitMrt)
152
+	scanner.Split(mrt.SplitMrt)
151
 	count := 0
153
 	count := 0
152
 
154
 
153
 	indexTableCount := 0
155
 	indexTableCount := 0
156
 		count++
158
 		count++
157
 		data := scanner.Bytes()
159
 		data := scanner.Bytes()
158
 
160
 
159
-		hdr := &bgp.MRTHeader{}
160
-		errh := hdr.DecodeFromBytes(data[:bgp.MRT_COMMON_HEADER_LEN])
161
+		hdr := &mrt.MRTHeader{}
162
+		errh := hdr.DecodeFromBytes(data[:mrt.MRT_COMMON_HEADER_LEN])
161
 		if err != nil {
163
 		if err != nil {
162
 			return 0, errh
164
 			return 0, errh
163
 		}
165
 		}
164
 
166
 
165
-		msg, err := bgp.ParseMRTBody(hdr, data[bgp.MRT_COMMON_HEADER_LEN:])
167
+		msg, err := mrt.ParseMRTBody(hdr, data[mrt.MRT_COMMON_HEADER_LEN:])
166
 		if err != nil {
168
 		if err != nil {
167
 			log.Printf("could not parse mrt body: %v", err)
169
 			log.Printf("could not parse mrt body: %v", err)
168
 			continue entries
170
 			continue entries
169
 		}
171
 		}
170
 
172
 
171
-		if msg.Header.Type != bgp.TABLE_DUMPv2 {
173
+		if msg.Header.Type != mrt.TABLE_DUMPv2 {
172
 			return 0, fmt.Errorf("unexpected message type: %d", msg.Header.Type)
174
 			return 0, fmt.Errorf("unexpected message type: %d", msg.Header.Type)
173
 		}
175
 		}
174
 
176
 
175
 		switch mtrBody := msg.Body.(type) {
177
 		switch mtrBody := msg.Body.(type) {
176
-		case *bgp.PeerIndexTable:
178
+		case *mrt.PeerIndexTable:
177
 			indexTableCount++
179
 			indexTableCount++
178
 			if indexTableCount != 1 {
180
 			if indexTableCount != 1 {
179
 				return 0, fmt.Errorf("got >1 PeerIndexTable")
181
 				return 0, fmt.Errorf("got >1 PeerIndexTable")
180
 			}
182
 			}
181
 
183
 
182
-		case *bgp.Rib:
184
+		case *mrt.Rib:
183
 			prefix := mtrBody.Prefix
185
 			prefix := mtrBody.Prefix
184
 			if len(mtrBody.Entries) < 0 {
186
 			if len(mtrBody.Entries) < 0 {
185
 				return 0, fmt.Errorf("no entries")
187
 				return 0, fmt.Errorf("no entries")