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

NETCONF YANG API Reference

AR100, AR120, AR160, AR1200, AR2200, AR3200, and AR3600 V300R003

NETCONF YANG API Reference
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).
Interface Common

Interface Common

Data Model

The public configuration model file matching the interface is ietf-interfaces.yang.

Table 1 Public data model of the interface

Object

Description

/ietf-interfaces:interfaces/interface/name

Indicates the interface name.

/ietf-interfaces:interfaces/interface/type

Indicates the interface type.

/ietf-interfaces:interfaces/interface/enabled

Indicates whether the interface is enabled. The value true indicates that the interface is enabled, and the value false indicates that the interface is disabled.

/ietf-interfaces:interfaces-state/interface/name

Indicates the name of the interface whose status is to be queried.

/ietf-interfaces:interfaces-state/interface/admin-status

Indicates the interface management status.

/ietf-interfaces:interfaces-state/interface/oper-status

Indicates the interface running status.

/ietf-interfaces:interfaces-state/interface/phys-address

Indicates the physical address of the interface.

/ietf-interfaces:interfaces-state/interface/statistics

Indicates the interface statistics.

/ietf-interfaces:interfaces/interface/link-track/track-obj-type

Indicates the interface association type.

/ietf-interfaces:interfaces/interface/link-track/track-obj-name

Indicates the interface association name.

/ietf-interfaces:interfaces/interface/link-track/track-obj-extend-name

Indicates the extended information about interface association.

/ietf-interfaces:interfaces/interface/link-track/track-obj-state

Indicates the interface association status.

Configuring the Interface Description

This section provides a sample of configuring the interface description.

Table 3-1 Entering an interface and configuring processes

Operation

XPATH

edit-config:config

/ietf-interfaces:interfaces/interface/name

/ietf-interfaces:interfaces/interface/description

/ietf-interfaces:interfaces/interface/type

/ietf-interfaces:interfaces/interface/enabled

Data Requirements

Item

Data

Description

Interface name

GigabitEthernet0/0/2

Configure the description of GigabitEthernet0/0/2 as "aa".

Interface description

aa

Whether the interface is enabled

true

Request Example
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="DEVICECONFIG_dc9bf91389364b8cada05b7d95f3e062">
 <edit-config>
  <target>
   <running/>
  </target>
  <error-option>rollback-on-error</error-option>
  <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
   
   <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces" >
    <interface>
     <name>GigabitEthernet0/0/2</name>
     <type xmlns:iana="urn:ietf:params:xml:ns:yang:iana-if-type">iana:ethernetCsmacd</type>
     <enabled>true</enabled>
     <description>aa</description>
    </interface>
   </interfaces>
  </config>
 </edit-config>
</rpc>
Response Example

Sample of successful response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="DEVICECONFIG_dc9bf91389364b8cada05b7d95f3e062">
  <ok/>
</rpc-reply>

Modifying the Interface Configuration

This section provides a sample of modifying the interface configuration.

Table 3-2 Modifying the interface configuration

Operation

XPATH

edit-config:replace

/ietf-interfaces:interfaces/interface/name

/ietf-interfaces:interfaces/interface/description

/ietf-interfaces:interfaces/interface/type

/ietf-interfaces:interfaces/interface/enabled

Data Requirements

Item

Data

Description

Interface name

GigabitEthernet0/0/2

Modify the description of GigabitEthernet0/0/2 as "ab".

Interface description

ab

Whether the interface is enabled

true

Request Example
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="DEVICECONFIG_dc9bf91389364b8cada05b7d95f3e062">
 <edit-config>
  <target>
   <running/>
  </target>
  <error-option>rollback-on-error</error-option>
  <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"> 
   <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces" xc:operation="replace">
    <interface>
     <name>GigabitEthernet0/0/2</name>
     <type xmlns:iana="urn:ietf:params:xml:ns:yang:iana-if-type">iana:ethernetCsmacd</type>
     <enabled>true</enabled>
     <description>ab</description>
    </interface>
   </interfaces>
  </config>
 </edit-config>
