IP6Block class - Platform - BlueCat Gateway - 24.1

Gateway Administration Guide

Locale
English
Product name
BlueCat Gateway
Version
24.1

class bluecat.ip6_block.IP6Block(api, api_entity)

Bases: bluecat.ip_object.IP6BlockNetwork bluecat.configuration.IP6SpaceConfiguration bluecat.configuration.IP6SpaceConfigurationBlockNet

An IPv6 block is a group of IPv6 addresses that is separated from a larger network by subnetting.

GLOBAL_UNICAST_PREFIX = '2000::/3'

UNIQUE_LOCAL_PREFIX = 'FC00::/6'

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_ip6_block_by_mac(mac_address, name, properties='')

..warning:: This method has been deprecated, use add_ip6_block_by_mac_address instead.

Adds a IPv6 block by specifying the MAC address of the server.

Parameters Description
mac_address

The MAC address of the server in the format nnnnnnnnnnnn, nn-nn-nn-nn-nn-nn or nn:nn:nn:nn:nn:nn, where nn is a hexadecimal value.

name

Descriptive name for the IPv6 block. This value can be empty.

properties

Adds object properties, including user-defined fields. This value can be empty.

Returns: Creates an IPv6 block instance.

add_ip6_block_by_mac_address(mac_address, name, properties='')

Adds a IPv6 block by specifying the MAC address of the server.

Parameters Description
mac_address (str)

The MAC address of the server in the format nnnnnnnnnnnn, nn-nn-nn-nn-nn-nn or nn:nn:nn:nn:nn:nn, where nn is a hexadecimal value.

name (str)

Descriptive name for the IPv6 block. This value can be empty.

properties (str, optional)

Adds object properties, including user-defined fields. This value can be empty.

Returns: Creates an IPv6 block instance.

add_ip6_block_by_prefix(ip6_prefix, block_name, properties='')

Adds an IPv6 block by specifying the prefix for the block.

Parameters Description
ip6_prefix

The IPv6 prefix for the new block. This value cannot be empty.

block_name

Descriptive name for the IPv6 block. This value can be empty.

properties

Adds object properties, including user-defined fields. This value can be empty.

Returns: Creates an IPv6 block instance.

add_ip6_network_by_prefix(prefix, name, properties='')

Parameters Description
prefix

The IPv6 prefix for the new network. This value cannot be empty.

name

Descriptive name for the IPv6 network. This value can be empty.

properties

Adds object properties, including user-defined fields. This value can be empty.

Returns: Creates an IPv6 network instance.

add_parent_block(block_or_network_ids)

Parameters Description
block_or_network_ids

An array containing the object IDs of IPv6 blocks or networks.

Returns: Creates an IPv6 block with a name from a list of 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_ip6_address(action, address, mac_address='', hostinfo='', duid='', properties='')

Assign an IPv6 address

Parameters Description
action

MAKE_STATIC / MAKE_DHCP_RESERVED

address

(e.g. ‘FC01:1:1:1::/64’)

mac_address

(e.g. ‘00-00-00-00-00-01’)

hostinfo

A string containing host information for the address in the following format: [viewId,hostname,reverseFlag,sameAsZoneFlag, …]

  • viewId - The object ID of the view under which this host should be created.

  • hostname - The Fully Qualified Domain Name (FQDN) for the host record to be added.

  • reverseFlag - The flag indicating if a reverse record should be created. The possible values are true or false.

  • sameAsZoneFlag - The flag indicating if record should be created as same as zone record. The possible values are true or false.

The comma-separated parameters may be repeated in the order shown above. The string must not end with a comma.

duid

(e.g. ‘00-01-00-01-14-77-21-A2-00-50-56-AA-5E-EE’)

properties

A string containing options.

Returns: Returns the updated IPv6Address

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

  • DNSOption

  • DNSRawOption

  • DHCPRawOption

  • DHCPV6RawOption

  • DHCPV4ClientOption

  • DHCPV6ClientOption

  • DHCPServiceOption

  • DHCPV6ServiceOption

  • VendorClientOption

  • StartOfAuthority

server

the server which the deployment option is attached to, there are 3 options:

  • >0—returns only the options that are linked to the specified server ID.

  • <0—returns all options regardless of the server ID specified.

  • =0—returns only the options that are linked to all servers.

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_ip6_address(address)

Get an IPv6 Address

Parameters Description
address

Address to be retrieved

get_ip6_block_by_prefix(ip6_prefix)

Get an immediate child ip6_block using an ip6_prefix.

Parameters Description
ip6_prefix

an ip6 CIDR block

Returns: IP6Block instance

get_ip6_blocks()

Get all immediate child IPv6 blocks.

Returns: Iterator of ip6_blocks instances or empty list.

get_ip6_network_by_prefix(ip6_prefix)

Get an immediate network child using an ip6_prefix.

Parameters Description
ip6_prefix

an ip6 CIDR block

Returns: IP6Network instance

get_ip6_networks()

Get all immediate child IPv6 networks.

Returns: Iterator of network instances or empty list.

get_ip6_objects_by_hint(hint, access_right='', count=10)

Get an array of ip6 objects. it only supports IP6 networks currently

Parameters Description
hint

The partial or full name of the ip6 object.

access_right

the access right option

count

the number of elements to return

Returns: Returns an array of any ip6 object that match the given hint as data in JSON.

Example:

from bluecat.constants import AccessRightValues

api = g.user.get_api()                          # get api object
ip6_block_id = 10223                            # ip6 block id
ip6_block = api.get_entity_by_id(ip6_block_id)

ip6_networks = ip6_block.get_ip6_objects_by_hint('2001', access_right=AccessRightValues.AddAccess,
                                                 count=10)
for network in ip6_networks:
    print(network)

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 True, instant dynamic host record changes will not occur on DNS/DHCP Servers when moving an IPv4 address object.

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)