This section provides a sample of configuring user-defined options using the rpc method.
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 |
||
Value and format of a user-defined option |
<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>
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>