This section describes how to enable the LLDP function and query the LLDP status using the rpc method.
Operation |
XPATH |
---|---|
rpc |
|
Item |
Data |
Description |
---|---|---|
Whether to enable the LLDP function on the switch |
true |
Enable the LLDP function on the switch. |
LLDP neighbor information queried on an interface |
GigabitEthernet0/0/1 |
Query LLDP neighbor information on the interface GigabitEthernet0/0/1. |
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="3" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <huawei-lldp:lldp xmlns:huawei-lldp="urn:huawei:params:xml:ns:yang:huawei-lldp"> <huawei-lldp:enabled>true</huawei-lldp:enabled> </huawei-lldp:lldp> </config> </edit-config> </rpc>
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="14" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<get>
<filter type="subtree">
<if:interfaces-state xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<if:interface>
<if:name>GigabitEthernet0/0/1</if:name>
<huawei-lldp:lldp xmlns:huawei-lldp="urn:huawei:params:xml:ns:yang:huawei-lldp">
<huawei-lldp:remote-port/>
</huawei-lldp:lldp>
</if:interface>
</if:interfaces-state>
</filter>
</get>
</rpc>
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="3"> <ok/> </rpc-reply>
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="3"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-message>parse rpc config error.</error-message> </rpc-error> </rpc-reply>
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="14"> <data> <interfaces-state xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <interface> <name>GigabitEthernet0/0/1</name> <lldp xmlns="urn:huawei:params:xml:ns:yang:huawei-lldp"> <remote-port> <index>1</index> <port-id-sub-type>5</port-id-sub-type> <system-cap-supported>cap-bridge cap-router</system-cap-supported> <system-name>Switch</system-name> <remote-management> <subtype>1</subtype> <address>192.168.10.1</address> <if-subtype>2</if-subtype> <if-id>44</if-id> <oid>0.6.15.43.6.1.4.1.2011.5.25.41.1.2.1.1.1</oid> </remote-management> <chassis-id>a4c6-4fcd-d060</chassis-id> <system-description>Huawei Switch S5720-56C-HI-AC Huawei Versatile Routing Platform Software VRP (R) software, Version 5.170 (S5720 V200R019C10) Copyright (C) 2000-2019 HUAWEI TECH CO., LTD</system-description> <system-cap-enabled>cap-bridge cap-router</system-cap-enabled> <port-id>GigabitEthernet0/0/1</port-id> <chassic-id-sub-type>4</chassic-id-sub-type> <port-description>GigabitEthernet0/0/1</port-description> </remote-port> </lldp> </interface> </interfaces-state> </data> </rpc-reply>