Click a link to jump to the indicated section.
class
bluecat.ip4_block.IP4Block
(api, api_entity)
Bases: bluecat.ip_object.IP4BlockNetwork
bluecat.configuration.IP4SpaceConfiguration
bluecat.configuration.IP4SpaceConfigurationBlockNet
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_dhcp_deployment_role(server_interface, role_type, properties='')
Adds a DHCP deployment role to a specified object.
Parameters | Description |
---|---|
server_interface |
The object ID/server interface object to which the role is to be deployed. |
role_type |
The type of DHCP role to be added. Possible roles are: MASTER NONE |
properties |
A string containing options including: inherited - either true or false; indicates whether or not the deployment role was inherited. secondaryServerInterfaceId - the object ID of the secondary server interface for a DHCP failover. |
Returns: The added DHCP deployment role object.
add_dns_deployment_role(server_interface, role_type, properties='')
Adds a DNS deployment role to a specified object.
Parameters | Description |
---|---|
server_interface |
The object ID/server interface object to which the role is to be added. |
role_type |
The type of DNS role to be added. The type must be one of: NONE MASTER MASTER_HIDDEN SLAVE SLAVE_STEALTH FORWARDER STUB RECURSION AD_MASTER |
properties |
Adds object properties, including the view associated with this DNS deployment role and user-defined fields. |
Returns: Added DNS deployment role object.
add_ip4_block_by_cidr(cidr, properties='')
Create a new ip4 child block using CIDR.
Parameters | Description |
---|---|
cidr |
the CIDR notation defining the block (for example, 10.10/16). |
properties |
A string containing options. |
Returns: Returns an APIEntity for the created IPv4 block object.
add_ip4_block_by_range(start, end, properties='')
Create a new ip4 child block by defining an address range.
Parameters | Description |
---|---|
start |
An IP address defining the lowest address or start of the block. |
end |
An IP address defining the highest address or end of the block. |
properties |
A string containing options. |
Returns: Returns an APIEntity for the created IPv4 block object.
add_ip4_network(cidr, properties='')
Adds an IPv4 network using CIDR notation.
Parameters | Description |
---|---|
soap (cidr) |
The CIDR notation defining the network (for example, 10.10.10/24). |
properties |
A string containing options. |
add_parent_block(block_or_network_ids)
Creates an IPv4 or IPv6 block from a list of IPv4 or IPv6 blocks or networks. All blocks and networks must have the same parent but do not need to be contiguous.
Block_or_network_ids:
An array containing the object IDs of IPv4 or IPv6 blocks or networks.
add_raw_deployment_option(option_type, raw_data, properties='')
Parameters | Description |
---|---|
option_type |
the option types for Raw Deployment Options, the Three options are DNS_RAW, DHCP_RAW, DHCPV6_RAW. |
raw_data |
the raw option value for the deployment option. |
properties |
the properties of the raw option, if it is an DNSRawOption you need to set server in properties |
Returns: Returns an instance of the type DNSOption that represents the DNS deployment option.
assign_ip4_address(address, mac_address, hostinfo, action, properties='')
Assign an IPv4 address (e.g. ‘192.168.0.1’).
Parameters | Description |
---|---|
address |
(e.g. ‘192.168.0.1’) |
mac_address |
(e.g. ‘“00-00-00-00-00-01’) |
hostinfo |
A string containing host information for the address in the following format: [hostname,viewId,reverseFlag,sameAsZoneFlag, ….]. Where:
The comma-separated parameters may be repeated in the order shown above. The string must not end with a comma. |
action |
MAKE_STATIC / MAKE_RESERVED / MAKE_DHCP_RESERVED |
properties |
A string containing options. |
Returns: Returns an APIEntity for the assigned IPv4 address object.
assign_next_available_ip4_address(mac_address, hostinfo, action, properties='')
Assigns next available IPv4 address.
Parameters | Description |
---|---|
mac_address |
(e.g. ‘00-00-00-00-00-01’) |
hostinfo |
A string containing host information for the address in the following format: [hostname,viewId,reverseFlag,sameAsZoneFlag, …]. Where:
The comma-separated parameters may be repeated in the order shown above. The string must not end with a comma. |
action |
MAKE_STATIC / MAKE_RESERVED / MAKE_DHCP_RESERVED |
properties |
A string containing options. Properties include:
|
Returns: Returns an APIEntity for the assigned IPv4 address object.
get_deployment_options(option_types, server)
Get deployment Option for the entity.
Parameters | Description |
---|---|
option_types |
the Deployment option type you would like to search, Includes
|
server |
the server which the deployment option is attached to, there are 3 options:
|
get_dhcp_deployment_role(server_interface)
Retrieves the DHCP deployment role assigned to a specified object.
Parameters | Description |
---|---|
server_interface |
The server interface to which the role is assigned. |
Returns: Returns the DHCP deployment role assigned to the specified object.
get_dns_deployment_role(server_interface)
Retrieves a DNS deployment role from a specified object.
Parameters | Description |
---|---|
server_interface |
The object ID/server interface object to which the DNS deployment role is assigned. |
get_entity_by_cidr(cidr, entity_type='IP4Block')
Returns an IPv4 Block object by calling the block using CIDR notation.
Parameters | Description |
---|---|
cidr |
CIDR notation defining the block to be returned (for example, 10.10/16). |
entity_type |
The type of object returned: IP4Block. |
Returns: The specified IPv4 block object from the database.
get_ip4_address(address)
Get an IPv4 address by IP (e.g. ‘192.168.0.1’).
Parameters | Description |
---|---|
address |
the IPv4 address string. |
Returns: Returns the requested APIEntity of IPv4 Address object.
get_ip4_blocks()
Get the IPv4 blocks directly underneath the current configuration or block. Note that blocks form the nodes of a tree with networks being the leaves.
Returns: Returns an iterator of DHCPv4 range objects from the database.
get_ip4_networks()
Get all immediate child IPv4 networks.
Returns: Iterator of network instances or empty list.
get_ip4_networks_by_hint(ip_prefix)
Search for IPv4 networks using their ip prefix in the configuration or block. Returns an array of IPv4 networks found under the container object. Currently only allows hints using ip prefix.
Parameters | Description |
---|---|
ip_prefix |
The beginning ip prefix of the networks you wish to find. ex. ‘172’, ‘192.27’, ‘100.100.100.’ |
Returns: Returns an array of IPv4 networks based on the input argument or returns an empty list if no results are found.
get_ip_range_by_ip(entity_type, address)
This method has been deprecated, use get_ip_ranged_by_ip instead.
Use this method to find the Configuration, IPv4 Block, IPv6 Block, IPv4 Network, IPv6 Network, DHCP Range, or DHCPv6 range containing a specified address. You can specify the type of object to be returned, or you can leave the type of object empty to find the most direct container for the object.
Parameters | Description |
---|---|
entity_type |
The type of object containing the IPv4 or IPv6 address. Specify EntityType.IP4Block, EntityType.IP4Network, or EntityType.DHCP4Range to find the block, network, or range containing the IPv4 address. Specify EntityType.IP6Block, EntityType.IP6Network, or EntityType.DHCP6Range to find the block, network, or range containing the IPv6 address. Specify an empty string (“”) to return the most direct container for the IPv4 address or IPv6 address. |
address |
An IPv4 address or Ipv6 address. |
Returns: Returns an APIEntity for the object containing the specified address. If EntityType.IP4Block, EntityType.IP6Block, EntityType.IP4Network, EntityType.IP6Network, EntityType.DHCP4Range, or EntityType.DHCP6Range is specified as the type parameter, returns an object of the specified type. If an empty string (“”) is specified as the type parameter, returns the most direct container for the IPv4 address or IPv6 address.
Raises:
PortalException – if no object matching the entity_type and address is found.
get_ip_ranged_by_ip(entity_type, address)
Use this method to find the Configuration, IPv4 Block, IPv6 Block, IPv4 Network, IPv6 Network, DHCP Range, or DHCPv6 range containing a specified address. You can specify the type of object to be returned, or you can leave the type of object empty to find the most direct container for the object.
Parameters | Description |
---|---|
entity_type (str) |
The type of object containing the IPv4 or IPv6 address. Specify EntityType.IP4Block, EntityType.IP4Network, or EntityType.DHCP4Range to find the block, network, or range containing the IPv4 address. Specify EntityType.IP6Block, EntityType.IP6Network, or EntityType.DHCP6Range to find the block, network, or range containing the IPv6 address. Specify an empty string (“”) to return the most direct container for the IPv4 address or IPv6 address. |
address (str) |
An IPv4 address or Ipv6 address. |
Returns: Returns an APIEntity for the object containing the specified address. If EntityType.IP4Block, EntityType.IP6Block, EntityType.IP4Network, EntityType.IP6Network, EntityType.DHCP4Range, or EntityType.DHCP6Range is specified as the type parameter, returns an object of the specified type. If an empty string (“”) is specified as the type parameter, returns the most direct container for the IPv4 address or IPv6 address.
Raises:
PortalException – if no object matching the entity_type and address is found.
get_ksk(ksk_format)
Get Key Signing Key (KSK) associated to an ip4 block
Parameters | Description |
---|---|
ksk_format |
ksk return type, accepted formats are: TRUST_ANCHOR, DNS_KEY and DS_RECORD |
Returns: List of KSKs in string format
Example:
from bluecat.constants import DNSSECKeyFormats
api = g.user.get_api() # get api object
ip4_network_id = 10223 # ip4 network id
ip4_object = api.get_entity_by_id(ip4_network_id)
ksk_list = ip4_object.get_ksk(DNSSECKeyFormats.TRUST_ANCHOR)
get_next_available_ip4_address()
Gets next available IPv4 address in current configuration
Returns: Returns the next available IPv4 address in an existing network as a string.
get_next_available_ip4_network(size, is_larger_allowed=False, auto_create=True)
Returns the next available (unused) network within a configuration or block.
Parameters | Description |
---|---|
size |
The size of the network, expressed as a power of 2 |
is_larger_allowed |
indicates whether to return larger networks than those specified with the size parameter |
auto_create |
indicates whether the next available network should be created if it does not exist. |
Returns: Returns the next available (unused) network or None.
get_next_available_ip_range(size, entity_type, properties='')
Returns the existing next available IPv4 range or, if the next available IP range does not exist and autoCreate-
was set to true, the newly created IPv4 range.
Parameters | Description |
---|---|
size |
The size of the range, expressed as a power of 2. |
entity_type |
The type of the range object to be fetched. Currently IPv4 block and network are supported. |
properties |
A string containing options. |
Returns: Returns the next available (unused) block or network within a configuration or block.
get_next_available_ip_ranges(size, max_results, properties='')
Finds or creates unused IPv4 Networks of the specified size.
Parameters | Description |
---|---|
size |
The size of the range, expressed as a power of 2. |
max_results |
The number of networks to be found or created. |
properties |
A string containing options. |
Returns: A list of newly created IPv4Networks.
move_ip_object(address, no_server_update=False)
Allows users to move the IP object to another address
Parameters | Description |
---|---|
address |
New address to be allocated |
no_server_update |
ONLY FOR IPV4 ADDRESSES, A boolean value.
If set to |
Example:
api = g.user.get_api() # get api object
ip4_id = 10234 # ip4 block/ip4 network id
ip4_object = api.get_entity_by_id(ip4_id)
new_ip4_address = '10.0.0.1' # new IP address to be allocated
ip4_object.move_ip_object(new_ip4_address)