Merge "Release D doc update"
[parser.git] / docs / developer / design / policy2tosca.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 POLICY2TOSCA
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 - POLICY2TOSCA requires the following to be installed.
21
22 1. cliff
23 --------
24
25 Install cliff with the following links.
26 ::
27 - `install <http://docs.openstack.org/developer/cliff/install.html>`
28 or
29 - `demoapp <http://docs.openstack.org/developer/cliff/demoapp.html>`
30
31 Installation
32 ============================
33
34 Please follow the below installation steps to install parser - POLICY2TOSCA.
35
36 Step 1: Clone the parser project.
37
38 .. code-block:: bash
39
40     git clone https://gerrit.opnfv.org/gerrit/parser
41
42 Step 2: Install the policy2tosca module.
43
44 .. code-block:: bash
45
46     cd parser/policy2tosca
47     python setup.py install
48
49 Execution
50 ===========================
51
52 Step 1: To see a list of commands available.
53
54 .. code-block:: bash
55
56     policy2tosca --help
57
58 Step 2: To see help for an individual command, include the command name on the command line
59
60 .. code-block:: bash
61
62     policy2tosca help <service>
63
64 Step 3: To inject/remove policy types/policy definitions provide the TOSCA file as input to policy2tosca command line.
65
66 .. code-block:: bash
67
68     policy2tosca <service> [arguments]
69
70 Example:
71
72 .. code-block:: bash
73
74     policy2tosca add-definition --policy_name rule2 --policy_type  tosca.policies.Placement.Geolocation --description "test description" --properties region:us-north-1,region:us-north-2,min_inst:2 --targets VNF2,VNF4 --metadata "map of strings" --triggers "1,2,3,4" --source example.yaml
75
76
77 Step 4: Verify the TOSCA YAMl updated with the injection/removal executed.
78
79 .. code-block:: bash
80
81     cat "<source tosca file>"
82
83 Example:
84
85 .. code-block:: bash
86
87     cat example_tosca.yaml