# octavia.amphorae.backends.utils package

## Submodules

## octavia.amphorae.backends.utils.haproxy_query module

class HAProxyQuery(stats_socket)

  Bases: `object`

  Class used for querying the HAProxy statistics socket.

  The CSV output is defined in the HAProxy documentation:

  http://cbonte.github.io/haproxy-dconv/configuration-1.4.html#9

  get_pool_status()

    Get status for each server and the pool as a whole.

    Returns:

      pool data structure {<pool-name>: { ‘uuid’: <uuid>, ‘status’: ‘UP’|’DOWN’, ‘members’: [<name>: ‘UP’|’DOWN’|’DRAIN’|’no check’] }}

  save_state(state_file_path)

    Save haproxy connection state to a file.

    Parameters:

      state_file_path – Absolute path to the state file

    Returns:

      bool (True if success, False otherwise)

  show_info()

    Get and parse output from ‘show info’ command.

  show_stat(proxy_iid=-1, object_type=-1, server_id=-1)

    Get and parse output from ‘show stat’ command.

    Parameters:

      - proxy_iid – Proxy ID (column 27 in CSV output). -1 for all.

      - object_type – Select the type of dumpable object. Values can be ORed. -1 - everything 1 - frontends 2 - backends 4 - servers

      - server_id – Server ID (column 28 in CSV output?), or -1 for everything.

    Returns:

      stats (split into an array by newline)

## octavia.amphorae.backends.utils.interface module

class InterfaceController

  Bases: `object`

  ADD = 'add'
  DELETE = 'delete'
  FLUSH = 'flush'
  SET = 'set'
  TENTATIVE_WAIT_INTERVAL = 0.2
  TENTATIVE_WAIT_TIMEOUT = 30
  down(interface)
  interface_file_list()
  list()
  up(interface)

## octavia.amphorae.backends.utils.interface_file module

class InterfaceFile(name, if_type, mtu=None, addresses=None, routes=None, rules=None, scripts=None, is_sriov=False)

  Bases: `object`

  classmethod dump(obj)
  classmethod from_file(filename)
  classmethod get_directory()
  classmethod get_extensions()
  classmethod get_host_routes(routes, **kwargs)
  classmethod load(fp)
  write()

class PortInterfaceFile(name, mtu, fixed_ips, is_sriov=False)

  Bases: `InterfaceFile`

class VIPInterfaceFile(name, mtu, vips, vrrp_info, fixed_ips, topology, is_sriov=False)

  Bases: `InterfaceFile`

## octavia.amphorae.backends.utils.ip_advertisement module

calculate_icmpv6_checksum(packet)

  Calculate the ICMPv6 checksum for a packet.

  Parameters:

    packet – The packet bytes to checksum.

  Returns:

    The checksum integer.

garp(interface, ip_address, net_ns=None)

  Sends a gratuitous ARP for ip_address on the interface.

  Parameters:

    - interface – The interface name to send the GARP on.

    - ip_address – The IP address to advertise in the GARP.

    - net_ns – The network namespace to send the GARP from.

  Returns:

    None

neighbor_advertisement(interface, ip_address, net_ns=None)

  Sends a unsolicited neighbor advertisement for an ip on the interface.

  Parameters:

    - interface – The interface name to send the GARP on.

    - ip_address – The IP address to advertise in the GARP.

    - net_ns – The network namespace to send the GARP from.

  Returns:

    None

send_ip_advertisement(interface, ip_address, net_ns=None)

  Send an address advertisement.

  This method will send either GARP (IPv4) or neighbor advertisements (IPv6) for the ip address specified.

  Parameters:

    - interface – The interface name to send the advertisement on.

    - ip_address – The IP address to advertise.

    - net_ns – The network namespace to send the advertisement from.

  Returns:

    None

## octavia.amphorae.backends.utils.keepalivedlvs_query module

get_ipvsadm_info(ns_name, is_stats_cmd=False)

get_listener_realserver_mapping(ns_name, listener_ip_ports, health_monitor_enabled)

get_lvs_listener_pool_status(listener_id)

get_lvs_listener_resource_ipports_nsname(listener_id)

get_lvs_listeners_stats()

read_kernel_file(ns_name, file_path)

## octavia.amphorae.backends.utils.network_namespace module

class NetworkNamespace(netns)

  Bases: `object`

  A network namespace context manager.

  Runs wrapped code inside the specified network namespace.

  Parameters:

    netns – The network namespace name to enter.

  CLONE_NEWNET = 1073741824

## octavia.amphorae.backends.utils.network_utils module

get_interface_name(ip_address, net_ns=None)

  Gets the interface name from an IP address.

  Parameters:

    - ip_address – The IP address to lookup.

    - net_ns – The network namespace to find the interface in.

  Returns:

    The interface name.

  Raises:

    - exceptions.InvalidIPAddress – Invalid IP address provided.

    - octavia.common.exceptions.NotFound – No interface was found.

## octavia.amphorae.backends.utils.nftable_utils module

load_nftables_file()

write_nftable_rules_file(interface_name, rules)

## Module contents

this page last updated: 2026-04-13 15:26:39

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