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).
DHCP Management

DHCP Management

Configuring a DHCP Server

Data Model

The data model file matching DHCP server is huawei-dhcp.yang.

Table 2-192  DHCP server data model

Object

Description

Value

Remarks

/huawei-dhcp:dhcp-config/dhcpv4-config/enable

Indicates whether DHCP is enabled.

The value is of the Boolean type:
  • true: DHCP is enabled.
  • false: DHCP is disabled.
The default value is false.
N/A

/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/enable

Indicates whether the DHCP server function is enabled.

The value is of the Boolean type:
  • true: The DHCP server function is enabled.
  • false: The DHCP server function is disabled.
The default value is false.
N/A

/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/user-defined-options/user-defined-option/option-code

Indicates the value of a user-defined option.

The value is an integer that ranges from 1 to 254, except values 1, 3, 6, 15, 44, 46, 50, 51, 52, 53, 54, 55, 57, 58, 59, 61, 82, 120, 121, and 184.

N/A

/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/user-defined-options/user-defined-option

Indicates the type of a user-defined option. The object includes:
  • ip-address: IP address type
  • ascii-string: ASCII character string
  • cipher-string: ciphertext character string
  • hex-string: hexadecimal character string
  • ip-address: The value is in dotted decimal notation.
  • ascii-string: The value is a string of 1 to 255 characters.
  • cipher-string: The value is a string of 1 to 64 plaintext characters or 32 to 104 ciphertext characters.
  • hex-string: The value is a hexadecimal string with an even number (in the range of 2 to 254) of characters, for example, hh or hhhh. The value can contain combinations of digits 0 to 9, uppercase letters A to F, and lowercase letters a to f.
N/A
Enabling the DHCP Server Function

This section provides a sample of enabling the DHCP server function using the rpc method.

Table 2-193  Enabling the DHCP server function

Operation

XPATH

rpc

/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server

Data Requirements

Item

Data

Description

DHCP function

true

Enable the DHCP server function on VLANIF404.

DHCP server function

true

Name and IP address of an interface

  • Interface name: VLANIF404

  • Interface IP address: 10.10.10.44/24

Request Example
<rpc message-id="123" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <config>
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
 <interface xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
  <name>Vlanif404</name>
  <type xmlns:x="urn:ietf:params:xml:ns:yang:iana-if-type">x:propVirtual</type>
  <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
   <address ns0:operation="merge">
    <ip>10.10.10.44</ip>
    <netmask>255.255.255.0</netmask>
   </address>
  </ipv4>
 </interface>
</interfaces>
<dhcp-config xmlns="urn:huawei:params:xml:ns:yang:huawei-dhcp">
 <dhcpv4-config>
  <enable>true</enable>
  <dhcp-server-configuration>
   <dhcp-servers>
    <dhcp-server xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
     <interface-name>Vlanif404</interface-name>
      <enable>true</enable>
     <hw-dhcp:interface-pool>
     </hw-dhcp:interface-pool>
    </dhcp-server>
   </dhcp-servers>
  </dhcp-server-configuration>
 </dhcpv4-config>
</dhcp-config>
    </config>
  </edit-config>
</rpc>
Response Example

Sample of successful response

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

Sample of failed response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="123">
  <rpc-error>
    <error-app-tag>-1</error-app-tag>
    <error-message> Please enable DHCP in the global view first.</error-message>
    <error-info>Error on node /huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server[interface-name="Vlanif404"]/enable</error-info>
  </rpc-error>
</rpc-reply>
Configuring User-defined Options

This section provides a sample of configuring user-defined options using the rpc method.

Table 2-194  Configuring user-defined options

Operation

XPATH

rpc

  • /huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/user-defined-options/user-defined-option/option-code

  • /huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/user-defined-options/user-defined-option
Data Requirements

Item

Data

Description

DHCP function

true

Enable the DHCP server function on VLANIF404 and set the format and value of the user-defined Option43 to the IP address format and 10.3.1.1, respectively.

