Jump to: navigation, search

Difference between revisions of "Neutron/LBaaS/DriverAPI"

< Neutron‎ | LBaaS
 
Line 4: Line 4:
 
= Scope =
 
= Scope =
  
This document describes API for LBaaS drivers.  
+
This document describes API for LBaaS drivers.
  
In LBaaS drivers perform vendor-specific configuration of load balancing devices. The main functionality is to translate LBaaS model into vendor.
+
LBaaS drivers are responsible for translation of abstract model into vendor-specific and performing configuration of load balancing devices.
  
 
= API =
 
= API =
Line 12: Line 12:
  
 
<pre><nowiki>
 
<pre><nowiki>
create_vip (vip: VIP)
+
create_vip (vip: Vip)
update_vip (newVip: VIP, oldVip: VIP)
+
update_vip (new_vip: Vip, old_vip: Vip)
delete_vip (vip: VIP)
+
delete_vip (vip: Vip)
  
 
create_pool (pool: Pool, vip: VIP)
 
create_pool (pool: Pool, vip: VIP)
Line 35: Line 35:
 
get_capabilities ()
 
get_capabilities ()
 
</nowiki></pre>
 
</nowiki></pre>
 +
 +
 +
All update methods receive both new and old objects. It's up to driver implementors how to apply changes to the actual configuration. For some devices (like HAProxy) it would be enough to replace the old part of config with newer one. For other devices (like Cisco ACE LB) it would be easier to calculate diff between new and old object and apply diff only.
 +
 +
'''get_capabilities''' function returns a dictionary that describes options supported by device. The structure of dictionary is following:
 +
 +
<pre><nowiki>
 +
{
 +
    "lb_methods": [
 +
        "ROUND_ROBIN",
 +
        "LEAST_CONNECTION"
 +
    ],
 +
    "protocols": [
 +
        "TCP",
 +
        "HTTP"
 +
    ],
 +
    "session_persistences": [
 +
        "SOURCE",
 +
        "COOKIE"
 +
    ],
 +
    "health_monitors": [
 +
        "ICMP",
 +
        "TCP",
 +
    ]
 +
}
 +
</nowiki></pre>
 +
 +
 +
= Error Handling =
 +
 +
Driver reports errors by raising an exception. The following types of exceptions are supported by framework:
 +
 +
== [[UnsupportedFeature]] ==
 +
The exception is raised when some feature is not supported by driver.
 +
 +
''Example'': driver is asked to configure session persistence, but it doesn't support it.
 +
 +
''Parameters'':
 +
* '''name''' - the name of feature
 +
 +
== [[UnsupportedOption]] ==
 +
The exception is raised when an unsupported option is requested.
 +
 +
''Example'': driver is asked to configure 'lb_method' of type 'some_exotic' and it doesn't support it.
 +
 +
''Parameters'':
 +
* '''feature''' - the name of feature
 +
* '''option''' - the name of option
 +
 +
== [[AttributeRequired]] ==
 +
The exception is raised when object misses some mandatory attribute.
 +
 +
''Example'': driver is asked to configure cookie-based session persistence, but name of cookie is missing.
 +
 +
''Parameters:
 +
* '''name''' - the name of attribute

Revision as of 14:41, 16 November 2012

/!\ Draft

Scope

This document describes API for LBaaS drivers.

LBaaS drivers are responsible for translation of abstract model into vendor-specific and performing configuration of load balancing devices.

API

create_vip (vip: Vip)
update_vip (new_vip: Vip, old_vip: Vip)
delete_vip (vip: Vip)

create_pool (pool: Pool, vip: VIP)
update_pool (new_pool: Pool, old_pool: Pool, vip: VIP)
delete_pool (pool: Pool, vip: VIP)

create_member (member: Member, pool: Pool)
update_member (new_member: Member, old_member: Member, pool: Pool)
delete_member (member: Member, pool: Pool)

create_health_monitor (health_monitor: HealthMonitor, pool: Pool)
update_health_monitor (new_health_monitor: HealthMonitor, old_health_monitor: HealthMonitor, pool: Pool)
delete_health_monitor (health_monitor: HealthMonitor, pool: Pool)

associate_health_monitor_with_pool (health_monitor: HealthMonitor, pool: Pool)
disassociate_health_monitor_from_pool (health_monitor: HealthMonitor, pool: Pool)

get_pool_stats (pool: Pool, vip: VIP)

get_capabilities ()


All update methods receive both new and old objects. It's up to driver implementors how to apply changes to the actual configuration. For some devices (like HAProxy) it would be enough to replace the old part of config with newer one. For other devices (like Cisco ACE LB) it would be easier to calculate diff between new and old object and apply diff only.

get_capabilities function returns a dictionary that describes options supported by device. The structure of dictionary is following:

{
    "lb_methods": [
        "ROUND_ROBIN",
        "LEAST_CONNECTION"
    ],
    "protocols": [
        "TCP",
        "HTTP"
    ],
    "session_persistences": [
        "SOURCE",
        "COOKIE"
    ],
    "health_monitors": [
        "ICMP",
        "TCP",
    ]
}


Error Handling

Driver reports errors by raising an exception. The following types of exceptions are supported by framework:

UnsupportedFeature

The exception is raised when some feature is not supported by driver.

Example: driver is asked to configure session persistence, but it doesn't support it.

Parameters:

  • name - the name of feature

UnsupportedOption

The exception is raised when an unsupported option is requested.

Example: driver is asked to configure 'lb_method' of type 'some_exotic' and it doesn't support it.

Parameters:

  • feature - the name of feature
  • option - the name of option

AttributeRequired

The exception is raised when object misses some mandatory attribute.

Example: driver is asked to configure cookie-based session persistence, but name of cookie is missing.

Parameters:

  • name - the name of attribute