# octavia.common package

## Subpackages

- octavia.common.jinja package
  - Subpackages
    - octavia.common.jinja.haproxy package
      - Subpackages
      - Module contents
    - octavia.common.jinja.logging package
      - Submodules
      - octavia.common.jinja.logging.logging_jinja_cfg module
      - Module contents
    - octavia.common.jinja.lvs package
      - Submodules
      - octavia.common.jinja.lvs.jinja_cfg module
      - Module contents
  - Submodules
  - octavia.common.jinja.user_data_jinja_cfg module
    - `UserDataJinjaCfg`
      - `UserDataJinjaCfg.build_user_data_config()`
  - Module contents
- octavia.common.tls_utils package
  - Submodules
  - octavia.common.tls_utils.cert_parser module
    - `build_pem()`
    - `get_cert_expiration()`
    - `get_host_names()`
    - `get_intermediates_pems()`
    - `get_primary_cn()`
    - `load_certificates_data()`
    - `prepare_private_key()`
    - `validate_cert()`
  - Module contents

## Submodules

## octavia.common.base_taskflow module

class BaseTaskFlowEngine

  Bases: `object`

  This is the task flow engine

  Use this engine to start/load flows in the code

  taskflow_load(flow, **kwargs)

class DynamicLoggingConductor(name, jobboard, persistence=None, engine=None, engine_options=None, wait_timeout=None, log=None, max_simultaneous_jobs=1)

  Bases: `BlockingConductor`

class ExtendExpiryDynamicLoggingConductor(name, jobboard, persistence=None, engine=None, engine_options=None, wait_timeout=None, log=None, max_simultaneous_jobs=1)

  Bases: `DynamicLoggingConductor`

class ExtendExpiryListener(engine, job)

  Bases: `Listener`

class FilteredJob(board, name, uuid=None, details=None, backend=None, book=None, book_data=None)

  Bases: `Job`

class JobDetailsFilter(name='')

  Bases: `Filter`

  filter(record)

    Determine if the specified record is to be logged.

    Returns True if the record should be logged, or False otherwise. If deemed appropriate, the record may be modified in-place.

class TaskFlowServiceController(driver)

  Bases: `object`

  run_conductor(name)
  run_poster(flow_factory, *args, **kwargs)

retryMaskFilter(record)

## octavia.common.clients module

class CinderAuth

  Bases: `object`

  cinder_client = None
  classmethod get_cinder_client(region, service_name=None, endpoint=None, endpoint_type='publicURL', insecure=False, cacert=None)

    Create cinder client object.

    Parameters:

      - region – The region of the service

      - service_name – The name of the cinder service in the catalog

      - endpoint – The endpoint of the service

      - endpoint_type – The endpoint type of the service

      - insecure – Turn off certificate validation

      - cacert – CA Cert file path

    Returns:

      a Cinder Client object

    Raises:

      Exception – if the client cannot be created

class GlanceAuth

  Bases: `object`

  classmethod get_glance_client(region, service_name=None, endpoint=None, endpoint_type='publicURL', insecure=False, cacert=None)

    Create glance client object.

    Parameters:

      - region – The region of the service

      - service_name – The name of the glance service in the catalog

      - endpoint – The endpoint of the service

      - endpoint_type – The endpoint_type of the service

      - insecure – Turn off certificate validation

      - cacert – CA Cert file path

    Returns:

      a Glance Client object.

    Raises:

      Exception – if the client cannot be created

  glance_client = <glanceclient.v2.client.Client object>

class NeutronAuth

  Bases: `object`

  classmethod get_neutron_client()

    Create neutron client object.

  classmethod get_user_neutron_client(context)

    Get neutron client for request user.

    It’s possible that the token in the context is a trust scoped which can’t be used to initialize a keystone session. We directly use the token and endpoint_url to initialize neutron client.

  neutron_client = None

class NovaAuth

  Bases: `object`

  classmethod get_nova_client(region, service_name=None, endpoint=None, endpoint_type='publicURL', insecure=False, cacert=None)

    Create nova client object.

    Parameters:

      - region – The region of the service

      - service_name – The name of the nova service in the catalog

      - endpoint – The endpoint of the service

      - endpoint_type – The type of the endpoint

      - insecure – Turn off certificate validation

      - cacert – CA Cert file path

    Returns:

      a Nova Client object.

    Raises:

      Exception – if the client cannot be created

  nova_client = <novaclient.v2.client.Client object>