DHCP server function

true

Name and IP address of an interface

  • Interface name: VLANIF404

  • Interface IP address: 10.10.10.44/24

Value and format of a user-defined option

  • Value: 43

  • Format: The IP address format is used and the value is 10.3.1.1.

Request Example
<rpc message-id="123" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <config>
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
 <interface xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
  <name>Vlanif404</name>
  <type xmlns:x="urn:ietf:params:xml:ns:yang:iana-if-type">x:propVirtual</type>
  <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
   <address ns0:operation="merge">
    <ip>10.10.10.44</ip>
    <netmask>255.255.255.0</netmask>
   </address>
  </ipv4>
 </interface>
</interfaces>
<dhcp-config xmlns="urn:huawei:params:xml:ns:yang:huawei-dhcp">
 <dhcpv4-config>
  <enable>true</enable>
  <dhcp-server-configuration>
   <dhcp-servers>
    <dhcp-server xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
     <interface-name>Vlanif404</interface-name>
      <enable>true</enable>
     <interface-pool>
      <user-defined-options>
       <user-defined-option>
        <option-code>43</option-code>
         <ip-address>10.3.1.1</ip-address>
        </user-defined-option>
       </user-defined-options>
      </interface-pool>
     </dhcp-server>
    </dhcp-servers>
   </dhcp-server-configuration>
  </dhcpv4-config>
</dhcp-config>
    </config>
  </edit-config>
</rpc>
Response Example

Sample of successful response

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

Sample of failed response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="11">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-path>/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server[interface-name='Vlanif404']/interface-pool/user-defined-options/user-defined-option[option-code='43']/ip-address[.='1000.0.0.1']</error-path>
    <error-message>parse rpc config error.(Value "1000.0.0.1" does not satisfy the constraint "(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?" (range, length, or pattern).).</error-message>
  </rpc-error>
</rpc-reply>

Configuring a DHCP Relay

Data Model

The data model file matching DHCP relay is huawei-dhcp.yang.

Table 2-195  DHCP relay data model

Object

Description

Value Range

Remarks

/huawei-dhcp:dhcp-config/dhcpv4-config/enable

Indicates whether to enable the DHCP function.

The value is of the Boolean type:
  • true: The DHCP function is enabled.
  • false: The DHCP function is disabled.
The default value is false.
N/A

/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay/enable

Indicates whether to enable the DHCP relay function.

The value is of the Boolean type:
  • true: The DHCP relay function is enabled.
  • false: The DHCP relay function is disabled.
The default value is false.
N/A

/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay/server-ip

Indicates the IP address of the DHCP server served by the DHCP relay agent.

The value is in dotted decimal notation.

N/A
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay/relay-information/enable Indicates whether to enable the Option82 function on a DHCP relay agent.
The value is of the Boolean type:
  • true: The Option82 function is enabled on the DHCP relay agent.
  • false: The Option82 function is disabled on the DHCP relay agent.
The default value is false.
N/A
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay/anycast-gw-reroute-enable Indicates whether the re-routing function for the DHCP relay agent on a distributed gateway is enabled.
The value is of the Boolean type:
  • true: The re-routing function for the DHCP relay agent on a distributed gateway is enabled.
  • false: The re-routing function for the DHCP relay agent on a distributed gateway is disabled.
The default value is false.
N/A
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-option82-configuration/option82-enable

Indicates whether the function of adding the Option82 field to DHCP messages is enabled.

The option insertion mode on an interface or an interface in a VLAN and in a VLAN or a BD can be set to the Insert mode (insert-enable) or Rebuild mode (rebuild-enable).

The value is of the Boolean type:
  • true: The function of adding the Option82 field to DHCP messages is enabled.
  • false: The function of adding the Option82 field to DHCP messages is disabled.
The default value is false.
N/A
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-option82-configuration/sub-option-enable

Indicates whether the function of adding a sub-option to the Option82 field is enabled.

