Forum Discussion
mshoaib
Nov 22, 2020Cirrus
Add/Remove ServerSSL profile on a Virtual Server using SDK
Hi, I am trying to add/remove ServerSSL profile to a Virtual Server using F5 SDK. I have the following script that will read the current profiles from the Virtual Server but I don't get my he...
mshoaib
Nov 28, 2020Cirrus
I came across BIGREST and found it much cleaner and easier to use.
I learned the syntax and developed the solution using BIGREST instead of f5-common-pyton.
Thank you Leonardo.
Below is the code snippet that will toggle Server side SSL profile.
# Connect to BigIP
domain_name = "www.example.com-https"
b = BIGIP(ip, username, password)
# Load the Profiles on a virtual server
profiles = b.load(f"/mgmt/tm/ltm/virtual/{rest_format(domain_name)}/profiles")
print(f"List of Profiles attached to {domain_name}")
profile_context_list = []
for p in profiles:
profile_context_list.append(p.properties["context"])
print(profile_context_list)
if "serverside" in profile_context_list:
print("Serverside SSL applied")
print("Deleting Serverside SSL profile")
path = (
f"/mgmt/tm/ltm/virtual/{rest_format(domain_name)}/profiles/{rest_format(profile_name)}"
)
b.delete(path)
else:
print("Serverside SSL doesn't applied")
print("Adding Serverside SSL Profile")
data = {}
data["name"] = profile_name
data["context"] = "serverside"
b.create(f"/mgmt/tm/ltm/virtual/{rest_format(domain_name)}/profiles", data)
Complete code is here :
https://github.com/mshoaibshafi/nre-tools/tree/main/f5
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects