Skip to main content

F5 plugins for Nornir

Project description

nornir_f5

Build Status codecov made-with-python Python Version Code style: black GitHub license

Collection of Nornir plugins to interact with F5 systems and deploy declaratives to F5 Automation Toolchain (ATC) services like AS3, DO, and TS.

Installation

Pip

pip install nornir_f5

Poetry

poetry add nornir_f5

Usage

from nornir import InitNornir
from nornir.core.task import Result, Task
from nornir_utils.plugins.functions import print_result

from nornir_f5.plugins.tasks import (
    atc,
    bigip_cm_config_sync,
    bigip_cm_failover_status,
)

def as3_post(task: Task, as3_tenant: str) -> Result:
    # Get the failover status of the device.
    failover_status = task.run(
        name="Get failover status", task=bigip_cm_failover_status
    ).result

    # If it's the ACTIVE device, send the declaration and perform a sync.
    if failover_status == "ACTIVE":
        task.run(
            name="AS3 POST",
            task=atc,
            atc_method="POST",
            atc_service="AS3",
            as3_tenant=as3_tenant,
            atc_declaration_file=task.host["appsvcs"][as3_tenant][
                "atc_declaration_file"
            ],
        )

        task.run(
            name="Synchronize the devices",
            task=bigip_cm_config_sync,
            device_group=task.host["device_group"],
        )

        return Result(
            host=task.host,
            result="ACTIVE device, AS3 declaration successfully deployed.",
        )
    # Else, do nothing...
    else:
        return Result(host=task.host, result="STANDBY device, skipped.")

nr = InitNornir(config_file="config.yml")
nr = nr.filter(platform="f5_bigip")

result = nr.run(
    name="POST AS3 Declaration from file",
    task=as3_post,
    as3_tenant="Simple_01",
)

print_result(result)

Plugins

Connections

  • f5: Connects to an F5 REST server.

Tasks

  • atc: Sends F5 Automation Toolchain (ATC) declaratives (like AS3, DO and TS) on a BIG-IP/IQ system.
  • bigip_cm_config_sync: Synchronizes the configuration between BIG-IP systems.
  • bigip_cm_failover_status: Gets the failover status of the BIG-IP system.
  • bigip_cm_sync_status: Gets the configuration synchronization status of the BIG-IP system.
  • bigip_shared_file_transfer_uploads: Uploads a file to a BIG-IP system.
  • bigip_shared_iapp_lx_package: Manages Javascript LX packages on a BIG-IP system.
  • bigip_sys_version: Gets software version information for the BIG-IP system.
  • bigip_util_unix_ls: Lists information about the file(s) or directory content on a BIG-IP system.
  • bigip_util_unix_rm: Deletes a file on a BIG-IP system.

Authors

  • Eric Jacob (@erjac77)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nornir_f5-0.4.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

nornir_f5-0.4.0-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file nornir_f5-0.4.0.tar.gz.

File metadata

  • Download URL: nornir_f5-0.4.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

File hashes

Hashes for nornir_f5-0.4.0.tar.gz
Algorithm Hash digest
SHA256 ed2930332d4a991fdd45724b3cdcf0d1bc68488c3086a7bbabcd8936e43881a1
MD5 6c34448125a9a81c5dd54f2e493f8fec
BLAKE2b-256 9c1d4d0fb1930437058cc4e61e91e010abfe34aee810e7418717b1149bbb1bb9

See more details on using hashes here.

Provenance

File details

Details for the file nornir_f5-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: nornir_f5-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

File hashes

Hashes for nornir_f5-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67083bb56462bb1e5220864e1b3aaa7ea70d98cd09eb29b49c338021666c6a90
MD5 faee58dbfc42a2d19813cd42ca191950
BLAKE2b-256 b1a879960eb776491e7fb30a0d012697cd1affff622ebfdf46793342b56f5f13

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page