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

S600-E V200R012C00 NETCONF YANG API Reference

This document describes the NETCONF YANG API functions supported by the switch, including the data model and samples.
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).
IP Address and MTU Management

IP Address and MTU Management

This section describes the configuration model of IP address and MTU management on an interface and provides examples of XML packets.

Data Model

The configuration model files matching IP address and MTU management on an interface are ietf-ip.yang and huawei-ip.yang.

NOTE:

Only VLANIF interfaces and loopback interfaces support the configuration.

Table 2-183  IP address and MTU management on an interface

Object

Description

Value Range

Remarks

/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address/ip

Configures the IPv4 address of an interface.

The value is in dotted decimal notation.

N/A

/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address/netmask

Configures an IPv4 subnet mask.

The value is in dotted decimal notation.

N/A

/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address/prefix-length

Configures the IPv4 mask length.

The value is an integer that ranges from 0 to 32.

N/A

/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address/huawei-ip:ip-address-sub

Configures a secondary IPv4 address for an interface.

The value is a string of spaces only with no limited length.

N/A

/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/mtu

Configures the IPv4 MTU of an interface.

The value is an integer that ranges from 128 to 9216, in bytes.

N/A

/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/enabled

Configures the IPv6 function on an interface.

The value is of the Boolean type:

  • true: The IPv6 function is enabled on the interface.
  • false: The IPv6 function is disabled on the interface.

The default value is false.

N/A

/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/mtu

Configures the IPv6 MTU of an interface.

The value is an integer that ranges from 1280 to 9600, in bytes.

N/A

/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/dup-addr-detect-transmits

Configures the number of times neighbor solicitation (NS) packets are sent during duplicate address detection (DAD).

The value is an integer that ranges from 0 to 600. The default value is 1.

N/A

/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/address/ip

Configures the IPv6 address of an interface.

The total length of the value is 128 bits. The string is divided into eight groups, each of which consists of four hexadecimal digits. The value is in the format of X:X:X:X:X:X:X:X.

N/A

/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/address/prefix-length

Configures the prefix length of an IPv6 address.

The value is an integer that ranges from 1 to 128.

N/A

/ietf-interfaces:interfaces-state/interface/ipv4/forwarding

Queries the IPv4 protocol status of an interface.

The value is of the Boolean type:

  • true: The protocol status is Up.
  • false: The protocol status is Down.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv4/mtu

Queries the IPv4 MTU of an interface.

The value is an integer.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv4/address/ip

Queries the IPv4 address of an interface.

The value is in dotted decimal notation.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv4/address/subnet/netmask

Queries the IPv4 subnet mask of an interface.

The value is in dotted decimal notation.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv4/address/origin

Queries the IPv4 address type of an interface.

The value is of the enumerated type:
  • static: The IPv4 address is manually configured.
  • dynamic: The IPv4 address is dynamically obtained using DHCP.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv4/neighbor/ip

Queries the IP address in the ARP entry learned by an interface.

The value is in dotted decimal notation.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv4/neighbor/link-layer-address

Queries the MAC address in the ARP entry learned by an interface.

The value is in the format of H-H-H. Each H is a hexadecimal number of 1 to 4 digits.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv4/neighbor/origin

Queries the type of the ARP entry learned by an interface.

The value is of the enumerated type:
  • static: static ARP entry
  • dynamic: dynamic ARP entry

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv6/forwarding

Queries the IPv6 protocol status of an interface.

The value is of the Boolean type:

  • true: The protocol status is Up.
  • false: The protocol status is Down.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv6/mtu

Queries the IPv6 MTU of an interface.

The value is an integer.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv6/address/ip

Queries the IPv6 address of an interface.

The total length of the value is 128 bits. The string is divided into eight groups, each of which consists of four hexadecimal digits. The value is in the format of X:X:X:X:X:X:X:X.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv6/address/prefix-length

Queries the IPv6 address prefix length of an interface.

The value is an integer.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv6/address/origin

Queries the IPv6 address type of an interface.

The value is of the enumerated type:
  • static: The IPv6 address is manually configured.
  • dhcp: The IPv6 address is bound to a DHCPv6 PD prefix or is dynamically obtained using DHCPv6.
  • link-layer: The IPv6 address is a link-local address.
  • random: The IPv6 address is an IPv6 unicast address generated through stateless autoconfiguration.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv6/address/status

Queries the IPv6 address status of an interface.

The value is of the enumerated type:

  • tentative: When the interface status is Down, the IPv6 address status is tentative.
  • duplicate: When an address conflict is detected, the IPv6 address status is duplicate.
  • preferred: The IPv6 address status is preferred, indicating that the address is valid.
  • unknown: The IPv6 address status is unknown.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv6/address/neighbor/ip

Queries the address of an IPv6 neighbor.

