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,6 +16,8 @@ import (
16 16
 	"github.com/davecgh/go-spew/spew"
17 17
 	"github.com/garyburd/redigo/redis"
18 18
 	"github.com/osrg/gobgp/packet/bgp"
19
+	"github.com/osrg/gobgp/packet/mrt"
20
+
19 21
 )
20 22
 
21 23
 // RefreshBGPDump ensures that the latest dump available is the one which is installed.
@@ -147,7 +149,7 @@ func (b *BGPDump) parseBGPDump(conn redis.Conn) (int, error) {
147 149
 		return n, fmt.Errorf("couldn't create gzip reader: %v", err)
148 150
 	}
149 151
 	scanner := bufio.NewScanner(gzipReader)
150
-	scanner.Split(bgp.SplitMrt)
152
+	scanner.Split(mrt.SplitMrt)
151 153
 	count := 0
152 154
 
153 155
 	indexTableCount := 0
@@ -156,30 +158,30 @@ entries:
156 158
 		count++
157 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 163
 		if err != nil {
162 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 168
 		if err != nil {
167 169
 			log.Printf("could not parse mrt body: %v", err)
168 170
 			continue entries
169 171
 		}
170 172
 
171
-		if msg.Header.Type != bgp.TABLE_DUMPv2 {
173
+		if msg.Header.Type != mrt.TABLE_DUMPv2 {
172 174
 			return 0, fmt.Errorf("unexpected message type: %d", msg.Header.Type)
173 175
 		}
174 176
 
175 177
 		switch mtrBody := msg.Body.(type) {
176
-		case *bgp.PeerIndexTable:
178
+		case *mrt.PeerIndexTable:
177 179
 			indexTableCount++
178 180
 			if indexTableCount != 1 {
179 181
 				return 0, fmt.Errorf("got >1 PeerIndexTable")
180 182
 			}
181 183
 
182
-		case *bgp.Rib:
184
+		case *mrt.Rib:
183 185
 			prefix := mtrBody.Prefix
184 186
 			if len(mtrBody.Entries) < 0 {
185 187
 				return 0, fmt.Errorf("no entries")