Support python3 uploaded to pypi websit
[parser.git] / docs / developer / design / yang2tosca.rst
1 .. This work is licensed under a Creative Commons Attribution
2 .. 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
4
5 =================
6 Parser yang2tosca
7 =================
8
9 Problem description
10 -------------------
11 In NFV, various templates are utilized to describe the deployment requirements,
12 the post-instantiation records or other purposes. However in order to make
13 these templates adaptable and feasible for purpose like deployment
14 orchestration/automation, certain tooling mechanism that provides template
15 translation is necessary.When an end user needs a translation from YANG to
16 TOSCA for further deployment this is where the yang2tosca module comes in as
17 part of parser project.
18
19 Design
20 ------
21 The following modules are implemented in yang2tosca module.
22
23 PYANG
24 -----
25 PYAG module is used to validate YANG templates, if the user input the YAGN
26 template in YAML format we use this module to validate and convert it to XML
27 format of YANG.The “yin” module under PYANG is used for the conversion from
28 YAML to XML.
29 Reference for PYANG:
30 http://www.yang-central.org/twiki/pub/Main/YangTools/pyang.1.html
31
32 LXML
33 ----
34 lxml is another python module that we make use in our design, this module is
35 used to parse the xml object, which will be the base for translational.
36 The “etree” module under lxml is used for the translation to TOSCA files.
37 Reference for lxml: http://lxml.de/
38
39 tosca_translator
40 ----------------
41 All the above module come under this tosca_translator function which can be
42 invoked and used for translation purposes.
43
44 The user inputs the YANG template in either XML or in YAML format to the
45 yang2tosca module and the output is the TOSCA YAML file.
46 1.The First step in the module is where the input is checked for the format.
47    If the format is YAML then a module called pyang converts this into a YANG
48    XML file.
49    If the format is XML then then the conversion process is initiated.
50 2.The conversion process will be with the help of an XSLT which will be invoked
51 through python scripting.
52
53 Input
54 -----
55 The user can input either YANG XML or YANG YAML file which should be present
56 where the scripts/modules are present.
57
58 Output
59 ------
60 The user will get the out TOSCA YAML file under the same directory where the
61 scripts/modules are executed with same name as the input file with "_tosca"
62 suffixed to it.