The total length of the value is 128 bits. The string is divided into eight groups, each of which consists of four hexadecimal digits. The value is in the format of X:X:X:X:X:X:X:X.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv6/address/neighbor/link-layer-address

Queries the MAC address of an IPv6 neighbor.

The value is in the format of H-H-H. Each H is a hexadecimal number of 1 to 4 digits.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv6/address/neighbor/origin

Queries the IPv6 neighbor entry type.

The value is of the enumerated type:
  • static: static neighbor entry
  • dynamic: dynamic neighbor entry

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv6/address/neighbor/is-router

Queries whether the NA packet sent by an IPv6 neighbor carries the R flag.

The value is a character string.

  • If the value is a space, the NA packet sent by the IPv6 neighbor carries the R flag.
  • If no value is displayed, the NA packet sent by the IPv6 neighbor does not carry the R flag.

This object only supports the get operation.

/ietf-interfaces:interfaces-state/interface/ipv6/address/neighbor/state

Queries the status of an IPv6 neighbor entry.

The value is of the enumerated type:

  • incomplete: The neighbor is unreachable. Address resolution is being performed and the link layer address of the neighbor is not detected. If the resolution succeeds, the neighbor entry enters the reachable state.
  • reachable: The neighbor is reachable within a specified period (30 seconds by default). If the period expires and the entry remains unused, the neighbor entry enters the stale state.
  • stale: Whether the neighbor is reachable is unknown. The entry remains unused within a specified period (30 seconds by default). The switch does not detect whether the neighbor is reachable unless it needs to send packets to the neighbor.
  • delay: Whether the neighbor is reachable is unknown. A packet has been sent to the neighbor. If no response is received within the specified period, the neighbor entry enters the probe state.
  • probe: Whether the neighbor is reachable is unknown. An NS packet has been sent to the neighbor to detect whether the neighbor is reachable. If a response is received within the specified period, the neighbor entry enters the reachable state. If no response is received, the neighbor entry enters the incomplete state.

This object only supports the get operation.

Configuring an IP Address for an Interface

This section describes how to configure an IP address for an interface using the edit-config:merge method.

Table 2-184  Configuring an IP Address for an Interface

Operation

XPATH

edit-config:merge

/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address

Data requirement

Item

Data

Description

IP address of an interface

10.1.1.1

Indicates that the IP address of the interface is 10.1.1.1.

Mask length

24

Indicates that the mask length is 24.

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>
      <if:interfaces xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces">
        <if:interface>
          <if:name>Vlanif101</if:name>
          <if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:propVirtual</if:type>
          <ip:ipv4 xmlns:ip="urn:ietf:params:xml:ns:yang:ietf-ip">
            <ip:address>
              <ip:ip>10.1.1.1</ip:ip>
              <ip:prefix-length>24</ip:prefix-length>
            </ip:address>
          </ip:ipv4>
        </if:interface>
      </if:interfaces>
    </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-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>

Configuring a Secondary IP Address for an Interface

This section describes how to configure a secondary IP address for an interface using the edit-config:merge method.

Table 2-185  Configuring a Secondary IP Address for an Interface

Operation

XPATH

edit-config:merge

/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address

Data requirement

Item

Data

Description

IP address

10.1.1.2

Indicates that the IP address of the interface is 10.1.1.2.

Mask length

24

Indicates that the mask length is 24.

Secondary IP address

A space

Indicates that this is a secondary IP address for the interface.

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>
      <if:interfaces xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces">
        <if:interface>
          <if:name>Vlanif101</if:name>
          <if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:propVirtual</if:type>
          <ip:ipv4 xmlns:ip="urn:ietf:params:xml:ns:yang:ietf-ip">
            <ip:address>
              <ip:ip>10.1.1.2</ip:ip>
              <ip:prefix-length>24</ip:prefix-length>
              <hw-ip:ip-address-sub xmlns:hw-ip="urn:huawei:params:xml:ns:yang:hw-ip"> </hw-ip:ip-address-sub>
            </ip:address>
          </ip:ipv4>
        </if:interface>
      </if:interfaces>
    </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-app-tag>1</error-app-tag>
    <error-message>Service process failed.</error-message>
    <error-info>Error on node /ietf-interfaces:interfaces/interface[name="Vlanif101"]/ietf-ip:ipv4/address[ip="10.1.1.2"]</error-info>
  </rpc-error>
</rpc-reply>

Configuring the MTU for an Interface

This section describes how to configure the MTU for an interface using the edit-config:merge method.

Table 2-186  Configuring the MTU for an Interface

Operation

XPATH

edit-config:merge

/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/mtu

Data requirement

Item

Data

Description

MTU of an interface

1200

