< Home

Applying a Traffic Policy

This section describes how to apply a traffic policy and cancel the traffic policy that is applied using the rpc method.

Table 1 Applying a traffic policy

Operation

XPATH

rpc

/huawei-mqc-apply:mqc-apply/traffic-policy-apply

Data Requirements 1

Item

Data

Description

Name of a traffic policy

p1

The traffic policy p1 is applied to GigabitEthernet0/0/1 in the inbound direction.

Interface

GigabitEthernet0/0/1

Inbound direction

inbound

Request example

<?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-mqc-ap:mqc-apply xmlns:hw-mqc-ap="urn:huawei:params:xml:ns:yang:huawei-mqc-apply">
        <hw-mqc-ap:traffic-policy-apply>
          <hw-mqc-ap:name>p1</hw-mqc-ap:name>
          <hw-mqc-ap:interface>
            <hw-mqc-ap:name>GigabitEthernet0/0/1</hw-mqc-ap:name>
            <hw-mqc-ap:inbound> </hw-mqc-ap:inbound>
          </hw-mqc-ap:interface>
        </hw-mqc-ap:traffic-policy-apply>
      </hw-mqc-ap:mqc-apply>
    </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="1">
  <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="1">
  <rpc-error>
    <error-app-tag>-1</error-app-tag>
    <error-message>Exception Found</error-message>
    <error-info>Error on node /huawei-mqc-apply:mqc-apply/traffic-policy-apply[name="p1"]</error-info>
  </rpc-error>
</rpc-reply>

Data Requirements 2

Delete the configuration in data requirement 1, that is, cancel the traffic policy p1 that is applied to GigabitEthernet0/0/1 in the inbound direction.

Request example

<?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>
      <hw-mqc-ap:mqc-apply xmlns:hw-mqc-ap="urn:huawei:params:xml:ns:yang:huawei-mqc-apply">
        <hw-mqc-ap:traffic-policy-apply xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="delete">
          <hw-mqc-ap:name>p1</hw-mqc-ap:name>
          <hw-mqc-ap:interface>
            <hw-mqc-ap:name>GigabitEthernet0/0/1</hw-mqc-ap:name>
            <hw-mqc-ap:inbound> </hw-mqc-ap:inbound>
          </hw-mqc-ap:interface>
        </hw-mqc-ap:traffic-policy-apply>
      </hw-mqc-ap:mqc-apply>
    </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="3">
  <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="3">
  <rpc-error>
    <error-app-tag>-1</error-app-tag>
    <error-message>Exception Found</error-message>
    <error-info>Error on node /huawei-mqc-apply:mqc-apply/traffic-policy-apply[name="p1"]</error-info>
  </rpc-error>
</rpc-reply>
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic