Skip to main content

F5 BIG-IP Parser and Config Generator written in Rust

Project description

f5py

Is a Python library written in Rust for the F5 BIG-IP Configurations parsing.

The idea is to provide a simple and easy to use library to parse, manipulate, construct and generate F5 BIG-IP configurations in multiple output formats

Starting with JSON for facilitating the automation of F5 python scripts written by network and security engineers.

Then the plan is to support generating to the following formats

* LTM commands
* F5 REST API
* F5 AS3

Although this library is not a replacement for the F5 SDK, it is a good starting point for those who want to automate F5 BIG-IP LTM configurations in a simpler way

Actual State

F5 TMM Configurations generated within the scf files (LTM Commands) are parsed to generate the native rust objects that represent the configurations. The configugurations can be parsed from supported formats as well Objects manipulation and JSON Output/Parsing are already supported

* to_json()
* to_yaml()
* to_toml()
* to_csv() <<-- Default implementation, works only on simple structs

* from_json()
* from_yaml()
* from_toml()  <<-- Default implementation, Some Toml restrictions may block the parsing!

Roadmap

* CSV output, having Virtual Servers as a reference. 
* Generating LTM commands
* Parsing and generating F5 iControl REST API
* Parsing and generating F5 AS3

Useful Links

* Github Issues Repository: `https://github.com/AhmedThabet/f5py-doc`

* The same library is used in this WASM frontend, so it's possible to parse the configs without writing a simple line of code!
    `https://ipvx.me/f5`

Usage

All the objects can be initialize by passing the raw config text to the class's initializer or using the new_default() function which will create a new object with default values

from f5py import *

l = LTM("""
ltm pool /Common/www.ipvx.me {
    members {
        /Common/10.1.2.3:8888 {
            address 10.1.2.3
        }
    }
    monitor /Common/TCP-8888
}
ltm virtual /Common/www.ipvx.me {
    destination /Common/35.156.107.63:443
    ip-protocol tcp
    mask 255.255.255.255
    pool /Common/www.ipvx.me
    profiles {
        /Common/clientssl {
            context clientside
        }
        /Common/serverssl {
            context serverside
        }
        /Common/http { }
        /Common/tcp { }
    }
    source 0.0.0.0/0
    source-address-translation {
        type automap
    }
    translate-address enabled
    translate-port enabled
}
""")

l
LTM at 0x7fff57e086b0, partitions: 1, virtual_servers: 1, pools: 1, snat_p
v = l.virtual_servers[0]
v
VS: 0x7fff57e086c8, name: /Common/www.ipvx.me , destination: /Common/35.156.107

v.to_json()
'{"name":"/Common/www.ipvx.me","destination":"/Common/35.156.107.63:443","ip-protocol":"tcp","profiles":[{"name":"/Common/clientssl","context":"clientside"},{"name":"/Common/serverssl","context":"serverside"},{"name":"/Common/http"},{"name":"/Common/tcp"}],"mask":"255.255.255.255","pool":"/Common/www.ipvx.me","source-address-translation":{"type":"automap"},"translate_address":"enabled","translate_port":"enabled","source":"0.0.0.0/0"}'

v.to_dict()

{'name': '/Common/www.ipvx.me',
 'destination': '/Common/35.156.107.63:443',
 'ip-protocol': 'tcp',
 'profiles': [{'name': '/Common/clientssl', 'context': 'clientside'},
  {'name': '/Common/serverssl', 'context': 'serverside'},
  {'name': '/Common/http'},
  {'name': '/Common/tcp'}],
 'mask': '255.255.255.255',
 'pool': '/Common/www.ipvx.me',
 'source-address-translation': {'type': 'automap'},
 'translate_address': 'enabled',
 'translate_port': 'enabled',
 'source': '0.0.0.0/0'}

print(v.to_yaml())
name: /Common/www.ipvx.me
destination: /Common/35.156.107.63:443
ip-protocol: tcp
profiles:
- name: /Common/clientssl
  context: clientside
- name: /Common/serverssl
  context: serverside
- name: /Common/http
- name: /Common/tcp
mask: 255.255.255.255
pool: /Common/www.ipvx.me
source-address-translation:
  type: automap
translate_address: enabled
translate_port: enabled
source: 0.0.0.0/0

v.destination.get_partition()
'Common'

v.destination.get_name()
'35.156.107.63'

v.destination.get_port()
443

v.destination.get_address()
'35.156.107.63'

v.to_toml()
'destination = "/Common/35.156.107.63:443"\nip-protocol = "tcp"\nmask = "255.255.255.255"\nname = "/Common/www.ipvx.me"\npool = "/Common/www.ipvx.me"\nsource = "0.0.0.0/0"\ntranslate_address = "enabled"\ntranslate_port = "enabled"\n\n[[profiles]]\ncontext = "clientside"\nname = "/Common/clientssl"\n\n[[profiles]]\ncontext = "serverside"\nname = "/Common/serverssl"\n\n[[profiles]]\nname = "/Common/http"\n\n[[profiles]]\nname = "/Common/tcp"\n\n[source-address-translation]\ntype = "automap"\n'

x = Virtual.from_toml(v.to_toml())
x
VS: 0x7fffce11e778, name: /Common/www.ipvx.me , destination: /Common/35.156.107.63:443


dir(l)

['__class__',
 '__delattr__',
 '__dir__',
 '__doc__',
 '__eq__',
 '__format__',
 '__ge__',
 '__getattribute__',
 '__gt__',
 '__hash__',
 '__init__',
 '__init_subclass__',
 '__le__',
 '__lt__',
 '__module__',
 '__ne__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__setattr__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 'from_json',
 'from_toml',
 'from_yaml',
 'new_default',
 'partitions',
 'pools',
 'snat_pools',
 'to_dict',
 'to_json',
 'to_toml',
 'to_yaml',
 'try_to_csv',
 'virtual_servers']

