|
|
@@ -73,8 +73,8 @@ func (p *H3CParser) Parse(device *models.Device, outputs []string) error {
|
|
|
|
|
|
// 解析ARP表用于MAC到IP映射(允许失败)
|
|
|
arpTable := make(map[string]string)
|
|
|
- if outputs[4] != "" {
|
|
|
- arpTable = p.parseARPTable(outputs[4])
|
|
|
+ if outputs[5] != "" {
|
|
|
+ arpTable = p.parseARPTable(outputs[5])
|
|
|
if len(arpTable) == 0 {
|
|
|
fmt.Printf("Warning: ARP table is empty for device %s\n", device.IP)
|
|
|
}
|
|
|
@@ -83,7 +83,7 @@ func (p *H3CParser) Parse(device *models.Device, outputs []string) error {
|
|
|
}
|
|
|
|
|
|
// 解析LLDP邻居,使用ARP表进行MAC到IP的映射
|
|
|
- device.Neighbors = p.parseNeighbors(outputs[3], arpTable)
|
|
|
+ device.Neighbors = p.parseNeighbors(outputs[4], arpTable)
|
|
|
|
|
|
fmt.Printf("Device %s: %d interfaces, %d neighbors, %d ARP entries\n",
|
|
|
device.IP, len(device.Interfaces), len(device.Neighbors), len(arpTable))
|