API Configuration wrapper
The configuration class wraps the BAM Configuration Entity type. Generally, most API use cases start with retrieving one or more configurations from where other object types may be retrieved.
Bases: configuration.IP4SpaceConfiguration, configuration.IP4SpaceConfigurationBlockNet, configuration.IP4SpaceConfigurationNet, configuration.IP6SpaceConfiguration, configuration.IP6SpaceConfigurationBlockNet, configuration.DNSConfiguration, configuration.ServerConfiguration
Instantiate a configuration.
Parameter | Description |
---|---|
api | API instance used by the API object to communicate with BAM. |
api_entity | The API object returned by the BAM API. |
GLOBAL_UNICAST_PREFIX= '2000::/3'
UNIQUE_LOCAL_PREFIX= 'FC00::/6'
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_mac_address(address, name='', mac_pool=None, properties='')
Adds a mac address object.
Parameters | Description |
---|---|
address | The MAC address in the format nnnnnnnnnnnn, nn-nn-nn-nn-nn-nn or nn:nn:nn:nn:nn:nn, where nn is a hexadecimal value. |
name | Name of the MAC address (optional). |
mac_pool | The MAC Pool object. |
properties | A string containing options. |
Returns: The added MAC address object.
add_server(name, address, host_name, profile='ADONIS_1200', properties='password=bluecat|connected=true|upgrade=False')
Parameters | Description |
---|---|
name | The name of the server within Address Manager. |
address | The physical IP address for the server within Address Manager. |
host_name | The DNS FQDN by which the server is referenced. |
profle | The server capability profile. Defaults to ‘ADONIS_1000’ |
properties | Defaults to ‘password=bluecat|connected=true|upgrade=False’ |
Returns: Server entity added.
add_tftp_group(name, properties='')
Parameters | Description |
---|---|
name | The name of the TFTP group. |
properties | Adds object properties, including comments and user-defined fields. |
Returns: TFTPGroup entity added.
add_view(name, properties='')
Parameters | Description |
---|---|
name | The name of the view. |
properties | Adds object properties, including user-defined fields. |
Returns: An instance of the created view.
assign_ip4_address(address, mac_address, hostinfo, action, properties='')
Assign an IPv4 address (e.g. ‘192.168.0.1’).
Parameters | Description |
---|---|
address | For example, 192.168.0.1 |
mac_address | For example, 00-00-00-00-00-01 |
hostinfo | A string containing host information for the address in the
following
format: hostname,viewId,reverseFlag,sameAsZoneFlag[, 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_RESERV |
properties | A string containing options. |
Returns: Returns an APIEntity for the assigned IPv4 address object.
assign_ip6_address(address, mac_address=", hostinfo=", duid=", properties='')
Assign an IPv6 address.
Parameters | Description |
---|---|
address | For example, FC01:1:1:1::/64 |
mac_address | For example, 00-00-00-00-00-01 |
hostinfo | A string containing host information for the address in the
following
format: hostname,viewId,reverseFlag,sameAsZoneFlag[, 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_DHCP_RESERVED |
duid | For example, 00-01-00-01-14-77-21-A2-00-50-56-AA-5E-EE |
properties | A string containing options. |
Returns: Returns the updated IPv6Address.
assign_next_available_ip4_address(mac_address, hostinfo, action, properties='')
Assigns next available IPv4 address.
Parameters | Description |
---|---|
mac_address | For example, 00-00-00-00-00-01 |
hostinfo | A string containing host information for the address in the
following
format: hostname,viewId,reverseFlag,sameAsZoneFlag[, 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:
The value is either true or false, default value is false. |
Returns: Returns an APIEntity for the assigned IPv4 address object.
create_xha_pair(active_server, passive_server, active_server_new_ip, properties='', max_wait=1200)
Parameters | Description |
---|---|
active_server | For example, 00-00-00-00-00-01 |
passive_server | MAKE_STATIC / MAKE_RESERVED / MAKE_DHCP_RESERVED |
active_server_new_ip | The new IPv4 address for the active server. |
properties | A string containing options. |
max_wait | Amount of time to wait for xHA pair to be created in seconds. |
Returns: Active BDDS server entity object if successful. Exception on failure.
delete()
Delete the entity from the BAM database.
dump()
Dump out details of the entity to stdout. Useful for debug.
get_access_rights()
Get an iterator for all access rights for an Entity :return.
get_child_by_name(name, entity_type)
Get a specific named immediate child entity of a given type.
get_child_of_type(name, entity_type)
Get a specific named immediate child entity of a given type.
Parameter | Description |
---|---|
entity_type | Entity type to search for. |
Returns: Generator object iterating over all children of specified type.
get_deployment_roles(types=None)
Get deployment roles for the entity.
Parameter | Description |
---|---|
types | An optional list of deployment role types (documented in the deployment_role class). If the list is empty all types are returned. |
Returns: .
get_entity_by_cidr(cidr, entity_type='IP4Block')
Returns an IPv4 Block object by calling the block using CIDR notation.
Parameter | 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_id()
Get the BAM ID of an entity.
get_ip4_address(address)
Get an IPv4 address by name (e.g. ‘192.168.0.1’). These are direct children of configurations.
Parameter | 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_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.
Parameter | Description |
---|---|
ip_prefix | The beginning ip prefix of the networks you wish to find. For example, ‘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_ip6_address(address)
Get an IPv6 Address.
Parameter | Description |
---|---|
address | Address to be retrieved. |
get_ip6_global_unicast_block()
Return the IPv6 global unicast address space block.
get_ip6_unique_local_block()
Return the IPv6 unique local address space block.
get_ip_range_by_ip(entity_type, address)
Use this method to find the Configuration, IPv4 Block, IPv4 Network, or DHCP 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.
Parameter | Description |
---|---|
entity_type | The type of object containing the IPv4 or IPv6 address. Specify ObjectTypes.IP4Block, ObjectTypes.IP4Network, or ObjectTypes.DHCP4Range to find the block, network, or range containing the IPv4 address. Specify an empty string (“”) to return the most direct container for the IPv4 address. |
address | An IPv4 address. |
Returns: Returns an APIEntity for the object containing the specified address. If no object is found, returns an empty APIEntity. If ObjectTypes.IP4Block, ObjectTypes.IP4Network, or ObjectTypes.DHCP4Range 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.
get_linked_entities(entity_type)
Get all the linked entities of a given type.
Returns: Iterator for a given type entities.
get_mac_address(address)
Retrieves a MAC address object by MAC address.
Parameter | Description |
---|---|
address | The MAC address in the format nnnnnnnnnnnn, nn-nn-nn-nn-nn-nn or nn:nn:nn:nn:nn:nn, where nn is a hexadecimal value. |
Returns: The MAC address object.
get_name()
Get the BAM name of the entity.
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.
Parameter | 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.
Parameter | 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.
Parameter | 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.
get_next_ip4_address_string(exclude=None)
Get the next available IPv4 address (as a string) optionally excluding a given list of addresses.
Parameter | Description |
---|---|
exclude | Which addresses (as a list of strings) to exclude. |
get_parent()
Get the parent entity or None if the entity is at the top of the hierarchy.
get_parent_configuration()
Walk up the entity hierarchy and return the Configuration entity; if none was found, returns None; if starting entity is configuration, returns itself.
Returns: An iterator of parent configuration objects.
get_parent_of_type(entity_type)
Walk up the entity hierarchy and return the first parent entity of the given type or, if none was found, raise PortalException.
get_properties()
Get the properties in the form of a dictionary containing one entry per property.
get_property()
Get a single named property or None if not defined.
get_server(name)
Get a named server. Returns None if the server wasn not found.
get_servers(name)
Get a list of all the servers in a configuration.
get_type()
Get the BAM type of the entity.
get_url()
Get URL.
get_view(name)
Get a named view (ref: split horizon DNS) out of a configuration. An exception is raised if the view does not exist.
get_views()
Get an Iterator for all child views (ref: split horizon DNS) of the configuration.
Returns: Iterator for View entities.
is_ip4_address_allocated(address, mac_address)
Checks if an IPv4 address is allocated in the current configuration.
Parameters | Description |
---|---|
address | The IPv4 address string. |
mac_address | The MAC address associated with the IPv4 DHCP allocated address. The MAC address can be specified in the format nnnnnnnnnnnn, nn-nn-nn-nn-nn-nn or nn:nn:nn:nn:nn:nn, where nn is a hexadecimal value. |
Returns: True/False.