From 211e9d00da7c8cdf8bccee6fc387d7389bd65224 Mon Sep 17 00:00:00 2001 From: demx8as6 Date: Mon, 21 Feb 2022 15:46:43 +0100 Subject: [PATCH] Create a script to generate a Topology - Describe purpose and usage of a topology generator. IssueID: OAM-249 Change-Id: I57bf5f7fe5b6605f1690f597e31e717253c818a5 Signed-off-by: demx8as6 --- code/network-topology-instance-generator/README.md | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 code/network-topology-instance-generator/README.md diff --git a/code/network-topology-instance-generator/README.md b/code/network-topology-instance-generator/README.md new file mode 100644 index 0000000..4e44de9 --- /dev/null +++ b/code/network-topology-instance-generator/README.md @@ -0,0 +1,99 @@ +# Network Topology Instance Generator + +This python project generates a network topology according +[TAPI-Topology yang - v2.1.3](https://github.com/OpenNetworkingFoundation/TAPI/blob/v2.1.3/YANG/tapi-topology.yang). + +Please note: The generator does not need to implement streaming or notification +functions. The dependencies to tapi-notification and tapi-streaming were +removed. + +Each network-function is represented as TAPI-Node which exposes interfaces to +other network-functions or to management systems. + +Therefore the Network Topology can cover + + * Data Plane (also called User Plane), + * Synchronization Plane, + * Control Plane and + * Management Plane. + +Interface end-points of network-functions are represented as +TAPI-Owned-Node-Edge-Points. TAPI-Links create a logical connection between +TAPI-Owned-Node-Edge-Points of the same layer (or even more strict of the same +layer-protocol-name). + +## Prerequisites + +All commands are executed form the directory of this README file. + +``` +sudo pip install jsonschema +``` + +Steps to import TAPI yang data models and O-RAN-SC extensions: + +``` bash +# TAPI v2.1.3 +cd model +mkdir yang +cd yang +git clone https://github.com/OpenNetworkingFoundation/TAPI.git +cd TAPI +git checkout v2.1.3 + +# O-RAN-SC extensions +cd .. +git clone "https://gerrit.o-ran-sc.org/r/scp/oam/modeling" +``` + +## Generation Input + +The generator consumes a json as input. The json defines the hierarchy of +network-function types and its number of elements per parent. + +Example: + +``` json +{ + "network": { + "name": "Test network", + "pattern": { + "o-du":2, + "o-ru":3 + } + } +} +``` + +The resulting network will include 2 network-functions of type "o-du". +Each "o-du" is connected to 3 network-function instances of type "o-ru". + +``` +network + +-- o-du-1 + | +-- o-ru-11 + | +-- o-ru-12 + | +-- o-ru-13 + +-- o-du-2 + +-- o-ru-21 + +-- o-ru-22 + +-- o-ru-23 +``` +## Usage + +``` +python tapi_topology_generator.py config.json +``` + +## Validation + +The generated json file can be validated against the yang models using 'yanglint'. + +``` +yanglint -f json \ +-p model/yang/modeling/data-model/yang/published/ietf \ +-p model/yang/TAPI/YANG \ +model/yang/modeling/data-model/yang/working/o-ran-sc/o-ran-sc-topology/o-ran-sc-topology*.yang \ +model/yang/TAPI/YANG/*.yang \ +output/TestNetwork.json +``` -- 2.16.6