Forum Discussion
[Sharing My Journey: Automating F5 Licensing]
editors note: Moved to Codeshare - Automating F5 Licensing - without direct internet access | DevCentral
---Hello DevCentral Community!
I'm excited to share a project I've been working on recently: **Automating F5 BIG-IP VE Licensing** without needing direct internet access!
The project covers:
- Retrieving a Dossier automatically via iControl REST API.
- Interacting with F5 licensing servers through proxies or offline.
- Re-activating licenses post-upgrade using custom scripts.
- Full Python 3 support (moving away from BigSuds/Python 2 limitations).
âś… The idea is to help users who need to automate the licensing process, especially for secure or offline environments.
I'll be sharing:
- Scripts
- Use cases
- Lessons learned
- Tips for real-world deployments
If you're interested in automating your BIG-IP licensing process, feel free to follow along! Feedback, ideas, or collaboration is most welcome! 🚀
#F5 #BIGIP #Automation #DevCentral #Python3 #Licensing
---
đź”— Upcoming posts: Detailed code examples, error handling tips, and best practices.
Thanks to the amazing DevCentral community for inspiring me to contribute and share!
...........................................................................................................................................................................................................................................
import requests
import json
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
class BigIPLicenseManager:
def __init__(self, host, username, password, registration_key):
self.host = host
self.username = username
self.password = password
self.registration_key = registration_key
self.base_url = f"https://{self.host}/mgmt/tm/sys/license"
self.headers = {'Content-Type': 'application/json'}
def get_dossier(self):
payload = {
"command": "install",
"registrationKey": self.registration_key
}
response = requests.post(
self.base_url,
auth=(self.username, self.password),
headers=self.headers,
json=payload,
verify=False
)
if response.status_code == 200:
data = response.json()
dossier = data.get('dossier')
if dossier:
print("[+] Dossier retrieved successfully.")
return dossier
else:
print("[-] No dossier found in response.")
return None
else:
print(f"[-] Failed to retrieve dossier: {response.text}")
return None
def install_license(self, license_text):
payload = {
"command": "install",
"licenseText": license_text
}
response = requests.post(
self.base_url,
auth=(self.username, self.password),
headers=self.headers,
json=payload,
verify=False
)
if response.status_code == 200:
print("[+] License installed successfully.")
else:
print(f"[-] Failed to install license: {response.text}")
if __name__ == "__main__":
# Define your BIG-IP credentials and registration key here
bigip_host = "192.168.1.245"
bigip_username = "admin"
bigip_password = "admin"
registration_key = "AAAAA-BBBBB-CCCCC-DDDDD-EEEEE"
manager = BigIPLicenseManager(
bigip_host,
bigip_username,
bigip_password,
registration_key
)
dossier = manager.get_dossier()
if dossier:
# Print the dossier to manually activate it via activate.f5.com
print("\n[!] Submit the following dossier to F5 activation server:")
print(dossier)
# After getting the license text (offline or from a licensing server)
license_text = input("\nPaste the license text here:\n")
manager.install_license(license_text.strip())
3 Replies
Hey ashrafelsayelshabany​ - this looks fantastic thanks for sharing.
I will move this (for you) over into our CodeShare space.Anything further that you plan to create, especially related to this, should be added to the CodeShare section as well.
Lastly - there is a code button in the editor toolbar that adds syntax highlighting and line numbers automagically.
in Forums (like this one) you'll see it here.
In articles (like CodeShare) the editor is slightly different.- ashrafelsayelshabany
Altocumulus
Thank you very much for the reminder.
My regards and appreciation. Moved to Codeshare - Automating F5 Licensing - without direct internet access | DevCentral
I'll lock comments on this thread and request any comments to continue in that article.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com