No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

S600-E V200R012C00 NETCONF YANG API Reference

This document describes the NETCONF YANG API functions supported by the switch, including the data model and samples.
Rate and give feedback :
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Port Mirroring

Port Mirroring

This section describes the configuration model of port mirroring and provides examples of XML packets.

Data Model

The configuration model file matching port mirroring is huawei-span.yang.

Table 2-286  Configuration objects of port mirroring

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 6.

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.

  • interface-type specifies the interface type.
  • interface-number specifies the interface 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 .

All Layer 2 remote observing ports can only be configured with the same VLAN.

/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.

Enumerated type:
  • inbound: Incoming packets of a mirrored port are copied to an observing port.
  • outbound: Outgoing packets of a mirrored port are copied to an observing port.
  • both: Both incoming and outgoing packets of a mirrored port are copied to an observing port.

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 6.

N/A

Configuring Port Mirroring

This section provides a sample to configure, modify, and delete port mirroring using the rpc method.

Table 2-287  Configuring port mirroring

Operation

XPATH

rpc

  • /huawei-span:observe-ports/observe-port/index
  • /huawei-span:observe-ports/observe-port/observe-interfaces/observe-interface
  • /huawei-span:observe-ports/observe-port/observe-interfaces/to-interface
  • /huawei-span:observe-ports/observe-port/rspan-vlan
  • /ietf-interfaces:interfaces/interface/huawei-span:mirrors/mirror/direction
  • /ietf-interfaces:interfaces/interface/huawei-span:mirrors/mirror/observe-ports-index
Data requirement

Item

Data

Description

Physical port for an observing port

GigabitEthernet0/0/3

Indicates that the physical port for an observing port is GigabitEthernet0/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

GigabitEthernet0/0/4

Indicates that the physical port for a mirrored port is GigabitEthernet0/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
# Configure a physical port for an observing port.
NOTE:

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>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>
# Configure a Layer 2 remote observing port.
<?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>
# Configure a mirrored port.
<?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>
# Modify the mirrored port configuration. The following example copies outgoing packets of a mirrored port to an observing port.
<?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>
# Cancel configuring GigabitEthernet0/0/4 as a mirrored port.
<?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>0/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>
# Modify the observing port configuration. The following example modifies the VLAN encapsulated in mirrored ports to 23. Make sure that no mirrored port on the switch is bound to this observing port before you perform this operation.
<?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>
# Cancel configuring GigabitEthernet0/0/3 as an observing port. Make sure that no mirrored port on the switch is bound to this observing port before you perform this operation.
<?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>
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="2">
  <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="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>
Translation
Download
Updated: 2018-09-01

Document ID: EDOC1100037962

Views: 7179

Downloads: 8

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next