Skip to content

Commit

Permalink
Adding SNIServerName support for BIGIPv16.0 or more
Browse files Browse the repository at this point in the history
  • Loading branch information
nandakishorepeddi committed Dec 13, 2021
1 parent 532ea58 commit efdc235
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ var/
*.manifest
*.spec

#IDE
.idea/
idea/

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
Expand Down
42 changes: 32 additions & 10 deletions f5_ctlr_agent/bigipconfigdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ def handle_operation_create(self,gtm,partition,oldConfig,gtmConfig,opr_config,op
for mon in opr_config["monitors"]:
if monitor==mon:
self.delete_gtm_hm(gtm,partition,pool['name'],pool['monitor']['name'],oldConfig)
self.create_HM(gtm, partition, pool['monitor'])
self.create_HM(gtm, partition, pool['monitor'], config['name'])
# Delete the old pool members
if partition in oldConfig and "wideIPs" in oldConfig[partition]:
if oldConfig[partition]['wideIPs'] is not None:
Expand Down Expand Up @@ -829,7 +829,7 @@ def create_gtm(self, partition, gtmConfig):
if "monitor" in pool.keys():
#Create Health Monitor
monitor = pool['monitor']['name']
self.create_HM(gtm, partition, pool['monitor'])
self.create_HM(gtm, partition, pool['monitor'], config['name'])
try:
#Create GTM pool
self.create_gtm_pool(gtm, partition, config, monitor)
Expand Down Expand Up @@ -962,7 +962,15 @@ def add_member_to_gtm_pool(self, gtm, pool, poolName, memberName, partition):
except (AttributeError):
log.debug("Error while adding member to pool.")

def create_HM(self, gtm, partition, monitor):
def get_bigip_version(self):
try:
mgmt= self.mgmt_root()
verList = mgmt.tmos_version.split('.')
return float(verList[0] + '.' + verList[1])
except Exception as e:
log.error("Could not fetch BigipVersion: %s", e)

def create_HM(self, gtm, partition, monitor, wideIPName):
""" Create Health Monitor """
if bool(monitor):
if monitor['type']=="http":
Expand All @@ -987,13 +995,25 @@ def create_HM(self, gtm, partition, monitor):
interval=monitor['interval'],
timeout=monitor['timeout'])
if monitor['type']=="https":
gtm.monitor.https_s.https.create(
name=monitor['name'],
partition=partition,
send=monitor['send'],
recv=monitor['recv'],
interval=monitor['interval'],
timeout=monitor['timeout'])
if self.get_bigip_version() >= 16.1:
gtm.monitor.https_s.https.create(
name=monitor['name'],
partition=partition,
send=monitor['send'],
recv=monitor['recv'],
sniServerName=wideIPName,
interval=monitor['interval'],
timeout=monitor['timeout'])
else:
gtm.monitor.https_s.https.create(
name=monitor['name'],
partition=partition,
send=monitor['send'],
recv=monitor['recv'],
interval=monitor['interval'],
timeout=monitor['timeout'])


if monitor['type']=="tcp":
gtm.monitor.tcps.tcp.create(
name=monitor['name'],
Expand All @@ -1018,6 +1038,8 @@ def create_HM(self, gtm, partition, monitor):
obj.send=monitor['send']
obj.interval=monitor['interval']
obj.timeout=monitor['timeout']
if self.get_bigip_version() >= 16.1:
obj.sniServerName=wideIPName
obj.update()
log.info("HTTPS Health monitor {} updated.".format(monitor['name']))
if monitor['type']=="tcp":
Expand Down

0 comments on commit efdc235

Please sign in to comment.