IP4Network class - Platform - BlueCat Gateway - 20.1.1

Gateway Administration Guide

prodname
BlueCat Gateway
version_custom
20.1.1

IPv4 network instances. Networks are the leaves underneath blocks that contain IP addresses.

class ip4_network.IP4Network(api, api_entity)

Bases: bluecat.ip4_block.IP4BlockNetwork, bluecat.configuration.IP4SpaceConfigurationBlockNet, bluecat.configuration.IP4SpaceConfigurationNet, bluecat.deployment_option.DNSOptionActionsMixin

Instantiate an IPv4 block.

Parameters Description
api API instance used by the entity to communicate with BAM.
api_entity The entity returned by the BAM API.

add_dhcp4_range(start, end, properties='')

Adds IPv4 DHCP ranges.

Parameters Description
start An IP address defining the lowest address or start of the range.
end An IP address defining the highest address or end of the range.
properties Adds object properties, including the object name and user-defined fields.

assign_or_update_template(template_id, gateway_reapply_mode='', reserved addresses_reapply_mode='', dhcp_ranges_reapply_mode='', ip_groups_reapply_mode=''options_reapply_mode='')

Assigns, updates, or removes IPv4 network templates. Also specifies the reapply mode for various properties of the template.

Parameter Description
template_id (integer, required)

The object ID of the DNS zone template or IPv4 network template. To remove a template, set this value to 0 (zero).

zone_template_reapply_mode (string, required)
The reapply mode for the zone in the template. The possible values are:
  • update
  • ignore
  • overwrite
    Note: ignore is the default value.

Example:

api = g.user.get_api()              # get api object
configuration_name = 'test_config'  # configuration name
view_name = 'test_view'             # view name
zone_name = 'test_zone'             # zone name

configuration = api.get_configuration(configuration_name)
view = configuration.get_view(view_name)
zone = view.get_zone(zone_name)
template_id = 10231

zone.assign_or_update_template(template_id, 
zone_template_reapply_mode='update')

get_entity_by_range(address1, address2)

Returns an IPv4 DHCP range object by calling it using its range.

Parameters Description
address1 An IP address defining the lowest address or start of the range.
address2 An IP address defining the highest address or end of the range.

get_first_addresses(n)

Parameters Description
n How many addresses to return.

split_ip4_network(number_of_parts=2, options='')

Splits an IPv4 network into the specified number of networks.

Parameters Description
number_of_parts The number of the networks into which the network will be split. Valid values are 2 to the power of 2 up to 1024.
options

A string containing the following options:

assignDefaultGateway - a Boolean value. If set to true, a gateway will be created by using the default gateway value which is the first IP address in the network. If set to false, no gateway will be created. The default value is true.

overwriteConflicts - a Boolean value. If set to true, any conflicts within the split IPv4 network will be removed. The default value is false.

template - a network template ID. The default value is 0 which means no network template will be used. Specify a network template ID if you wish to apply one.

preserveGateway - a Boolean value. If set to true, the gateway in the original network will be preserved. The default value is true.

Returns: Returns an array of networks created after splitting the network.