## octavia.common.config module

Routines for configuring Octavia

handle_neutron_deprecations()

init(args, **kwargs)

register_cli_opts()

register_ks_options(group)

set_cors_middleware_defaults()

  Update default configuration options for oslo.middleware.

set_lib_defaults()

  Update default value for configuration options from other namespace.

  Example, oslo lib config options. This is needed for config generator tool to pick these default value changes. https://docs.openstack.org/oslo.config/latest/cli/ generator.html#modifying-defaults-from-other-namespaces

setup_logging(conf)

  Sets up the logging options for a log with supplied name.

  Parameters:

    conf – a cfg.ConfOpts object

setup_remote_debugger()

  Required setup for remote debugging.

## octavia.common.constants module

## octavia.common.context module

class RequestContext(user_id=None, **kwargs)

  Bases: `RequestContext`

  property session

## octavia.common.data_models module

class AdditionalVip(load_balancer_id=None, ip_address=None, subnet_id=None, network_id=None, port_id=None, load_balancer=None)

  Bases: `BaseDataModel`

class Amphora(id=None, load_balancer_id=None, compute_id=None, status=None, lb_network_ip=None, vrrp_ip=None, ha_ip=None, vrrp_port_id=None, ha_port_id=None, load_balancer=None, role=None, cert_expiration=None, cert_busy=False, vrrp_interface=None, vrrp_id=None, vrrp_priority=None, cached_zone=None, created_at=None, updated_at=None, image_id=None, compute_flavor=None)

  Bases: `BaseDataModel`

  delete()

class AmphoraHealth(amphora_id=None, last_update=None, busy=False)

  Bases: `BaseDataModel`

class AmphoraMemberPort(port_id=None, amphora_id=None, network_id=None, created_at=None, updated_at=None)

  Bases: `BaseDataModel`

class AvailabilityZone(name=None, description=None, enabled=None, availability_zone_profile_id=None)

  Bases: `BaseDataModel`

class AvailabilityZoneProfile(id=None, name=None, provider_name=None, availability_zone_data=None)

  Bases: `BaseDataModel`

class BaseDataModel

  Bases: `object`

  classmethod from_dict(dict)
  to_dict(calling_classes=None, recurse=False, **kwargs)

    Converts a data model to a dictionary.

  update(update_dict)

    Generic update method which works for simple,

    non-relational attributes.

class Flavor(id=None, name=None, description=None, enabled=None, flavor_profile_id=None)

  Bases: `BaseDataModel`

class FlavorProfile(id=None, name=None, provider_name=None, flavor_data=None)

  Bases: `BaseDataModel`

class HealthMonitor(id=None, project_id=None, pool_id=None, type=None, delay=None, timeout=None, fall_threshold=None, rise_threshold=None, http_method=None, url_path=None, expected_codes=None, enabled=None, pool=None, name=None, provisioning_status=None, operating_status=None, created_at=None, updated_at=None, tags=None, http_version=None, domain_name=None)

  Bases: `BaseDataModel`

  delete()

class L7Policy(id=None, name=None, description=None, listener_id=None, action=None, redirect_pool_id=None, redirect_url=None, position=None, listener=None, redirect_pool=None, enabled=None, l7rules=None, provisioning_status=None, operating_status=None, project_id=None, created_at=None, updated_at=None, redirect_prefix=None, tags=None, redirect_http_code=None)

  Bases: `BaseDataModel`

  delete()
  update(update_dict)

    Generic update method which works for simple,

    non-relational attributes.

class L7Rule(id=None, l7policy_id=None, type=None, enabled=None, compare_type=None, key=None, value=None, l7policy=None, invert=False, provisioning_status=None, operating_status=None, project_id=None, created_at=None, updated_at=None, tags=None)

  Bases: `BaseDataModel`

  delete()