Indicates that the MTU of the interface is 1200 bytes.

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>
      <if:interfaces xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces">
        <if:interface>
          <if:name>Vlanif101</if:name>
          <if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:propVirtual</if:type>
          <ip:ipv4 xmlns:ip="urn:ietf:params:xml:ns:yang:ietf-ip">
            <ip:mtu>1200</ip:mtu>
          </ip:ipv4>
        </if:interface>
      </if:interfaces>
    </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-app-tag>-1</error-app-tag>
    <error-message>Wrong parameter.</error-message>
    <error-info>Error on node /ietf-interfaces:interfaces/interface[name="Vlanif101"]/ietf-ip:ipv4/mtu</error-info>
  </rpc-error>
</rpc-reply>

Configuring the IPv6 Address and MTU of an Interface

This section provides a sample of configuring the IPv6 address and MTU of an interface using the edit-config:merge method.

Table 2-187  Configuring the IPv6 address and MTU of an interface

Operation

XPATH

edit-config:merge

/ietf-interfaces:interfaces/interface/ietf-ip:ipv6

Data Requirements

Item

Data

Description

Interface name

Vlanif100

Configure VLANIF 100.

Interface type

iana-if-type:propVirtual

IPv6 function on an interface

true

Enable the IPv6 function on the interface.

IPv6 MTU of an interface

1280

Set the IPv6 MTU of the interface to 1280 bytes.

IPv6 address of an interface

fc00::1

Set the IPv6 address of the interface to fc00::1.

Prefix length of an IPv6 address

64

Set the prefix length of the IPv6 address to 64.

Number of times neighbor solicitation (NS) packets are sent during duplicate address detection (DAD)

20

Set the number of times NS packets sent by the switch during DAD to 20.

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>
      <if:interfaces xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces">
        <if:interface>
          <if:name>Vlanif100</if:name>
          <if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:propVirtual</if:type>
          <ip:ipv6 xmlns:ip="urn:ietf:params:xml:ns:yang:ietf-ip">
            <ip:enabled>true</ip:enabled>
            <ip:mtu>1280</ip:mtu>
            <ip:address>
              <ip:ip>fc00::1</ip:ip>
              <ip:prefix-length>64</ip:prefix-length>
            </ip:address>
            <ip:dup-addr-detect-transmits>20</ip:dup-addr-detect-transmits>
          </ip:ipv6>
        </if:interface>
      </if:interfaces>
    </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-app-tag>-1</error-app-tag>
    <error-message>Wrong parameter.</error-message>
    <error-info>Error on node /ietf-interfaces:interfaces/interface[name="Vlanif100"]/ietf-ip:ipv6/mtu</error-info>
  </rpc-error>
</rpc-reply>

Querying IPv4 and IPv6 Configuration Information of an Interface

This section provides a sample of querying IPv4 and IPv6 configuration information of an interface using the get method.

Table 2-188  Querying IPv4 and IPv6 configuration information of an interface

Operation

XPATH

get

/ietf-interfaces:interfaces-state/interface

Request Example

Query IPv4 and IPv6 configuration information of VLANIF 100.

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="4" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <get>
    <filter type="subtree">
      <if:interfaces-state xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces">
        <if:interface>
          <if:name>Vlanif100</if:name>
        </if:interface>
      </if:interfaces-state>
    </filter>
  </get>
</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">
  <data>
    <interfaces-state xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
      <interface>
        <name>Vlanif100</name>
        <type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:propVirtual</type>
        <admin-status>up</admin-status>
        <oper-status>up</oper-status>
        <if-index>417</if-index>
        <phys-address>fc:e3:3c:9f:17:64</phys-address>
        <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
          <forwarding>true</forwarding>
          <mtu>1700</mtu>
          <address>
            <ip>10.1.1.1</ip>
            <netmask>255.255.255.0</netmask>
            <origin>static</origin>
          </address>
          <neighbor>
            <ip>10.1.1.10</ip>
            <link-layer-address>00:01:00:02:00:03</link-layer-address>
            <origin>static</origin>
          </neighbor>
        </ipv4>
        <ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
          <forwarding>true</forwarding>
          <mtu>1600</mtu>
          <address>
            <ip>FE80::FEE3:3CFF:FE9F:1764</ip>
            <prefix-length>64</prefix-length>
            <origin>static</origin>
            <status>preferred</status>
          </address>
          <address>
            <ip>2001::1</ip>
            <prefix-length>64</prefix-length>
            <origin>static</origin>
            <status>preferred</status>
          </address>
          <neighbor>
            <ip>2001::10</ip>
            <link-layer-address>00:01:00:01:00:01</link-layer-address>
            <origin>static</origin>
            <is-router> </is-router>
            <state>reachable</state>
          </neighbor>
        </ipv6>
      </interface>
    </interfaces-state>
  </data>
</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">
  <data/>
</rpc-reply>
Translation
Download
Updated: 2018-09-01

Document ID: EDOC1100037962

Views: 7007

Downloads: 8

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