octavia.network package¶
Subpackages¶
Submodules¶
octavia.network.base module¶
- class AbstractNetworkDriver[source]¶
Bases:
object
This class defines the methods for a fully functional network driver.
Implementations of this interface can expect a rollback to occur if any of the non-nullipotent methods raise an exception.
- abstract allocate_vip(load_balancer)[source]¶
Allocates a virtual ip.
Reserves it for later use as the frontend connection of a load balancer.
- Parameters:
load_balancer – octavia.common.data_models.LoadBalancer instance
- Returns:
octavia.common.data_models.Vip, list(octavia.common.data_models.AdditionalVip)
- Raises:
AllocateVIPException, PortNotFound, SubnetNotFound
- abstract create_port(network_id, name=None, fixed_ips=(), secondary_ips=(), security_group_ids=(), admin_state_up=True, qos_policy_id=None, vnic_type='normal')[source]¶
Creates a network port.
fixed_ips = [{‘subnet_id’: <id>, (‘ip_address’: <IP>’)},] ip_address is optional in the fixed_ips dictionary.
- Parameters:
network_id – The network the port should be created on.
name – The name to apply to the port.
fixed_ips – A list of fixed IP dicts.
secondary_ips – A list of secondary IPs to add to the port.
security_group_ids – A list of security group IDs for the port.
qos_policy_id – The QoS policy ID to apply to the port.
- Returns port:
A port data model object.
- abstract deallocate_vip(vip)[source]¶
Removes any resources that reserved this virtual ip.
- Parameters:
vip – octavia.common.data_models.VIP instance
- Returns:
None
- Raises:
DeallocateVIPException, VIPInUseException, VIPConfiigurationNotFound
- abstract delete_port(port_id)[source]¶
Delete a network port.
- Parameters:
port_id – The port ID to delete.
- Returns:
None
- abstract failover_preparation(amphora)[source]¶
Prepare an amphora for failover.
- Parameters:
amphora – amphora object to failover
- Returns:
None
- Raises:
PortNotFound
- abstract get_network(network_id, context=None)[source]¶
Retrieves network from network id.
- Parameters:
network_id – id of an network to retrieve
context – A request context
- Returns:
octavia.network.data_models.Network
- Raises:
NetworkException, NetworkNotFound
- abstract get_network_by_name(network_name)[source]¶
Retrieves network from network name.
- Parameters:
network_name – name of a network to retrieve
- Returns:
octavia.network.data_models.Network
- Raises:
NetworkException, NetworkNotFound
- abstract get_network_configs(load_balancer, amphora=None)[source]¶
Retrieve network configurations
This method assumes that a dictionary of AmphoraNetworkConfigs keyed off of the related amphora id are returned. The configs contain data pertaining to each amphora that is later used for finalization of the entire load balancer configuration. The data provided to these configs is left up to the driver, this means the driver is responsible for providing data that is appropriate for the amphora network configurations.
Example return: {<amphora.id>: <AmphoraNetworkConfig>}
- Parameters:
load_balancer – The load_balancer configuration
amphora – Optional amphora to only query.
- Returns:
dict of octavia.network.data_models.AmphoraNetworkConfig keyed off of the amphora id the config is associated with.
- Raises:
NotFound, NetworkNotFound, SubnetNotFound, PortNotFound
- abstract get_network_ip_availability(network)[source]¶
Retrieves network IP availability.
- Parameters:
network – octavia.network.data_models.Network
- Returns:
octavia.network.data_models.Network_IP_Availability
- Raises:
NetworkException, NetworkNotFound
- abstract get_plugged_networks(compute_id)[source]¶
Retrieves the current plugged networking configuration.
- Parameters:
compute_id – id of an amphora in the compute service
- Returns:
[octavia.network.data_models.Instance]
- abstract get_port(port_id, context=None)[source]¶
Retrieves port from port id.
- Parameters:
port_id – id of a port to retrieve
context – A request context
- Returns:
octavia.network.data_models.Port
- Raises:
NetworkException, PortNotFound
- abstract get_port_by_name(port_name)[source]¶
Retrieves port from port name.
- Parameters:
port_name – name of a port to retrieve
- Returns:
octavia.network.data_models.Port
- Raises:
NetworkException, PortNotFound
- abstract get_port_by_net_id_device_id(network_id, device_id)[source]¶
Retrieves port from network id and device id.
- Parameters:
network_id – id of a network to filter by
device_id – id of a network device to filter by
- Returns:
octavia.network.data_models.Port
- Raises:
NetworkException, PortNotFound
- abstract get_security_group(sg_name)[source]¶
Retrieves the security group by it’s name.
- Parameters:
sg_name – The security group name.
- Returns:
octavia.network.data_models.SecurityGroup, None if not enabled
- Raises:
NetworkException, SecurityGroupNotFound
- abstract get_subnet(subnet_id, context=None)[source]¶
Retrieves subnet from subnet id.
- Parameters:
subnet_id – id of a subnet to retrieve
context – A request context
- Returns:
octavia.network.data_models.Subnet
- Raises:
NetworkException, SubnetNotFound
- abstract get_subnet_by_name(subnet_name)[source]¶
Retrieves subnet from subnet name.
- Parameters:
subnet_name – name of a subnet to retrieve
- Returns:
octavia.network.data_models.Subnet
- Raises:
NetworkException, SubnetNotFound
- abstract plug_aap_port(load_balancer, vip, amphora, subnet)[source]¶
Plugs the AAP port to the amp
- Parameters:
load_balancer – Load Balancer to prepare the VIP for
vip – The VIP to plug
amphora – The amphora to plug the VIP into
subnet – The subnet to plug the aap into
- abstract plug_fixed_ip(port_id, subnet_id, ip_address=None)[source]¶
Plug a fixed ip to an existing port.
If ip_address is not specified, one will be auto-assigned.
- Parameters:
port_id – id of a port to add a fixed ip
subnet_id – id of a subnet
ip_address – specific ip_address to add
- Returns:
octavia.network.data_models.Port
- Raises:
NetworkException, PortNotFound
- abstract plug_network(compute_id, network_id)[source]¶
Connects an existing amphora to an existing network.
- Parameters:
compute_id – id of an amphora in the compute service
network_id – id of a network
- Returns:
octavia.network.data_models.Interface instance
- Raises:
PlugNetworkException, AmphoraNotFound, NetworkNotFound
- abstract plug_port(amphora, port)[source]¶
Plug a neutron port in to a compute instance
- Parameters:
amphora – amphora object to plug the port into
port – port to plug into the compute instance
- Returns:
None
- Raises:
PlugNetworkException, AmphoraNotFound, NetworkNotFound
- abstract set_port_admin_state_up(port_id, state)[source]¶
Set the admin state of a port. True is up, False is down.
- Parameters:
port_id – The port ID to update.
state – True for up, False for down.
- Returns:
None
- abstract unplug_aap_port(vip, amphora, subnet)[source]¶
Unplugs the AAP port to the amp
- Parameters:
vip – The VIP to plug
amphora – The amphora to plug the VIP into
subnet – The subnet to plug the aap into
- abstract unplug_fixed_ip(port_id, subnet_id)[source]¶
Unplug a fixed ip from an existing port.
- Parameters:
port_id – id of a port to remove the fixed ip from
subnet_id – id of a subnet
- Returns:
octavia.network.data_models.Port
- Raises:
NetworkException, PortNotFound
- abstract unplug_network(compute_id, network_id)[source]¶
Disconnects an existing amphora from an existing network.
If ip_address is not specified, all the interfaces plugged on network_id should be unplugged.
- Parameters:
compute_id – id of an amphora in the compute service
network_id – id of a network
- Returns:
None
- Raises:
UnplugNetworkException, AmphoraNotFound, NetworkNotFound, NetworkException
- abstract unplug_vip(load_balancer, vip)[source]¶
Unplugs a virtual ip as the frontend connection of a load balancer.
Removes the routing of traffic from the vip to the load balancer and its amphorae.
- Parameters:
load_balancer – octavia.common.data_models.LoadBalancer instance
vip – octavia.common.data_models.VIP instance
- Returns:
octavia.common.data_models.VIP instance
- Raises:
UnplugVIPException, PluggedVIPNotFound
- update_vip(load_balancer, for_delete)[source]¶
Hook for the driver to update the VIP information.
This method will be called upon the change of a load_balancer configuration. It is an optional method to be implemented by drivers. It allows the driver to update any VIP information based on the state of the passed in load_balancer.
- Parameters:
load_balancer – octavia.common.data_models.LoadBalancer instance
for_delete – Boolean indicating if this update is for a delete
- Raises:
MissingVIPSecurityGroup
- Returns:
None
- exception AllocateVIPException(*args, **kwargs)[source]¶
Bases:
NetworkException
- exception AmphoraNotFound(*args, **kwargs)[source]¶
Bases:
NetworkException
- exception CreatePortException(*args, **kwargs)[source]¶
Bases:
NetworkException
- exception DeallocateVIPException(*args, **kwargs)[source]¶
Bases:
NetworkException
- exception NetworkException(*args, **kwargs)[source]¶
Bases:
OctaviaException
- exception NetworkNotFound(*args, **kwargs)[source]¶
Bases:
NetworkException
- exception PlugNetworkException(*args, **kwargs)[source]¶
Bases:
NetworkException
- exception PlugVIPException(*args, **kwargs)[source]¶
Bases:
NetworkException
- exception PluggedVIPNotFound(*args, **kwargs)[source]¶
Bases:
NetworkException
- exception PortNotFound(*args, **kwargs)[source]¶
Bases:
NetworkException
- exception QosPolicyNotFound(*args, **kwargs)[source]¶
Bases:
NetworkException
- exception SecurityGroupNotFound(*args, **kwargs)[source]¶
Bases:
NetworkException
- exception SubnetNotFound(*args, **kwargs)[source]¶
Bases:
NetworkException
- exception TimeoutException(*args, **kwargs)[source]¶
Bases:
NetworkException
- exception UnplugNetworkException(*args, **kwargs)[source]¶
Bases:
NetworkException
- exception UnplugVIPException(*args, **kwargs)[source]¶
Bases:
NetworkException
- exception VIPInUseException(*args, **kwargs)[source]¶
Bases:
NetworkException
octavia.network.data_models module¶
- class AdditionalVipData(ip_address=None, subnet=None)[source]¶
Bases:
BaseDataModel
- class AmphoraNetworkConfig(amphora=None, vip_subnet=None, vip_port=None, vrrp_subnet=None, vrrp_port=None, ha_subnet=None, ha_port=None, additional_vip_data=None)[source]¶
Bases:
BaseDataModel
- class Delta(amphora_id=None, compute_id=None, add_nics=None, delete_nics=None, add_subnets=None, delete_subnets=None)[source]¶
Bases:
BaseDataModel
- class FixedIP(subnet_id=None, ip_address=None, subnet=None)[source]¶
Bases:
BaseDataModel
- class FloatingIP(id=None, description=None, project_id=None, status=None, router_id=None, port_id=None, floating_network_id=None, floating_ip_address=None, fixed_ip_address=None, fixed_port_id=None)[source]¶
Bases:
BaseDataModel
- class HostRoute(nexthop=None, destination=None)[source]¶
Bases:
BaseDataModel
- class Interface(id=None, compute_id=None, network_id=None, fixed_ips=None, port_id=None)[source]¶
Bases:
BaseDataModel
- class Network(id=None, name=None, subnets=None, project_id=None, admin_state_up=None, mtu=None, provider_network_type=None, provider_physical_network=None, provider_segmentation_id=None, router_external=None, port_security_enabled=None)[source]¶
Bases:
BaseDataModel
- class Network_IP_Availability(network_id=None, tenant_id=None, project_id=None, network_name=None, total_ips=None, used_ips=None, subnet_ip_availability=None)[source]¶
Bases:
BaseDataModel
- class Port(id=None, name=None, device_id=None, device_owner=None, mac_address=None, network_id=None, status=None, project_id=None, admin_state_up=None, fixed_ips=None, network=None, qos_policy_id=None, security_group_ids=None, vnic_type='normal')[source]¶
Bases:
BaseDataModel
- class QosPolicy(id)[source]¶
Bases:
BaseDataModel
- class SecurityGroup(id=None, project_id=None, name=None, description=None, security_group_rule_ids=None, tags=None, stateful=None)[source]¶
Bases:
BaseDataModel
- class Subnet(id=None, name=None, network_id=None, project_id=None, gateway_ip=None, cidr=None, ip_version=None, host_routes=None)[source]¶
Bases:
BaseDataModel