DHCP‑Relay
This chapter provides examples on how to use Netconf to manage DHCP Relay configurations on AsterNOS devices.
Get Current DHCP Relay Configurations
Section titled “Get Current DHCP Relay Configurations”Request example to get all DHCP Relay configurations via get-config with subtree filter.
<filter type="subtree"> <top> <dhcp-relay/> </top></filter>Response example
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <top> <dhcp-relay xmlns="http://asterfusion.com/ns/yang/asternos-dhcp-relay"> <dhcp-relay-agent> <name>test</name> <ip-type>v4</ip-type> <downlink-interfaces>Vlan100</downlink-interfaces> <uplink-interfaces>Ethernet1</uplink-interfaces> <loopback-interface>Loopback1</loopback-interface> <server-ips>10.1.1.1</server-ips> <server-ips>10.1.1.11</server-ips> <source-ip>10.2.2.2</source-ip> </dhcp-relay-agent> <interfaces> <name>Vlan100</name> <option82-remote-id>sonic</option82-remote-id> <dhcp-agent-ip>10.1.1.12</dhcp-agent-ip> </interfaces> </dhcp-relay> </top></data>Set DHCP Relay Configurations
Section titled “Set DHCP Relay Configurations”Request example to set a DHCP Relay configuration via edit-config.
<config> <top> <dhcp-relay> <dhcp-relay-agent> <name>test</name> <ip-type>v4</ip-type> <downlink-interfaces>Vlan100</downlink-interfaces> <uplink-interfaces>Ethernet1</uplink-interfaces> <loopback-interface>Loopback1</loopback-interface> <server-ips>10.1.1.1</server-ips> <server-ips>10.1.1.11</server-ips> <source-ip>10.2.2.2</source-ip> </dhcp-relay-agent> </dhcp-relay> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:487ac1eb-4a86-4f44-bd6f-87a16ad92815"> <ok/></rpc-reply>Set DHCP Relay Agent IP configuration
Section titled “Set DHCP Relay Agent IP configuration”Request example to set a DHCP Relay Agent IP for down link interface via edit-config.
<config> <top> <dhcp-relay> <interfaces> <name>Vlan100</name> <dhcp-agent-ip>10.1.1.12</dhcp-agent-ip> </interfaces> </dhcp-relay> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:be7fefd9-98af-4153-9a86-cf82410e4676"> <ok/></rpc-reply>Set DHCP Relay Option82 for down link interface
Section titled “Set DHCP Relay Option82 for down link interface”Request example to set a DHCP Relay Option82 for down link interface via edit-config.
<config> <top> <dhcp-relay> <interfaces> <name>Vlan100</name> <option82-remote-id>sonic</option82-remote-id> </interfaces> </dhcp-relay> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:a6096761-9460-480d-bac2-0d7727ddef90"> <ok/></rpc-reply>Delete DHCP Relay Configuration
Section titled “Delete DHCP Relay Configuration”Request example to delete DHCP Relay configurations of interface via edit-config.
<config> <top> <dhcp-relay> <dhcp-relay-agent operation="delete"> <name>test</name> <ip-type>v4</ip-type> </dhcp-relay-agent> </dhcp-relay> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:81c62129-0eed-4041-93a9-dd748f2c9dcf"> <ok/></rpc-reply>