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 V200R011C10 NETCONF YANG API Reference

This document describes the NETCONF 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

Data Model

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

Table 2-167  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

Enabling DHCP Relay

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

Table 2-168  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>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>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>

Changing the DHCP Server Served by the DHCP Relay Agent

This section provides a sample of changing the DHCP server served by the DHCP relay agent using the rpc method.

Table 2-169  Changing the DHCP server served by the DHCP relay agent

Operation

XPATH

rpc

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

Data Requirements

Item

Data

Description

Whether DHCP is enabled

true

On VLANIF3 with DHCP relay enabled, change the served DHCP server IP address to 192.168.1.2.

Whether DHCP relay is enabled

true

Interface name

3

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

192.168.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>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>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 xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="replace">
                <hw-dhcp:interface-name>Vlanif3</hw-dhcp:interface-name>
                <hw-dhcp:enable>true</hw-dhcp:enable>
                <hw-dhcp:server-ip>192.168.1.1</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"]/server-ip[.="192.168.1.2"]</error-info>
  </rpc-error>
</rpc-reply>

Disabling DHCP Relay

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

Table 2-170  Disabling 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

Disable DHCP relay on VLANIF3.

Whether DHCP relay is enabled

false

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>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>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 xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="remove">
                <hw-dhcp:interface-name>Vlanif3</hw-dhcp:interface-name>
                <hw-dhcp:enable>false</hw-dhcp:enable>
                <hw-dhcp:server-ip>192.168.1.1</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>
Translation
Download
Updated: 2019-10-18

Document ID: EDOC1000178028

Views: 5155

Downloads: 0

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