Configuring a Voice VLAN
This section describes the data model of a voice VLAN and provides examples of XML packets.
Data Model
The configuration model files matching VLAN management are huawei-vlan.yang and ietf-interfaces.yang.
Object |
Description |
Value |
Remarks |
---|---|---|---|
/huawei-vlan:voice-vlan/remark-8021p |
Specifies the 802.1p priority. |
The value is an integer that ranges from 0 to 7. The default value is 6. A larger value indicates a higher priority. |
NA |
/huawei-vlan:voice-vlan/remark-dscp |
Specifies the DSCP priority. |
The value is an integer that ranges from 0 to 63. The default value is 46. A larger value indicates a higher priority. |
NA |
/huawei-vlan:voice-vlan/address/mac |
Specifies the OUI address of voice packets that can be transmitted in the voice VLAN. |
The value is in H:H:H:H:H:H format. H is a hexadecimal number that contains 1 to 2 digits, such as e0 and fc. The address cannot be all 0s, multicast address, or broadcast address. |
NA |
/huawei-vlan:voice-vlan/address/mask |
Specifies the mask length of the OUI address. |
The value is an integer that ranges from 1 to 48. |
NA |
/huawei-vlan:voice-vlan/address/description |
Indicates the description of the OUI address. |
The value is a string of 1 to 80 case-sensitive characters. |
NA |
/ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan/voice-vlan-id |
Configures a specified VLAN as a voice VLAN. |
The value is an integer that ranges from 2 to 4094. |
NA |
/ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan/include-untagged |
Adds voice VLAN IDs to untagged packets. |
The value is of the Boolean type:
The default value is false. |
NA |
/ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan/include-tag0 |
Changes VLAN 0 in packets to the voice VLAN ID. |
The value is of the Boolean type:
The default value is false. |
The LE1D2S04SEC0, LE1D2X32SEC0, LE1D2H02QEC0, and X series cards do not support include-tag0. |
/ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan/remark-mode |
Configures a mode to increase the priority of voice packets. |
The value is of the enumerated type:
The default value is vlan. |
You must enable the voice VLAN function on interfaces before configuring a mode to increase the priority of voice packets. |
/ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan/security |
Configures the secure or normal mode of a voice VLAN. |
The value is of the enumerated type:
The default value is disable. |
You must specify that the priority of voice VLANs is increased based on MAC addresses before enabling the secure mode of the voice VLAN. |
/ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan/mode |
Specifies the working mode of the voice VLAN. |
The value is of the enumerated type:
The default value is manual. |
You must specify that the priority of voice VLANs is increased based on MAC addresses before specifying the auto mode for the voice VLAN. Access interfaces cannot work in auto mode. To configure these interfaces to work in auto mode, change the interface type to trunk or hybrid. |
/ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan/legacy |
Enables the CDP-compatible voice VLAN function so that the switch encapsulates voice VLAN information in CDP packets and sends them to connected IP phones. |
The value is of the enumerated type:
The default value is disable. |
You must enable the voice VLAN function on interfaces before enabling the CDP-compatible voice VLAN function so that the switch encapsulates voice VLAN information in CDP packets and sends them to connected IP phones. |
Sample of Configuring a MAC Address-based Voice VLAN
This section provides a sample of configuring a MAC address-based voice VLAN using the edit-config method.
Operation |
XPATH |
---|---|
edit-config |
/huawei-vlan:voice-vlan/remark-8021p /huawei-vlan:voice-vlan/remark-dscp /huawei-vlan:voice-vlan/address /ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan |
Data Requirements
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. |
OUI addresses of voice packets |
12:34:12:34:12:34 |
Allow the voice packets coming from an IP phone whose MAC address is 1234-1234-1234 to be identified by the voice VLAN. |
Mask length of the OUI address |
24 |
The OUI mask address is ffff-ff00-0000. |
Description of the OUI address |
PhoneA |
The description of the OUI address is PhoneA. |
Interface name |
XGigabitEthernet1/0/1 |
Enable the voice VLAN function on the XGigabitEthernet1/0/1 interface and specify VLAN 103 as a 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 |
103 | |
Adding voice VLAN IDs to untagged packets |
true | |
Changing VLAN 0 in packets to the voice VLAN ID |
true | |
Mode of increasing the priority of voice packets |
mac-address | Specify that the priority of voice packets is increased based on MAC addresses. |
Working mode of the voice VLAN |
enable | Configure the voice VLAN to work in secure mode. |
Mode of adding an interface to a voice VLAN |
manual | Configure an interface to be added to a voice VLAN in manual mode. |
To create a VLAN and add an interface to the VLAN, refer to VLAN Management. The related configuration is not provided here.
Request Example
# Sample of configuring the 802.1p priority and DSCP priority for a voice VLAN and setting the OUI address
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="11" 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:address> <huawei-vlan:mac>12:34:12:34:12:34</huawei-vlan:mac> <huawei-vlan:mask>24</huawei-vlan:mask> <huawei-vlan:description>PhoneA</huawei-vlan:description> </huawei-vlan:address> </huawei-vlan:voice-vlan> </config> </edit-config> </rpc>
# Sample of configuring a MAC address-based voice VLAN on the XGigabitEthernet1/0/1 interface
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="12" 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>XGigabitEthernet1/0/1</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>103</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>mac-address</huawei-vlan:remark-mode>
<huawei-vlan:security>enable</huawei-vlan:security>
<huawei-vlan:mode>manual</huawei-vlan:mode>
</huawei-vlan:voice-vlan>
</if:interface>
</if:interfaces>
</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="11"> <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="4">
<rpc-error>
<error-app-tag>-1</error-app-tag>
<error-message> Auto-mode voice VLAN cannot be configured on a negotiation port.</error-message>
<error-info>Error on node /ietf-interfaces:interfaces/interface[name="XGigabitEthernet1/0/1"]/huawei-vlan:voice-vlan</error-info>
</rpc-error>
</rpc-reply>
Sample of Configuring a VLAN ID-based Voice VLAN
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 |
Data Requirements
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 |
XGigabitEthernet1/0/2 |
Enable the voice VLAN function on the XGigabitEthernet1/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.
Request Example
# 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 1/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>XGigabitEthernet1/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>
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="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='XGigabitEthernet1/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>