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()

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.7 Windows x86-64

f5py-0.2.2-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.2-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for f5py-0.2.2-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5936aded8a1bcf2931882f6b87179449e7990aea4622c267b4a2f9f677df3a80
MD5 3a753ffb5138b1f98fe13653e78812ae
BLAKE2b-256 34ad7d62ae3f270ae159271259728aeb17b47038c487501c13714ee2c8a4af4f

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: f5py-0.2.2-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.14.13

File hashes

Hashes for f5py-0.2.2-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 7b33f6ddc288ec21208d4924c6d82d5546dc008c2212ff370d6a279f9a715d23
MD5 44ef7c1d8d1ea39659f48cd12dc4cae8
BLAKE2b-256 51d0e53d27b78451f60c61e550bff28f0748e8638b78fe67ea7a910f4845ba17

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: f5py-0.2.2-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.14.13

File hashes

Hashes for f5py-0.2.2-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 c48d22eedc86b5c544d44d66ce226ea05faf67924525e35db46d31389b0dce09
MD5 dd27dbb15fd50986dc52b0791f632076
BLAKE2b-256 5fc17fdb5257b1d40de1e448f190521f733e3b28a7a4cc08591f6984bcec5896

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for f5py-0.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 69e278a85df04698f5b7d4dd5de11fcac44fa5b52ec0a73dcd361849af23a1d5
MD5 c3abc482c718e8ea0d4a52f24057e777
BLAKE2b-256 eaac030f9c5dc392bba28cd310f179a36dd8fc1b0ae8be8645f0f86e9a82de03

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: f5py-0.2.2-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.14.13

File hashes

Hashes for f5py-0.2.2-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 65e7bffa0b03ce571241330abfb954845c138ce3ea1ef48789c3544e2e1bc986
MD5 470fab8f7993c429dbbd3e1e3fe660d5
BLAKE2b-256 7494882c9e1f57b0437137b5025d34258c32072bbe0ff95f5fd2e64ccae829c3

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for f5py-0.2.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 46219d661f8d5c7e4386b320087190ba8bb1102495362ae5b0f57a41cac0e307
MD5 d78e4fb6b50ba80576bcac35746b2e40
BLAKE2b-256 f7f00c3134c7aa17959b351f4ea081690b100209fbc702621085da38ef5d9492

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: f5py-0.2.2-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.14.13

File hashes

Hashes for f5py-0.2.2-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 c8afa5ce43eae75d64ebd167bbf65c4f2a79b2049c0aec34467f7a95958e5452
MD5 2ce40c8f87850a6653957d089e3772b3
BLAKE2b-256 da668df8cba27da32f72bbf618d3e974baa1a5dda94af88feeb0dd28344a04f6

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for f5py-0.2.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 49fa7bf553ac0a92fc7a27b8f98ac344160929fd1647ff46eef97c073ace34ac
MD5 94c204493c5213053adf011a3b4c2f2e
BLAKE2b-256 63277e7a68d8098863771442aedb301c850dfdd80cd83cffa058d27fdd100c5b

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: f5py-0.2.2-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.14.13

File hashes

Hashes for f5py-0.2.2-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 f9957ff4f9704ce0883772082052cc70a38fd553b94b3243d66acea1a02325d2
MD5 6ba1cd5d1cd5fe291f8e049379a81133
BLAKE2b-256 2d27d63cacea04908f25835d86141b4229b01115898bcad0a832252fc3307ea2

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for f5py-0.2.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7024b233f24ef7f35a0da4c0aceda2716ecda5a21ca1364f719c7402acdac9c9
MD5 23d2a5f7dfa920d29a063ed45b94f5f3
BLAKE2b-256 ed9b4c319da0c00697e3d89d2b3354e6545963b1b1ec0f803c7d9114849edc6f

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