Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Assign host ip from next available IP in reserved range
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 02:21 PM
607     0
I can currently identify the range by using the <'range?network=192.168.120.0/24'> endpoint.
I can then find the reserved range based on 'start_addr'.
let's say range_data['_ref] = 'range/XX5zXmRoX3BfcmXuZ2UkMTkyLjE2OC4xMjAuMjE0LzE5Mi4xNjguMTIwLjIxNy8vLzAv:192.168.120.214/192.168.120.217/default'
I can then get the next available IP using <range_data['_ref'] + '?_function=next_available_ip'>
I want to skip the last step above and both get and reserve the IP in one call (similar to how I currently get an IP from a subnet with no reserved ranges)
endpoint - <"/record:host?_return_fields%2B=name,ipv4addrs">
json_body = {
'name': request_hostname.lower(),
'extattrs': {
'REQUEST': {'value': change_number}, 'TYPE': {'value': 'Server'}},
'ipv4addrs': [{
'ipv4addr': {
'_object_function': 'next_available_ip',
'_result_field': 'ips',
'_object': 'network',
'_object_parameters': {
'network': request_subnet
}
}
}]
}
I would think I would just add something like 'range': range_data['_ref'] under '_object_parameters', but this returns AdmConProtoError: Unknown object type
I would think I would just add something like 'range': range_data['_ref'] under '_object_parameters', but this returns AdmConProtoError: Unknown object type
Labels: