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 V200R011C10 NETCONF YANG API Reference

This document describes the NETCONF 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).
Packet Capture

Packet Capture

This section describes the configuration model of packet capture and provides examples of XML packets.

Data Model

The configuration model file matching packet capture is huawei-capture.yang.

Table 2-245  Configuration objects of packet capture

Object

Description

Value

Remarks

/huawei-capture:capture-pkt/cpu

Captures packets sent to the CPU.

This object does not need any data configuration.

cpu and ifNameType cannot be configured simultaneously.

/huawei-capture:capture-pkt/ifNameType

Captures packets on a specified interface.

The value is a string in the format of interface-typeinterface-number.

  • interface-type specifies the interface type.
  • interface-number specifies the interface number.

The interface must exist on the switch.

/huawei-capture:capture-pkt/vlan-id

Captures packets from the specified outer VLAN.

The value is an integer that ranges from 1 to 4094. The VLAN must exist on the switch.

N/A

/huawei-capture:capture-pkt/acl-id

Captures packets matching the specified ACL.

The value is an integer that ranges from 2000 to 4999. The ACL must exist on the switch.

N/A

/huawei-capture:capture-pkt/packetnumber

Indicates the number of packets to be captured. The system stops capturing packets after the specified number of packets are captured.

The value is an integer that ranges from 1 to 1000. The default value is 100.

N/A

/huawei-capture:capture-pkt/packetlenth

Indicates the length of a single captured packet, which means the first several bytes of the captured packet.

The value is an integer that ranges from 20 to 64, in bytes. The default value is 64.

N/A

/huawei-capture:capture-pkt/timeout

Indicates the timeout interval of packet capture. The system stops capturing packets after the specified timeout interval.

The value is an integer that ranges from 1 to 300, in seconds. The default value is 60.

N/A

/huawei-capture:capture-pkt/filename

Saves captured packets to the specified file.

The file name is a string in *.cap format. The default value is capture.cap.

N/A

Table 2-246  Notification message
Item Description
esn Indicates the device ESN.
filename Indicates the name of the file that stores the captured packets.
type Indicates the type of the file that stores the captured packets.
status Indicates the result of packet capture.
errorcode Indicates the error code.

Capturing Packets Sent to the CPU

This section describes how to capture packets sent to the CPU using the rpc method.

Table 2-247  Capturing packets sent to the CPU

Operation

XPATH

rpc

  • /huawei-capture:capture-pkt/cpu
  • /huawei-capture:capture-pkt/vlan-id
  • /huawei-capture:capture-pkt/acl-id
  • /huawei-capture:capture-pkt/packetnumber
  • /huawei-capture:capture-pkt/packetlenth
  • /huawei-capture:capture-pkt/timeout
  • /huawei-capture:capture-pkt/filename

Data Requirements

Item

Data

Description

Capturing packets sent to the CPU

-

-

Capturing packets from the specified outer VLAN

10

Capture packets from VLAN 10.

Capturing packets matching the specified ACL

2003

Capture packets matching the ACL 2003.

Number of packets to be captured

120

Capture 120 packets.

Length of a single captured packet

55

Set the length of a single captured packet to 55 bytes.

Timeout interval of packet capture

10

Set the timeout interval of packet capture to 10 seconds.

Name of the file to which packets are saved

captureTest1.cap

Save the captured packets to the captureTest1.cap file.

Request Example

NOTE:

The specified VLAN and ACL must exist, and the ACL must have the rules configured. For details about how to configure VLAN and ACL, see VLAN Management and ACL Rule Management separately.

Name of the file to which packets are saved cannot exist.

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="14" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <huawei-capture:capture-pkt xmlns:huawei-capture="urn:huawei:params:xml:ns:yang:huawei-capture">
    <huawei-capture:cpu></huawei-capture:cpu>
    <huawei-capture:vlan-id>10</huawei-capture:vlan-id>
    <huawei-capture:acl-id>2003</huawei-capture:acl-id>
    <huawei-capture:packetnumber>120</huawei-capture:packetnumber>
    <huawei-capture:packetlenth>55</huawei-capture:packetlenth>
    <huawei-capture:timeout>10</huawei-capture:timeout>
    <huawei-capture:filename>captureTest1.cap</huawei-capture:filename>
  </huawei-capture:capture-pkt>
</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="14">
  <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="14">
  <rpc-error xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-app-tag>1</error-app-tag>
    <error-message>Error: The saved file already exists. Error: Failed to configure packet getting. </error-message>
  </rpc-error>
</rpc-reply>

Capturing Packets on a Specified Interface

This section describes how to capture packets on a specified interface using the rpc method.

Table 2-248  Capturing packets on a specified interface

Operation

XPATH

rpc

  • /huawei-capture:capture-pkt/ifNameType
  • /huawei-capture:capture-pkt/vlan-id
  • /huawei-capture:capture-pkt/acl-id
  • /huawei-capture:capture-pkt/packetnumber
  • /huawei-capture:capture-pkt/packetlenth
  • /huawei-capture:capture-pkt/timeout
  • /huawei-capture:capture-pkt/filename

Data Requirements

Item

Data

Description

Capturing packets on a specified interface

GigabitEthernet0/0/1

Capture packets on the interface GigabitEthernet0/0/1.

Capturing packets from the specified outer VLAN

10

Capture packets from VLAN 10.

Capturing packets matching the specified ACL

2003

Capture packets matching the ACL 2003.

Number of packets to be captured

120

Capture 120 packets.

Length of a single captured packet

55

Set the length of a single captured packet to 55 bytes.

Timeout interval of packet capture

10

Set the timeout interval of packet capture to 10 seconds.

Name of the file to which packets are saved

captureTest1.cap

Save the captured packets to the captureTest1.cap file.

Request Example

NOTE:

The specified VLAN and ACL must already exist, and the ACL must have the rules configured. For details about how to configure VLAN and ACL, see VLAN Management and ACL Rule Management separately.

Name of the file to which packets are saved cannot already exist.

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="14" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <huawei-capture:capture-pkt xmlns:huawei-capture="urn:huawei:params:xml:ns:yang:huawei-capture">
    <huawei-capture:ifNameType>GigabitEthernet0/0/1</huawei-capture:ifNameType>
    <huawei-capture:vlan-id>10</huawei-capture:vlan-id>
    <huawei-capture:acl-id>2003</huawei-capture:acl-id>
    <huawei-capture:packetnumber>120</huawei-capture:packetnumber>
    <huawei-capture:packetlenth>55</huawei-capture:packetlenth>
    <huawei-capture:timeout>10</huawei-capture:timeout>
    <huawei-capture:filename>captureTest1.cap</huawei-capture:filename>
  </huawei-capture:capture-pkt>
</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="14">
  <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="14">
  <rpc-error xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-app-tag>1</error-app-tag>
    <error-message>Error: The saved file already exists. Error: Failed to configure packet getting. </error-message>
  </rpc-error>
</rpc-reply>
Translation
Download
Updated: 2019-09-23

Document ID: EDOC1000178028

Views: 4978

Downloads: 0

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