</rpc>
Response Example

Sample of successful response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="DEVICECONFIG_dc9bf91389364b8cada05b7d95f3e062">
  <ok/>
</rpc-reply>

Deleting the Interface Configuration

This section provides a sample of deleting the interface configuration.

Table 3-3 Deleting the interface configuration

Operation

XPATH

edit-config:remove

/ietf-interfaces:interfaces/interface/name

/ietf-interfaces:interfaces/interface/description

/ietf-interfaces:interfaces/interface/type

/ietf-interfaces:interfaces/interface/enabled

Data Requirements

Item

Data

Description

Interface name

GigabitEthernet0/0/2

Delete all configuration of GigabitEthernet0/0/2.

Interface description

aa

Whether the interface is enabled

true

Request Example
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="DEVICECONFIG_dc9bf91389364b8cada05b7d95f3e062">
 <edit-config>
  <target>
   <running/>
  </target>
  <error-option>rollback-on-error</error-option>
  <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
   
   <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces" xc:operation="remove">
    <interface>
     <name>GigabitEthernet0/0/2</name>
     <type xmlns:iana="urn:ietf:params:xml:ns:yang:iana-if-type">iana:ethernetCsmacd</type>
     <enabled>true</enabled>
     <description>aa</description>
    </interface>
   </interfaces>
  </config>
 </edit-config>
</rpc>
Response Example

Sample of successful response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="DEVICECONFIG_dc9bf91389364b8cada05b7d95f3e062">
  <ok/>
</rpc-reply>

Querying the Interface Configuration

This section provides a sample of querying the interface.

Table 3-4 Entering an interface and configuring processes

Operation

XPATH

edit-config:get

/ietf-interfaces:interfaces/interface/name

/ietf-interfaces:interfaces/interface/type

/ietf-interfaces:interfaces/interface/admin-status

/ietf-interfaces:interfaces/interface/oper-status

/ietf-interfaces:interfaces/interface/phys-address

Request Example
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="getSingleDevicePort-76674736-d7fe-4438-8232-748e29218e78">
  <get>
    <filter type="subtree">
       <interfaces-state xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
       <interface/>
       </interfaces-state>
    </filter>
  </get>
</rpc>
Response Example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="getSingleDevicePort-76674736-d7fe-4438-8232-748e29218e78">
  <data>
    <interfaces-state xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
      <interface>
          <name>Cellular0/0/0</name>
          <admin-status>down</ad min-status>
          <oper-status>down</oper-status>
          <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
            <address><ip>0.0.0.0</ip><prefix-length> 0</prefix-length>
            </address>
          </ipv4>
      </interface>
      <interface>
          <name>GigabitEthernet0/0/0</name>
          <admin-status>down</ad min-status>
          <oper-status>down</oper-status>
          <physical-state xmlns="urn:huawei:params:xml:ns:yang:huawei-ethernet">
             <speed>1Gbps</speed>
             <duplex>full</duplex>
          </physical-state>
          <phys-address>00:e0:fc:03:02:03</phys-address>
          <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
            <address><ip>10.0.0.0</ip><prefix-length> 8</prefix-length>
            </address>
          </ipv4>
      </interface>
      <interface>
          <name>GigabitEthernet0/0/1</name>
          <admin-status>up</ad min-status>
          <oper-status>up</oper-status>
          <physical-state xmlns="urn:huawei:params:xml:ns:yang:huawei-ethernet">
             <speed>1Gbps</speed>
             <duplex>full</duplex>
          </physical-state>
          <phys-address>00:e0:fc:03:02:01</phys-address>
          <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
            <address><ip>10.0.1.0</ip><prefix-length> 24</prefix-length>
            </address>
          </ipv4>
      </interface>
      <interface>
          <name>Loopbac0</name>
          <admin-status>down</ad min-status>
          <oper-status>down</oper-status>
          <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
            <address><ip>192.168.2.1</ip><prefix-length> 32</prefix-length>
            </address>
          </ipv4>
      </interface>
  </data>
