This section describes how to capture packets on a specified interface using the rpc method.
Operation |
XPATH |
---|---|
rpc |
|
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. |
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>
<?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>
<?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>