diff options
author | ebo <eliezio.oliveira@est.tech> | 2020-04-03 15:24:15 +0100 |
---|---|---|
committer | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2020-04-08 08:52:09 +0000 |
commit | f986059d04af9eafe85aafe467e3196e8400098c (patch) | |
tree | e42f20f8117d752498ba9d302878172280c98a1c /test/mocks/netconf-pnp-simulator/docs | |
parent | 7a3199bf4a05ffe7148ab7139a73df863a659353 (diff) |
netconf-pnp-simulator: convenient TLS and SSH configuration
- Simple SSH and TLS configuration. Instead of specific Netopeer2
XML configuration files, the user only needs to provide:
For SSH: id_XXX.pub
For TLS: server_key.pem, server_cert.pem, and ca.pem
- SSH and TLS can be reconfigured at runtime by running
/opt/bin/reconfigure-ssh.sh and /opt/bin/reconfigure-tls.sh respectively
- Improved log readability by using zlog (on C applications) and loguru
for Python
See the updated documentation under ../docs for more information.
Issue-ID: INT-1516
Change-Id: I21052d2524f0610c6197875a544113cce1a02787
Signed-off-by: ebo <eliezio.oliveira@est.tech>
Diffstat (limited to 'test/mocks/netconf-pnp-simulator/docs')
-rw-r--r-- | test/mocks/netconf-pnp-simulator/docs/README.md | 63 | ||||
-rw-r--r-- | test/mocks/netconf-pnp-simulator/docs/README.rst | 116 |
2 files changed, 116 insertions, 63 deletions
diff --git a/test/mocks/netconf-pnp-simulator/docs/README.md b/test/mocks/netconf-pnp-simulator/docs/README.md deleted file mode 100644 index 8aa24504f..000000000 --- a/test/mocks/netconf-pnp-simulator/docs/README.md +++ /dev/null @@ -1,63 +0,0 @@ -# NETCONF Plug-and-Play Simulator - -[![GitHub Tag][gh-tag-badge]]() -[![Docker Automated Build][dockerhub-badge]][dockerhub] - -## Overview - -This project builds a modular engine that allows the creation of NETCONF-enabled devices simulators, -either physical (PNF) and virtual (VNF). - -Basically it's a docker container running Sysrepo and Netopeer2 servers enhanced with a plugger script that, at -start-time, performs the following actions: - -1. Configures TLS and SSH secure accesses to the Netopeer2 server; -2. Installs multiple YANG models into sysrepo datastore; -3. Launches the corresponding subscriber applications. - -The picture below unveils the architecture of this solution. - -![Architecture](images/Architecture.png) - -A YANG module contains the following files: - -| Filename | Purpose -| -------- | ------- -|`model.yang` | The YANG model specified according to [RFC-6020][yang-rfc]. Alternatively, you can use your model's name as a basename for this file. Example: `mynetconf.yang`. -|`data.json` or `data.xml` | An optional data file used to initialize your model. -|`subscriber.py` | The Python 3 application that implements the behavioral aspects of the YANG model. -|`requirements.txt` | [Optional] Additional Python packages specified in the [Requirements File Format][py-requirements]. - -## Application - -The `subscriber` is free to implement any wanted passive or active behaviour: - -**Passive Behaviour**: The subscriber will receive an event for each modification externally applied to the YANG model. - -**Active Behaviour**: At any point in time the subscriber can proactively change its own YANG model. - -## Runtime Configuration - -### Customizing TLS and SSH accesses - -The distributed docker image comes with a sample configuration for TLS and SSH, that can be found at -`/config/tls` and `/home/netconf/.ssh` directories respectively. The user can replace one or both configurations -by mounting a custom directory under the respective TLS or SSH mounting point. - -### Python Virtual Environment Support - -Python programs usually use additional packages not included in the standard Python distribution, -like the `requests` package, for example. -We support this scenario by creating isolated Python environments for each custom-provided module whenever -a `requirements.txt` file is present in the module directory. - -## Example Module - -The directory `examples/mynetconf` contains an example YANG model and its subscriber along with a -Docker Compose configuration file to launch a basic simulator. - -[dockerhub]: https://hub.docker.com/r/blueonap/netconf-pnp-simulator/ -[dockerhub-badge]: https://img.shields.io/docker/cloud/automated/blueonap/netconf-pnp-simulator -[gh-tag-badge]: https://img.shields.io/github/v/tag/blue-onap/netconf-pnp-simulator?label=Release -[py-requirements]: https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format -[yang-rfc]: https://tools.ietf.org/html/rfc6020 diff --git a/test/mocks/netconf-pnp-simulator/docs/README.rst b/test/mocks/netconf-pnp-simulator/docs/README.rst new file mode 100644 index 000000000..452827970 --- /dev/null +++ b/test/mocks/netconf-pnp-simulator/docs/README.rst @@ -0,0 +1,116 @@ +NETCONF Plug-and-Play Simulator +=============================== + +.. sectnum:: + +.. _py-requirements: https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format +.. _yang-rfc: https://tools.ietf.org/html/rfc6020 + +|ci-badge| |release-badge| |docker-badge| + +.. |ci-badge| image:: https://github.com/blue-onap/netconf-pnp-simulator/workflows/CI/badge.svg + :alt: CI +.. |release-badge| image:: https://img.shields.io/github/v/tag/blue-onap/netconf-pnp-simulator?label=Release + :alt: GitHub tag +.. |docker-badge| image:: https://img.shields.io/badge/docker%20registry-Quay.io-red + :target: https://quay.io/repository/blue-onap/netconf-pnp-simulator?tab=tags + +Overview +-------- + +This project builds a modular engine that allows the creation of NETCONF-enabled devices simulators, +either physical (PNF), virtual (VNF), or cloud-native (CNF) + +Simply put, it's a docker container running Sysrepo and Netopeer2 servers enhanced with a plugger script that +performs the following actions at start-time: + +1. Configures TLS and SSH secure accesses to the Netopeer2 server; +2. Installs multiple YANG models into sysrepo datastore; +3. Launches the corresponding subscriber applications. + +The picture below unveils the architecture of this solution. + +.. image:: images/Architecture.png + :width: 511px + +A YANG module contains the following files: + +.. list-table:: + :widths: 10 50 + :header-rows: 1 + + * - Filename + - Purpose + * - ``model.yang`` + - The YANG model specified according to `RFC-6020 <yang-rfc_>`_ and named after the module's name, e.g., *mynetconf.yang*. + * - ``startup.json`` or ``startup.xml`` + - An optional data file with the initial values of the model. Both JSON and XML formats are supported. + * - ``subscriber.py`` + - The Python 3 application that implements the behavioral aspects of the YANG model. + * - ``requirements.txt`` + - [Optional] Lists the additional Python packages required by the application, specified in the `Requirements File Format <py-requirements_>`_. + +Application +----------- + +The ``subscriber.py`` application can implement any wanted passive or active behaviour: + +**Passive Behaviour**: The subscriber will receive an event for each modification externally applied to the YANG model. + +**Active Behaviour**: At any point in time the subscriber can proactively change its own YANG model. + +Runtime Configuration +--------------------- + +Customizing TLS and SSH accesses +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The distributed docker image comes with a sample configuration for TLS and SSH, that can be found at +``/config/tls`` and ``/config/ssh`` directories respectively. The user can replace one or both configurations +by mounting a custom directory under the respective TLS or SSH mounting point. + +TLS Configuration +^^^^^^^^^^^^^^^^^ + +You need to provide the following PEM files under ``/config/tls``: + +.. list-table:: + :widths: 10 50 + :header-rows: 1 + + * - File + - Contents + * - ``server_key.pem`` + - The server's private key in plain (*not* protected by a passphrase). + * - ``server_cert.pem`` + - The corresponding server's X.509v3 certificate. + * - ``ca.pem`` + - The Certificate Authority (CA) certificate. + +.. TIP:: You can reload the configuration at runtime by running ``docker exec <CONTAINER NAME or ID> /opt/bin/reconfigure-tls.sh`` + +SSH Configuration +^^^^^^^^^^^^^^^^^ + +For the SSH connection, you need to provide the public SSH key in one of these 3 files under ``/config/ssh`` +in order of preference: + +- ``id_ecdsa.pub``; or +- ``id_dsa.pub``; or +- ``id_rsa.pub`` + +.. TIP:: You can reload the configuration at runtime by running ``docker exec <CONTAINER NAME or ID> /opt/bin/reconfigure-ssh.sh`` + +Python Virtual Environment Support +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Python programs usually use additional packages not included in the standard Python distribution, +like the ``requests`` package, for example. +We support this scenario by creating isolated Python environments for each custom-provided module whenever +a ``requirements.txt`` file is present in the module directory. + +Example Module +-------------- + +The directory ``examples/mynetconf`` contains an example YANG model and its subscriber along with a +Docker Compose configuration file to launch a basic simulator. |