# nornir_f5
![Build Status](https://github.com/erjac77/nornir_f5/workflows/test/badge.svg)
[![codecov](https://codecov.io/gh/erjac77/nornir_f5/branch/master/graph/badge.svg?token=XXIASNEDFR)](https://codecov.io/gh/erjac77/nornir_f5)
[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
![Python Version](https://img.shields.io/badge/python-3.6+-blue.svg)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![GitHub license](https://img.shields.io/github/license/erjac77/nornir_f5.svg)](https://github.com/erjac77/nornir_f5/blob/master/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
```bash
pip install nornir-f5
```
### Poetry
```bash
poetry add nornir-f5
```
## Usage
```python
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="POST AS3 Declaration from file",
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="AS3 POST",
task=as3_post,
as3_tenant="Simple_01",
)
print_result(result)
```
## Plugins
### Connections
* __f5__: Connects to an F5 REST server.
### Tasks
* __atc__: Deploys ATC declaratives on a BIG-IP/IQ system.
* __atc_info__: Returns the version and release information of the ATC service instance.
* __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)
Raw data
{
"_id": null,
"home_page": "https://github.com/erjac77/nornir_f5",
"name": "nornir-f5",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7.2,<4.0.0",
"maintainer_email": "",
"keywords": "nornir,f5,bigip,automation,as3",
"author": "Eric Jacob",
"author_email": "erjac77@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/8e/9e/a36022039f06623e592acb2873abd7cfd4ca17a0fd467fd0e878272424e8/nornir_f5-0.6.1.tar.gz",
"platform": null,
"description": "# nornir_f5\n\n![Build Status](https://github.com/erjac77/nornir_f5/workflows/test/badge.svg)\n[![codecov](https://codecov.io/gh/erjac77/nornir_f5/branch/master/graph/badge.svg?token=XXIASNEDFR)](https://codecov.io/gh/erjac77/nornir_f5)\n[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)\n![Python Version](https://img.shields.io/badge/python-3.6+-blue.svg)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![GitHub license](https://img.shields.io/github/license/erjac77/nornir_f5.svg)](https://github.com/erjac77/nornir_f5/blob/master/LICENSE)\n\nCollection of Nornir plugins to interact with F5 systems and deploy declaratives to F5 Automation Toolchain (ATC) services like AS3, DO, and TS.\n\n## Installation\n\n### Pip\n\n```bash\npip install nornir-f5\n```\n\n### Poetry\n\n```bash\npoetry add nornir-f5\n```\n\n## Usage\n\n```python\nfrom nornir import InitNornir\nfrom nornir.core.task import Result, Task\nfrom nornir_utils.plugins.functions import print_result\n\nfrom nornir_f5.plugins.tasks import (\n atc,\n bigip_cm_config_sync,\n bigip_cm_failover_status,\n)\n\ndef as3_post(task: Task, as3_tenant: str) -> Result:\n # Get the failover status of the device.\n failover_status = task.run(\n name=\"Get failover status\", task=bigip_cm_failover_status\n ).result\n\n # If it's the ACTIVE device, send the declaration and perform a sync.\n if failover_status == \"ACTIVE\":\n task.run(\n name=\"POST AS3 Declaration from file\",\n task=atc,\n atc_method=\"POST\",\n atc_service=\"AS3\",\n as3_tenant=as3_tenant,\n atc_declaration_file=task.host[\"appsvcs\"][as3_tenant][\n \"atc_declaration_file\"\n ],\n )\n\n task.run(\n name=\"Synchronize the devices\",\n task=bigip_cm_config_sync,\n device_group=task.host[\"device_group\"],\n )\n\n return Result(\n host=task.host,\n result=\"ACTIVE device, AS3 declaration successfully deployed.\",\n )\n # Else, do nothing...\n else:\n return Result(host=task.host, result=\"STANDBY device, skipped.\")\n\nnr = InitNornir(config_file=\"config.yml\")\nnr = nr.filter(platform=\"f5_bigip\")\n\nresult = nr.run(\n name=\"AS3 POST\",\n task=as3_post,\n as3_tenant=\"Simple_01\",\n)\n\nprint_result(result)\n```\n\n## Plugins\n\n### Connections\n\n* __f5__: Connects to an F5 REST server.\n\n### Tasks\n\n* __atc__: Deploys ATC declaratives on a BIG-IP/IQ system.\n* __atc_info__: Returns the version and release information of the ATC service instance.\n* __bigip_cm_config_sync__: Synchronizes the configuration between BIG-IP systems.\n* __bigip_cm_failover_status__: Gets the failover status of the BIG-IP system.\n* __bigip_cm_sync_status__: Gets the configuration synchronization status of the BIG-IP system.\n* __bigip_shared_file_transfer_uploads__: Uploads a file to a BIG-IP system.\n* __bigip_shared_iapp_lx_package__: Manages Javascript LX packages on a BIG-IP system.\n* __bigip_sys_version__: Gets software version information for the BIG-IP system.\n* __bigip_util_unix_ls__: Lists information about the file(s) or directory content on a BIG-IP system.\n* __bigip_util_unix_rm__: Deletes a file on a BIG-IP system.\n\n## Authors\n\n* Eric Jacob (@erjac77)\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "F5 plugins for Nornir",
"version": "0.6.1",
"project_urls": {
"Documentation": "https://github.com/erjac77/nornir_f5",
"Homepage": "https://github.com/erjac77/nornir_f5",
"Issues": "https://github.com/erjac77/nornir_f5/issues",
"Pull Requests": "https://github.com/erjac77/nornir_f5/pulls",
"Releases": "https://github.com/erjac77/nornir_f5/releases",
"Repository": "https://github.com/erjac77/nornir_f5"
},
"split_keywords": [
"nornir",
"f5",
"bigip",
"automation",
"as3"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9382f5ebeb8333b7c646feeae750366db348b4f441da77c28b8a37b3c08ad824",
"md5": "b99d241c6ad2505d145b9b274463e0c1",
"sha256": "47b64e461ce70bfd35b7a468dd5eee68c7ed0eb57f6d7c878983e7d044f33c9e"
},
"downloads": -1,
"filename": "nornir_f5-0.6.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b99d241c6ad2505d145b9b274463e0c1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7.2,<4.0.0",
"size": 22510,
"upload_time": "2023-05-11T15:37:21",
"upload_time_iso_8601": "2023-05-11T15:37:21.259944Z",
"url": "https://files.pythonhosted.org/packages/93/82/f5ebeb8333b7c646feeae750366db348b4f441da77c28b8a37b3c08ad824/nornir_f5-0.6.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8e9ea36022039f06623e592acb2873abd7cfd4ca17a0fd467fd0e878272424e8",
"md5": "3767e3fe4f28f3e99acb505a0a3c964a",
"sha256": "cd2f84143df02d9671f4e9dbf88aa497456fe28646c7d3d6f424f41b3e077c26"
},
"downloads": -1,
"filename": "nornir_f5-0.6.1.tar.gz",
"has_sig": false,
"md5_digest": "3767e3fe4f28f3e99acb505a0a3c964a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7.2,<4.0.0",
"size": 15841,
"upload_time": "2023-05-11T15:37:23",
"upload_time_iso_8601": "2023-05-11T15:37:23.894631Z",
"url": "https://files.pythonhosted.org/packages/8e/9e/a36022039f06623e592acb2873abd7cfd4ca17a0fd467fd0e878272424e8/nornir_f5-0.6.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-11 15:37:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "erjac77",
"github_project": "nornir_f5",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nornir-f5"
}