f5.multi_device

Module contents

Submodule List

device_group Class for managing a DeviceGroup for a set of BIG-IP® devices
exceptions These exceptions for clustering, devicegroup, and trustdomain.
trust_domain Class to manage a TrustDomain for a set of BIG-IP® devices.
utils

Submodules

device_group

Class for managing a DeviceGroup for a set of BIG-IP® devices

Managing a device group for clustering is an event-driven process. Please use the methods here to control that process. The fundamental idea is that any action should have an observable outcome. Adding a device to the device group should have a consequence for each member of the device group, including the newly added member.

Examples:

There are two major use-cases here:

  • Manage an existing device group:

    list_of_bigips = [ManagementRoot(...), ManagementRoot(...)] device_group = DeviceGroup(

    devices=list_of_bigips, device_group_name=’my_cluster’, device_group_type=’sync-failover’, device_group_partition=’Common’

    )

    device_group.ensure_all_devices_in_sync()

  • Create a new device group and manage it:

    list_of_bigips = [ManagementRoot(...), ManagementRoot(...)] device_group = DeviceGroup() device_group.create(

    devices=list_of_bigips, device_group_name=’my_cluster’, device_group_type=’sync-failover’, device_group_partition=’Common’

    )

    device_group.ensure_all_devices_in_sync()

Methods:

  • create – create a device group from a list of devices
  • teardown – teardown a device group, but leave the trust domain intact
  • validate – ensure a device group is in the proper state based on inputs
  • manage_extant – manage an existing device group
class f5.multi_device.device_group.DeviceGroup(**kwargs)[source]

Bases: object

Class to manage device service group

For the non-public methods, there are a few flavors of behavior: get, check, and ensure. A ‘get’ retrieves some info from the device without any assumptions about that info. A ‘check’ will assert a device’s info is as expected. An ‘ensure’ method often does one or more of the above and also may take some other action to enforce the expected state, such as syncing config.

The pollster is used heavliy here for ‘check’ and ‘get’ methods, since we are often waiting for the device or devices to respond to some action.

Example:

  • dg = self._get_device_group()
  • self._check_all_devices_in_sync()
  • self.ensure_all_devices_in_sync()
validate(**kwargs)[source]

Validate device group state among given devices.

Parameters:kwargs – dict – keyword args of device group information
Raises:UnexpectedDeviceGroupType, UnexpectedDeviceGroupDevices
create(**kwargs)[source]

Create the device service cluster group and add devices to it.

teardown()[source]

Teardown device service cluster group.

ensure_all_devices_in_sync()[source]

Ensure all devices have ‘In Sync’ status are sync is done.

exceptions

These exceptions for clustering, devicegroup, and trustdomain.

trust_domain

Class to manage a TrustDomain for a set of BIG-IP® devices.

A trust domain defines a group of devices that have signed and exchanged certificates. Establishing a trust domain is prerequisite for device service clustering. Once devices are part of a trust domain, they can synchronize configuration and act as failovers for one another. This class manages that trust domain.

Examples:

devices = [ManagementRoot(‘x’, ‘un’, ‘pw’), ManagementRoot(‘x’, ‘un’, ‘pw’)

  • Existing domain:
    dg = DeviceGroup(devices=devices, partition=’Common’)
  • New domain:
    dg = DeviceGroup() dg.create(devices=devices, partition=’Common’)

Methods:

  • validate – ensure devices are a part of the same trust domain
  • create – create a trust domain amongst two or more devices
  • teardown – teardown a trust domain by traversing each member and
    removing all other devices from its local trust besides itself.
class f5.multi_device.trust_domain.TrustDomain(**kwargs)[source]

Bases: object

Manages the trust domain of a BIG-IP® device.

validate()[source]

Validate that devices are each trusted by one another

Parameters:kwargs – dict – keyword args for devices and partition
Raises:DeviceNotTrusted
create(**kwargs)[source]

Add trusted peers to the root bigip device.

When adding a trusted device to a device, the trust is reflexive. That is, the truster trusts the trustee and the trustee trusts the truster. So we only need to add the trusted devices to one device.

Parameters:kwargs – dict – devices and partition
teardown()[source]

Teardown trust domain by removing trusted devices.

utils

f5.multi_device.utils.pollster(callable)[source]

Wraps the poll to get attempts and interval applicable for cluster.

Parameters:callable – callable – callable to pass into poll
f5.multi_device.utils.get_device_info(bigip)[source]

Get device information about a specific BigIP device.

Parameters:bigip – ManagementRoot object — device to inspect
Returns:ManagementRoot object
f5.multi_device.utils.get_device_names_to_objects(devices)[source]

Map a list of devices to their hostnames.

Parameters:devices – list – list of ManagementRoot objects
Returns:dict – mapping of hostnames to ManagementRoot objects