ensp_verify_lldp_neighbors
Collect LLDP neighbor information from a device and auto-enable LLDP if needed to verify real physical topology connections.
Instructions
采集指定设备的 LLDP 邻居信息(真实物理连接)。
与 ensp_verify_interfaces 的区别:
ensp_verify_interfaces只看本设备接口状态,不知道对端是谁本工具通过 LLDP 看到的是「对端设备 + 对端接口」,是物理事实
自动使能 LLDP(默认开启):
先发
display lldp neighbor brief(默认)或display lldp neighbor若回显表明 LLDP 未使能(命令报错,或含
LLDP is not enabled/LLDP功能未使能等关键字),且auto_enable=True,自动走:system-view → lldp enable → quit,等enable_retry_delay秒 让邻居收敛,再发一次采集命令若第二次仍然失败,返回
status="error"并附带 hint
把 auto_enable 设为 False 时,行为退回到「仅采集,未使能则报错」,
便于在已经手工开启 LLDP 的脚本里复用。
输出格式:
neighbors列表:每条含local_interface/remote_device/remote_interface/remote_chassis_id等字段返回的接口名已归一化(
GE0/0/0→GigabitEthernet0/0/0)lldp_was_enabled/auto_enable_attempts字段告诉调用方 本次是否自动使能过 LLDP(避免 LLM 重复操作)
典型用法:
在每台路由器 / 交换机上各调一次,收集到全网 LLDP 邻居后 传给
ensp_cross_validate_topology做交叉验证
核心实现见 :func:grbj_ensp_mcp.lldp_verifier.collect_lldp_neighbors_with_auto_enable。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| detail | No | ||
| auto_enable | No | ||
| enable_retry_delay | No | ||
| session_id_or_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||