Fix: 修正H3C解析器输出索引
- outputs[4] 是 display lldp neighbor-information - outputs[5] 是 display arp - 修正后邻居和ARP表解析正确
このコミットが含まれているのは:
@@ -73,8 +73,8 @@ func (p *H3CParser) Parse(device *models.Device, outputs []string) error {
|
|||||||
|
|
||||||
// 解析ARP表用于MAC到IP映射(允许失败)
|
// 解析ARP表用于MAC到IP映射(允许失败)
|
||||||
arpTable := make(map[string]string)
|
arpTable := make(map[string]string)
|
||||||
if outputs[4] != "" {
|
if outputs[5] != "" {
|
||||||
arpTable = p.parseARPTable(outputs[4])
|
arpTable = p.parseARPTable(outputs[5])
|
||||||
if len(arpTable) == 0 {
|
if len(arpTable) == 0 {
|
||||||
fmt.Printf("Warning: ARP table is empty for device %s\n", device.IP)
|
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的映射
|
// 解析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",
|
fmt.Printf("Device %s: %d interfaces, %d neighbors, %d ARP entries\n",
|
||||||
device.IP, len(device.Interfaces), len(device.Neighbors), len(arpTable))
|
device.IP, len(device.Interfaces), len(device.Neighbors), len(arpTable))
|
||||||
|
|||||||
新しいイシューから参照
ユーザーをブロックする