Sub-option 1 (circuit-id-enable), sub-option 2 (remote-id-enable), suboption 6 (subscriber-id-enable), and suboption 9 (vendor-specific-enable) can be added to the Option82 field globally, on an interface, or in a VLAN or BD.

NOTE:

The four suboptions cannot be inserted simultaneously.

The value is of the Boolean type:
  • true: The function of adding a suboption to the Option82 field is enabled.
  • false: The function of adding a suboption to the Option82 field is disabled.
The default value is false.
N/A
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-option82-configuration/option82-format/vendor-specific-format/global/vendor-sub-option/option-format
Indicates the format of suboption 9 in the Option82 field. The value can be:
  • ip-address: IP address format
  • ascii-string: ASCII character string
  • sysname: device name
  • hex-string: hexadecimal character string
  • ip-address: The value is in dotted decimal notation.
  • ascii-string: The value is an ASCII character string and must be smaller than 129 characters.
  • sysname: –
  • hex-string: The value is a hexadecimal character string. The value can contain only digits 0 to 9, uppercase letters A to F, and lowercase letters a to f. Excluding the space, the value length must be an even number smaller than 257.
N/A
Enabling DHCP Relay

This section provides a sample of enabling DHCP relay using the rpc method.

Table 2-196  Enabling DHCP relay

Operation

XPATH

rpc

/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays

Data Requirements

Item

Data

Description

Whether DHCP is enabled

true

Enable DHCP relay on VLANIF 3 and configure it to serve DHCP server with the IP address 10.1.1.2.

Whether DHCP relay is enabled

true

Interface name

VLANIF3

IP address of the DHCP server served by the DHCP relay agent

10.1.1.2

Request example
<rpc message-id="123" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <config>

      <huawei-vlan:vlans xmlns:huawei-vlan="urn:huawei:params:xml:ns:yang:huawei-vlan">
        <huawei-vlan:vlan>
          <huawei-vlan:id>3</huawei-vlan:id>
        </huawei-vlan:vlan>
      </huawei-vlan:vlans>

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

      <if:interfaces xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces">
        <if:interface>
          <if:name>GigabitEthernet0/0/1</if:name>
          <if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:ethernetCsmacd</if:type>
          <huawei-vlan:vlan xmlns:huawei-vlan="urn:huawei:params:xml:ns:yang:huawei-vlan">
            <huawei-vlan:port-link-type>trunk</huawei-vlan:port-link-type>
            <huawei-vlan:trunk>
              <huawei-vlan:trunk-vlan>3</huawei-vlan:trunk-vlan>
            </huawei-vlan:trunk>
          </huawei-vlan:vlan>
        </if:interface>
      </if:interfaces>

      <hw-dhcp:dhcp-config xmlns:hw-dhcp="urn:huawei:params:xml:ns:yang:huawei-dhcp">
        <hw-dhcp:dhcpv4-config>
          <hw-dhcp:enable>true</hw-dhcp:enable>
          <hw-dhcp:dhcp-relay-configuration>
            <hw-dhcp:dhcp-relays>
              <hw-dhcp:dhcp-relay>
                <hw-dhcp:interface-name>Vlanif3</hw-dhcp:interface-name>
                <hw-dhcp:enable>true</hw-dhcp:enable>
                <hw-dhcp:server-ip>10.1.1.2</hw-dhcp:server-ip>
              </hw-dhcp:dhcp-relay>
            </hw-dhcp:dhcp-relays>
          </hw-dhcp:dhcp-relay-configuration>
        </hw-dhcp:dhcpv4-config>
      </hw-dhcp:dhcp-config>

    </config>
  </edit-config>
</rpc>
Response example

Sample of successful response

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

Sample of failed response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="123">
  <rpc-error>
    <error-app-tag>-1</error-app-tag>
    <error-message> Please enable DHCP in the global view first.</error-message>
    <error-info>Error on node /huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay[interface-name="Vlanif3"]/enable</error-info>
  </rpc-error>
