def connect(self, application_name, **kwargs): network_application = NetworkApplication.get_instance() network_application.name = application_name self.network_element = network_application.get_network_element( self.element_hostname) if self.network_element is None: self.logger.error("Failed to get network element") sys.exit(1) self.logger.info("We have a NetworkElement : " + self.network_element.__str__()) session_config = SessionConfig( SessionConfig.SessionTransportMode.TLS) #default is TLS session_config.eventQueueSize = self.properties["eventQueueSize"] session_config.eventThreadPool = self.properties["eventThreadPool"] session_config.eventDropMode = self.properties["eventDropMode"] session_config.keepAliveIdleTime = self.properties["keepAliveIdleTime"] session_config._keepAliveInterval = self.properties[ "keepAliveInterval"] session_config.keepAliveRetryCount = self.properties[ "keepAliveRetryCount"] session_config.reconnectTimer = self.properties["reconnectTimer"] session_config.ca_certs = self.root_cert_path self.session_handle = self.network_element.connect( self.username, self.password, session_config) if self.session_handle is None: logging.error("Failed to connect to the network element") return False logging.info("successful in connecting to the network element") return True