This section provides a sample of configuring a VLAN ID-based voice VLAN using the edit-config method.
Operation |
XPATH |
---|---|
edit-config |
/huawei-vlan:voice-vlan/remark-8021p /huawei-vlan:voice-vlan/remark-dscp /ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan |
Item |
Data |
Description |
---|---|---|
802.1p priority of the voice VLAN |
7 |
Set the 802.1p priority of the voice VLAN to 7. |
DSCP priority of the voice VLAN |
50 |
Set the DSCP priority of the voice VLAN to 50. |
Interface name |
XGigabitEthernet0/0/2 |
Enable the voice VLAN function on the XGigabitEthernet0/0/2 interface and specify VLAN 105 as the voice VLAN. Add voice VLAN IDs to untagged packets and change VLAN 0 in packets to the voice VLAN ID. |
Interface type |
iana-if-type:ethernetCsmacd |
|
Voice VLAN ID |
105 | |
Whether to add voice VLAN IDs to untagged packets |
true | |
Whether to change VLAN 0 in packets to the voice VLAN ID |
true | |
Mode of increasing the priority of voice packets |
vlan | Specify that the priority of voice packets is increased based on VLAN IDs. |
CDP-compatible capability |
enable | Enable the CDP-compatible voice VLAN function so that the switch encapsulates voice VLAN information in CDP packets and sends them to connected IP phones. |
To create a VLAN and add an interface to the VLAN, refer to VLAN Management. The related configuration is not provided here.
# Sample of configuring the 802.1p priority and DSCP priority for a voice VLAN
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="7" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <huawei-vlan:voice-vlan xmlns:huawei-vlan="urn:huawei:params:xml:ns:yang:huawei-vlan"> <huawei-vlan:remark-8021p>7</huawei-vlan:remark-8021p> <huawei-vlan:remark-dscp>50</huawei-vlan:remark-dscp> </huawei-vlan:voice-vlan> </config> </edit-config> </rpc>
# Sample of configuring a VLAN ID-based voice VLAN on the XGigabitEthernet 0/0/2 interface
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="8" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<running/>
</target>
<config>
<if:interfaces xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<if:interface>
<if:name>XGigabitEthernet0/0/2</if:name>
<if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:ethernetCsmacd</if:type>
<huawei-vlan:voice-vlan xmlns:huawei-vlan="urn:huawei:params:xml:ns:yang:huawei-vlan">
<huawei-vlan:voice-vlan-id>105</huawei-vlan:voice-vlan-id>
<huawei-vlan:include-untagged>true</huawei-vlan:include-untagged>
<huawei-vlan:include-tag0>true</huawei-vlan:include-tag0>
<huawei-vlan:remark-mode>vlan</huawei-vlan:remark-mode>
<huawei-vlan:legacy>enable</huawei-vlan:legacy>
</huawei-vlan:voice-vlan>
</if:interface>
</if:interfaces>
</config>
</edit-config>
</rpc>
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="8"> <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="8">
<rpc-error>
<error-type>application</error-type>
<error-tag>operation-failed</error-tag>
<error-severity>error</error-severity>
<error-path>/ietf-interfaces:interfaces/interface[name='XGigabitEthernet0/0/2']/huawei-vlan:voice-vlan/security</error-path>
<error-message>parse rpc config error.(Invalid value "true" in "security" element.).</error-message>
</rpc-error>
</rpc-reply>