LLDP
This section describes the configuration model of LLDP and provides examples of XML packets.
Data Model
The configuration model files matching LLDP are ietf-interfaces.yang, huawei-lldp.yang, and huawei-device.yang.
Object |
Description |
Value |
Remarks |
---|---|---|---|
/huawei-lldp:lldp/enabled |
Indicates whether the global LLDP function is enabled on the switch. |
The value is of the Boolean type:
By default, the global LLDP function is enabled on the switch. |
Operations can be performed on other objects only when the global LLDP function is enabled on the switch. |
/huawei-lldp:lldp/sensor-ap-vlanid |
Configures the switch to identify Huawei Fit APs using LLDP and adds the interfaces receiving LLDP packets from the APs to the specified VLAN in untagged mode. |
The value is an integer ranging from 1 to 4094. By default, this function is disabled. |
The VLAN specified in the object can be an existing VLAN or created after this object is executed, but cannot be the control VLAN of ring protocols such as SEP, RRPP, and ERPS. |
/huawei-lldp:lldp/sensor-ap-trunk-vlanid |
Configures a switch to automatically identify Huawei Fit APs through the LLDPDUs sent from the Fit APs and add the receiving interfaces to the specified VLAN in tagged mode. |
The value of this object can be either of the following:
|
Multiple VLAN configurations are supported. The value of this object cannot contain the VLAN IDs configured by /huawei-lldp:lldp/sensor-ap-vlanid object. |
/huawei-lldp:lldp/management-address |
Configures the LLDP management IP address. |
The value is in dotted decimal notation. |
N/A |
/ietf-interfaces:interfaces/interface/huawei-lldp:lldp/admin-status |
Indicates whether the LLDP function is enabled on the interface. |
The value is of the enumerated type:
By default, the LLDP function status on an interface is the same as the global LLDP function status. |
N/A |
/ietf-interfaces:interfaces/interface/huawei-lldp:lldp/compliance-cdp-status |
Refer to the value. |
The value is of the enumerated type:
By default, the two functions are disabled. |
N/A |
/ietf-interfaces:interfaces/interface/huawei-lldp:lldp/tlv/med/tlvs/type |
Specifies the MED TLVs advertised on the interface. |
The value is tlv-med-network-policy, indicating that the Network Policy TLV is advertised on the interface. Network Policy TLV is used to exchange VLAN configurations between network devices and terminal devices. A switch uses this TLV to advertise Voice VLAN ID and voice stream priority to an IP phone. Then the IP phone forwards packets according to the received Voice VLAN ID and priority, ensuring the voice quality. |
This object and /ietf-interfaces:interfaces/interface/huawei-lldp:lldp/tlv/med/tlvs/enable must be configured simultaneously. |
/ietf-interfaces:interfaces/interface/huawei-lldp:lldp/tlv/med/tlvs/enable |
Indicates whether the MED TLV is advertised on the interface. |
The value is of the Boolean type:
By default, the MED TLV is not advertised on the interface. |
This object and /ietf-interfaces:interfaces/interface/huawei-lldp:lldp/tlv/med/tlvs/type must be configured simultaneously. |
/ietf-interfaces:interfaces/interface/huawei-lldp:lldp/tlv/med/tlvs/parameters/network-policy/vlan-type |
Specifies the VLAN type in the Network Policy TLV advertised on the interface. |
The value is of the enumerated type:
|
If this object is configured as network-policy-vlan-vlanid, you must configure the /ietf-interfaces:interfaces/interface/huawei-lldp:lldp/tlv/med/tlvs/parameters/network-policy/parameters/vlanid object simultaneously. |
/ietf-interfaces:interfaces/interface/huawei-lldp:lldp/tlv/med/tlvs/parameters/network-policy/parameters/vlanid |
Specifies the Voice VLAN ID. |
The value is an integer ranging from 1 to 4094. |
This object can be and must be configured only when the value of /ietf-interfaces:interfaces/interface/huawei-lldp:lldp/tlv/med/tlvs/parameters/network-policy/vlan-type is network-policy-vlan-vlanid. |
/ietf-interfaces:interfaces/interface/huawei-lldp:lldp/tlv/med/tlvs/parameters/network-policy/parameters/cos |
Specifies the 802.1p priority of the voice packets. |
The value is an integer ranging from 0 to 7, and the default value is 5. A larger value indicates a higher priority. |
This object can be configured only when the value of /ietf-interfaces:interfaces/interface/huawei-lldp:lldp/tlv/med/tlvs/parameters/network-policy/vlan-type is network-policy-vlan-vlanid or network-policy-vlan-8021. |
/ietf-interfaces:interfaces/interface/huawei-lldp:lldp/tlv/med/tlvs/parameters/network-policy/parameters/dscp |
Specifies the DSCP priority of the voice packets. |
The value is an integer ranging from 0 to 63, and the default value is 46. A larger value indicates a higher priority. |
This object can be configured only when the value of /ietf-interfaces:interfaces/interface/huawei-lldp:lldp/tlv/med/tlvs/parameters/network-policy/vlan-type is network-policy-vlan-vlanid or network-policy-vlan-8021. |
Object |
Description |
---|---|
/huawei-lldp:lldp-neighbor-change-event/lldp-neighbor/event-type |
Indicates the type of neighbor change:
|
|
Indicates the local interface name. |
|
Indicates the index of a neighbor. |
|
Indicates the ID type of a neighboring device:
|
|
Indicates the ID of a neighboring device. |
|
Indicates the ID type of a neighboring interface:
|
|
Indicates the ID of a neighboring interface. |
/ietf-interfaces:interfaces-state/interface/huawei-lldp:lldp/remote-port/port-description |
Indicates the description of a neighboring interface. |
|
Indicates the name of a neighboring device. |
|
Indicates the description of a neighboring device. |
|
Indicates capabilities supported by a neighboring device:
|
|
Indicates capabilities enabled on a neighboring device:
Multiple capabilities can be enabled on a neighboring device simultaneously. |
|
Name of the manufacturer. |
/ietf-interfaces:interfaces-state/interface/huawei-lldp:lldp/remote-port/remote-management/subtype |
Indicates the management address type of a neighboring device:
|
/ietf-interfaces:interfaces-state/interface/huawei-lldp:lldp/remote-port/remote-management/address |
Indicates the management address of a neighboring device. |
/ietf-interfaces:interfaces-state/interface/huawei-lldp:lldp/remote-port/remote-management/if-subtype |
Indicates the interface index type for the management address of a neighboring device:
|
/ietf-interfaces:interfaces-state/interface/huawei-lldp:lldp/remote-port/remote-management/if-id |
Indicates the interface index for the management address of a neighboring device. |
/ietf-interfaces:interfaces-state/interface/huawei-lldp:lldp/remote-port/remote-management/oid |
Indicates the OID for the management address of a neighboring device. |
Object |
Description |
---|---|
/huawei-lldp:cdp-neighbor-change-event/cdp-neighbor/event-type |
Indicates the type of neighbor change:
|
/huawei-lldp:cdp-neighbor-change-event/cdp-neighbor/local-port |
Indicates the local interface name. |
|
Indicates the index of a neighbor. |
|
Indicates the ID of a neighboring device. |
|
Indicates the ID of a neighboring interface. |
|
Indicates capabilities enabled on a neighboring device:
Multiple capabilities can be enabled on a neighboring device simultaneously. |
|
Indicates the software platform of a neighboring device. |
|
Indicates the software version of a neighboring device. |
|
Indicates the MAC address of a neighboring device. |
Configuring LLDP
This section describes how to enable the LLDP function and query the LLDP status using the rpc method.
Operation |
XPATH |
---|---|
rpc |
|
Data Requirements
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 |
GigabitEthernet1/0/1 |
Query LLDP neighbor information on the interface GigabitEthernet1/0/1. |
Request Example
<?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>GigabitEthernet1/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>
Response Example
<?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>GigabitEthernet1/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>00e0-fccd-d060</chassis-id> <system-description>Huawei Switch S12704 Huawei Versatile Routing Platform Software VRP (R) software, Version 5.170 (S12700 V200R020C00) Copyright (C) 2000-2019 HUAWEI TECH CO., LTD</system-description> <system-cap-enabled>cap-bridge cap-router</system-cap-enabled> <port-id>GigabitEthernet1/0/1</port-id> <chassic-id-sub-type>4</chassic-id-sub-type> <port-description>GigabitEthernet1/0/1</port-description> </remote-port> </lldp> </interface> </interfaces-state> </data> </rpc-reply>
Configuring the Switch to Automatically Identify Huawei Fit APs Using LLDP
This section provides samples of configuring the switch to automatically identify Huawei fit APs through LLDP using the config method.
Operation |
XPATH |
---|---|
edit-config:config |
/huawei-lldp:lldp/sensor-ap-vlanid |
Data Requirement 1
Item |
Data |
Description |
---|---|---|
Enable the LLDP function on the switch. |
true |
- |
Configure the switch to identify Huawei fit APs using LLDP and add the interfaces receiving the LLDP packets from APs to the specified VLAN in untagged mode. |
10 |
- |
Request Example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="1" 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:sensor-ap-vlanid>10</huawei-lldp:sensor-ap-vlanid> </huawei-lldp:lldp> </config> </edit-config> </rpc>
Response Example
# Sample of successful response.
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <ok/> </rpc-reply>
# Sample of failed response.
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-path>/huawei-lldp:lldp/sensor-ap-vlanid</error-path> <error-message>parse rpc config error.(Value "5000" does not satisfy the constraint "1..4094" (range, length, or pattern).).</error-message> </rpc-error> </rpc-reply>
Data Requirement 2
Item |
Data |
Description |
---|---|---|
Disable the switch from automatically identifying Huawei fit APs using LLDP. |
10 |
- |
Request Example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="2" 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:sensor-ap-vlanid xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="delete">10</huawei-lldp:sensor-ap-vlanid> </huawei-lldp:lldp> </config> </edit-config> </rpc>
Response Example
# Sample of successful response.
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2"> <ok/> </rpc-reply>
# Sample of failed response.
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-path>/huawei-lldp:lldp/sensor-ap-vlanid</error-path> <error-message>parse rpc config error.(Value "5000" does not satisfy the constraint "1..4094" (range, length, or pattern).).</error-message> </rpc-error> </rpc-reply>
Querying Information About CDP Neighbors
This section provides a sample of querying information about CDP neighbors using the get method.
Operation |
XPATH |
---|---|
get |
/ietf-interfaces:interfaces-state/interface/huawei-lldp:cdp |
Request Example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="6" 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/> <huawei-lldp:cdp xmlns:huawei-lldp="urn:huawei:params:xml:ns:yang:huawei-lldp"/> </if:interface> </if:interfaces-state> </filter> </get> </rpc>
Response Example
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="6"> <data> <interfaces-state xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <interface> <name>GigabitEthernet1/0/1</name> <cdp xmlns="urn:huawei:params:xml:ns:yang:huawei-lldp"> <remote-port> <index>1</index> <device-id>hw20180927</device-id> <port-id>GigabitEthernet1/0/10</port-id> <system-platform>huawei</system-platform> <system-mac-address>00:e0:fc:12:34:56</system-mac-address> <system-capabilities>router switch igmp</system-capabilities> </remote-port> </cdp> </interface> </interfaces-state> </data> </rpc-reply>