This document provides a brief description of the IpHelper OpEN APIs. It provides the following services:
- Get the Maximum Hop count configured for DHCP relay agent for the given VRF.
- Set the Maximum Hop count for DHCP relay agent for the given VRF.
- Get the Minimum Wait time configured for DHCP relay agent for the given VRF.
- Set the Minimum Wait time for DHCP relay agent for the given VRF.
- Get the administrative mode of IP-Helper for the given VRF.
- Set the administrative mode of IP-Helper for the given VRF.
- Get the Relay Agent Circuit ID option mode for the given VRF.
- Set the Relay Agent Circuit ID option mode for the given VRF.
- Get the Relay Agent global option check mode for the given VRF.
- Set the Relay Agent global option check mode for the given VRF.
- Get the IP Helper statistics for the given VRF.
- Get the Relay Agent global Server Override mode for the given VRF.
- Set the Relay Agent global Server Override mode for the given VRF.
- Get the Relay Agent Server Override mode for the given interface.
- Set the Relay Agent Server Override mode for the given interface.
- Get the global Source interface of DHCP relay agent for the given VRF.
- Set the global Source interface of DHCP relay agent for the given VRF.
- Clear the global Source interface of DHCP relay agent for the given VRF.
- Get the interface level Source interface for DHCP relay agent.
- Set the interface level Source interface for DHCP relay agent.
- Clear the interface level Source interface for DHCP relay agent.
- Remove all IP helper addresses configured on an interface.
- Get the Relay Agent Circuit ID Option mode for the given interface.
- Set the Relay Agent Circuit ID Option mode for the given interface.
- Get the Relay Agent Circuit ID option check mode for the given interface.
- Set the Relay Agent Circuit ID option check mode for the given interface.
- Clear IP helper statistics for the given VRF.
- Get the first relay entry along with server's VRF name and interface info.
- Get the next relay entry along with server's VRF name, interface and UDP-port info.
Example C Application iphelper_example
Initialization
In the main function, the sample application initializes the OpEN API RPC service by calling openapiClientRegister() and waits for the RPC service in switchdrvr to start. A Client Handle is returned by openapiClientRegister() which is used while invoking the OpEN APIs. The application then exercises the associated OpEN APIs and logs informational and/or error messages on the console. The example application runs to its completion and exits.
iphelper_example
iphelper_example.c is a sample application that demonstrates the use of OpEN's IpHelper APIs. iphelper_example is started from the command line and can be used to exercise the various APIs by specifying arguments on the command line.
Sample Output
- Usage: ./iphelper_example <test#> <arg1> <arg2> ...
- Test 1: Get the Maximum Hop count configured for DHCP relay agent for the given VRF: iphelper_example 1 <vrfName>
- Test 2: Set the Maximum Hop count for DHCP relay agent for the given VRF: iphelper_example 2 <vrfName> <maxHopCount>
- Test 3: Get the Minimum Wait time configured for DHCP relay agent for the given VRF: iphelper_example 3 <vrfName>
- Test 4: Set the Minimum Wait time for DHCP relay agent for the given VRF: iphelper_example 4 <vrfName> <minWaitTime>
- Test 5: Get the administrative mode of IP-Helper for the given VRF: iphelper_example 5 <vrfName>
- Test 6: Set the administrative mode of IP-Helper for the given VRF: iphelper_example 6 <vrfName> <mode>
- Test 7: Get the Relay Agent Circuit ID option mode for the given VRF: iphelper_example 7 <vrfName>
- Test 8: Set the Relay Agent Circuit ID option mode for the given VRF: iphelper_example 8 <vrfName> <circuitIDOptionMode>
- Test 9: Get the Relay Agent global option check mode for the given VRF: iphelper_example 9 <vrfName>
- Test 10: Set the Relay Agent global option check mode for the given VRF: iphelper_example 10 <vrfName> <cidOptionCheckMode>
- Test 11: Get the IP Helper statistics for the given VRF: iphelper_example 11 <vrfName>
- Test 12: Get the Relay Agent global Server Override mode for the given VRF: iphelper_example 12 <vrfName>
- Test 13: Set the Relay Agent global Server Override mode for the given VRF: iphelper_example 13 <vrfName> <mode>
- Test 14: Get the Relay Agent Server Override mode for the given interface: iphelper_example 14 <ifNum>
- Test 15: Set the Relay Agent Server Override mode for the given interface: iphelper_example 15 <ifNum> <mode>
- Test 16: Get the global Source interface of DHCP relay agent for the given VRF: iphelper_example 16 <vrfName>
- Test 17: Set the global Source interface of DHCP relay agent for the given VRF: iphelper_example 17 <vrfName> <ifNum>
- Test 18: Clear the global Source interface of DHCP relay agent for the given VRF: iphelper_example 18 <vrfName>
- Test 19: Get the interface level Source interface for DHCP relay agent: iphelper_example 19 <ifNum>
- Test 20: Set the interface level Source interface for DHCP relay agent: iphelper_example 20 <ifNum> <srcIfNum>
- Test 21: Clear the interface level Source interface for DHCP relay agent: iphelper_example 21 <ifNum>
- Test 22: Remove all IP helper addresses configured on an interface: iphelper_example 22 <ifNum>
- Test 23: Get the Relay Agent Circuit ID Option mode for the given interface: iphelper_example 23 <ifNum>
- Test 24: Set the Relay Agent Circuit ID Option mode for the given interface: iphelper_example 24 <ifNum> <circuitIDintfOptionMode>
- Test 25: Get the Relay Agent Circuit ID option check mode for the given interface: iphelper_example 25 <ifNum>
- Test 26: Set the Relay Agent Circuit ID option check mode for the given interface: iphelper_example 26 <ifNum> <cidOptionCheckMode>
- Test 27: Clear IP helper statistics for the given VRF: iphelper_example 27 <vrfName>
- Test 28: Get the first relay entry along with server's VRF name and interface info: iphelper_example 28 <vrfName> <ifNum>
- Test 29: Get the next relay entry along with server's VRF name, interface and UDP-port info: iphelper_example 29 <vrfName> <ifNum> <udpPort>
IpHelper CLI/API Cross Reference
(Global-config Mode)##
bootpdhcprelay source-interface interface {<u/s/p> | vlan <id> | loopback <id>} | openapiBootpDhcpRelaySourceInterfaceSet() (Global-config Mode)##
no bootpdhcprelay source-interface | openapiBootpDhcpRelaySourceInterfaceClear() (Global-config Mode)##
bootpdhcprelay server-override | openapiBootpDhcpRelayServerOverrideModeSet() (Config-interface-mode)##
bootpdhcprelay server-override | openapiBootpDhcpRelayIntfServerOverrideSet() (Config-interface-mode)##
bootpdhcprelay source-interface interface {{<u/s/p> | vlan <id> | loopback <id>} | openapiBootpDhcpRelayIntfSourceInterfaceSet() (Config-interface-mode)##
no bootpdhcprelay source-interface | openapiBootpDhcpRelayIntfSourceInterfaceClear() (Priv-User Mode)##
show bootpdhcprelay | openapiBootpDhcpRelayCircuitIdOptionModeGet() (Priv-User Mode)##
show bootpdhcprelay | openapiBootpDhcpRelayServerOverrideModeGet()
openapiBootpDhcpRelayIntfServerOverrideGet() (Priv-User Mode)##
show bootpdhcprelay | openapiBootpDhcpRelaySourceInterfaceGet()
openapiBootpDhcpRelayIntfSourceInterfaceGet() (Priv-User Mode)##
show bootpdhcprelay | openapiBootpDhcpRelayMaxHopCountGet()
openapiBootpDhcpRelayMinWaitTimeGet()
openapiIpHelperAdminModeGet() (Priv-User Mode)##
show ip helper-address [u/s/p] | openapiIhIpHelperAddressFirst()
openapiIhIpHelperAddressNext() (Global-config Mode)##
no ip helper-address | openapiIpHelperAddressesRemove()