LLDP
此内容尚不支持你的语言。
This chapter provides examples on how to use Netconf to manage LLDP configurations on AsterNOS devices.
Enable LLDP Feature
Section titled “Enable LLDP Feature”Request example to enable LLDP feature via edit-config.
<config><top> <lldp-global operation="create"> <admin-status>true</admin-status> </lldp-global></top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:088fc1fb-b534-42aa-b7d3-1ab408d6ffe6"> <ok/></rpc-reply>Disable LLDP Feature
Section titled “Disable LLDP Feature”Request example to disable LLDP feature via edit-config.
<config><top> <lldp-global operation="merge"> <admin-status>false</admin-status> </lldp-global></top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:caf95cdc-e6fc-43ed-9682-5c5a6c50cd6c"> <ok/></rpc-reply>Edit Lldp Global Config
Section titled “Edit Lldp Global Config”Request example to edit LLDP global configuration via edit-config.
<config> <top> <lldp-global operation="merge"> <global-portid-subtype>macaddress</global-portid-subtype> <management-address>1.1.1.1</management-address> <dot3-power>true</dot3-power> <med-power>true</med-power> <admin-status>true</admin-status> </lldp-global> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:7f3e2f3a-2f4e-4d1b-8e2e-3c3f0b6e5f4a"> <ok/></rpc-reply>Replace Lldp Global Config
Section titled “Replace Lldp Global Config”Request example to replace LLDP global configuration via edit-config.
<config> <top> <lldp-global operation="replace"> <global-portid-subtype>ifname</global-portid-subtype> <admin-status>true</admin-status> </lldp-global> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:f8b9af10-0da7-4634-baad-ac27cd353c4a"> <ok/></rpc-reply>Get LLDP Global Config
Section titled “Get LLDP Global Config”Request example to get LLDP global configuration via get-config with subtree filter.
<filter type="subtree"> <top> <lldp-global/> </top></filter>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:a7600ade-aa6e-4ccd-9fd5-0b2d7ba95d27"> <data> <top> <lldp-global xmlns="http://asterfusion.com/ns/yang/asternos-lldp"> <global-portid-subtype>macaddress</global-portid-subtype> <management-address>1.1.1.1</management-address> <dot3-power>true</dot3-power> <med-power>true</med-power> <admin-status>true</admin-status> </lldp-global> </top> </data></rpc-reply>Delete LLDP Global Config
Section titled “Delete LLDP Global Config”Request example to delete LLDP global configuration via edit-config.
<config> <top> <lldp-global operation="delete"/> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:e1396839-b3f9-4dcf-bd34-7231175454f4"> <ok/></rpc-reply>Create LLDP Entry for Interface
Section titled “Create LLDP Entry for Interface”Request example to create LLDP entry for interface via edit-config.
<config> <top> <lldp-ports> <lldp-port operation="merge"> <ifname>Ethernet1</ifname> <priority>5</priority> <dscp>20</dscp> <vid>20</vid> <vlan-type>untagged</vlan-type> </lldp-port> </lldp-ports> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:4f5c6e2b-3c4d-4e5f-8a9b-0c1d2e3f4a5b"> <ok/></rpc-reply>Modify LLDP Entry for Interface
Section titled “Modify LLDP Entry for Interface”Request example to modify specific LLDP entry for interface via edit-config with merge operation.
<config> <top> <lldp-ports> <lldp-port operation="merge"> <ifname>Ethernet1</ifname> <priority>3</priority> <dscp>30</dscp> <vid>30</vid> <vlan-type>tagged</vlan-type> </lldp-port> </lldp-ports> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:59274d9a-6e2f-4b55-b27c-242d44aa231d"> <ok/></rpc-reply>Get LLDP Entry for Interface
Section titled “Get LLDP Entry for Interface”Request example to get specific LLDP entry for interface via get-config with subtree filter.
<filter type="subtree"> <top> <lldp-ports> <lldp-port> <ifname>Ethernet1</ifname> </lldp-port> </lldp-ports> </top></filter>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:5fb8022a-e506-4357-9b2a-7a0a0712cbab"> <data> <top> <lldp-ports xmlns="http://asterfusion.com/ns/yang/asternos-lldp"> <lldp-port> <ifname>Ethernet1</ifname> <vid>30</vid> <vlan-type>tagged</vlan-type> <priority>3</priority> <dscp>30</dscp> </lldp-port> </lldp-ports> </top> </data></rpc-reply>Delete LLDP Entry for Interface
Section titled “Delete LLDP Entry for Interface”Request example to delete specific LLDP entry for interface via edit-config.
<config> <top> <lldp-ports> <lldp-port operation="delete"> <ifname>Ethernet1</ifname> </lldp-port> </lldp-ports> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:8d6f4e2c-1a2b-3c4d-5e6f-7a8b9c0d1e2f"> <ok/></rpc-reply>Show LLDP Table
Section titled “Show LLDP Table”Request example to show LLDP table via rpc show-lldp-table.
<show-lldp-table/>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:680ce60c-a289-4344-a8a1-61e1753174b5"> <data xmlns="http://asterfusion.com/ns/yang/asternos-lldp"> Capability codes: (R) Router, (B) Bridge, (O) Other LocalPort RemoteDevice RemotePortID Capability RemotePortDescr ----------- -------------- -------------- ------------ ----------------- Ethernet29 sonic Ethernet37 BR Y37 eth0 Dev-Leaf-4 Ethernet27 BR Ethernet27 -------------------------------------------------- Total entries displayed: 2 </data></rpc-reply>Show LLDP Neighbors
Section titled “Show LLDP Neighbors”Request example to show LLDP neighbors via rpc show-lldp-neighbors.
<show-lldp-neighbor/>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:cbde15fb-9bcb-4a90-8253-4c0e8cc0773f"> <data xmlns="http://asterfusion.com/ns/yang/asternos-lldp"> ------------------------------------------------------------------------------- LLDP neighbors: ------------------------------------------------------------------------------- Interface: eth0, via: LLDP, RID: 1, Time: 0 day, 02:33:41 Chassis: ChassisID: local 60:eb:5a:01:02:a4 SysName: Dev-Leaf-4 SysDescr: db98dx3530_52cd Debian GNU/Linux 9 (stretch) 5.10.34-103 aarch64 MgmtIP: 172.18.0.1 MgmtIface: 10 MgmtIP: fc00::62eb:ffc:ac10:10b MgmtIface: 15 Capability: Bridge, on Capability: Router, on Port: PortID: ifname Ethernet27 PortDescr: Ethernet27 TTL: 8 MFS: 9216 PMD autoneg: supported: no, enabled: no MAU oper type: 10BaseTFD - UTP MAU, full duplex mode VLAN: 802, pvid: yes vlan802 VLAN: 4094, pvid: no vlan4094 ------------------------------------------------------------------------------- Interface: Ethernet29, via: LLDP, RID: 2, Time: 0 day, 02:33:41 Chassis: ChassisID: local 60:eb:5a:01:12:f2 SysName: sonic SysDescr: SONiC Software Version: SONiC.V6.1R004T006 - HwSku: CX308P-48Y-M - Distribution: Debian 12.12 - Kernel: 6.1.0-22-2-amd64 MgmtIP: 192.168.15.167 MgmtIface: 2 Capability: Bridge, on Capability: Router, on Capability: Wlan, off Capability: Station, off Port: PortID: ifname Ethernet37 PortDescr: Y37 TTL: 8 PMD autoneg: supported: no, enabled: no MAU oper type: 10BaseTFD - UTP MAU, full duplex mode ------------------------------------------------------------------------------- </data></rpc-reply>Show LLDP Ports Med Policy
Section titled “Show LLDP Ports Med Policy”Request example to show LLDP ports med policy via rpc show-lldp-ports-med-policy.
<show-lldp-ports-med-policy/>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:19401514-72f0-4834-a666-4eef10cd7ff0"> <data xmlns="http://asterfusion.com/ns/yang/asternos-lldp"> +-----------+---------------+--------+----------+------------+--------+ | Ports | application | vlan | tagged | priority | dscp | +===========+===============+========+==========+============+========+ | Ethernet1 | voice | 30 | tagged | 3 | 30 | +-----------+---------------+--------+----------+------------+--------+ </data></rpc-reply>