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.partition()
'Common'

v.destination.name()
'35.156.107.63'

v.destination.port()
443

v.destination.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.1-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.1-cp311-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

f5py-0.2.1-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.1-cp39-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.9 Windows x86-64

f5py-0.2.1-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.1-cp38-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.8 Windows x86-64

f5py-0.2.1-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.1-cp37-none-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.7 Windows x86-64

f5py-0.2.1-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.1-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for f5py-0.2.1-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 434f6d34efb1ab8e24e4d00d8be12e97d09da32952d79fa766f5ee93c0e18888
MD5 78b8aec4f4e1a853276be87ce54dca89
BLAKE2b-256 e37c4b470d3d0a5b493be84ab05f80ae1f14ce510603760d35bb085dea8e0fa6

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: f5py-0.2.1-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.1-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 e39b95b673c1afcef5ecb0a33825c64cd343d139d728acdd395e717723d91366
MD5 19677616dcba452a2815633d1d576a2e
BLAKE2b-256 9474f1d8fa277db9f062128f2562284608fae6b7bda170cc48280bbb9b72b9b1

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: f5py-0.2.1-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.1-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 c516cfd613d833a037df41b28efec81c5056479a2f80d2db5690832c0040e5a8
MD5 fb803e7d8215ca5950bf3936a92f43cf
BLAKE2b-256 d8c7c14e3d96098f45148d08bca5f90d15826adc887026fdfed3f7f409dfdf55

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for f5py-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6e527f96cd68a0ed8f3112924e2f975e465c274284b5e13e76c4d028d21753a6
MD5 8f2b71284029e6223870571e45433fe8
BLAKE2b-256 1118380fb91fb9abc0cd929446651309520152d22d27e8e667f760eb025c1978

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: f5py-0.2.1-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.1-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 d7b82cfb50b9d0ef80f3b2e188d7a87430d56a0822bfc8c86689664c1cc31b37
MD5 63669c84edf4543a08e3ff074a4a8f56
BLAKE2b-256 185b510a9b39b17a3df555ec8eef52268ca56d4e1aa0da24550ff69787867550

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for f5py-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 83ffed7cca229eb2b1d161fee20af085d22a1169a02c46813c5678192237f8ee
MD5 2df3065d12a2f4c99174dc1c6361b675
BLAKE2b-256 9493f49391696f6401ec3817b1fda51e9381555a3f8f2228860713c44e2a22b4

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: f5py-0.2.1-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.1-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 62138457d0523aed5bb8c38f9a89ea9e977244be5a3444f051babb826d8bab77
MD5 033e4dbbacb1c77dfff3ec2fa2e7b43c
BLAKE2b-256 92adc6784742844d81db62635f8ab164b0fc72ea9c9fe4c2642c58f189869abe

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for f5py-0.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 55976299d65f3133ad7606ebb4b29aaa0878ac8041431a66d049ecdd49be4e50
MD5 942d16162fec7cdba1d818074144aa6b
BLAKE2b-256 9f3ab5d8e2c3a355eb827b14be0cc9ae3db2844a42955e5466a27dcb9e67926f

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: f5py-0.2.1-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.1-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 d05b8594f38ddab178b265db0a7eef3938852b4055b55a3520a8c1dc7d5d3804
MD5 4627cd652d99b625672a3695b8570ffb
BLAKE2b-256 57bb228e60d3b09ea6eceecd1ce317eef580207ef762b761cecc272a5272ed7d

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for f5py-0.2.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d412eac999d2dee7f46fe290cf319e616ff8f88e18fac4fd161a032ca7f255c9
MD5 df2ae493fcdb689752cbf8fa0b29d568
BLAKE2b-256 62065e6fc24ba96ad20d701d96c2fd1ec035d8b4f40e36e8baea48b760eb8469

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