remove contributors
[parser.git] / docs / developer / design / yang2tosca.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3
4 =================
5 Parser YANG2TOSCA
6 =================
7
8 Overview
9 ========
10
11 Parser is an open source project and licensed under Apache 2. Parser will help
12 to provide a tooling mechanism, by parsing Telecom operators’ VNF descriptors
13 (YANG templates) into TOSCA templates and then further translate TOSCA
14 templates into certain common templates, which could be used in IaaS orchestration
15 projects like OpenStack Heat.
16
17 Prerequisites
18 =============
19
20 Parser requires the following to be installed.
21
22 1. PYANG
23 --------
24
25 Please follow the below installation steps.
26
27 Step 1: Clone pyang tool or download the zip file from the following link.
28
29 .. code-block:: bash
30
31     git clone https://github.com/mbj4668/pyang.git
32
33 OR
34
35 .. code-block:: bash
36
37     wget https://github.com/mbj4668/pyang/archive/master.zip
38
39 Step 2: Change directory to the downloaded directory and run the setup file.
40
41 .. code-block:: bash
42
43     cd pyang
44     python setup.py
45
46 2. python-lxml
47 --------------
48
49 Please follow the below installation link. http://lxml.de/installation.html
50
51
52 Installation
53 ============================
54
55 Please follow the below installation steps to install parser.
56
57 Step 1: Clone the parser project.
58
59 .. code-block:: bash
60
61     git clone https://gerrit.opnfv.org/gerrit/parser
62
63 Execution
64 ===========================
65
66 Step 1: Change directory to where the scripts are present.
67
68 .. code-block:: bash
69
70     cd parser/yang2tosca
71
72 Step 2: Copy the YANG file which needs to be converted into TOSCA to
73         current (parser/yang2tosca) folder.
74
75 Step 3: Run the python script "parser.py" with the YANG file as an input option.
76
77 .. code-block:: bash
78
79     python parser.py -n "YANG filename"
80
81 Example:
82
83 .. code-block:: bash
84
85     python parser.py -n example.yaml
86
87 Step 4: Verify the TOSCA YAMl which file has been created with the same name
88         as the YANG file with a “_tosca” suffix.
89
90 .. code-block:: bash
91
92     cat "YANG filename_tosca.yaml"
93
94 Example:
95
96 .. code-block:: bash
97
98     cat example_tosca.yaml