This section provides a sample of configuring NetStream flow statistics collection for IPv4 flexible flows using the edit-config method.
Operation |
XPATH |
---|---|
edit-config |
|
Item | Data |
---|---|
Name of a flexible flow statistics template | huawei |
Aggregation keywords for flexible flow statistics | destination-address source-address |
Types of information included in flexible flow statistics | bytes packets |
Source IPv4 address of the exported packets carrying IPv4 flow statistics | 192.168.10.1 |
Destination IPv4 address of the exported packets carrying IPv4 flow statistics | 192.168.50.1 |
Destination UDP port number of the exported packets carrying IPv4 flow statistics | 65505 |
Interface where NetStream flow statistics collection is to be enabled | GigabitEthernet0/0/2 |
Direction of traffic to be sampled on the interface | inbound |
# Enable NetStream flow statistics collection for incoming IPv4 flexible flows on GE0/0/2.
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="0" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<running/>
</target>
<config>
<hw-ns:netstream-policy xmlns:hw-ns="urn:huawei:params:xml:ns:yang:huawei-netstream">
<hw-ns:sample-rule>
<hw-ns:name>huawei</hw-ns:name>
<hw-ns:record-info>
<hw-ns:match-field-bits>destination-address source-address</hw-ns:match-field-bits>
<hw-ns:collect-field-bits>bytes packets</hw-ns:collect-field-bits>
</hw-ns:record-info>
</hw-ns:sample-rule>
<hw-ns:export-source>
<hw-ns:ip>192.168.10.1</hw-ns:ip>
</hw-ns:export-source>
<hw-ns:export-host-no-vpn>
<hw-ns:ip>192.168.50.1</hw-ns:ip>
<hw-ns:port>65505</hw-ns:port>
</hw-ns:export-host-no-vpn>
</hw-ns:netstream-policy>
<hw-ns:netstream-apply xmlns:hw-ns="urn:huawei:params:xml:ns:yang:huawei-netstream">
<hw-ns:interface>
<hw-ns:name>GigabitEthernet0/0/2</hw-ns:name>
<hw-ns:record-applys>
<hw-ns:record-apply>
<hw-ns:direction>inbound</hw-ns:direction>
<hw-ns:record-name>huawei</hw-ns:record-name>
</hw-ns:record-apply>
</hw-ns:record-applys>
<hw-ns:ns-enable>
<hw-ns:direction>inbound</hw-ns:direction>
</hw-ns:ns-enable>
</hw-ns:interface>
</hw-ns:netstream-apply>
</config>
</edit-config>
</rpc>
# Disable NetStream flow statistics collection for incoming IPv4 flexible flows on GE0/0/2 and delete the flexible flow statistics template.
<?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>
<hw-ns:netstream-policy xmlns:hw-ns="urn:huawei:params:xml:ns:yang:huawei-netstream">
<hw-ns:sample-rule xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="delete">
<hw-ns:name>huawei</hw-ns:name>
<hw-ns:record-info>
<hw-ns:match-field-bits>destination-address source-address</hw-ns:match-field-bits>
<hw-ns:collect-field-bits>bytes packets</hw-ns:collect-field-bits>
</hw-ns:record-info>
</hw-ns:sample-rule>
</hw-ns:netstream-policy>
<hw-ns:netstream-apply xmlns:hw-ns="urn:huawei:params:xml:ns:yang:huawei-netstream">
<hw-ns:interface>
<hw-ns:name>GigabitEthernet0/0/2</hw-ns:name>
<hw-ns:record-applys>
<hw-ns:record-apply xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="delete">
<hw-ns:direction>inbound</hw-ns:direction>
<hw-ns:record-name>huawei</hw-ns:record-name>
</hw-ns:record-apply>
</hw-ns:record-applys>
<hw-ns:ns-enable xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="delete">
<hw-ns:direction>inbound</hw-ns:direction>
</hw-ns:ns-enable>
</hw-ns:interface>
</hw-ns:netstream-apply>
</config>
</edit-config>
</rpc>
# Sample of successful response.
##### Ok Reply or Operation Successful ##### <?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="0"> <ok/> </rpc-reply>
# Sample of failed response.
##### Error Reply or Operation Failed #####
<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="0">
<rpc-error>
<error-type>application</error-type>
<error-tag>invalid-value</error-tag>
<error-severity>error</error-severity>
<error-path>/huawei-netstream:netstream-apply/interface[name='GigabitEthernet0/0/2']/record-applys/record-apply[direction='inbound']/record-name</error-path>
<error-message>validation failed(Leafref "/huawei-netstream:netstream-policy/huawei-netstream:sample-rule/huawei-netstream:name" of value "huawei" points to a non-existing leaf.).</error-message>
</rpc-error>
</rpc-reply>