NTTC-CIS Load Balancer Driver Documentation¶
NTT Communications 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 NTTC-CIS 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:
na
: NTTC-CIS North America (USA)eu
: NTTC-CIS Europeaf
: NTTC-CIS Africaau
: NTTC-CIS Australiaap
: NTTC-CIS Asia Pacificca
: 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 NTTC-CIS 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.nttcis.
NttCisLBDriver
(key, network_domain_id, secret=None, secure=True, host=None, port=None, api_version=None, region='na', **kwargs)[source]¶ NttCis LB driver.
-
balancer_attach_compute_node
(balancer, node)¶ Attach a compute node as a member to the load balancer.
Parameters: - balancer (
LoadBalancer
) – LoadBalancer which should be used - node (
Node
) – Node to join to the balancer
Returns: Member after joining the balancer.
Return type: Member
- balancer (
-
balancer_attach_member
(balancer, member)[source]¶ Attach a member to balancer
Parameters: - balancer (
LoadBalancer
) – LoadBalancer which should be used - member (
Member
) – Member to join to the balancer
Returns: Member after joining the balancer.
Return type: Member
- balancer (
-
balancer_detach_member
(balancer, member)[source]¶ Detach member from balancer
Parameters: - balancer (
LoadBalancer
) – LoadBalancer which should be used - member (
Member
) – Member which should be used
Returns: True
if member detach was successful, otherwiseFalse
.Return type: bool
- balancer (
-
balancer_list_members
(balancer)[source]¶ Return list of members attached to balancer.
In NTTC-CIS terminology these are the members of the pools within a virtual listener.
Parameters: balancer ( LoadBalancer
) – LoadBalancer which should be usedReturn type: list
ofMember
-
connectionCls
¶
-
create_balancer
(name, listener_port=None, port=None, protocol=None, algorithm=None, members=None, optimization_profile='TCP', ex_listener_ip_address=None)[source]¶ Create a new load balancer instance
Parameters: - name (
str
) – Name of the new load balancer (required) - listener_port – An integer in the range of 1-65535. If not supplied, it will be taken to mean ‘Any Port’
- port (
int
) – An integer in the range of 1-65535. If not supplied, it will be taken to mean ‘Any Port’ Assumed that node ports will different from listener 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. - optimization_profile – For STANDARD type and protocol TCP an optimization type of TCP, LAN_OPT, WAN_OPT, MOBILE_OPT, or TCP_LEGACY is required. Default is TCP
- ex_listener_ip_address (
str
) – Must be a valid IPv4 in dot-decimal notation (x.x.x.x).
Return type: LoadBalancer
- name (
-
destroy_balancer
(balancer)[source]¶ Destroy a load balancer (virtual listener)
Parameters: balancer ( LoadBalancer
) – LoadBalancer which should be usedReturns: True
if the destroy was successful, otherwiseFalse
.Return type: bool
-
ex_create_node
(network_domain_id, name, ip, ex_description=None, 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 sec - connection_rate_limit (
int
) – Maximum number of concurrent sessions
Returns: Instance of
NttCisVIPNode
Return type: NttCisVIPNode
-
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
ofNttCisDefaultHealthMonitor
) – A list of health monitors to use for the pool. - service_down_action (
str
) – What to do when node is unavailable NONE, DROP or RESELECT - slow_ramp_time (
int
) – Number of seconds to stagger ramp up of nodes
Returns: Instance of
NttCisPool
Return type: NttCisPool
-
ex_create_pool_member
(pool, node, port=None)[source]¶ Create a new member in an existing pool from an existing node
Parameters: - pool (
NttCisPool
) – Instance ofNttCisPool
(required) - node (
NttCisVIPNode
) – Instance ofNttCisVIPNode
(required) - port (
str
) – Port the the service will listen on
Returns: The node member, instance of
NttCisPoolMember
Return type: NttCisPoolMember
- pool (
-
ex_create_ssl_offload_profile
(netowrk_domain_id, name, ssl_domain_cert_id, description=None, ciphers=None, ssl_cert_chain_id=None)[source]¶ Creates an SSL Offload profile
Parameters: - network_domain_id – The network domain’s Id
- name (
str
) – Offload profile’s name - ssl_domain_cert_id (
str
) – Certificate’s Id - description (
str
) – (Optional) Profile’s description - ciphers – (Optional) The default cipher string is:
“MEDIUM:HIGH:!EXPORT:!ADH:!MD5:!RC4:!SSLv2:!SSLv3: !ECDHE+AES-GCM:!ECDHE+AES:!ECDHE+3DES:!ECDHE_ECDSA: !ECDH_RSA:!ECDH_ECDSA:@SPEED” It is possible to choose just a subset of this string :type ciphers:
str
:param ssl_cert_chain_id: (Optional) Bind the certificate chain to the profile. :type ssl_cert_chain_id: str` :returns:bool
-
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', optimization_profile='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 (
NttCisPool
) – The pool to use for the listener - listener_ip_address (
str
) – The IPv4 Address of the virtual listener - persistence_profile (
NttCisPersistenceProfile
) – Persistence profile - fallback_persistence_profile (
NttCisPersistenceProfile
) – Fallback persistence profile - irule (
NttCisDefaultiRule
) – The iRule to apply - protocol (
str
) – For STANDARD type, ANY, TCP or UDP for PERFORMANCE_LAYER_4 choice of ANY, TCP, UDP, HTTP - optimization_profile – For STANDARD type and protocol TCP an optimization type of TCP, LAN_OPT, WAN_OPT, MOBILE_OPT, or TCP_LEGACY is required. Default is ‘TCP’.
- connection_limit (
int
) – Maximum number of concurrent connections per sec - connection_rate_limit (
int
) – Maximum number of concurrent sessions - source_port_preservation (
str
) – Choice of PRESERVE, PRESERVE_STRICT or CHANGE
Returns: Instance of the listener
Return type: NttCisVirtualListener
-
ex_delete_ssl_certificate_chain
(cert_chain_id)[source]¶ Deletes a certificate chain
Parameters: cert_chain_id ( str
) – Id of certificate chain to delete:return
bool
-
ex_delete_ssl_domain_certificate
(dom_cert_id)[source]¶ Deletes an SSL domain certificate
Parameters: dom_cert_id ( str
) – Id of certificate to deleteReturns: bool
-
ex_delete_ssl_offload_profile
(profile_id)[source]¶ Delete an offload profile
Parameters: profile_id ( str
) – Id of profile to be deletedReturns: bool
-
ex_destroy_node
(node_id)[source]¶ Destroy a specific node
Parameters: node_id ( str
) – The ID of of aNttCisVIPNode
Returns: True
for success,False
for failureReturn type: bool
-
ex_destroy_pool
(pool)[source]¶ Destroy an existing pool
Parameters: pool ( NttCisPool
) – The instance ofNttCisPool
to destroyReturns: True
for success,False
for failureReturn type: bool
-
ex_destroy_pool_member
(member, destroy_node=False)[source]¶ Destroy a specific member of a pool
Parameters: - pool (
NttCisPoolMember
) – The instance of a pool member - destroy_node (
bool
) – Also destroy the associated node
Returns: True
for success,False
for failureReturn type: bool
- pool (
-
ex_edit_ssl_offload_profile
(profile_id, name, ssl_domain_cert_id, description=None, ciphers=None, ssl_cert_chain_id=None)[source]¶ The function edits the ssl offload profile
Parameters: - profil_id – The id of the profile to be edited
- name (
str
) – The name of the profile, new name or previous name - ssl_domain_cert_id (
str
) – The certificate id to use, new or current - description (
str
) – (Optional) Profile’s description - ciphers (
str
) – (Optional) String of acceptable ciphers to use - ssl_cert_chain_id – If using a certificate chain
or changing to a new one :type: ssl_cert_chain_id:
str
:returns: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)[source]¶ Get the default health monitors available for a network domain
Parameters: network_domain_id ( str
) – The ID of of aNttCisNetworkDomain
Return type: list of NttCisDefaultHealthMonitor
-
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 aNttCisNetworkDomain
Return type: list of NttCisDefaultiRule
-
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 aNttCisNetworkDomain
Return type: list of NttCisPersistenceProfile
-
ex_get_node
(node_id)[source]¶ Get the node specified by node_id
Returns: Returns an instance of NttCisVIPNode
Return type: Instance of NttCisVIPNode
-
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 organizationReturns: Returns an list
ofNttCisVIPNode
Return type: list
ofNttCisVIPNode
-
ex_get_pool
(pool_id)[source]¶ Get a specific pool inside the current geography
Parameters: pool_id ( str
) – The identifier of the poolReturns: Returns an instance of NttCisPool
Return type: NttCisPool
-
ex_get_pool_member
(pool_member_id)[source]¶ Get a specific member of a pool
Parameters: pool ( str
) – The id of a pool memberReturns: Returns an instance of NttCisPoolMember
Return type: NttCisPoolMember
-
ex_get_pool_members
(pool_id)[source]¶ Get the members of a pool
Parameters: pool ( NttCisPool
) – The instance of a poolReturns: Returns an list
ofNttCisPoolMember
Return type: list
ofNttCisPoolMember
-
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 organizationReturns: Returns a list
of typeNttCisPool
Return type: list
ofNttCisPool
-
ex_get_ssl_certificate_chain
(chain_id)[source]¶ Function gets the certificate chain by id. Use this if only if the id is already known :param cert_id: The id of the specific cert :return: :class: `NttCiscertificatechain
-
ex_get_ssl_domain_cert
(cert_id)[source]¶ Function gets the cert by id. Use this if only if the id is already known
Parameters: cert_id ( str
) – The id of the specific certReturns: class: `NttCisdomaincertificate
-
ex_import_ssl_cert_chain
(network_domain_id, name, chain_crt_file, description=None)[source]¶ Import an ssl certificate chain for ssl offloading onto the the load balancer
Parameters: - network_domain_id (
str
) – The Network Domain’s Id. - name (
str
) – The name of the ssl certificate chain - chain_crt_file (
str
) – The complete path to the certificate chain file - description (
str
) – (Optional) A description of the certificate chain
Returns: bool
- network_domain_id (
-
ex_import_ssl_domain_certificate
(network_domain_id, name, crt_file, key_file, description=None)[source]¶ Import an ssl cert for ssl offloading onto the the load balancer
Parameters: - network_domain_id (
str
) – The Network Domain’s Id. - name (
str
) – The name of the ssl certificate - crt_file (
str
) – The complete path to the certificate file - key_file (
str
) – The complete pathy to the key file - description – (Optional) A description of the certificate
Returns: bool
- network_domain_id (
-
ex_list_ssl_certificate_chains
(params={})[source]¶ Functions takes a named parameter that can be one or none of the following to filter returned items
Parameters: params – A sequence of comma separated keyword arguments - and a value
- id=
- network_domain_id=
- name=
- state=
- create_time=
- expiry_time=
Returns: list of :class: NttCissslcertficiatechain
-
ex_list_ssl_domain_certs
(params={})[source]¶ Functions takes a named parameter that can be one or none of the following
Parameters: params – A sequence of comma separated keyword arguments - and a value
- id=
- network_domain_id=
- name=
- state=
- create_time=
- expiry_time=
Returns: list of :class: NttCisDomaincertificate
-
ex_list_ssl_offload_profiles
(params={})[source]¶ Functions takes a named parameter that can be one or none of the following to filter returned items
Parameters: params – A sequence of comma separated keyword arguments - and a value
- id=
- network_domain_id=
- datacenter_id=
- name=
- state=
- ssl_domain_certificate_id=
- ssl_domain_certificate_name=
- ssl_certificate_chain_id=
- ssl_certificate_chain_name=
- create_time=
Returns: list of :class: NttCisSslssloffloadprofile
-
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 (
NttCisNode
) – The instance ofNttCisNode
to update - enabled (
bool
) – The target state of the node
Returns: The instance of
NttCisNode
Return type: NttCisNode
- pool (
-
ex_update_listener
(virtual_listener, **kwargs)[source]¶ Update a current virtual listener. :param virtual_listener: The listener to be updated :return: The edited version of the listener
-
ex_update_node
(node)[source]¶ Update the properties of a node
Parameters: pool ( NttCisNode
) – The instance ofNttCisNode
to updateReturns: The instance of NttCisNode
Return type: NttCisNode
-
ex_update_pool
(pool)[source]¶ Update the properties of an existing pool only method, serviceDownAction and slowRampTime are updated
Parameters: pool ( NttCisPool
) – The instance ofNttCisPool
to updateReturns: True
for success,False
for failureReturn 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 states - func (
function
) – The function to call, e.g. ex_get_vlan - poll_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
- state (
-
get_balancer
(balancer_id)[source]¶ Return a
LoadBalancer
object.Parameters: balancer_id ( str
) – id of a load balancer you want to fetchReturn type: LoadBalancer
-
list_balancers
(ex_network_domain_id=None)[source]¶ List all loadbalancers inside a geography or in given network.
In NTTC-CIS 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 organizationReturn type: list
ofLoadBalancer
-
list_protocols
()[source]¶ Return a list of supported protocols.
Since all protocols are support by NTTC-CIS, 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 used - name (
str
) – New load balancer name - algorithm (
Algorithm
) – New load balancer algorithm - protocol (
str
) – New load balancer protocol - port (
int
) – New load balancer port
Return type: LoadBalancer
- balancer (
-