</rpc-reply>
Configuring the Re-routing Function for the DHCP Relay Agent on a Distributed Gateway

This section provides a sample of configuring the re-routing function for the DHCP relay agent on a distributed gateway using the rpc method.

NOTE:
You need to configure the Option82 field to carry backhaul information of DHCP messages before configuring this function. For the Option82 field configuration, see Configuring the Option82 Function.
Table 2-197  Configuring the re-routing function for the DHCP relay agent on a distributed gateway

Operation

XPATH

rpc

/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay/anycast-gw-reroute-enable
Data Requirements

Item

Data

Description

Whether to enable DHCP

true

Enable DHCP.

Whether to enable the DHCP relay function

true

Enable the DHCP relay function.

Interface name

VBDIF26

Set the name of the interface enabled with the DHCP relay function to VLANIF3.

Whether to enable the re-routing function for the DHCP relay agent on a distributed gateway.

true

Enable the re-routing function for the DHCP relay agent on a distributed gateway.

Request Example
<rpc message-id="123" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <config>
    <bd:bridge-domains xmlns:bd="urn:huawei:params:xml:ns:yang:huawei-bd" xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="merge">
        <bd:bridge-domain>
        <bd:id>26</bd:id>
        </bd:bridge-domain>
    </bd:bridge-domains>
    <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
     <interface xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
      <name>Vbdif26</name>
      <type xmlns:x="urn:ietf:params:xml:ns:yang:iana-if-type">x:propVirtual</type>
     </interface>
    </interfaces>
    <dhcp-config xmlns="urn:huawei:params:xml:ns:yang:huawei-dhcp">
     <dhcpv4-config>
      <enable>true</enable>
      <dhcp-relay-configuration>
       <dhcp-relays>
        <dhcp-relay xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
         <interface-name>Vbdif26</interface-name>
          <enable>true</enable>
          <anycast-gw-reroute-enable>true</anycast-gw-reroute-enable>
         </dhcp-relay>
        </dhcp-relays>
       </dhcp-relay-configuration>
      </dhcpv4-config>
     </dhcp-config>
    </config>
  </edit-config>
</rpc>
Response Example

Sample of successful response

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

Sample of failed response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="11">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-path>/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay[interface-name='Vbdif26']/anycast-gw-reroute-enable</error-path>
    <error-message>parse rpc config error.(Invalid value in "anycast-gw-reroute-enable" element.).</error-message>
  </rpc-error>
</rpc-reply>
Configuring the Option82 Function

This section provides a sample of configuring the Option82 function using the rpc method.

Table 2-198  Configuring the Option82 function

Operation

XPATH

rpc

  • /huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay/relay-information/enable
  • /huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-option82-configuration/option82-enable
  • /huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-option82-configuration/sub-option-enable
  • /huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-option82-configuration/option82-format/vendor-specific-format/global/vendor-sub-option/option-format
Data Requirements

Item

Data

Description

Whether to enable the Option82 function on a DHCP relay agent

true

Enable the Option82 function on the DHCP relay agent.

Whether to enable the function of adding the Option82 field to DHCP messages

true

Enable the function of adding the Option82 field to DHCP messages.

Whether to enable the function of adding sub-option 9 to the Option82 field

true

Enable the function of adding sub-option 9 to the Option82 field.

Format of sub-option 9 in the Option82 field

ip-address

Set the format of sub-option 9 in the Option82 field to the IP address format.

