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

Uploaded CPython 3.11 Windows x86-64

f5py-0.2.3-cp310-none-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.10 Windows x86-64

f5py-0.2.3-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.3-cp39-none-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.9 Windows x86-64

f5py-0.2.3-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.3-cp38-none-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.8 Windows x86-64

f5py-0.2.3-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.3-cp37-none-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.7 Windows x86-64

f5py-0.2.3-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.3-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for f5py-0.2.3-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5b155a1949f73f2fed5f643f54c1450e9fa10c28d322ee910d9001abfd116905
MD5 c84b95d985e812f4de64412bd7bc1bc4
BLAKE2b-256 9177a98078e05c587c30253349573de445d8e5ac12c74e4d155ae3301aa17b7e

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: f5py-0.2.3-cp311-none-win_amd64.whl
  • Upload date:
  • Size: 1.1 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.3-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 9a4662b5e843fcfd5023be4e6e5a632c8f94ad834334a73543109185fba1c966
MD5 fdddf3575b21bc017ede78faff103445
BLAKE2b-256 87a323e90943c5ca4219e6bf76a6e764b9770de55d96362179f7f7416296d81f

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: f5py-0.2.3-cp310-none-win_amd64.whl
  • Upload date:
  • Size: 1.1 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.3-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 41ecaf78b1fdd97a8cd8923ba32ae458caceac726a3cf1ee9c90cf58c9e8477b
MD5 ce32a5ecd77f0d7922142b3afba1b367
BLAKE2b-256 7592dd9dda3e7c5e2f069a3fafb39b846ef550b627dd39bff442e296a07da494

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for f5py-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fec3811a8cf38639b2939ee001f2dff141a85d3f598491a8843a401b032fc23e
MD5 3759b7f08f9433dee7fce8374a496678
BLAKE2b-256 672fcc0c6ac507d11925badd85e2bbc4408a5520574643afc71c48ec9177e8a0

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: f5py-0.2.3-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 1.1 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.3-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 ddf1c818947af79f299778414a81c2174040440e0e1b28db270f60822cc90446
MD5 73a147fc541e1fecddd4ef82887f0819
BLAKE2b-256 140d3ff6f6118210240688bcb27e16d3c73202d5d24b788f8aa242734891a60b

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for f5py-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 33e51831016657c9c42d01ce59b0f6a3c21dbb8ae69db923cac81d8aa75550b9
MD5 c1ab51096f4d719ad20b5399dd006108
BLAKE2b-256 e74c0a884d5bf25bc38d70929260cfeac2b3c5e56f147245f6051dd6be7d5c5a

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: f5py-0.2.3-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 1.1 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.3-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 0844d07680f0929eebc910e7ad1db16fcf041149766c77d29133668000f9a6ba
MD5 6764a3bdee306ef36e4f4429f3cfa339
BLAKE2b-256 b6483ff439b2145de1e20010d9d31910c81fd4250aa45a376d58c54e45861997

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for f5py-0.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 13450fc3fec0f58f3c7fbb9e6ff8365c8106bd44569b05d178fafb349f17391d
MD5 a74c99aacbd569bb4bc4c829cecc2bd8
BLAKE2b-256 c71b142f8c77b2d2afd1a3a166126de38ad0bc881fae9900266e60b15123d117

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: f5py-0.2.3-cp37-none-win_amd64.whl
  • Upload date:
  • Size: 1.1 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.3-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 bc63805a27b0a25981ef5d028a168e3a2dc4508216d32644937742aec5ddf5d5
MD5 08fc1249a666258adbab01a0d4420e7c
BLAKE2b-256 179e8e7df324afe1d25c2c0b97f421ad470a25dbe5fe2c35ec68b2d0e7670896

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for f5py-0.2.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ccb57b56b3804cd3079e163888135ddbc068dbaa294fa2662e04a57cec267dc8
MD5 0e34fcdf74adeef584cded737f788996
BLAKE2b-256 6be4dc077c21b5cd0208717f33790b8c68a0b7ddd7c882f372d4b3b1b114bae4

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