< Home

Configuring a Traffic Policy

This section describes how to configure, modify, and delete a traffic policy using the rpc method.

Table 1 Configuring a traffic policy

Operation

XPATH

rpc

/huawei-mqc:mqc/traffic-classifier

/huawei-mqc:mqc/traffic-behaviour

/huawei-mqc:mqc/traffic-policy

Data Requirements 1

Create a traffic classifier named c1 and define traffic classification rules, create a traffic behavior named b1 and define actions, and create a traffic policy named p1 and bind the traffic classifier c1 and traffic behavior b1 to it.

Item

Data

Description

Name of a traffic classifier

c1

The name of a traffic classifier is c1.

Start outer VLAN ID

100

Packets tagged with VLAN 100 are matched.

Name of a traffic behavior

b1

The name of a traffic behavior is b1.

DSCP priority value of IP packets to be re-marked

46

The DSCP priority value of IP packets is re-marked with 46.

CIR

2000

The CIR is 2000 kbit/s.

PIR

10000

The PIR is 10000 kbit/s.

Mode in which yellow packets are processed

pass

Yellow packets are allowed to pass through.

Whether the traffic statistics function is enabled

true

The traffic statistics function is enabled.

Name of a traffic policy

p1

The name of a traffic policy is p1.

Name of a traffic classifier

c1

The traffic classifier c1 and traffic behavior b1 are bound to the traffic policy p1.

Name of a traffic behavior

b1

Request example

<?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>
      <hw-mqc:mqc xmlns:hw-mqc="urn:huawei:params:xml:ns:yang:huawei-mqc">
        <hw-mqc:traffic-classifier>
          <hw-mqc:name>c1</hw-mqc:name>
          <hw-mqc:match-condition>
            <hw-mqc:named-field>
              <hw-mqc:vlan>
                <hw-mqc:start-vlan>100</hw-mqc:start-vlan>
              </hw-mqc:vlan>
            </hw-mqc:named-field>
          </hw-mqc:match-condition>
        </hw-mqc:traffic-classifier>
        <hw-mqc:traffic-behaviour>
          <hw-mqc:name>b1</hw-mqc:name>
          <hw-mqc:dscp-value>46</hw-mqc:dscp-value>
          <hw-mqc:car>
            <hw-mqc:cir>2000</hw-mqc:cir>
            <hw-mqc:pir>10000</hw-mqc:pir>
            <hw-mqc:yellow>
              <hw-mqc:processing>pass</hw-mqc:processing>
            </hw-mqc:yellow>
          </hw-mqc:car>
          <hw-mqc:enable-statistics>true</hw-mqc:enable-statistics>
        </hw-mqc:traffic-behaviour>
        <hw-mqc:traffic-policy>
          <hw-mqc:name>p1</hw-mqc:name>
          <hw-mqc:rule>
            <hw-mqc:traffic-classifier>c1</hw-mqc:traffic-classifier>
            <hw-mqc:traffic-behaviour>b1</hw-mqc:traffic-behaviour>
          </hw-mqc:rule>
        </hw-mqc:traffic-policy>
      </hw-mqc:mqc>
    </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="4">
  <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="4">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-message>parse rpc config error.</error-message>
  </rpc-error>
</rpc-reply>

Data Requirements 2

Change the DSCP priority of IP packets to be re-marked to 50.

Only changed data items are provided here. For other information, see data requirement 1.

Item

Data

Description

DSCP priority value of IP packets to be re-marked

50

The DSCP priority of IP packets to be re-marked is changed to 50.

Request example

<?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>
      <hw-mqc:mqc xmlns:hw-mqc="urn:huawei:params:xml:ns:yang:huawei-mqc" xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="replace">
        <hw-mqc:traffic-classifier>
          <hw-mqc:name>c1</hw-mqc:name>
          <hw-mqc:match-condition>
            <hw-mqc:named-field>
              <hw-mqc:vlan>
                <hw-mqc:start-vlan>100</hw-mqc:start-vlan>
              </hw-mqc:vlan>
            </hw-mqc:named-field>
          </hw-mqc:match-condition>
        </hw-mqc:traffic-classifier>
        <hw-mqc:traffic-behaviour>
          <hw-mqc:name>b1</hw-mqc:name>
          <hw-mqc:dscp-value>50</hw-mqc:dscp-value>
          <hw-mqc:car>
            <hw-mqc:cir>2000</hw-mqc:cir>
            <hw-mqc:pir>10000</hw-mqc:pir>
            <hw-mqc:yellow>
              <hw-mqc:processing>pass</hw-mqc:processing>
            </hw-mqc:yellow>
          </hw-mqc:car>
          <hw-mqc:enable-statistics>true</hw-mqc:enable-statistics>
        </hw-mqc:traffic-behaviour>
        <hw-mqc:traffic-policy>
          <hw-mqc:name>p1</hw-mqc:name>
          <hw-mqc:rule>
            <hw-mqc:traffic-classifier>c1</hw-mqc:traffic-classifier>
            <hw-mqc:traffic-behaviour>b1</hw-mqc:traffic-behaviour>
          </hw-mqc:rule>
        </hw-mqc:traffic-policy>
      </hw-mqc:mqc>
    </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="5">
  <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="5">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-message>parse rpc config error.</error-message>
  </rpc-error>
</rpc-reply>

Data Requirements 3

Delete the configuration in data requirement 1.

Request example

<?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>
      <hw-mqc:mqc xmlns:hw-mqc="urn:huawei:params:xml:ns:yang:huawei-mqc" xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="remove">
        <hw-mqc:traffic-classifier>
          <hw-mqc:name>c1</hw-mqc:name>
          <hw-mqc:match-condition>
            <hw-mqc:named-field>
              <hw-mqc:vlan>
                <hw-mqc:start-vlan>100</hw-mqc:start-vlan>
              </hw-mqc:vlan>
            </hw-mqc:named-field>
          </hw-mqc:match-condition>
        </hw-mqc:traffic-classifier>
        <hw-mqc:traffic-behaviour>
          <hw-mqc:name>b1</hw-mqc:name>
          <hw-mqc:dscp-value>50</hw-mqc:dscp-value>
          <hw-mqc:car>
            <hw-mqc:cir>2000</hw-mqc:cir>
            <hw-mqc:pir>10000</hw-mqc:pir>
            <hw-mqc:yellow>
              <hw-mqc:processing>pass</hw-mqc:processing>
            </hw-mqc:yellow>
          </hw-mqc:car>
          <hw-mqc:enable-statistics>true</hw-mqc:enable-statistics>
        </hw-mqc:traffic-behaviour>
        <hw-mqc:traffic-policy>
          <hw-mqc:name>p1</hw-mqc:name>
          <hw-mqc:rule>
            <hw-mqc:traffic-classifier>c1</hw-mqc:traffic-classifier>
            <hw-mqc:traffic-behaviour>b1</hw-mqc:traffic-behaviour>
          </hw-mqc:rule>
        </hw-mqc:traffic-policy>
      </hw-mqc:mqc>
    </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="6">
  <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="6">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-message>parse rpc config error.</error-message>
  </rpc-error>
</rpc-reply>
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >