[VES-OPENAPI] Update docs with kafka
[dcaegen2.git] / docs / sections / design-components / blueprint_generator.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. _blueprintgenerator:
4
5
6 Blueprint Generator
7 ===================
8
9 What is Blueprint Generator?
10 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11
12 The blueprint generator is java-based tool to take a component spec 
13 for a given micro-service and translate that component spec into a 
14 cloudify blueprint yaml file that can be used during deployment in DCAE 
15 Runtime plaform.  
16
17 Service components to be deployed as stand-alone 
18 (i.e not part of DCAE service composition flow) can use the blueprint-generator
19 utility to create deployment yaml. The generated blueprint can be uploaded 
20 to inventory and deployed from Dashboard directly.
21
22
23 Steps to run the blueprint generator
24 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25
26 1. Download the `blueprint generator jar <https://nexus.onap.org/service/local/repositories/releases/content/org/onap/dcaegen2/platform/mod/blueprint-generator-onap-executable/1.7.3/blueprint-generator-onap-executable-1.7.3.jar>`__  file from Nexus
27
28 2. To execute the application, run the following command
29  
30     ``java -jar blueprint-generator-onap-executable-1.7.3.jar app ONAP``
31
32 3. This execution will provide the help, as you have not provided the required flags.
33
34 4. When ready you can run the program again except with the required flags.
35
36 5. OPTIONS
37
38    -  -i OR --component-spec: The path of the ONAP Blueprint INPUT JSON SPEC FILE (Required)
39    -  -p OR --blueprint-path: The path of the ONAP Blueprint OUTPUT where it will be saved (Required)
40    -  -n OR --blueprint-name: The NAME of the ONAP Blueprint OUTPUT that will be created (Optional)
41    -  -t OR --imports: The path of the ONAP Blueprint IMPORT FILE (Optional)
42    -  -o OR --service-name-override: The Value used to OVERRIDE the SERVICE NAME of the ONAP Blueprint  (Optional)
43    -  -d OR --dmaap-plugin: The option to create an ONAP Blueprint with DMAAP Plugin included (Optional)
44
45 6. An example running this program is shown below
46
47     ``java -jar blueprint-generator-onap-executable-1.7.3.jar app ONAP -p blueprint_output -i ComponentSpecs/TestComponentSpec.json -n TestAppBlueprint``
48
49
50 Extra information
51 -----------------
52
53 1. The component spec must be compliant with `Component Spec json schema <https://git.onap.org/dcaegen2/platform/plain/mod/component-json-schemas/component-specification/dcae-cli-v2/component-spec-schema.json>`__
54    
55 2. If the flag is marked required then the corresponding values must be provided for blueprint-generator execution
56
57 3. If the flag is identified as optional then it is not mandatory for blueprint-generator execution
58
59 4. If you do not add a -n flag the blueprint name will default to what it is in the component spec
60
61 5. If the directory you specified in the -p flag does not already exist the directory will be created for you
62
63 6. The -t flag will override the default imports set for the blueprints. Below you can see example content of the import file:
64
65 ::
66
67     imports:
68       - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml
69       - plugin:k8splugin?version=3.6.0
70       - plugin:dcaepolicyplugin?version=2.4.0
71
72
73 How to create policy models:
74 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
75
76 1. Policy model creation can be done with the same jar as downloaded for the blueprint generation.
77
78 2. Run the same command as the blueprint generator except add a flag ``-type policycreate``
79
80 3. Options
81
82    - -i: The path to the JSON spec file (required)
83    - -p: The Output path for all of the models (required)
84
85 4. Example command
86
87     ``java -jar blueprint-generator-onap-executable-1.7.3.jar app ONAP -type policycreate -i componentspec -p OutputPolicyPath``
88
89
90 Extra information
91 -----------------
92
93 1. Not all component specs will be able to create policy models
94
95 2. Multiple policy model files may be created from a single component spec
96
97
98 How to use Blueprint Generator as a Spring library
99 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100 To use BlueprintGenerator you need to import the following artifact to your project:
101
102 ::
103
104     <dependency>
105         <groupId>org.onap.dcaegen2.platform.mod</groupId>
106         <artifactId>blueprint-generator-onap</artifactId>
107         <version>1.7.3</version>
108     </dependency>
109
110 In order to see how to use the library in detail please familiarize yourself with real application: `Blueprint Generator Executable main class <https://git.onap.org/dcaegen2/platform/plain/mod/bpgenerator/onap-executable/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java>`__