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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file f5py-0.2.4-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: f5py-0.2.4-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.11-beta.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | adeae0d4a682355f2eb48af2726d3d202c77314f322440a22383c8f0925ab027 |
|
MD5 | b26c72fad196eac82b2d1748a787c093 |
|
BLAKE2b-256 | 0d89bcba1f86ad303e07e9be1961e0b1fa979f212663ac40c8569820d9acd9ad |
Provenance
File details
Details for the file f5py-0.2.4-cp311-none-win_amd64.whl
.
File metadata
- Download URL: f5py-0.2.4-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | afc726f9da2b7f12a11a1148ef28661c147b19f422f39c56d24d3bd825c4b1ac |
|
MD5 | 68b68e0326684c64320a3fd84089fe59 |
|
BLAKE2b-256 | c6321fbacb75983b8de34ebeecb1ef2df4f20c095b336f5eb83f1cc555f09c82 |
Provenance
File details
Details for the file f5py-0.2.4-cp310-none-win_amd64.whl
.
File metadata
- Download URL: f5py-0.2.4-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b9ef558c573f5e9a81eb9e8e6069f74bd7bf0a6a9707493d24905677da839d4 |
|
MD5 | dd0cf5e6947a7adfa252af011b72daaa |
|
BLAKE2b-256 | 4eead4a29f674ae82c0f276c2d510547272ed1b2d8cefe8780b0e9d574c8fe0e |
Provenance
File details
Details for the file f5py-0.2.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: f5py-0.2.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.11-beta.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59247f81fd1ccac4e9ef4f1871201a6a6a59aa9cca71a5f6ed0733d9fc4d1f73 |
|
MD5 | 1a26d3b65b1b013124c5b03b5eff108b |
|
BLAKE2b-256 | a77ff4dd581b8cf7e43be9e5a6ae6a6d3235c77a64f27d046a8a269c80e73402 |
Provenance
File details
Details for the file f5py-0.2.4-cp39-none-win_amd64.whl
.
File metadata
- Download URL: f5py-0.2.4-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | daf3ec28e27231ca10be2ed782c02ab9a691d2b1e990355230f3f71afde17775 |
|
MD5 | ed4baea460a87a7b826dc57845d3788a |
|
BLAKE2b-256 | c783de128e01584ff91e2d9b47589837b80fa453f20e2750b29219422ae490aa |
Provenance
File details
Details for the file f5py-0.2.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: f5py-0.2.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.11-beta.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d4cdee2d5eef9e2b03e4c0f5eaf9ef4c9defeace30afc50e8bcd4daeb99624d |
|
MD5 | 162822d04c5f6678db1370411108cf90 |
|
BLAKE2b-256 | d192ad119a1150b272291c115ab1b73834539c85806cede948f5c5501e418cc9 |
Provenance
File details
Details for the file f5py-0.2.4-cp38-none-win_amd64.whl
.
File metadata
- Download URL: f5py-0.2.4-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0908e58e3ec4d935a80e56db764fff0a43912b588366e247a96f1d2dbcbe987b |
|
MD5 | f072373c53910f9d01af9bf090118474 |
|
BLAKE2b-256 | 0fbd367bf37cc8c57be2bfd5d5c5e7d8626e02fdf9ff045f29b8a7bdc181d4e9 |
Provenance
File details
Details for the file f5py-0.2.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: f5py-0.2.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.11-beta.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e621e10b078e6d08ad69d0d161114a50219eb3bb8159ff54198263ea02a54245 |
|
MD5 | 6ccf8cf39185c05b79f2ee68312c5d51 |
|
BLAKE2b-256 | ec3819386f445e9cee180560f98016a0941eaedbc445d32bf2360ee744097b98 |
Provenance
File details
Details for the file f5py-0.2.4-cp37-none-win_amd64.whl
.
File metadata
- Download URL: f5py-0.2.4-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48227adf3f6fa28718c2d8b8ab751ac27e1c72e073303a7746232852212eb4ec |
|
MD5 | 62bcdf5456218cb0c57bc219db50e5c3 |
|
BLAKE2b-256 | cca5e9acbc7effe3fc620152cfe983196b3001e244943a465a3f4b72b192e900 |
Provenance
File details
Details for the file f5py-0.2.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: f5py-0.2.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.11-beta.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88c7db45e6675d9c33309ecb3f1e41ae1a826ade48c50340b046b5427b2d3f2a |
|
MD5 | 8b14b20db72ac071bc0c9870caa791de |
|
BLAKE2b-256 | 8bc03c1d0be6c77f8c679b3a6f41d4c79ee8894c020e2f467fdf0adc98f3deac |