Add to_directory method to relevant object classes
[oam.git] / code / network-topology-instance-generator / README.md
1 # Network Topology Instance Generator 
2
3 This python project generates a network topology according 
4 [TAPI-Topology yang - v2.1.3](https://github.com/OpenNetworkingFoundation/TAPI/blob/v2.1.3/YANG/tapi-topology.yang).
5
6 Please note: The generator does not need to implement streaming or notification 
7 functions. The dependencies to tapi-notification and tapi-streaming were 
8 removed. 
9
10 Each network-function is represented as TAPI-Node which exposes interfaces to 
11 other network-functions or to management systems.
12
13 Therefore the Network Topology can cover 
14
15  * Data Plane (also called User Plane), 
16  * Synchronization Plane, 
17  * Control Plane and
18  * Management Plane.
19
20 Interface end-points of network-functions are represented as 
21 TAPI-Owned-Node-Edge-Points. TAPI-Links create a logical connection between 
22 TAPI-Owned-Node-Edge-Points of the same layer (or even more strict of the same 
23 layer-protocol-name).
24
25 ## Prerequisites
26
27 All commands are executed form the directory of this README file.
28
29 ```
30 sudo pip install jsonschema
31 ```
32
33 Steps to import TAPI yang data models and O-RAN-SC extensions:
34
35 ``` bash
36 # TAPI v2.1.3
37 cd model
38 mkdir yang
39 cd yang
40 git clone https://github.com/OpenNetworkingFoundation/TAPI.git
41 cd TAPI
42 git checkout v2.1.3
43
44 # O-RAN-SC extensions
45 cd ..
46 git clone "https://gerrit.o-ran-sc.org/r/scp/oam/modeling"
47 ```
48
49 ## Generation Input
50
51 The generator consumes a json as input. The json defines the hierarchy of 
52 network-function types and its number of elements per parent.
53
54 Example:
55
56 ``` json
57 {
58   "network": {
59     "name": "Test network",
60     "pattern": {
61       "o-du":2,
62       "o-ru":3
63     }
64   }
65 }
66 ```
67
68 The resulting network will include 2 network-functions of type "o-du". 
69 Each "o-du" is connected to 3 network-function instances of type "o-ru".
70
71 ```
72 network
73  +-- o-du-1
74  |   +-- o-ru-11
75  |   +-- o-ru-12
76  |   +-- o-ru-13
77  +-- o-du-2
78      +-- o-ru-21
79      +-- o-ru-22
80      +-- o-ru-23
81 ```
82 ## Usage
83
84 ```
85 python tapi_topology_generator.py config.json
86 ```
87
88 ## Validation
89
90 The generated json file can be validated against the yang models using 'yanglint'.
91
92 ```
93 yanglint -f json \
94 -p model/yang/modeling/data-model/yang/published/ietf \
95 -p model/yang/TAPI/YANG \
96 model/yang/modeling/data-model/yang/working/o-ran-sc/o-ran-sc-topology/o-ran-sc-topology*.yang \
97 model/yang/TAPI/YANG/*.yang \
98 output/TestNetwork.json
99 ```