This section provides a sample of configuring a DHCP client on an interface using the config method.
Operation |
XPATH |
|---|---|
config |
/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/huawei-ip:ip-address-extend-type |
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 |
<?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>
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>