diff --git a/.gitignore b/.gitignore index 72364f9..69ae1f0 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,10 @@ var/ *.manifest *.spec +#IDE +.idea/ +idea/ + # Installer logs pip-log.txt pip-delete-this-directory.txt diff --git a/f5_ctlr_agent/bigipconfigdriver.py b/f5_ctlr_agent/bigipconfigdriver.py index fc9d097..9c51b4b 100644 --- a/f5_ctlr_agent/bigipconfigdriver.py +++ b/f5_ctlr_agent/bigipconfigdriver.py @@ -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: @@ -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) @@ -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": @@ -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'], @@ -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":