Request Example
<rpc message-id="123" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <config>
    <bd:bridge-domains xmlns:bd="urn:huawei:params:xml:ns:yang:huawei-bd" xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="merge">
        <bd:bridge-domain>
        <bd:id>26</bd:id>
        </bd:bridge-domain>
    </bd:bridge-domains>
    <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
     <interface xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
      <name>Vbdif26</name>
      <type xmlns:x="urn:ietf:params:xml:ns:yang:iana-if-type">x:propVirtual</type>
     </interface>
    </interfaces>
    <dhcp-config xmlns="urn:huawei:params:xml:ns:yang:huawei-dhcp">
     <dhcpv4-config>
      <enable>true</enable>
      <dhcp-relay-configuration>
       <dhcp-relays>
        <dhcp-relay xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
         <interface-name>Vbdif26</interface-name>
          <enable>true</enable>
          <relay-information>
           <enable>true</enable>
          </relay-information>
         </dhcp-relay>
        </dhcp-relays>
       </dhcp-relay-configuration>
          <hw-dhcp:dhcp-option82-configuration>
            <hw-dhcp:option82-enable>
              <hw-dhcp:bd>
                <hw-dhcp:bd-id>26</hw-dhcp:bd-id>
                <hw-dhcp:insert-enable>true</hw-dhcp:insert-enable>
              </hw-dhcp:bd>
            </hw-dhcp:option82-enable>
            <hw-dhcp:option82-format>
              <hw-dhcp:vendor-specific-format>
                <hw-dhcp:global>
                  <hw-dhcp:vsys>pub</hw-dhcp:vsys>
                  <hw-dhcp:vendor-sub-option>
                    <hw-dhcp:sub-option-code>23</hw-dhcp:sub-option-code>
                    <hw-dhcp:ip-address>10.1.1.1</hw-dhcp:ip-address>
                  </hw-dhcp:vendor-sub-option>
                </hw-dhcp:global>
              </hw-dhcp:vendor-specific-format>
            </hw-dhcp:option82-format>
            <hw-dhcp:sub-option-enable>
              <hw-dhcp:bd xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="merge">
                <hw-dhcp:bd-id>26</hw-dhcp:bd-id>
                <hw-dhcp:vendor-specific-enable>true</hw-dhcp:vendor-specific-enable>
              </hw-dhcp:bd>
            </hw-dhcp:sub-option-enable>
          </hw-dhcp:dhcp-option82-configuration>
      </dhcpv4-config>
     </dhcp-config>
    </config>
  </edit-config>
</rpc>
Response Example

Sample of successful response

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

Sample of failed response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="47">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-path>/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay[interface-name='Vlanif4000']/relay-information/enable</error-path>
    <error-message>parse rpc config error.(Invalid value in "enable" element.).</error-message>
  </rpc-error>
</rpc-reply>

Configuring a DHCP Client

Data Model

The data model file matching DHCP client is huawei-ip.yang.

Table 2-199  DHCP client

Object

Description

Value Range

Remarks

/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/huawei-ip:ip-address-extend-type

Indicates whether to enable the DHCP client function on an interface.

IdentityRef value. The values are as follows:

  • dhcp: The interface uses DHCP to obtain an IP address.
  • static: The IP address on the interface is configured manually.
N/A
Configuring a DHCP Client on an Interface

This section provides a sample of configuring a DHCP client on an interface using the config method.

Table 2-200  Configuring a DHCP client on an interface

Operation

XPATH

config

/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/huawei-ip:ip-address-extend-type

Data Requirements

Item

Data

Description

Interface name

Vlanif2

Configure the DHCP client function on VLANIF 2, that is, the interface uses DHCP to obtain an IP address.

Whether to enable the DHCP client function on an interface

dhcp

Request example
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="2" 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>Vlanif2</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">
            <hw-ip:ip-address-extend-type xmlns:hw-ip="urn:huawei:params:xml:ns:yang:hw-ip">dhcp</hw-ip:ip-address-extend-type>
          </ip:ipv4>
        </if:interface>
      </if: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="2">
  <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="2">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-path>/ietf-interfaces:interfaces/interface[name='Vlanif2']/ietf-ip:ipv4/huawei-ip:ip-address-extend-type</error-path>
    <error-message>parse rpc config error.(Failed to resolve identityref "huawei-ip:dhc".).</error-message>
  </rpc-error>
</rpc-reply>
Translation
Download
Updated: 2018-09-01

Document ID: EDOC1100037962

Views: 6292

Downloads: 8

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