Disclaimer

This library is not affiliated with F5 Networks in any way. It is a personal project and is not supported by F5 Networks.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

f5py-0.2.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

f5py-0.2.0-cp311-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.11 Windows x86-64

f5py-0.2.0-cp310-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.10 Windows x86-64

f5py-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

f5py-0.2.0-cp39-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.9 Windows x86-64

f5py-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

f5py-0.2.0-cp38-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.8 Windows x86-64

f5py-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

f5py-0.2.0-cp37-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.7 Windows x86-64

f5py-0.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

File details

Details for the file f5py-0.2.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for f5py-0.2.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1073aae99fe8d351036804eedde763bea94d9ce5ea679b7e00035268f17df9c7
MD5 231ec441a3fe82e5e23a33d497936ed6
BLAKE2b-256 bd23ec3838055bf8b0076424ffff221971128e3598d6dd52e54c40e1b73bf5f5

See more details on using hashes here.

Provenance

File details

Details for the file f5py-0.2.0-cp311-none-win_amd64.whl.

File metadata

  • Download URL: f5py-0.2.0-cp311-none-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.13.7

File hashes

Hashes for f5py-0.2.0-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 48749ea60ac69ee0f48745b2edf4ceab65ea340f3099ce0876ae59e563501dda
MD5 285d8b120b13ced2ac33f56204a0c737
BLAKE2b-256 c0fd8e58f639489ebd5ffac812cd2a9b75742beee076183afa57556f7b77d2da

See more details on using hashes here.

Provenance

File details

Details for the file f5py-0.2.0-cp310-none-win_amd64.whl.

File metadata

  • Download URL: f5py-0.2.0-cp310-none-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.13.7

File hashes

Hashes for f5py-0.2.0-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 1a5225f6e0d8fab00ddb6a3de587cd57c3895564c9146c4cf8ca8a9b514ffa1d
MD5 d94c77827d0293772135f31ca2865189
BLAKE2b-256 97d7727a5670b2fc2aec9ffdb5430bd36941395491d8b3050c9987c35e4d50d8

See more details on using hashes here.

Provenance

File details

Details for the file f5py-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for f5py-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e2837fc5bfd99a5962282e5fe7fc0c3dd26d4b246575a7ed08cdbddfdce844bc
MD5 db2262a96b4dc801527290fd3c815f6a
BLAKE2b-256 2507e5b08bf4747982f6729eec5e1d7e6705479d1bb1b0a1ed4b98111bb55d04

See more details on using hashes here.

Provenance

File details

Details for the file f5py-0.2.0-cp39-none-win_amd64.whl.

File metadata

  • Download URL: f5py-0.2.0-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.13.7

File hashes

Hashes for f5py-0.2.0-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 619930efba723b77a50bcd393abb226b796e9735e3d36890a30ed93619c6620e
MD5 3a70b28f03c1c5fa63d0a09b1956477e
BLAKE2b-256 51b8ee3249fd163199a540587abfd253f5a2eeb8be19d0f95b2adbb6123e85f1

See more details on using hashes here.

Provenance

File details

Details for the file f5py-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for f5py-0.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1d427c6a3318ae6f60a921e1bc0c6d3c45606453dd7be8e56a1dcbd8aec716c1
MD5 c83926f3784529268fdb723f73ab9895
BLAKE2b-256 14e01140a18e6cde56d6982bccafd02a07b882741f1b019b0e56d950a2204e0d

See more details on using hashes here.

Provenance

File details

Details for the file f5py-0.2.0-cp38-none-win_amd64.whl.

File metadata

  • Download URL: f5py-0.2.0-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.13.7

File hashes

Hashes for f5py-0.2.0-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 01d46c1aafa92096b32bf5da365df6fc7fb2fe974f3da26fd2e84d746de4edf0
MD5 4f22d4dc78ae2d35ffe40911a05900a5
BLAKE2b-256 b10d7ce2480505f7416f79823f3c4a24a975542ea8067bb04a27fbe3f6d283a3

See more details on using hashes here.

Provenance

File details

Details for the file f5py-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for f5py-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0cc9932496b1a577cdd9143d767eeb827745ca6301f721738c2c06d4b7e9c7a9
MD5 d27e113d6da255e03ee6a05f8017b224
BLAKE2b-256 5d3159a5fc6a0349ea141a6eaef550b33a4c479e39ff4c8e11e662d7aa6d50c3

See more details on using hashes here.

Provenance

File details

Details for the file f5py-0.2.0-cp37-none-win_amd64.whl.

File metadata

  • Download URL: f5py-0.2.0-cp37-none-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.7, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.13.7

File hashes

Hashes for f5py-0.2.0-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 eaeb0dce8daca3703593f86c19117415b54bfea9d514e39ac7272e417ef54cbb
MD5 9af26f4bebfccc11dcadcbafa6d05afa
BLAKE2b-256 8ce8ef6733a1a733725866b71866027d72b54c434b55ad6f94b6d4dee004cbba

See more details on using hashes here.

Provenance

File details

Details for the file f5py-0.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for f5py-0.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0463b13c849dcfc6e1584567591caacc97ada4dcf2f4413dad8b223a35f9dddc
MD5 aa0960bf4505667ee03d7ae01a06d058
BLAKE2b-256 70fe5982327616ca3aefce4287ee1e0d8719db0ace9bddac0dba2aadb1ecb229

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