</rpc-reply> 

Querying a Specified Interface

This section provides a sample of querying a specified interface.

Table 3-5 Entering an interface and configuring processes

Operation

XPATH

edit-config:get

/ietf-interfaces:interfaces/interface/name

/ietf-interfaces:interfaces/interface/type

/ietf-interfaces:interfaces/interface/admin-status

/ietf-interfaces:interfaces/interface/oper-status

/ietf-interfaces:interfaces/interface/phys-address

Data Requirements

Item

Data

Description

Interface name

GigabitEthernet0/0/0

Query the configurtion of GigabitEthernet0/0/0.

Request Example
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="getSingleDevicePort-5ece59cf-f5d8-464e-b2f1-d222816c27f4">
  <get>
    <filter type="subtree">
      <interfaces-state xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
      <interface xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
        <name>GigabitEthernet0/0/0</name>
      </interface>
      </interfaces-state>
    </filter>
   </get>
</rpc>
Response Example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="getSingleDevicePort-5ece59cf-f5d8-464e-b2f1-d222816c27f4">
<data>
    <interfaces-state xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
      <interface>
          <name>GigabitEthernet0/0/0</name>
          <admin-status>down</admin-status>
          <oper-status>down</oper-status>
          <phys-address>bc:62:0e:20:73:38</phys-address>
          <physical-state xmlns="urn:huawei:params:xml:ns:yang:huawei-ethernet">
             <speed>1Gbps</speed>
             <duplex>full</duplex>
          </physical-state>
          <phys-address>00:e0:fc:03:02:01</phys-address>
          <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
            <address>
              <ip>10.10.3.2</ip>
              <prefix-length>24</prefix-length>
            </address>
            <mtu>1500</mtu>
          </ipv4>
      </interface></interfaces-state>
</data>
</rpc-reply> 

Configuring Interface Status Switchover Control

This section provides a sample of configuring interface status switchover control.

Table 3-6 Configuring interface status switchover control

Operation

XPATH

edit-config:merge

/ietf-interfaces:interfaces/interface/link-track/track-obj-type

/ietf-interfaces:interfaces/interface/link-track/track-obj-name

/ietf-interfaces:interfaces/interface/link-track/track-obj-extend-name

/ietf-interfaces:interfaces/interface/link-track/track-obj-status

Data Requirements
Table 3-7 Configuring interface status switchover control

Item

Data

Description

Interface name

GigabitEthernet0/0/0

Configure GigabitEthernet0/0/0 to be in Up state when the NQA test instance test is successfully associated, and set the administrator of the NQA test instance to admin.

Interface type

iana:ethernetCsmacd

Whether the interface is enabled

true

Interface association type

nqa

Interface association test administrator

admin

Interface association name

test

Interface switchover status

up

Request Example
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="DEVICECONFIG_dc9bf91389364b8cada05b7d95f3e062">
 <edit-config>
  <target>
   <running/>
  </target>
  <error-option>rollback-on-error</error-option>
  <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
   <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces" >
    <interface>
     <name>GigabitEthernet0/0/0</name>
     <type xmlns:iana="urn:ietf:params:xml:ns:yang:iana-if-type">iana:ethernetCsmacd</type>
     <enabled>true</enabled>
     <link-track xmlns="urn:huawei:params:xml:ns:yang:huawei-interfaces" xc:operation="merge">
      <track-obj-type>nqa</track-obj-type>
      <track-obj-name>admin</track-obj-name>
      <track-obj-extend-name>test</track-obj-extend-name>
      <track-obj-state>up</track-obj-state>
     </link-track>
    </interface>
   </interfaces>
  </config>
 </edit-config>
</rpc>
Response Example

Sample of successful response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="DEVICECONFIG_dc9bf91389364b8cada05b7d95f3e062">
 <ok/>
</rpc-reply>

Modifying Interface Status Switchover Control

This section provides a sample of modifying interface status switchover control.

Table 3-8 Modifying interface status switchover control

