1414# limitations under the License.
1515#
1616
17+ import base64
1718import datetime
1819import hashlib
1920import json
@@ -334,7 +335,7 @@ class iControlDriver(LBaaSBaseDriver):
334335 def __init__ (self , conf , registerOpts = True ):
335336 # The registerOpts parameter allows a test to
336337 # turn off config option handling so that it can
337- # set the options manually instead. """
338+ # set the options manually instead.
338339 super (iControlDriver , self ).__init__ (conf )
339340 self .conf = conf
340341 if registerOpts :
@@ -368,6 +369,7 @@ def __init__(self, conf, registerOpts=True):
368369
369370 # to store the verified esd names
370371 self .esd_names = []
372+ self .esd_processor = None
371373
372374 # service component managers
373375 self .tenant_manager = None
@@ -389,6 +391,12 @@ def __init__(self, conf, registerOpts=True):
389391 self .pool_manager = resource_helper .BigIPResourceHelper (
390392 resource_helper .ResourceType .pool )
391393
394+ if self .conf .password_cipher_mode :
395+ self .conf .icontrol_password = \
396+ base64 .b64decode (self .conf .icontrol_password )
397+ if self .conf .os_password :
398+ self .conf .os_password = base64 .b64decode (self .conf .os_password )
399+
392400 try :
393401
394402 # debug logging of service requests recieved by driver
@@ -493,6 +501,11 @@ def _init_bigip_managers(self):
493501 self .system_helper = SystemHelper ()
494502 self .lbaas_builder = LBaaSBuilder (self .conf , self )
495503
504+ # Set esd_processor object as soon as ServiceModelAdapter and
505+ # LBaaSBuilder class instantiated, otherwise manager RPC exception
506+ # will break setting esd_porcessor procedure.
507+ self .init_esd ()
508+
496509 if self .conf .f5_global_routed_mode :
497510 self .network_builder = None
498511 else :
@@ -668,7 +681,7 @@ def _init_errored_bigips(self):
668681 raise
669682
670683 def _open_bigip (self , hostname ):
671- # Open bigip connection """
684+ # Open bigip connection
672685 try :
673686 bigip = self .__bigips [hostname ]
674687 if bigip .status not in ['creating' , 'error' ]:
@@ -824,27 +837,37 @@ def _post_init(self):
824837 if self .network_builder :
825838 self .network_builder .post_init ()
826839
827- # read enhanced services definitions
840+ self ._set_agent_status (False )
841+
842+ def init_esd (self ):
843+ # read all esd file from esd dir
844+ # init esd object in lbaas_builder
845+ # init esd object in service_adapter
828846 esd_dir = os .path .join (self .get_config_dir (), 'esd' )
829- esd = EsdTagProcessor (esd_dir )
847+ # EsdTagProcessor is a singleton, so nothing new
848+ self .esd_processor = EsdTagProcessor ()
830849 try :
831- esd .process_esd (self .get_all_bigips ())
832- self .lbaas_builder .init_esd (esd )
833- self .service_adapter .init_esd (esd )
834-
835- LOG .debug ('esd details here after process_esd(): ' )
836- LOG .debug (esd )
837- self .esd_names = esd .esd_dict .keys () or []
838- LOG .debug ('##### self.esd_names obtainded here:' )
839- LOG .debug (self .esd_names )
850+ self .esd_processor .process_esd (self .get_all_bigips (), esd_dir )
851+ self .lbaas_builder .init_esd (self .esd_processor )
852+ self .service_adapter .init_esd (self .esd_processor )
853+
840854 except f5ex .esdJSONFileInvalidException as err :
841855 LOG .error ("unable to initialize ESD. Error: %s." , err .message )
842- self ._set_agent_status (False )
856+ except IOError as ioe :
857+ LOG .error ("unable to process ESD file. Error: %s." , ioe .message )
858+ except Exception as exc :
859+ LOG .error ("unknown Error happens. Error: %s." , exc .message )
860+
861+ LOG .debug ('ESD details here after process_esd(): ' )
862+ LOG .debug (self .esd_processor )
863+ self .esd_names = self .esd_processor .esd_dict .keys () or []
864+ LOG .debug ('self.esd_names obtainded here:' )
865+ LOG .debug (self .esd_names )
843866
844867 def _validate_ha (self , bigip ):
845868 # if there was only one address supplied and
846869 # this is not a standalone device, get the
847- # devices trusted by this device. """
870+ # devices trusted by this device.
848871 device_group_name = None
849872 if self .conf .f5_ha_type == 'standalone' :
850873 if len (self .hostnames ) != 1 :
0 commit comments