Dimension Data Load Balancer Driver Documentation¶
Dimension Data are a global IT Services company and form part of the NTT Group. Dimension Data provide IT-as-a-Service to customers around the globe on their cloud platform (Compute as a Service). The CaaS service is available either on one of the public cloud instances or as a private instance on premises.
CaaS has its own non-standard API , libcloud provides a Python wrapper on top of this API with common methods with other IaaS solutions and Public cloud providers. Therefore, you can use use the Dimension Data libcloud driver to communicate with both the public and private clouds.
Instantiating a driver¶
When you instantiate a driver you need to pass the following arguments to the driver constructor:
user_id
- Your Dimension Data Cloud usernamekey
- Your Dimension Data Cloud passwordregion
- The region key, one of the possible region keys
Possible regions:
dd-na
: Dimension Data North America (USA)dd-eu
: Dimension Data Europedd-af
: Dimension Data Africadd-au
: Dimension Data Australiadd-latam
: Dimension Data Latin Americadd-ap
: Dimension Data Asia Pacificdd-canada
: Dimension Data Canada region
The base libcloud API allows you to:
create balancers, add members and destroy members
Non-standard functionality and extension methods¶
The Dimension Data driver exposes some libcloud non-standard functionalities through extension methods and arguments.
These functionalities include:
list nodes
list pools
set the network domain (zone)
For information on how to use these functionalities please see the method docstrings below. You can also use an interactive shell for exploration as shown in the examples.
API Docs¶
- class libcloud.loadbalancer.drivers.dimensiondata.DimensionDataLBDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region='dd-na', **kwargs)[source]¶
DimensionData node driver.
- Parameters
key (
str
) – API key or username to be used (required)secret (
str
) – Secret password to be used (required)secure (
bool
) – Whether to use HTTPS or HTTP. Note: Some providers only support HTTPS, and it is on by default.host (
str
) – Override hostname used for connections.port (
int
) – Override port used for connections.api_version (
str
) – Optional API version. Only used by drivers which support multiple API versions.region (
str
) – Optional driver region. Only used by drivers which support multiple regions.
- Return type
None
- balancer_attach_compute_node(balancer, node)¶
Attach a compute node as a member to the load balancer.
- Parameters
balancer (
LoadBalancer
) – LoadBalancer which should be usednode (
Node
) – Node to join to the balancer
- Returns
Member after joining the balancer.
- Return type
Member
- balancer_attach_member(balancer, member)[source]¶
Attach a member to balancer
- Parameters
balancer (
LoadBalancer
) – LoadBalancer which should be usedmember (
Member
) – Member to join to the balancer
- Returns
Member after joining the balancer.
- Return type
Member
- balancer_detach_member(balancer, member)[source]¶
Detach member from balancer
- Parameters
balancer (
LoadBalancer
) – LoadBalancer which should be usedmember (
Member
) – Member which should be used
- Returns
True
if member detach was successful, otherwiseFalse
.- Return type
bool
- balancer_list_members(balancer)[source]¶
Return list of members attached to balancer.
In Dimension Data terminology these are the members of the pools within a virtual listener.
- Parameters
balancer (
LoadBalancer
) – LoadBalancer which should be used- Return type
list
ofMember
- connectionCls¶
alias of
libcloud.common.dimensiondata.DimensionDataConnection
- create_balancer(name, port=None, protocol=None, algorithm=None, members=None, ex_listener_ip_address=None)[source]¶
Create a new load balancer instance
- Parameters
name (
str
) – Name of the new load balancer (required)port (
int
) – An integer in the range of 1-65535. If not supplied, it will be taken to mean ‘Any Port’protocol (
str
) – Loadbalancer protocol, defaults to http.members (
list
ofMember
) – list of Members to attach to balancer (optional)algorithm (
Algorithm
) – Load balancing algorithm, defaults to ROUND_ROBIN.ex_listener_ip_address (
str
) – Must be a valid IPv4 in dot-decimal notation (x.x.x.x).
- Return type
LoadBalancer
- destroy_balancer(balancer)[source]¶
Destroy a load balancer (virtual listener)
- Parameters
balancer (
LoadBalancer
) – LoadBalancer which should be used- Returns
True
if the destroy was successful, otherwiseFalse
.- Return type
bool
- ex_create_node(network_domain_id, name, ip, ex_description, connection_limit=25000, connection_rate_limit=2000)[source]¶
Create a new node
- Parameters
network_domain_id – Network Domain ID (required)
name (
str
) – name of the node (required)ip (
str
) – IPv4 address of the node (required)ex_description (
str
) – Description of the node (required)connection_limit (
int
) – Maximum number of concurrent connections per secconnection_rate_limit (
int
) – Maximum number of concurrent sessions
- Returns
Instance of
DimensionDataVIPNode
- Return type
DimensionDataVIPNode
- ex_create_pool(network_domain_id, name, balancer_method, ex_description, health_monitors=None, service_down_action='NONE', slow_ramp_time=30)[source]¶
Create a new pool
- Parameters
network_domain_id – Network Domain ID (required)
name (
str
) – name of the node (required)balancer_method (
str
) – The load balancer algorithm (required)ex_description (
str
) – Description of the node (required)health_monitors (
list
ofDimensionDataDefaultHealthMonitor
) – A list of health monitors to use for the pool.service_down_action (
str
) – What to do when node is unavailable NONE, DROP or RESELECTslow_ramp_time (
int
) – Number of seconds to stagger ramp up of nodes
- Returns
Instance of
DimensionDataPool
- Return type
DimensionDataPool
- ex_create_pool_member(pool, node, port=None)[source]¶
Create a new member in an existing pool from an existing node
- Parameters
pool (
DimensionDataPool
) – Instance ofDimensionDataPool
(required)node (
DimensionDataVIPNode
) – Instance ofDimensionDataVIPNode
(required)port (
str
) – Port the the service will listen on
- Returns
The node member, instance of
DimensionDataPoolMember
- Return type
DimensionDataPoolMember
- ex_create_virtual_listener(network_domain_id, name, ex_description, port=None, pool=None, listener_ip_address=None, persistence_profile=None, fallback_persistence_profile=None, irule=None, protocol='TCP', connection_limit=25000, connection_rate_limit=2000, source_port_preservation='PRESERVE')[source]¶
Create a new virtual listener (load balancer)
- Parameters
network_domain_id – Network Domain ID (required)
name (
str
) – name of the listener (required)ex_description (
str
) – Description of the node (required)port (
int
) – An integer in the range of 1-65535. If not supplied, it will be taken to mean ‘Any Port’pool (
DimensionDataPool
) – The pool to use for the listenerlistener_ip_address (
str
) – The IPv4 Address of the virtual listenerpersistence_profile (
DimensionDataPersistenceProfile
) – Persistence profilefallback_persistence_profile (
DimensionDataPersistenceProfile
) – Fallback persistence profileirule (
DimensionDataDefaultiRule
) – The iRule to applyprotocol – For STANDARD type, ANY, TCP or UDP for PERFORMANCE_LAYER_4 choice of ANY, TCP, UDP, HTTP
connection_limit (
int
) – Maximum number of concurrent connections per secconnection_rate_limit (
int
) – Maximum number of concurrent sessionssource_port_preservation (
str
) – Choice of PRESERVE, PRESERVE_STRICT or CHANGE
- Returns
Instance of the listener
- Return type
DimensionDataVirtualListener
- ex_destroy_node(node_id)[source]¶
Destroy a specific node
- Parameters
node_id (
str
) – The ID of of aDimensionDataVIPNode
- Returns
True
for success,False
for failure- Return type
bool
- ex_destroy_pool(pool)[source]¶
Destroy an existing pool
- Parameters
pool (
DimensionDataPool
) – The instance ofDimensionDataPool
to destroy- Returns
True
for success,False
for failure- Return type
bool
- ex_destroy_pool_member(member, destroy_node=False)[source]¶
Destroy a specific member of a pool
- Parameters
pool (
DimensionDataPoolMember
) – The instance of a pool memberdestroy_node (
bool
) – Also destroy the associated node
- Returns
True
for success,False
for failure- Return type
bool
- ex_get_current_network_domain()[source]¶
Get the current network domain ID of the driver.
- Returns
ID of the network domain
- Return type
str
- ex_get_default_health_monitors(network_domain_id)[source]¶
Get the default health monitors available for a network domain
- Parameters
network_domain_id (
str
) – The ID of of aDimensionDataNetworkDomain
- Return type
list of
DimensionDataDefaultHealthMonitor
- ex_get_default_irules(network_domain_id)[source]¶
Get the default iRules available for a network domain
- Parameters
network_domain_id (
str
) – The ID of of aDimensionDataNetworkDomain
- Return type
list of
DimensionDataDefaultiRule
- ex_get_default_persistence_profiles(network_domain_id)[source]¶
Get the default persistence profiles available for a network domain
- Parameters
network_domain_id (
str
) – The ID of of aDimensionDataNetworkDomain
- Return type
list of
DimensionDataPersistenceProfile
- ex_get_node(node_id)[source]¶
Get the node specified by node_id
- Returns
Returns an instance of
DimensionDataVIPNode
- Return type
Instance of
DimensionDataVIPNode
- ex_get_nodes(ex_network_domain_id=None)[source]¶
Get the nodes within this geography or in given network.
- Parameters
ex_network_domain_id (
str
) – UUID of Network Domain if not None returns only balancers in the given network if None then returns all pools for the organization- Returns
Returns an
list
ofDimensionDataVIPNode
- Return type
list
ofDimensionDataVIPNode
- ex_get_pool(pool_id)[source]¶
Get a specific pool inside the current geography
- Parameters
pool_id (
str
) – The identifier of the pool- Returns
Returns an instance of
DimensionDataPool
- Return type
DimensionDataPool
- ex_get_pool_member(pool_member_id)[source]¶
Get a specific member of a pool
- Parameters
pool (
str
) – The id of a pool member- Returns
Returns an instance of
DimensionDataPoolMember
- Return type
DimensionDataPoolMember
- ex_get_pool_members(pool_id)[source]¶
Get the members of a pool
- Parameters
pool (
DimensionDataPool
) – The instance of a pool- Returns
Returns an
list
ofDimensionDataPoolMember
- Return type
list
ofDimensionDataPoolMember
- ex_get_pools(ex_network_domain_id=None)[source]¶
Get all of the pools inside the current geography or in given network.
- Parameters
ex_network_domain_id (
str
) – UUID of Network Domain if not None returns only balancers in the given network if None then returns all pools for the organization- Returns
Returns a
list
of typeDimensionDataPool
- Return type
list
ofDimensionDataPool
- ex_set_current_network_domain(network_domain_id)[source]¶
Set the network domain (part of the network) of the driver
- Parameters
network_domain_id (
str
) – ID of the pool (required)
- ex_set_node_state(node, enabled)[source]¶
Change the state of a node (enable/disable)
- Parameters
pool (
DimensionDataNode
) – The instance ofDimensionDataNode
to updateenabled (
bool
) – The target state of the node
- Returns
The instance of
DimensionDataNode
- Return type
DimensionDataNode
- ex_update_node(node)[source]¶
Update the properties of a node
- Parameters
pool (
DimensionDataNode
) – The instance ofDimensionDataNode
to update- Returns
The instance of
DimensionDataNode
- Return type
DimensionDataNode
- ex_update_pool(pool)[source]¶
Update the properties of an existing pool only method, serviceDownAction and slowRampTime are updated
- Parameters
pool (
DimensionDataPool
) – The instance ofDimensionDataPool
to update- Returns
True
for success,False
for failure- Return type
bool
- ex_wait_for_state(state, func, poll_interval=2, timeout=60, *args, **kwargs)[source]¶
Wait for the function which returns a instance with field status to match
Keep polling func until one of the desired states is matched
- Parameters
state (
str
orlist
) – Either the desired state (str) or a list of statesfunc (
function
) – The function to call, e.g. ex_get_vlanpoll_interval (int) – The number of seconds to wait between checks
timeout (int) – The total number of seconds to wait to reach a state
args (Positional arguments) – The arguments for func
kwargs (Keyword arguments) – The arguments for func
- get_balancer(balancer_id)[source]¶
Return a
LoadBalancer
object.- Parameters
balancer_id (
str
) – id of a load balancer you want to fetch- Return type
LoadBalancer
- list_balancers(ex_network_domain_id=None)[source]¶
List all loadbalancers inside a geography or in given network.
In Dimension Data terminology these are known as virtual listeners
- Parameters
ex_network_domain_id (
str
) – UUID of Network Domain if not None returns only balancers in the given network if None then returns all pools for the organization- Return type
list
ofLoadBalancer
- list_protocols()[source]¶
Return a list of supported protocols.
Since all protocols are support by Dimension Data, this is a list of common protocols.
- Return type
list
ofstr
- list_supported_algorithms()¶
Return algorithms supported by this driver.
- Return type
list
ofstr
- update_balancer(balancer, **kwargs)¶
Sets the name, algorithm, protocol, or port on a load balancer.
- Parameters
balancer (
LoadBalancer
) – LoadBalancer which should be usedname (
str
) – New load balancer namealgorithm (
Algorithm
) – New load balancer algorithmprotocol (
str
) – New load balancer protocolport (
int
) – New load balancer port
- Return type
LoadBalancer