From 7dba0ae9c7a6833579139c3f095d280c4439d055 Mon Sep 17 00:00:00 2001 From: Bartosz Gardziejewski Date: Wed, 14 Apr 2021 13:00:19 +0200 Subject: Update README Signed-off-by: Bartosz Gardziejewski Change-Id: I857731efaf7bcdeeaaa354ba33379371131b5237 Issue-ID: INT-1869 --- README.md | 2 +- src/python/README.md | 57 +++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index cd45156..8f351cc 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Netconf server provides REST interface, with enpoints: ### logging Netconf server print all logs on to the console. -Logs from python application are also stored in file `/logs/netconf_saver.log` +Logs from python applications are also stored in files located in `/logs` directory ## Development guide diff --git a/src/python/README.md b/src/python/README.md index 90906c6..7ad3b2a 100644 --- a/src/python/README.md +++ b/src/python/README.md @@ -1,17 +1,54 @@ -# Netconf Server Python Application -This application is providing core Netconf Server capabilities. -It is started in detached mode on image startup. +# Netconf Server Python Applications +This Python project contains two entry points for two applications. +These applications are providing core Netconf Server capabilities. +They are both started in detached mode on image startup. -Application capabilities: - - Subscribing on config change per model. - - Models to subscribe to are loaded from configuration file, - provided as application parameter. - - When configuration of one of models change - information about change are logged +Applications: +- netconf_change_listener +- netconf_rest + +This approach was selected due to problem with opening two connections to sysrepo in one process. +Moreover, both applications are independent, they use sysrepo to communicate. + +*netconf_rest or TLS or SSH -> sysrepo -> netconf_change_listener -> kafka* + +Common parts for both entry points is located in python package netconf-server. + + +## Netconf change listener +Change listener is subscribing on sysrepo model configuration change. +Then it connects to *Kafka* message queue as a *KafkaProducer*. +In order to connect to *Kafka* application parameters are used. + +**Application capabilities:** +- Subscribing on config change per model. + - Models to subscribe to are loaded from configuration file, + provided as application parameter. + - When configuration of one of models change + information about change are logged and send to *Kafka* + + +## Netconf rest +Creates endpoints that can be used to communicate with sysrepo. +Then it connects to *Kafka* message queue as a *KafkaConsumer*. +In order to connect to *Kafka* application parameters are used. + +Available endpoints: +- *GET* `/healthcheck` returns 200 "UP" if server is up and running +- *POST* `/readiness` return 200 "Ready" if server is ready, if not, returns 503 "Not Ready" + - readiness check is trying to connect with *Kafka* as a consumer, + if this connection fails application is returning "Not Ready". +- *POST* `/change_config/` changes configuration ad returns 202 "Accepted" + - performs configuration change for given module (module_name) using sysrepo-python library. +- *GET* `/get_config/` returns 200 and current configuration + - performs get configuration for given module (module_name) using sysrepo-python library. +- *GET* `/change_history` returns 200 and change history as json + - Connects to *Kafka* as a consumer and pulls all changes, then returns them in json form. ## Testing Tox file with pytest are used fo testing. + ## Logging -Application prints logs on to the console and to file `/logs/netconf_saver.log` +Applications print logs on to the console and to files located in `/logs` directory -- cgit 1.2.3-korg