# 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
```python
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
}
persist {
/Common/EXAMPLE_PERSIST {
default yes
}
}
translate-address enabled
translate-port enabled
}
ltm data-group internal /Common/abc_datagroup {
description "test"
records {
0 {
data "0"
}
1 {
data 1
}
}
type integer
}
""")
l
LTM at 0xe6231ed398, partitions: 1, virtual_servers: 1, pools: 1, snat_pools: 0, data_groups: 1
v = l.virtual_servers[0]
v
VS: 0xe6231ed578, name: /Common/www.ipvx.me , destination: /Common/35.156.107.63:443
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"}],"persist":{"name":"/Common/EXAMPLE_PERSIST","default":"yes"},"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'}],
'persist': {'name': '/Common/EXAMPLE_PERSIST', 'default': 'yes'},
'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
persist:
name: /Common/EXAMPLE_PERSIST
default: yes
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()
'name = "/Common/www.ipvx.me"\ndestination = "/Common/35.156.107.63:443"\nip-protocol = "tcp"\nmask = "255.255.255.255"\npool = "/Common/www.ipvx.me"\ntranslate_address = "enabled"\ntranslate_port = "enabled"\nsource = "0.0.0.0/0"\n\n[[profiles]]\nname = "/Common/clientssl"\ncontext = "clientside"\n\n[[profiles]]\nname = "/Common/serverssl"\ncontext = "serverside"\n\n[[profiles]]\nname = "/Common/http"\n\n[[profiles]]\nname = "/Common/tcp"\n\n[persist]\nname = "/Common/EXAMPLE_PERSIST"\ndefault = "yes"\n\n[source-address-translation]\ntype = "automap"\n'
x = Virtual.from_toml(v.to_toml())
x
VS: 0x4de57ecd68, name: /Common/www.ipvx.me , destination: /Common/35.156.107.63:44
l.data_groups[0].to_json()
'{"name":"/Common/abc_datagroup","records":{"1":"1","0":"0"},"description":"test","type":"integer"}'
dir(l)
['__class__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getstate__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__le__',
'__lt__',
'__module__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'data_groups',
'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.
by: <a href="https://www.linkedin.com/in/ahmedthabet/" target="_blank">Ahmed Thabet</a>
Raw data
{
"_id": null,
"home_page": "https://ipvx.me/f5",
"name": "f5py",
"maintainer": null,
"docs_url": null,
"requires_python": "",
"maintainer_email": null,
"keywords": "f5,big-ip,parser,rust,load balancer,applications delivery controller,config,generator,ADC,cisco,juniper",
"author": "Ahmed Thabet <eng@AhmedThabet.com>",
"author_email": "Ahmed Thabet <eng@AhmedThabet.com>",
"download_url": null,
"platform": null,
"description": "# f5py\n\nIs a Python library written in Rust for the F5 BIG-IP Configurations parsing.\n\nThe 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\n\nStarting with JSON for facilitating the automation of F5 python scripts written by network and security engineers.\n\nThen the plan is to support generating to the following formats\n\n * LTM commands\n * F5 REST API\n * F5 AS3\n\nAlthough 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\n\n## Actual State\n\nF5 TMM Configurations generated within the scf files (LTM Commands) are parsed to generate the native rust objects that represent the configurations.\nThe configugurations can be parsed from supported formats as well\nObjects manipulation and JSON Output/Parsing are already supported\n \n * to_json()\n * to_yaml()\n * to_toml()\n * to_csv() <<-- Default implementation, works only on simple structs\n\n * from_json()\n * from_yaml()\n * from_toml()\n\n## Roadmap\n \n * CSV output, having Virtual Servers as a reference. \n * Generating LTM commands\n * Parsing and generating F5 iControl REST API\n * Parsing and generating F5 AS3\n \n## Useful Links\n\n * Github Issues Repository: `https://github.com/AhmedThabet/f5py-doc`\n \n * The same library is used in this WASM frontend, so it's possible to parse the configs without writing a simple line of code!\n `https://ipvx.me/f5`\n \n## Usage\n\nAll the objects can be initialize by passing the raw config text to the class's initializer\nor using the new_default() function which will create a new object with default values\n\n```python\nfrom f5py import *\n\nl = LTM(\"\"\"\nltm pool /Common/www.ipvx.me {\n members {\n /Common/10.1.2.3:8888 {\n address 10.1.2.3\n }\n }\n monitor /Common/TCP-8888\n}\nltm virtual /Common/www.ipvx.me {\n destination /Common/35.156.107.63:443\n ip-protocol tcp\n mask 255.255.255.255\n pool /Common/www.ipvx.me\n profiles {\n /Common/clientssl {\n context clientside\n }\n /Common/serverssl {\n context serverside\n }\n /Common/http { }\n /Common/tcp { }\n }\n source 0.0.0.0/0\n source-address-translation {\n type automap\n }\n persist {\n /Common/EXAMPLE_PERSIST {\n default yes\n }\n }\n translate-address enabled\n translate-port enabled\n}\nltm data-group internal /Common/abc_datagroup {\n description \"test\"\n records {\n 0 {\n data \"0\"\n }\n 1 {\n data 1\n }\n }\n type integer\n}\n\"\"\")\n\nl\nLTM at 0xe6231ed398, partitions: 1, virtual_servers: 1, pools: 1, snat_pools: 0, data_groups: 1\nv = l.virtual_servers[0]\nv\nVS: 0xe6231ed578, name: /Common/www.ipvx.me , destination: /Common/35.156.107.63:443\n\nv.to_json()\n'{\"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\"}],\"persist\":{\"name\":\"/Common/EXAMPLE_PERSIST\",\"default\":\"yes\"},\"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\"}'\n\nv.to_dict()\n\n{'name': '/Common/www.ipvx.me',\n 'destination': '/Common/35.156.107.63:443',\n 'ip-protocol': 'tcp',\n 'profiles': [{'name': '/Common/clientssl', 'context': 'clientside'},\n {'name': '/Common/serverssl', 'context': 'serverside'},\n {'name': '/Common/http'},\n {'name': '/Common/tcp'}],\n 'persist': {'name': '/Common/EXAMPLE_PERSIST', 'default': 'yes'},\n 'mask': '255.255.255.255',\n 'pool': '/Common/www.ipvx.me',\n 'source-address-translation': {'type': 'automap'},\n 'translate_address': 'enabled',\n 'translate_port': 'enabled',\n 'source': '0.0.0.0/0'}\n\nprint(v.to_yaml())\nname: /Common/www.ipvx.me\ndestination: /Common/35.156.107.63:443\nip-protocol: tcp\nprofiles:\n- name: /Common/clientssl\n context: clientside\n- name: /Common/serverssl\n context: serverside\n- name: /Common/http\n- name: /Common/tcp\npersist:\n name: /Common/EXAMPLE_PERSIST\n default: yes\nmask: 255.255.255.255\npool: /Common/www.ipvx.me\nsource-address-translation:\n type: automap\ntranslate_address: enabled\ntranslate_port: enabled\nsource: 0.0.0.0/0\n\nv.destination.partition()\n'Common'\n\nv.destination.name()\n'35.156.107.63'\n\nv.destination.port()\n443\n\nv.destination.address()\n'35.156.107.63'\n\nv.to_toml()\n'name = \"/Common/www.ipvx.me\"\\ndestination = \"/Common/35.156.107.63:443\"\\nip-protocol = \"tcp\"\\nmask = \"255.255.255.255\"\\npool = \"/Common/www.ipvx.me\"\\ntranslate_address = \"enabled\"\\ntranslate_port = \"enabled\"\\nsource = \"0.0.0.0/0\"\\n\\n[[profiles]]\\nname = \"/Common/clientssl\"\\ncontext = \"clientside\"\\n\\n[[profiles]]\\nname = \"/Common/serverssl\"\\ncontext = \"serverside\"\\n\\n[[profiles]]\\nname = \"/Common/http\"\\n\\n[[profiles]]\\nname = \"/Common/tcp\"\\n\\n[persist]\\nname = \"/Common/EXAMPLE_PERSIST\"\\ndefault = \"yes\"\\n\\n[source-address-translation]\\ntype = \"automap\"\\n'\n\nx = Virtual.from_toml(v.to_toml())\nx\nVS: 0x4de57ecd68, name: /Common/www.ipvx.me , destination: /Common/35.156.107.63:44\n\nl.data_groups[0].to_json()\n'{\"name\":\"/Common/abc_datagroup\",\"records\":{\"1\":\"1\",\"0\":\"0\"},\"description\":\"test\",\"type\":\"integer\"}'\n\ndir(l)\n\n['__class__',\n '__delattr__',\n '__dir__',\n '__doc__',\n '__eq__',\n '__format__',\n '__ge__',\n '__getattribute__',\n '__getstate__',\n '__gt__',\n '__hash__',\n '__init__',\n '__init_subclass__',\n '__le__',\n '__lt__',\n '__module__',\n '__ne__',\n '__new__',\n '__reduce__',\n '__reduce_ex__',\n '__repr__',\n '__setattr__',\n '__sizeof__',\n '__str__',\n '__subclasshook__',\n 'data_groups',\n 'from_json',\n 'from_toml',\n 'from_yaml',\n 'new_default',\n 'partitions',\n 'pools',\n 'snat_pools',\n 'to_dict',\n 'to_json',\n 'to_toml',\n 'to_yaml',\n 'try_to_csv',\n 'virtual_servers']\n\n\n\n```\n\n### Disclaimer\n\nThis library is not affiliated with F5 Networks in any way. It is a personal project and is not supported by F5 Networks.\n\nby: <a href=\"https://www.linkedin.com/in/ahmedthabet/\" target=\"_blank\">Ahmed Thabet</a>\n",
"bugtrack_url": null,
"license": null,
"summary": "F5 BIG-IP Parser and Config Generator written in Rust",
"version": "0.3.0",
"project_urls": {
"Homepage": "https://ipvx.me/f5",
"Source Code": "https://github.com/AhmedThabet/f5py-doc"
},
"split_keywords": [
"f5",
"big-ip",
"parser",
"rust",
"load balancer",
"applications delivery controller",
"config",
"generator",
"adc",
"cisco",
"juniper"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "4700c16be728d9b866315e2f4e9eaede359a14cf4f22f2a2d4c2be162061681b",
"md5": "cc8b2497aa6958e2fe59788934ab5e14",
"sha256": "96910e2a5527e4659cb0ede815d3db44ae0c225ab8cc1fbf88f933153528fb4c"
},
"downloads": -1,
"filename": "f5py-0.3.0-cp310-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "cc8b2497aa6958e2fe59788934ab5e14",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": null,
"size": 1485768,
"upload_time": "2024-03-02T11:42:54",
"upload_time_iso_8601": "2024-03-02T11:42:54.505080Z",
"url": "https://files.pythonhosted.org/packages/47/00/c16be728d9b866315e2f4e9eaede359a14cf4f22f2a2d4c2be162061681b/f5py-0.3.0-cp310-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "03513511be49d93ebf4c0deb9094057616863e63c69a39e69305c196a280425f",
"md5": "530fad137fb06d560583b7764e738a3f",
"sha256": "1fd834fc4577907bfb9c603b4eb1c27401afa73f9f5f8de1827e57eef4c60a67"
},
"downloads": -1,
"filename": "f5py-0.3.0-cp311-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "530fad137fb06d560583b7764e738a3f",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": null,
"size": 1485678,
"upload_time": "2024-03-02T11:42:51",
"upload_time_iso_8601": "2024-03-02T11:42:51.467612Z",
"url": "https://files.pythonhosted.org/packages/03/51/3511be49d93ebf4c0deb9094057616863e63c69a39e69305c196a280425f/f5py-0.3.0-cp311-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c8152a1029377a991d08a6a91d18f3f96c464a3e6d1fe6ba160f4d90bfa6d359",
"md5": "6ff462c4857a7cb069827f92a03207b1",
"sha256": "7ea43631c546f8b9154909f5245f2ab2723d0ab6abcd639f751a4db431421bc1"
},
"downloads": -1,
"filename": "f5py-0.3.0-cp312-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "6ff462c4857a7cb069827f92a03207b1",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": null,
"size": 1486683,
"upload_time": "2024-03-02T11:42:48",
"upload_time_iso_8601": "2024-03-02T11:42:48.205186Z",
"url": "https://files.pythonhosted.org/packages/c8/15/2a1029377a991d08a6a91d18f3f96c464a3e6d1fe6ba160f4d90bfa6d359/f5py-0.3.0-cp312-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a64e348dda8bcfc452b16c9eaf12b828c27e8638fb6a42bf7503630c39231727",
"md5": "85ae70f644ec3d25930c982c3d93993d",
"sha256": "ff106ea08655ae2722245ecb2db3213ef13b585c7b480156e4cdd6ed840c9272"
},
"downloads": -1,
"filename": "f5py-0.3.0-cp37-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "85ae70f644ec3d25930c982c3d93993d",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 1485299,
"upload_time": "2024-03-02T11:43:03",
"upload_time_iso_8601": "2024-03-02T11:43:03.564173Z",
"url": "https://files.pythonhosted.org/packages/a6/4e/348dda8bcfc452b16c9eaf12b828c27e8638fb6a42bf7503630c39231727/f5py-0.3.0-cp37-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "29550a707b5e5f2506bc7f9305ec876b0aa8585e05c833e5acdaab5aa606ade2",
"md5": "ac560c5c904b3887613fffff57883e58",
"sha256": "ed6dd763b80e398b14a9c906c2c09c42b5c080aa17851deba077064343a7ce0c"
},
"downloads": -1,
"filename": "f5py-0.3.0-cp38-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "ac560c5c904b3887613fffff57883e58",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": null,
"size": 1485144,
"upload_time": "2024-03-02T11:43:00",
"upload_time_iso_8601": "2024-03-02T11:43:00.464100Z",
"url": "https://files.pythonhosted.org/packages/29/55/0a707b5e5f2506bc7f9305ec876b0aa8585e05c833e5acdaab5aa606ade2/f5py-0.3.0-cp38-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "498302a9ebfc7bd714818a1331c15978ec3aa5823393c485ea583a8841a0b2ce",
"md5": "fd0faaf661d9c6018e4eaeb7c59411a0",
"sha256": "478262ceacd49910dd7269c2ac81424b2fd9ef57f2552164675548ed01a76b8e"
},
"downloads": -1,
"filename": "f5py-0.3.0-cp39-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "fd0faaf661d9c6018e4eaeb7c59411a0",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": null,
"size": 1486363,
"upload_time": "2024-03-02T11:42:57",
"upload_time_iso_8601": "2024-03-02T11:42:57.477841Z",
"url": "https://files.pythonhosted.org/packages/49/83/02a9ebfc7bd714818a1331c15978ec3aa5823393c485ea583a8841a0b2ce/f5py-0.3.0-cp39-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-02 11:42:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AhmedThabet",
"github_project": "f5py-doc",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "f5py"
}