class Listener(id=None, project_id=None, name=None, description=None, default_pool_id=None, load_balancer_id=None, protocol=None, protocol_port=None, connection_limit=None, enabled=None, provisioning_status=None, operating_status=None, tls_certificate_id=None, stats=None, default_pool=None, load_balancer=None, sni_containers=None, peer_port=None, l7policies=None, pools=None, insert_headers=None, created_at=None, updated_at=None, timeout_client_data=None, timeout_member_connect=None, timeout_member_data=None, timeout_tcp_inspect=None, tags=None, client_ca_tls_certificate_id=None, client_authentication=None, client_crl_container_id=None, allowed_cidrs=None, tls_ciphers=None, tls_versions=None, alpn_protocols=None, hsts_max_age=None, hsts_include_subdomains=None, hsts_preload=None)

  Bases: `BaseDataModel`

  delete()
  update(update_dict)

    Generic update method which works for simple,

    non-relational attributes.

class ListenerCidr(listener_id=None, cidr=None)

  Bases: `BaseDataModel`

  to_dict(**kwargs)

    Converts a data model to a dictionary.

class ListenerStatistics(listener_id=None, amphora_id=None, bytes_in=0, bytes_out=0, active_connections=0, total_connections=0, request_errors=0, received_time=0.0)

  Bases: `BaseDataModel`

  db_fields()
  get_stats()

class LoadBalancer(id=None, project_id=None, name=None, description=None, provisioning_status=None, operating_status=None, enabled=None, topology=None, vip=None, listeners=None, amphorae=None, pools=None, vrrp_group=None, server_group_id=None, created_at=None, updated_at=None, provider=None, tags=None, flavor_id=None, availability_zone=None, additional_vips=None)

  Bases: `BaseDataModel`

  update(update_dict)

    Generic update method which works for simple,

    non-relational attributes.

class LoadBalancerStatistics(bytes_in=0, bytes_out=0, active_connections=0, total_connections=0, request_errors=0, listeners=None)

  Bases: `BaseDataModel`

  get_stats()

class Member(id=None, project_id=None, pool_id=None, ip_address=None, protocol_port=None, weight=None, backup=None, enabled=None, subnet_id=None, operating_status=None, pool=None, created_at=None, updated_at=None, provisioning_status=None, name=None, monitor_address=None, monitor_port=None, tags=None, vnic_type=None)

  Bases: `BaseDataModel`

  delete()

class Pool(id=None, project_id=None, name=None, description=None, protocol=None, lb_algorithm=None, enabled=None, operating_status=None, members=None, health_monitor=None, session_persistence=None, load_balancer_id=None, load_balancer=None, listeners=None, l7policies=None, created_at=None, updated_at=None, provisioning_status=None, tags=None, tls_certificate_id=None, ca_tls_certificate_id=None, crl_container_id=None, tls_enabled=None, tls_ciphers=None, tls_versions=None, alpn_protocols=None)

  Bases: `BaseDataModel`

  delete()
  update(update_dict)

    Generic update method which works for simple,

    non-relational attributes.

class Quotas(project_id=None, load_balancer=None, listener=None, pool=None, health_monitor=None, member=None, l7policy=None, l7rule=None, in_use_health_monitor=None, in_use_listener=None, in_use_load_balancer=None, in_use_member=None, in_use_pool=None, in_use_l7policy=None, in_use_l7rule=None)

  Bases: `BaseDataModel`

class SNI(listener_id=None, position=None, listener=None, tls_container_id=None)

  Bases: `BaseDataModel`

  to_dict(**kwargs)

    Converts a data model to a dictionary.

class SessionPersistence(pool_id=None, type=None, cookie_name=None, pool=None, persistence_timeout=None, persistence_granularity=None)

  Bases: `BaseDataModel`

  delete()

class TLSContainer(id=None, primary_cn=None, certificate=None, private_key=None, passphrase=None, intermediates=None)

  Bases: `BaseDataModel`

class VRRPGroup(load_balancer_id=None, vrrp_group_name=None, vrrp_auth_type=None, vrrp_auth_pass=None, advert_int=None, smtp_server=None, smtp_connect_timeout=None, load_balancer=None)

  Bases: `BaseDataModel`

class Vip(load_balancer_id=None, ip_address=None, subnet_id=None, network_id=None, port_id=None, load_balancer=None, qos_policy_id=None, octavia_owned=None, vnic_type=None, sg_ids=None)

  Bases: `BaseDataModel`

  to_dict(**kwargs)

    Converts a data model to a dictionary.

