- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Adding domain-name for roaminghost entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-16-2016 03:30 AM
Hey,
I'm currently trying to figure out how to set the domain-name option via WAPI for a roaminghost object. I tested 2 possibilities so far and didn't find a working solution: (I'm working with PHP and the CURL extension)
- Adding DHCP options like this ->
array("use_option" => "domain-name", "value" => $domain)
- Adding DHCP options with additional DHCP code and name like this ->
array("name" => "domain-name", "num" => "15", "use_option" => "domain-name", "value" => $domain)
Both ways didn't work. Does anyone have a working solution for this? (no matter what programming language)
The boolean "use_options" is set TRUE and works fine with DHCP option 12.
"use_options" => TRUE,
Anybody?
Kind regards,
Daniel
Solved! Go to Solution.
Re: Adding domain-name for roaminghost entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-22-2016 09:04 AM
Can you show us the complete payload you are using to modify the object ?
DHCP options will be an array of objects, e.g:
[ { ’name’: ’dhcp-lease-time’, ’num’: 51, ’use_option’: True, ’value’: ’43200’ } ]
I think you might be getting errors because you're passing name-value pairs as individual array elements.
The default value of 'use_option' is TRUE, so it is kinda redundant, It only really applies when you want to do odd things like disable an option in an inheritance override.
The syntax for all this is described in the 'dhcpoption : DHCP option' section of the API manual.
You should be able to use either 'name' or 'num', both are not required. And if you use both, but get their names wrong, you will probably get errors.
Re: Adding domain-name for roaminghost entry
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-23-2016 01:20 AM - edited 03-23-2016 01:22 AM
Thanks for the respond. My code looks like this:
$query = '/roaminghost'; $postfields = array("name" => $name, "mac" => $mac, "match_client" => "MAC_ADDRESS", "address_type" => "IPV4", "use_options" => TRUE, "options" => array(array("name" => "host-name", "num" => 12,"value" => $name),
array("name" => "domain-name", "num" => "15", "use_option" => "domain-name", "value" => $domain)), "comment" => $comment); $this->curl_post($query,$postfields);
The function curl_post looks like this:
private function curl_post($query,$postfields) { curl_setopt($this->curl, CURLOPT_POST, true); curl_setopt($this->curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($this->curl, CURLOPT_URL, $this->base_url . $query); curl_setopt($this->curl, CURLOPT_POSTFIELDS, json_encode($postfields)); $this->set_curl_response = curl_exec($this->curl); $this->set_curl_info_http_code = curl_getinfo($this->curl, CURLINFO_HTTP_CODE); }
Does this help?
Usually the domain-name is inherited by the grid, but for roaminghosts I want to overwrite this inheritance by passing manually a domain name.

Re: Adding domain-name for roaminghost entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-18-2016 01:12 AM
I just fixed the problem:
$query = '/roaminghost'; $postfields = array("name" => $name, "mac" => $mac, "match_client" => "MAC_ADDRESS", "address_type" => "IPV4", "use_options" => TRUE, "options" => array(array("name" => "host-name", "num" => 12,"value" => $name), array("name" => "domain-name", "num" => 15,"value" => $domain)), "comment" => $comment); $this->curl_post($query,$postfields);
The solution was to just pass the dhcp option 15 without any special marking like it is stated in the WAPI docs. So like any other dhcp option too you have to pass the name, the numerical value (check RF2131) and the value you want to insert.