Versions Compared

Key

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

...

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"}

assigning an IP address or blocks to a DHCP Pool

DescriptionAssigning IP addresses or blocks to a DHCP Pool resource removes them from the available pool so they cannot be assigned out again. This procedure uses all the standard IPAM assignment functions, so long as the resource assigned from is the DHCP Available resource.
URL/api/v1/api.php?target=ipam&action=smartAssign&resourceId=2162&type=ipv4&mask=31&rir=1918&assignedResourceId=1282
Returns

Examples:

SUCCESSFUL:{"success":1,"message":"Assigned 10.8.1.4\/31 to 208.39.104.106 (2162) via Smart Assign","id":94468,"data":{"id":94468,"type":"ipv4","top_aggregate":44616,"cidr":"10.8.1.4\/31","formatted_ip":"10.8.1.4\/31","address":"168296708","end_address":"168296709","mask":31,"netmask":"255.255.255.254","child1":null,"child2":null,"is_assigned":1,"is_swipped":0,"is_aggregate":1,"custid":2162,"resource_id":2162,"resource_name":null,"last_updated_time":"2015-03-15 20:17:32","description":null,"parent":80882,"rir":"1918","lir_id":null,"notes":null,"generic_code":null,"code":null,"region":"Quito","region_name":"Quito","vlan":null,"arin_net_id":null,"arin_cust_id":null,"org_id":null,"arin_swip_time":null,"assigned_time":"2015-03-15 20:17:32","asn":null,"allowSubAssignments":false,"permissions":[],"range":"10.8.1.4 - 10.8.1.5","tags":["DHCP"]}}
ERROR:{"success":0, "message":"error message"}

Return Detail:

For a detailed breakdown of this endpoint's return data, please see the IPAM documentation.

get all DHCP Pool linkages

DescriptionThe association between DHCP Pools and DHCP Modules belongs to the Resource Linkage family of endpoints. The 'relation' field should be set to the 'dhcpPoolLink' type to pull only DHCP Pool linkage information.
URL/api/v1/api.php?target=resource&action=getLink&relation=dhcpPoolLink
Returns

Examples:

SUCCESSFUL:{"success":1 ,"message":"Search successful", "data":{"meta":{"totalRecords":"3", "retrieved":3}, "0":{"id":"22", "resource_id1":"1292", "resource_id2":"1302", "relation":"dhcpPoolLink"}, "1":{"id":"2", "resource_id1":"1292", "resource_id2":"1452", "relation":"dhcpPoolLink"}, "2":{"id":"12", "resource_id1":"1422", "resource_id2":"1482", "relation":"dhcpPoolLink"}}}
ERROR:{"success":0, "message":"error message"}

Return Detail:

NameTypeDescription
idINTEGERId of the pool-module linkage
resource_id1INTEGERThe id of the dhcp_module resource
resource_id2INTEGERThe id of the dhcp_pool resource
relationSTRINGThe relation type. Always 'dhcpPoolLink'

Meta Attributes:

NameTypeDescription
totalRecordsINTEGERHow many records were found by this query, without pagination.
retrievedINTEGERHow many records were returned by this query, with pagination.

add a new DHCP Pool linkage

DescriptionAdds a new link between a DHCP Pool and a dhcp_module resource. A single pool can be linked to many dhcp_modules, and a single dhcp_module can have any number of linked pools.
URL/api/v1/api.php?target=resource&action=addLink&resource_id1=1292&resource_id2=2162&relation=dhcpPoolLink
Returns

Examples:

SUCCESSFUL:{"success":1,"message":"Resource link added"}
ERROR:{"success":0, "message":"error message"}

Data Detail:

NameTypeDescription
resource_id1INTEGERThe id of the dhcp_module resource
resource_id2INTEGERThe id of the dhcp_pool resource
relationSTRINGThe relation type being added. Always 'dhcpPoolLink'

delete DHCP Pool linkages

DescriptionDeletes a link between a dhcp_module and a dhcp_pool. Uses the standard Resource Linkage endpoints.
URL/api/v1/api.php?target=resource&action=deleteLink&id=22
Returns

Examples:

SUCCESSFUL:{"success":1,"message":"Resource link(s) deleted."}
ERROR:{"success":0, "message":"error message"}

push a DHCP config

DescriptionBuilds a DHCP configuration from the attributes assigned to a dhcp_module and all of the linked dhcp_pools. Pushes that config to the configured DHCP server, tests it against the config parsing function, then restarts the server with the new configuration.
URL/api/v1/api.php?target=dhcp&action=push&id=1292
Returns

Examples:

SUCCESSFUL:{"success":1,"message":"Pushes Attempted.","data":[[1,"1292","381 DHCP Module","Configuration successfully pushed."]]}
ERROR:{"success":0, "message":"error message"}

Data Detail

NameTypeDescription
idINTEGERThe id of the dhcp_module resource whose configuration is to be pushed.

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.

...