class VipSecurityGroup(load_balancer_id: str = None, sg_id: str = None)

  Bases: `BaseDataModel`

## octavia.common.decorators module

Decorators to provide backwards compatibility for V1 API.

rename_kwargs(**renamed_kwargs)

  Renames a class’s variables and maintains backwards compatibility.

  Parameters:

    renamed_kwargs – mapping of old kwargs to new kwargs. For example, to say a class has renamed variable foo to bar the decorator would be used like: rename_kwargs(foo=’bar’)

## octavia.common.exceptions module

Octavia base exception handling.

exception APIException(**kwargs)

  Bases: `HTTPClientError`

  code = 500
  msg = 'Something unknown went wrong'

exception AmphoraNetworkConfigException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Cannot configure network resource in the amphora: %(detail)s'

exception CertificateGenerationException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Could not sign the certificate request: %(msg)s'

exception CertificateRetrievalException(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'Could not retrieve certificate: %(ref)s'

exception CertificateStorageException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Could not store certificate: %(msg)s'

exception ComputeBuildException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Failed to build compute instance due to: %(fault)s'

exception ComputeBuildQueueTimeoutException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Failed to get an amphora build slot.'

exception ComputeDeleteException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Failed to delete compute instance. The compute service reports: %(compute_msg)s'

exception ComputeGetException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Failed to retrieve compute instance.'

exception ComputeGetInterfaceException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Failed to retrieve compute virtual interfaces.'

exception ComputeNoResourcesException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'The compute service does not have the resources available to fulfill the request'

exception ComputePortInUseException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Compute driver reports port %(port)s is already in use.'

exception ComputeStatusException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Failed to retrieve compute instance status.'

exception ComputeUnknownException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Unknown exception from the compute driver: %(exc)s.'

exception ComputeWaitTimeoutException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Waiting for compute id %(id)s to go active timeout.'

exception DisabledOption(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'The selected %(option)s is not allowed in this deployment: %(value)s'

exception DuplicateHealthMonitor(**kwargs)

  Bases: `APIException`

  code = 409
  msg = 'This pool already has a health monitor'

exception DuplicateListenerEntry(**kwargs)

  Bases: `APIException`

  code = 409
  msg = 'Another Listener on this Load Balancer is already using protocol %(protocol)s and protocol_port %(port)d'

exception DuplicateMemberEntry(**kwargs)

  Bases: `APIException`

  code = 409
  msg = 'Another member on this pool is already using ip %(ip_address)s on protocol_port %(port)d'

exception DuplicatePoolEntry(**kwargs)

  Bases: `APIException`

  code = 409
  msg = 'This listener already has a default pool'

exception IDAlreadyExists(**kwargs)

  Bases: `APIException`

  code = 409
  msg = 'Already an entity with that specified id.'

exception ImageGetException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Failed to retrieve image with %(tag)s tag.'

exception ImmutableObject(**kwargs)

  Bases: `APIException`

  code = 409
  msg = '%(resource)s %(id)s is immutable and cannot be updated.'

exception InputFileError(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Error with file %(file_name)s. Reason: %(reason)s'

exception InvalidAmphoraOperatingSystem(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Invalid amphora operating system: %(os_name)s'

exception InvalidFilterArgument(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'One or more arguments are either duplicate or invalid'

exception InvalidHMACException(*args, **kwargs)

  Bases: `OctaviaException`

  message = "HMAC hashes didn't match"

exception InvalidIPAddress(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'The IP Address %(ip_addr)s is invalid.'

exception InvalidL7PolicyAction(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'Invalid L7 Policy action specified: %(action)s'

exception InvalidL7PolicyArgs(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'Invalid L7 Policy arguments: %(msg)s'

exception InvalidL7Rule(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Invalid L7 Rule: %(msg)s'

exception InvalidLimit(**kwargs)

  Bases: `APIException`

  code = 400
  msg = "Supplied pagination limit '%(key)s' is not valid."

exception InvalidMarker(**kwargs)

  Bases: `APIException`

  code = 400
  msg = "Supplied pagination marker '%(key)s' is not valid."

exception InvalidOption(**kwargs)

  Bases: `APIException`

  code = 400
  msg = '%(value)s is not a valid option for %(option)s'

exception InvalidRegex(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Unable to parse regular expression: %(e)s'

exception InvalidSortDirection(**kwargs)

  Bases: `APIException`

  code = 400
  msg = "Supplied sort direction '%(key)s' is not valid."

exception InvalidSortKey(**kwargs)

  Bases: `APIException`

  code = 400
  msg = "Supplied sort key '%(key)s' is not valid."

exception InvalidString(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Invalid characters in %(what)s'

exception InvalidSubresource(**kwargs)

  Bases: `APIException`

  code = 400
  msg = '%(resource)s %(id)s not found.'

exception InvalidTopology(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Invalid topology specified: %(topology)s'

exception InvalidURL(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Not a valid URL: %(url)s'

exception InvalidURLPath(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'Not a valid URLPath: %(url_path)s'

exception L7RuleValidation(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'Error parsing L7Rule: %(error)s'

exception LBPendingStateError(**kwargs)

  Bases: `APIException`

  code = 409
  msg = 'Invalid state %(state)s of loadbalancer resource %(id)s'

exception ListenerNoChildren(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'Protocol %(protocol)s listeners cannot have child objects.'

exception MemberSRIOVDisabled(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'The load balancer flavor does not allow SR-IOV member ports.'

exception MisMatchedKey(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Key and x509 certificate do not match'

exception MissingAPIProjectID(**kwargs)

  Bases: `APIException`

  code = 400
  message = 'Missing project ID in request where one is required.'

exception MissingArguments(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Missing arguments.'

exception MissingCertSubject(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'No CN or DNSName(s) found in certificate. The certificate is invalid.'

exception MissingProjectID(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Missing project ID in request where one is required.'

exception MissingVIPSecurityGroup(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'VIP security group is missing for load balancer: %(lb_id)s'

exception NeedsPassphrase(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Passphrase needed to decrypt key but client did not provide one.'

exception NetworkConfig(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Unable to allocate network resource from config'

exception NetworkServiceError(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'The networking service had a failure: %(net_error)s'

exception NoReadyAmphoraeException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'There are not any READY amphora available.'

exception NotFound(**kwargs)

  Bases: `APIException`

  code = 404
  msg = '%(resource)s %(id)s not found.'

exception ObjectInUse(**kwargs)

  Bases: `APIException`

  code = 409
  msg = '%(object)s %(id)s is in use and cannot be modified.'

exception OctaviaException(*args, **kwargs)

  Bases: `Exception`

  Base Octavia Exception.

  To correctly use this class, inherit from it and define a ‘message’ property. That message will get printf’d with the keyword arguments provided to the constructor.

  message = 'An unknown exception occurred.'
  orig_code = None
  orig_msg = None
  static use_fatal_exceptions()

exception PolicyForbidden(**kwargs)

  Bases: `APIException`

  code = 403
  msg = 'Policy does not allow this request to be performed.'

exception PoolInUseByL7Policy(**kwargs)

  Bases: `APIException`

  code = 409
  msg = 'Pool %(id)s is in use by L7 policy %(l7policy_id)s'

exception ProjectBusyException(**kwargs)

  Bases: `APIException`

  code = 503
  msg = 'Project busy. Unable to lock the project. Please try again.'

exception ProviderDriverError(**kwargs)

  Bases: `APIException`

  code = 500
  msg = "Provider '%(prov)s' reports error: %(user_msg)s"

exception ProviderFlavorMismatchError(**kwargs)

  Bases: `APIException`

  code = 400
  msg = "Flavor '%(flav)s' is not compatible with provider '%(prov)s'"

exception ProviderNotEnabled(**kwargs)

  Bases: `APIException`

  code = 400
  msg = "Provider '%(prov)s' is not enabled."

exception ProviderNotFound(**kwargs)

  Bases: `APIException`

  code = 501
  msg = "Provider '%(prov)s' was not found."

exception ProviderNotImplementedError(**kwargs)

  Bases: `APIException`

  code = 501
  msg = "Provider '%(prov)s' does not support a requested action: %(user_msg)s"

exception ProviderUnsupportedOptionError(**kwargs)

  Bases: `APIException`

  code = 501
  msg = "Provider '%(prov)s' does not support a requested option: %(user_msg)s"

exception QuotaException(**kwargs)

  Bases: `APIException`

  code = 403
  msg = 'Quota has been met for resources: %(resource)s'

exception RecordAlreadyExists(**kwargs)

  Bases: `APIException`

  code = 409
  msg = 'A %(field)s of %(name)s already exists.'

exception ServerGroupObjectCreateException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Failed to create server group object.'

exception ServerGroupObjectDeleteException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Failed to delete server group object.'

exception SingleCreateDetailsMissing(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'Missing details for %(type)s object: %(name)s'

exception TooManyL7RulesOnL7Policy(**kwargs)

  Bases: `APIException`

  code = 409
  msg = 'Too many rules on L7 policy %(id)s'

exception UnreadableCert(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Could not read X509 from PEM'

exception UnreadablePKCS12(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'The PKCS12 bundle is unreadable. Please check the PKCS12 bundle validity. In addition, make sure it does not require a pass phrase. Error: %(error)s'

exception VIPAddressConflict(**kwargs)

  Bases: `APIException`

  code = 409
  msg = 'The VIP IP address is already in use: %(msg)s'

exception VIPValidationException(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'Validation failure: VIP must contain one of: %(objects)s.'

exception ValidationException(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'Validation failure: %(detail)s'

exception VolumeDeleteException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Failed to delete volume instance.'

exception VolumeGetException(*args, **kwargs)

  Bases: `OctaviaException`

  message = 'Failed to retrieve volume instance.'

## octavia.common.keystone module

class KeystoneSession(section='service_auth')

  Bases: `object`

  get_auth()
  get_service_user_id()
  get_session(auth=None)

    Initializes a Keystone session.

    Returns:

      a Keystone Session object

class SkippingAuthProtocol(app, conf)

  Bases: `AuthProtocol`

  SkippingAuthProtocol to reach special endpoints

  Bypasses keystone authentication for special request paths, such as the api version discovery path.

  Note:

    SkippingAuthProtocol is lean customization of `keystonemiddleware.auth_token.AuthProtocol` that disables keystone communication if the request path is in the _NOAUTH_PATHS list.

  process_request(request)

    Process request.

    Evaluate the headers in a request and attempt to authenticate the request. If authenticated then additional headers are added to the request for use by applications. If not authenticated the request will be rejected or marked unauthenticated depending on configuration.

## octavia.common.policy module

Policy Engine For Octavia.

class IsAdminCheck(kind, match)

  Bases: `Check`

  An explicit check for is_admin.

class Policy(conf=<oslo_config.cfg.ConfigOpts object>, policy_file=None, rules=None, default_rule=None, use_conf=True, overwrite=True)

  Bases: `Enforcer`

  authorize(action, target, context, do_raise=True, exc=None)

    Verifies that the action is valid on the target in this context.

    Parameters:

      - context – The oslo context for this request.

      - action – string representing the action to be checked this should be colon separated for clarity. i.e. `compute:create_instance`, `compute:attach_volume`, `volume:attach_volume`

      - target – dictionary representing the object of the action for object creation this should be a dictionary representing the location of the object e.g. `{'project_id': context.project_id}`

      - do_raise – if True (the default), raises PolicyForbidden; if False, returns False

      - exc – Class of the exceptions to raise if the check fails. Any remaining arguments passed to `enforce()` (both positional and keyword arguments) will be passed to the exceptions class. If not specified, `PolicyForbidden` will be used.

    Raises:

      PolicyForbidden – if verification fails and do_raise is True. Or if ‘exc’ is specified it will raise an exceptions of that type.

    Returns:

      returns a non-False value (not necessarily “True”) if authorized, and the exact value False if not authorized and do_raise is False.

  check_is_admin(context)

    Does roles contains ‘admin’ role according to policy setting.

  get_rules()

get_enforcer()

get_no_context_enforcer()

reset()

## octavia.common.rpc module

cleanup()

create_transport(url)

get_client(target, version_cap=None, serializer=None, call_monitor_timeout=None)

get_notifier(service=None, host=None, publisher_id=None)

get_server(target, endpoints, access_policy=<class 'oslo_messaging.rpc.dispatcher.DefaultRPCAccessPolicy'>, serializer=None)

get_transport_url(url_str=None)

init()

## octavia.common.service module

prepare_service(argv=None)

  Sets global config from config file and sets up logging.

## octavia.common.stats module

class StatsMixin

  Bases: `object`

  get_listener_stats(session, listener_id)

    Gets the listener statistics data_models object.

  get_loadbalancer_stats(session, loadbalancer_id)

## octavia.common.utils module

Utilities and helper functions.

b(s)

base64_sha1_string(string_to_hash)

  Get a b64-encoded sha1 hash of a string. Not intended to be secure!

class exception_logger(logger=None)

  Bases: `object`

  Wrap a function and log raised exception

  Parameters:

    logger – the logger to log the exception default is LOG.exception

  Returns:

    origin value if no exception raised; re-raise the exception if any occurred

expand_expected_codes(codes)

  Expand the expected code string in set of codes.

  200-204 -> 200, 201, 202, 204 200, 203 -> 200, 203

get_amphora_driver()

get_compatible_value(value)

get_hostname()

get_network_driver() → network_base.AbstractNetworkDriver

get_server_certs_key_passphrases_fernet() → MultiFernet

  Get a cryptography.MultiFernet with loaded keys.

get_vip_security_group_name(loadbalancer_id)

ip_netmask_to_cidr(ip, netmask)

ip_port_str(ip_address, port)

  Return IP port as string representation depending on address family.

ip_version(ip_address)

is_cidr_ipv6(cidr)

  Check if CIDR is IPv6 address with subnet prefix.

is_ipv4(ip_address)

  Check if ip address is IPv4 address.

is_ipv6(ip_address)

  Check if ip address is IPv6 address.

is_ipv6_lla(ip_address)

  Check if ip address is IPv6 link local address.

map_protocol_to_nftable_protocol(rule_dict)

netmask_to_prefix(netmask)

subnet_ip_availability(nw_ip_avail, subnet_id, req_num_ips)

## octavia.common.validate module

Several handy validation functions that go beyond simple type checking. Defined here so these can also be used at deeper levels than the API.

check_alpn_protocols(protocols)

check_cipher_prohibit_list(cipherstring)

check_default_ciphers_prohibit_list_conflict()

check_default_tls_versions_min_conflict()

check_hsts_options(listener: dict)

check_hsts_options_put(listener: octavia.api.v2.types.listener.ListenerPUT, db_listener: Listener)

check_port_in_use(port)

  Raise an exception when a port is used.

check_session_persistence(SP_dict)

check_tls_version_list(versions)

check_tls_version_min(versions, message=None)

  Checks a TLS version string against the configured minimum.

cookie_value_string(value, what=None)

  Raises an error if the value string contains invalid characters.

header_name(header, what=None)

  Raises an error if header does not look like an HTML header name.

header_value_string(value, what=None)

  Raises an error if the value string contains invalid characters.

ip_not_reserved(ip_address)

is_ip_member_of_cidr(address, cidr)

l7rule_data(l7rule)

  Raises an error if the l7rule given is invalid in some way.

network_allowed_by_config(network_id, valid_networks=None)

network_exists_optionally_contains_subnet(network_id, subnet_id=None, context=None)

  Raises an exception when a network does not exist.

  If a subnet is provided, also validate the network contains that subnet.

port_exists(port_id, context=None)

  Raises an exception when a port does not exist.

qos_extension_enabled(network_driver)

qos_policy_exists(qos_policy_id)

regex(regex)

  Raises an error if the string given is not a valid regex.

sanitize_l7policy_api_args(l7policy, create=False)

  Validate and make consistent L7Policy API arguments.

  This method is mainly meant to sanitize L7 Policy create and update API dictionaries, so that we strip ‘None’ values that don’t apply for our particular update. This method does not verify that any redirect_pool_id exists in the database, but will raise an error if a redirect_url doesn’t look like a URL.

  Parameters:

    l7policy – The L7 Policy dictionary we are sanitizing / validating

security_group_exists(sg_id: str, context: context.RequestContext = None)

  Raises an exception when a security group does not exist.

subnet_exists(subnet_id, context=None)

  Raises an exception when a subnet does not exist.

url(url, require_scheme=True)

  Raises an error if the url doesn’t look like a URL.

url_path(url_path)

  Raises an error if the url_path doesn’t look like a URL Path.

validate_l7rule_ssl_types(l7rule)

## Module contents

this page last updated: 2026-03-10 18:02:42

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.

found an error? report a bug