Operation

XPATH

edit-config:replace

/ietf-interfaces:interfaces/interface/link-track/track-obj-type

/ietf-interfaces:interfaces/interface/link-track/track-obj-name

/ietf-interfaces:interfaces/interface/link-track/track-obj-extend-name

/ietf-interfaces:interfaces/interface/link-track/track-obj-status

Data Requirements
Table 3-9 Modifying interface status switchover control

Item

Data

Description

Interface name

GigabitEthernet0/0/0

Modify the association type of GigabitEthernet0/0/0 to NQA group named group1.

Interface type

iana:ethernetCsmacd

Whether the interface is enabled

true

Interface association type

nqa-group

Interface association name

group1

Interface switchover status

up

Request Example
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="DEVICECONFIG_dc9bf91389364b8cada05b7d95f3e062">
 <edit-config>
  <target>
   <running/>
  </target>
  <error-option>rollback-on-error</error-option>
  <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
   <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces" >
    <interface>
     <name>GigabitEthernet0/0/0</name>
     <type xmlns:iana="urn:ietf:params:xml:ns:yang:iana-if-type">iana:ethernetCsmacd</type>
     <enabled>true</enabled>
     <link-track xmlns="urn:huawei:params:xml:ns:yang:huawei-interfaces" xc:operation="replace">
      <track-obj-type>nqa-group</track-obj-type>
      <track-obj-name>group1</track-obj-name>
       <track-obj-state>up</track-obj-state>
     </link-track>
    </interface>
   </interfaces>
  </config>
 </edit-config>
</rpc>
Response Example

Sample of successful response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="DEVICECONFIG_dc9bf91389364b8cada05b7d95f3e062">
 <ok/>
</rpc-reply>

Deleting Interface Status Switchover Control

This section provides a sample of deleting interface status switchover control.

Table 3-10 Deleting interface status switchover control

Operation

XPATH

edit-config:remove

/ietf-interfaces:interfaces/interface/link-track

Data Requirements
Table 3-11 Deleting interface status switchover control

Item

Data

Description

Interface name

GigabitEthernet0/0/0

Delete interface status switchover control from the NQA test instance on GigabitEthernet0/0/0.

Interface type

iana:ethernetCsmacd

Whether the interface is enabled

true

Request Example
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="DEVICECONFIG_dc9bf91389364b8cada05b7d95f3e062">
 <edit-config>
  <target>
   <running/>
  </target>
  <error-option>rollback-on-error</error-option>
  <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
   <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces" >
    <interface>
     <name>GigabitEthernet0/0/0</name>
     <type xmlns:iana="urn:ietf:params:xml:ns:yang:iana-if-type">iana:ethernetCsmacd</type>
     <enabled>true</enabled>
     <link-track xmlns="urn:huawei:params:xml:ns:yang:huawei-interfaces" xc:operation="remove">
     </link-track>
    </interface>
   </interfaces>
  </config>
 </edit-config>
</rpc>
Response Example

Sample of successful response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="DEVICECONFIG_dc9bf91389364b8cada05b7d95f3e062">
 <ok/>
</rpc-reply>

Notifying the Interface Status

This section provides a sample of notifying the interface status.

Table 3-12 Process foraccessing and configuring an interface

Operation

XPATH

edit-config:get

/huawei-interfaces:interface-status-change/name

/ietf-interfaces:interfaces/interface/admin-status

/ietf-interfaces:interfaces/interface/oper-status

Data Requirements

None

Notification Example
<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"> 
  <eventTime>2017-06-01T14:07:02Z</eventTime> 
    <interface-status-change xmlns="urn:huawei:params:xml:ns:yang:huawei-interfaces"> 
      <name>GigabitEthernet0/0/5</name> 
      <admin-status>2</admin-status> 
      <oper-status>2</oper-status> 
    </interface-status-change> 
</notification>
Translation
Download
Updated: 2019-03-06

Document ID: EDOC1100022096

Views: 8581

Downloads: 69

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