aboutsummaryrefslogtreecommitdiffstats
path: root/src/python/netconf_server/netconf_change_listener_factory.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/python/netconf_server/netconf_change_listener_factory.py')
-rw-r--r--src/python/netconf_server/netconf_change_listener_factory.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/python/netconf_server/netconf_change_listener_factory.py b/src/python/netconf_server/netconf_change_listener_factory.py
index fa5e071..9b9ff24 100644
--- a/src/python/netconf_server/netconf_change_listener_factory.py
+++ b/src/python/netconf_server/netconf_change_listener_factory.py
@@ -19,7 +19,10 @@
###
import logging
+
+from netconf_server.netconf_app_configuration import NetconfAppConfiguration
from netconf_server.netconf_change_listener import NetconfChangeListener
+from netconf_server.netconf_kafka_client import NetconfKafkaClient, provide_configured_kafka_client
from netconf_server.sysrepo_interface.config_change_subscriber import ConfigChangeSubscriber
logger = logging.getLogger(__name__)
@@ -27,8 +30,9 @@ logger = logging.getLogger(__name__)
class NetconfChangeListenerFactory(object):
- def __init__(self, modules_to_subscribe_names: list):
+ def __init__(self, modules_to_subscribe_names: list, app_configuration: NetconfAppConfiguration):
self.modules_to_subscribe_names = modules_to_subscribe_names
+ self.app_configuration = app_configuration
def create(self) -> NetconfChangeListener:
subscriptions = list()
@@ -36,5 +40,13 @@ class NetconfChangeListenerFactory(object):
subscriptions.append(
ConfigChangeSubscriber(module_name)
)
- return NetconfChangeListener(subscriptions)
+ kafka_client = NetconfChangeListenerFactory._try_to_create_kafka_client(
+ self.app_configuration.kafka_host_name,
+ self.app_configuration.kafka_port
+ )
+
+ return NetconfChangeListener(subscriptions, kafka_client, self.app_configuration.kafka_topic)
+ @staticmethod
+ def _try_to_create_kafka_client(kafka_host_name: str, kafka_port: int):
+ return provide_configured_kafka_client(kafka_host_name, kafka_port) # type: NetconfKafkaClient