镜像配置
数据模型
镜像配置的配置模型文件名为huawei-span.yang。
节点 |
说明 |
取值范围 |
备注 |
---|---|---|---|
/huawei-span:observe-ports/observe-port/index |
观察端口索引。 |
整数形式。S5720-EI、S5720-HI、S5730-HI、S5731-H-K、S5731-H、S5731-S、S5731S-H、S5731S-S、S5732-H、S5732-H-K、S6720-EI、S6720-HI、S6720S-EI、S6730-H-K、S6730-H、S6730S-H、S6730-S和S6730S-S的取值范围是1~8,S1730S-H、S5735-L、S5735S-L、S5735S-L-M、S5735-S、S5735-S-I和S5735S-S的取值范围是1~4,其他设备的取值范围是1~6。 |
NA |
/huawei-span:observe-ports/observe-port/observe-interfaces/observe-interface |
观察端口对应的物理接口。 |
字符串形式,格式为interface-typeinterface-number,其中:
必须是交换机上存在的接口。 |
NA |
/huawei-span:observe-ports/observe-port/observe-interfaces/to-interface |
加入该观察端口的最后一个物理接口。 |
字符串形式,interface-typeinterface-number,其中:
必须是交换机上存在的接口。 |
仅S5720-EI、S5720-HI、S5730-HI、S5731-H-K、S5731-H、S5731-S、S5731S-H、S5731S-S、S5732-H、S5732-H-K、S6720-EI、S6720-HI、S6720S-EI、S6730-H-K、S6730-H、S6730S-H、S6730-S和S6730S-S支持该节点。 |
/huawei-span:observe-ports/observe-port/rspan-vlan |
配置二层远程观察端口时,指定镜像报文封装的VLAN。 |
整数形式,取值范围是1~4094,必须是交换机上已存在的VLAN。 |
对于S1720GF、S1720GFR-P、S2720-EI、S5720-LI、S1730S-H、S5735-L、S5735S-L、S5735S-L-M、S5720S-LI、S5720-SI、S5735-S、S5735S-S、S5735-S-I、S5720S-SI、S5720I-SI、S5730-SI、S5730S-EI、S6720-LI、S6720S-LI、S6720-SI和S6720S-SI,所有的二层远程观察端口只能配置同一个VLAN。 |
/ietf-interfaces:interfaces/interface/huawei-span:mirrors/mirror/direction |
将镜像端口指定方向的报文镜像到观察端口。 |
枚举值类型,取值范围是:
|
NA |
/ietf-interfaces:interfaces/interface/huawei-span:mirrors/mirror/observe-ports-index |
镜像端口绑定的观察端口索引。 |
整数形式。S5720-EI、S5720-HI、S5730-HI、S5731-H-K、S5731-H、S5731-S、S5731S-H、S5731S-S、S5732-H、S5732-H-K、S6720-EI、S6720-HI、S6720S-EI、S6730-H-K、S6730-H、S6730S-H、S6730-S和S6730S-S的取值范围是1~8,S1730S-H、S5735-L、S5735S-L、S5735S-L-M、S5735-S、S5735-S-I和S5735S-S的取值范围是1~4,其他设备的取值范围是1~6。 |
NA |
配置端口镜像示例
本章节主要介绍通过rpc方法对端口镜像进行配置、修改和删除操作。
操作 |
XPATH |
---|---|
rpc |
|
数据需求
项目 |
数据 |
描述 |
---|---|---|
观察端口对应的物理接口 |
GigabitEthernet0/0/3 |
观察端口对应的物理接口为GigabitEthernet0/0/3。 |
观察端口索引 |
3 |
观察端口索引为3。 |
配置二层远程观察端口时,镜像报文封装的VLAN |
10 |
配置二层远程观察端口时,镜像报文封装到VLAN 10。 |
镜像端口对应的物理接口 |
GigabitEthernet0/0/4 |
镜像端口对应的物理接口为GigabitEthernet0/0/4。 |
将镜像端口指定方向的报文镜像到观察端口 |
inbound |
将镜像端口入方向的报文镜像到观察端口。 |
镜像端口绑定的观察端口索引 |
3 |
将镜像端口的报文镜像到观察端口3。 |
请求示例
配置观察端口和镜像端口之前必须先配置其对应的物理接口,您也可以在配置观察端口和镜像端口的同时配置其对应的物理接口。这里分别以配置观察端口对应的物理接口、配置观察端口以及同时配置镜像端口和其对应的物理接口为例。
<?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>
<if:interfaces xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<if:interface>
<if:name>GigabitEthernet0/0/3</if:name>
<if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:ethernetCsmacd</if:type>
<if:enabled>true</if:enabled>
</if:interface>
</if:interfaces>
</config>
</edit-config>
</rpc>
<?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>
<span:observe-ports xmlns:span="urn:huawei:params:xml:ns:yang:huawei-span">
<span:observe-port>
<span:index>3</span:index>
<span:observe-interfaces>
<span:observe-interface>GigabitEthernet0/0/3</span:observe-interface>
</span:observe-interfaces>
<span:rspan-vlan>10</span:rspan-vlan>
</span:observe-port>
</span:observe-ports>
</config>
</edit-config>
</rpc>
<?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>
<if:interfaces xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<if:interface>
<if:name>GigabitEthernet0/0/4</if:name>
<if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:ethernetCsmacd</if:type>
<if:enabled>true</if:enabled>
<span:mirrors xmlns:span="urn:huawei:params:xml:ns:yang:huawei-span">
<span:mirror>
<span:direction>inbound</span:direction>
<span:observe-ports-index>3</span:observe-ports-index>
</span:mirror>
</span:mirrors>
</if:interface>
</if:interfaces>
</config>
</edit-config>
</rpc>
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="4" 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>GigabitEthernet0/0/4</if:name>
<if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:ethernetCsmacd</if:type>
<span:mirrors xmlns:span="urn:huawei:params:xml:ns:yang:huawei-span">
<span:mirror xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="replace">
<span:direction>outbound</span:direction>
<span:observe-ports-index>3</span:observe-ports-index>
</span:mirror>
</span:mirrors>
</if:interface>
</if:interfaces>
</config>
</edit-config>
</rpc>
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="5" 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>GigabitEthernet0/0/4</if:name>
<if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:ethernetCsmacd</if:type>
<span:mirrors xmlns:span="urn:huawei:params:xml:ns:yang:huawei-span">
<span:mirror xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="delete">
<span:direction>outbound</span:direction>
<span:observe-ports-index>3</span:observe-ports-index>
</span:mirror>
</span:mirrors>
</if:interface>
</if:interfaces>
</config>
</edit-config>
</rpc>
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="6" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<running/>
</target>
<config>
<span:observe-ports xmlns:span="urn:huawei:params:xml:ns:yang:huawei-span">
<span:observe-port>
<span:index>3</span:index>
<span:observe-interfaces>
<span:observe-interface>GigabitEthernet0/0/3</span:observe-interface>
</span:observe-interfaces>
<span:rspan-vlan xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="replace">23</span:rspan-vlan>
</span:observe-port>
</span:observe-ports>
</config>
</edit-config>
</rpc>
<?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>
<span:observe-ports xmlns:span="urn:huawei:params:xml:ns:yang:huawei-span">
<span:observe-port xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="delete">
<span:index>3</span:index>
<span:observe-interfaces>
<span:observe-interface>GigabitEthernet0/0/3</span:observe-interface>
</span:observe-interfaces>
<span:rspan-vlan>23</span:rspan-vlan>
</span:observe-port>
</span:observe-ports>
</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="2"> <ok/> </rpc-reply>
<?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-app-tag>-1</error-app-tag>
<error-message>Service process failed.</error-message>
<error-info>Error on node /ietf-interfaces:interfaces/interface[name="GigabitEthernet0/0/3"]/huawei-span:mirrors/mirror[direction="inbound"]</error-info>
</rpc-error>
</rpc-reply>