Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

create a new DHCP Pool resource

DescriptionUses the general Resource-Add endpoint to create a DHCP Pool resource.
URL/api/v1/api.php?target=resource& action=add& meta[type]=dhcp_pool& meta[name]=New Subnet& fields[_dhcp_type][]=host& fields[_dhcp_pool_attributes][]={"mac":"aa:bb:cc:dd:ee:ff", "rangeStart":"", "rangeEnd":"", "freeLines":3, "freeLine1":"Free Line 1", "freeLine2":"Free Line 2", "freeLine3":"Free Line 3"}
Returns

Examples:

SUCCESSFUL:{"success":1,"message":"Resource added","data":{"id":2167,"name":"New Subnet","slug":"new-subnet","type":"dhcp_pool ","parent_id":1,"category_id":null,"attr":[]}}
ERROR:{"success":0, "message":"error message"}

Return Detail:

NameTypeDescription
idINTEGERID of the newly created dhcp_pool
nameSTRINGThe name of the dhcp_pool
slugSTRINGThe unique reference string for this resource
typeSTRINGAlways 'dhcp_pool'
parent_idINTEGERThe parent resource; by default the TLR.
category_idINTEGERThe category to which this dhcp_pool is associated

update a DHCP Pool

DescriptionModifying an existing dhcp_pool uses the identical commands as all other Resource-Update actions.
URL/api/v1/api.php?target=resource& action=update& meta[type]=dhcp_pool& meta[name]=Another Test& fields[_dhcp_type][]=subnet& fields[_dhcp_pool_attributes][]={"mac":"", "rangeStart":"10.10.10.4", "rangeEnd":"10.10.10.5", "freeLines":3, "freeLine1":"example1", "freeLine2":"example2", "freeLine3":"example3"}&fields[_dhcp_ip_id][]=92430&meta[id]=2165
Returns

Examples:

SUCCESSFUL:{"success":1, "message":"Resource Updated", "data":{"id":"2165", "name":"Another Test", "slug":"2163-dhcp-module-2", "type":"dhcp_module", "parent_id":"2163", "category_id":null,"attr":{"_dhcp_type":"subnet" ,"_dhcp_pool_attributes":"{\"mac\":\"\", \"rangeStart\":\"10.10.10.4\", \"rangeEnd\":\"10.10.10.5\", \"freeLines\":3, \"freeLine1\":\"example1\", \"freeLine2\":\"example2\", \"freeLine3\":\"example3\"}", "_dhcp_ip_id":"92430"}}}
ERROR:{"success":0, "message":"error message"}

Return Detail:

NameTypeDescription
idINTEGERID of the newly created dhcp_module
nameSTRINGThe name of the dhcp_module
slugSTRINGThe unique reference string for this resource
typeSTRINGAlways 'dhcp_module'
parent_idINTEGERThe resource to which the dhcp_module is attached
category_idINTEGERThe category to which this dhcp_module is associated

Attributes:

KeyTypeDescription
_dhcp_typeSTRINGEither 'subnet' or 'host'. Determines whether this DHCP Pool is describing a Subnet or a Host.
_dhcp_pool_attributesJSONA JSON-encoded string containing all the specific configuration parameters which govern this DHCP Pool. An expansion of the JSON object is given below in the Data Attributes section.
_dhcp_ip_idINTEGERThe id of the IPAM subnet or host which is assigned to this DHCP Pool

delete a DHCP Pool

DescriptionTo delete a DHCP Pool, use the standard Resource-Delete functionality
URL/api/v1/api.php?target=resource&action=delete&id=2165
Returns

Examples:

SUCCESSFUL:{"success":1,"message":"Deleted 2165-another-subnet-3 (#2165)"}
ERROR:{"success":0, "message":"error message"}

Data Attributes

_dhcp_attributes

DescriptionThe _dhcp_attributes data attribute holds the specific settings used to generate a DHCP configuration file, place it on a server via SCP, and restart that server via a SSH session.
Example:{"type":"ISC", "notes":"notes here", "username":"username", "port":"22", "config_test":"/etc/init.d/dhcpd configtest", "server_stop":"/etc/init.d/dhcpd stop", "server_start":"/etc/init.d/dhcpd start", "config_path":"/tmp/dhcpd.conf", "option_routers":"", "option_domain_name_servers":"", "option_domain_name":"", "authoritative":"1", "default_lease_time":"600", "max_lease_time":"7200", "local_port":"67", "log_facility":"local7", "password":"", "server_ip":"10.0.0.0", "freeLines":0}
 

Data Description

NameTypeDescription
typeSTRINGThe type of DHCP server being administered. Currently only 'ISC' is supported.
notesSTRINGNotes associated with this DHCP server
server_ipSTRINGThe IP address of the DHCP server
usernameSTRING

The SSH username employed when transferring the DHCP configuration file to the server.

passwordSTRINGThe SSH password employed when transferring the DHCP configuration file to the server.
portINTEGERThe SSH port employed when transferring the DHCP configuration file to the server.
config_testSTRINGThe command to test if a configuration file parses correctly. ex: /etc/init.d/dhcpd configtest
server_stopSTRINGThe command to stop the DHCP server. ex: /etc/init.d/dhcpd stop
server_startSTRINGThe command to start the DHCP server. ex: /etc/init.d/dhcpd start
config_pathSTRINGWhere to place the configuration file on the server.
authoritativeBOOLWhether or not this DHCP server is authoritative.
default_lease_timeINTEGERThe default lease time for IPs distributed by this DHCP server.
max_lease_timeINTEGERThe max lease time for IPs distributed by this DHCP server.
local_portINTEGERThe port on which this DHCP server listens
option_routersSTRINGThe information which populates the "routers" option in the DHCP configuration

option_domain_name_servers

STRINGThe information which populates the "domain_name_servers" option in the DHCP configuration
option_domain_nameSTRINGThe information which populates the "domain_name" option in the DHCP configuration
log_facilitySTRINGThe log facility to which this DHCP Server sends its logging information
freeLinesINTEGERAs this system cannot hope to support all the thousands of different DHCP configurations, ProVision's DHCPv2 system includes a mechanism for adding "free lines" to the end of certain DHCP config sections so that administrators can customize their DHCP config file to their needs. The "freeLines" field indicates how many of these lines exist to be inserted after the general server definition section but before the subnets and hosts are enumerated.
freeLine#STRINGFree line data to be inserted after the general server definition section but before the subnets and hosts are enumerated. There can be multiple instances of this attribute, numbered appropriately. ex: "freeLine1", "freeLine2", "freeLine3", etc. The number of freeLine# entries must match the number in the "freeLines" attribute.

...