Mirroring
This section describes the mirroring configuration model and provides examples of XML packets.
Data Model
The configuration model file matching mirroring is huawei-span.yang.
Object |
Description |
Value Range |
Remarks |
---|---|---|---|
/huawei-span:observe-ports/observe-port/index |
Indicates the index of an observing port. |
The value is an integer that ranges from 1 to 8. |
N/A |
/huawei-span:observe-ports/observe-port/observe-interfaces/observe-interface |
Indicates the physical port for the observing port. |
The value is a character string in the format of interface-typeinterface-number.
This port must be an existing port on the switch. |
N/A |
/huawei-span:observe-ports/observe-port/observe-interfaces/to-interface |
Indicates the last physical port added to the observing port. |
The value is a character string in the format of interface-typeinterface-number.
This port must be an existing port on the switch. |
N/A |
/huawei-span:observe-ports/observe-port/rspan-vlan |
Indicates the VLAN encapsulated in mirrored packets during the configuration of a Layer 2 remote observing port. |
The value is an integer that ranges from 1 to 4094 and must be an existing VLAN. |
N/A |
/ietf-interfaces:interfaces/interface/huawei-span:mirrors/mirror/direction |
Indicates that packets in the specified direction of a mirrored port are copied to an observing port. |
The value is of the enumerated type:
|
N/A |
/ietf-interfaces:interfaces/interface/huawei-span:mirrors/mirror/observe-ports-index |
Indicates the observing port index bound to a mirrored port. |
The value is an integer that ranges from 1 to 8. |
N/A |
Configuring Port Mirroring
This section provides a sample to configure, modify, and delete port mirroring using the rpc method.
Operation |
XPATH |
---|---|
rpc |
|
Data requirement
Item |
Data |
Description |
---|---|---|
Physical port for an observing port |
GigabitEthernet1/0/3 |
Indicates that the physical port for an observing port is GigabitEthernet1/0/3. |
Observing port index |
3 |
Indicates that the observing port index is 3. |
VLAN encapsulated in mirrored packets during the configuration of a Layer 2 remote observing port |
10 |
Indicates that VLAN 10 is encapsulated in mirrored packets during the configuration of a Layer 2 remote observing port. |
Physical port for a mirrored port |
GigabitEthernet1/0/4 |
Indicates that the physical port for a mirrored port is GigabitEthernet1/0/4. |
Copying packets in the specified direction of a mirrored port to an observing port |
inbound |
Indicates that incoming packets of a mirrored port are copied to an observing port. |
Observing port index bound to a mirrored port |
3 |
Indicates that packets of a mirrored port are copied to the observing port 3. |
Request example
Before configuring observing and mirrored ports, you must configure their physical ports. You can also configure their physical ports when configuring observing and mirrored ports. The following example describes how to configure a physical port for an observing port, how to configure an observing port, and how to configure both a mirrored port and its physical port.
<?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>GigabitEthernet1/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>GigabitEthernet1/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>GigabitEthernet1/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>GigabitEthernet1/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>GigabitEthernet1/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>GigabitEthernet1/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>GigabitEthernet1/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>
Response example
<?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="GigabitEthernet1/0/3"]/huawei-span:mirrors/mirror[direction="inbound"]</error-info>
</rpc-error>
</rpc-reply>