配置Voice VLAN
本章节介绍Voice VLAN的数据模型,以及配置的XML报文示例。
数据模型
VLAN管理的对应配置模型文件名为huawei-vlan.yang和ietf-interfaces.yang。
节点 |
说明 |
取值范围 |
备注 |
---|---|---|---|
/huawei-vlan:voice-vlan/remark-8021p |
指定802.1p优先级。 |
整数形式,取值范围是0~7。缺省值是6,值越大优先级越高。 |
NA |
/huawei-vlan:voice-vlan/remark-dscp |
指定DSCP优先级。 |
整数形式,取值范围是0~63,缺省值是46,值越大优先级越高。 |
NA |
/huawei-vlan:voice-vlan/address/mac |
指定语音报文的OUI。 |
格式为H:H:H:H:H:H。其中H为1至2位的十六进制数,如e0、fc。不能设置为全零、组播地址或广播地址。 |
NA |
/huawei-vlan:voice-vlan/address/mask |
指定OUI的掩码长度。 |
整数形式,取值范围是1~48。 |
NA |
/huawei-vlan:voice-vlan/address/description |
指定OUI的描述信息。 |
字符串形式,长度范围是1~80,区分大小写。 |
NA |
/ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan/voice-vlan-id |
使能指定VLAN ID的Voice VLAN功能。 |
整数形式,取值范围是2~4094。 |
NA |
/ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan/include-untagged |
指定为不带VLAN Tag的报文添加Voice VLAN ID。 |
布尔类型,取值如下:
缺省值是false。 |
NA |
/ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan/include-tag0 |
指定VLAN Tag为0的报文中的Tag修改为Voice VLAN ID对应的Tag。 |
布尔类型,取值如下:
缺省值是false。 |
仅S5720-EI、S6720-EI和S6720S-EI支持include-tag0。 |
/ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan/remark-mode |
指定语音报文提升优先级的模式。 |
枚举值类型,取值如下:
缺省值是vlan。 |
指定语音报文提升优先级的模式前,需要已使能接口的Voice VLAN功能。 |
/ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan/security |
配置Voice VLAN的安全模式或普通模式。 |
枚举值类型,取值如下:
缺省值是disable。 |
打开Voice VLAN的安全模式前,需要已配置Voice VLAN基于MAC地址提升优先级。 |
/ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan/mode |
指定接口的Voice VLAN的工作模式。 |
枚举值类型,取值如下:
缺省值是manual。 |
S5720-HI、S5730-HI、S5731-H-K、S5731-H、S5731-S、S5731S-H、S5731S-S、S5732-H、S5732-H-K、S6720-HI、S6730-H-K、S6730-H、S6730S-H、S6730-S和S6730S-S不支持该配置。 配置接口的Voice VLAN的工作模式为自动模式前,需要已配置Voice VLAN基于MAC地址提升优先级。 Access、negotiation-auto和negotiation-desirable类型接口不支持配置为自动模式,需要将接口配置为Trunk或Hybrid类型。 |
/ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan/legacy |
配置Voice VLAN兼容CDP功能,使设备将Voice VLAN信息封装在CDP报文中通告给IP电话。 |
枚举值类型,取值如下:
缺省值是disable。 |
配置Voice VLAN兼容CDP功能,使设备将Voice VLAN信息封装在CDP报文中通告给IP电话前,需要已使能接口的Voice VLAN功能。 |
配置基于MAC地址的Voice VLAN示例
本章节主要介绍通过edit-config方法配置基于MAC地址的Voice VLAN。
操作 |
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 |
数据需求
项目 |
数据 |
描述 |
---|---|---|
Voice VLAN的802.1p优先级 |
7 |
配置Voice VLAN的802.1p优先级为7。 |
Voice VLAN的DSCP优先级 |
50 |
配置Voice VLAN的DSCP优先级为50。 |
语音报文的OUI |
12:34:12:34:12:34 |
配置允许来自MAC地址为1234-1234-1234的语音报文被Voice VLAN识别。 |
OUI的掩码长度 |
24 |
OUI掩码地址为ffff-ff00-0000。 |
OUI的描述信息 |
PhoneA |
OUI的描述信息为PhoneA。 |
接口名称 |
XGigabitEthernet0/0/1 |
在XGigabitEthernet0/0/1接口下使能Voice VLAN功能,指定Voice VLAN为103,指定为不带VLAN Tag的报文添加Voice VLAN ID,并且指定VLAN Tag为0的报文中的Tag修改为Voice VLAN ID对应的Tag。 |
接口类型 |
iana-if-type:ethernetCsmacd |
|
Voice VLAN ID |
103 | |
指定为不带VLAN Tag的报文添加Voice VLAN ID |
true | |
指定VLAN Tag为0的报文中的Tag修改为Voice VLAN ID对应的Tag |
true | |
语音报文提升优先级的模式 |
mac-address | 配置语音报文按照MAC地址提升优先级。 |
Voice VLAN的工作模式 |
enable | 配置Voice VLAN的工作模式是安全模式。 |
接口加入Voice VLAN的模式 |
manual | 配置接口加入Voice VLAN的模式为手动模式。 |
请求示例
# 配置Voice VLAN的802.1p和DSCP优先级,并配置OUI。
<?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>
# 在XGigabitEthernet0/0/1接口下配置基于MAC地址的Voice VLAN示例。
<?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>XGigabitEthernet0/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>
响应示例
配置成功响应示例
<?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>
配置失败响应示例
<?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="XGigabitEthernet0/0/1"]/huawei-vlan:voice-vlan</error-info>
</rpc-error>
</rpc-reply>
配置基于VLAN的Voice VLAN示例
本章节主要介绍通过edit-config方法配置基于VLAN的Voice VLAN。
操作 |
XPATH |
---|---|
edit-config |
/huawei-vlan:voice-vlan/remark-8021p /huawei-vlan:voice-vlan/remark-dscp /ietf-interfaces:interfaces/interface/huawei-vlan:voice-vlan |
数据需求
项目 |
数据 |
描述 |
---|---|---|
Voice VLAN的802.1p优先级 |
7 |
配置Voice VLAN的802.1p优先级为7。 |
Voice VLAN的DSCP优先级 |
50 |
配置Voice VLAN的DSCP优先级为50。 |
接口名称 |
XGigabitEthernet0/0/2 |
在XGigabitEthernet0/0/2接口下使能Voice VLAN功能,指定Voice VLAN为105,指定为不带VLAN Tag的报文添加Voice VLAN ID,并且指定VLAN Tag为0的报文中的Tag修改为Voice VLAN ID对应的Tag。 |
接口类型 |
iana-if-type:ethernetCsmacd |
|
Voice VLAN ID |
105 | |
是否指定为不带VLAN Tag的报文添加Voice VLAN ID |
true | |
是否指定VLAN Tag为0的报文中的Tag修改为Voice VLAN ID对应的Tag |
true | |
语音报文提升优先级的模式 |
vlan | 配置语音报文按照VLAN提升优先级。 |
兼容CDP功能 |
enable | 使能兼容CDP功能,使交换机将Voice VLAN信息封装在CDP报文中通告给IP电话。 |
请求示例
# 配置Voice VLAN的802.1p和DSCP优先级。
<?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>
# 在XGigabitEthernet0/0/2接口下配置基于VLAN的Voice VLAN示例。
<?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>
响应示例
配置成功响应示例
<?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>
配置失败响应示例
<?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>