Update BPGenerator readme
[dcaegen2/platform.git] / mod / bpgenerator / README.md
1 # Blueprint Generator 
2
3 Blueprint Generator is a java-based project used to generate a cloudify blueprint yaml from a component spec json file.
4
5 It can be used either:
6 - as a standalone application by directly using *onap-executable/target/blueprint-generator-onap-executable-1.7.3-SNAPSHOT.jar*
7 - as a Spring library
8
9 # Instructions for building the tool locally
10 - Change directory into the root directory of the project (where the pom is located)
11 - Run the command: `mvn clean install`
12 - This will create jar files
13
14 # Instructions for running BlueprintGenerator standalone:
15 Base command to run BlueprintGenerator:
16 ```bash
17 java -jar onap-executable/target/blueprint-generator-onap-executable-1.7.3-SNAPSHOT.jar app ONAP
18 ```
19 ## Instructions for component blueprints:
20 Run the program on the command line with the following options:
21 - -i OR --component-spec: The path of the ONAP Blueprint INPUT JSON SPEC FILE (Required)
22 - -p OR --blueprint-path: The path of the ONAP Blueprint OUTPUT where it will be saved (Required)
23 - -n OR --blueprint-name: The NAME of the ONAP Blueprint OUTPUT that will be created (Optional)
24 - -t OR --imports: The path of the ONAP Blueprint IMPORT FILE (Optional)
25 - -o OR --service-name-override: The Value used to OVERRIDE the SERVICE NAME of the ONAP Blueprint  (Optional)
26 - -d OR --dmaap-plugin: The option to create an ONAP Blueprint with DMAAP Plugin included (Optional)
27
28 it will look like this:
29
30 ```bash
31 java -jar onap-executable/target/<JAR Filename>.jar app ONAP -i componentspec -p OutputBlueprintPath  -n Blueprintname -d
32 ```
33
34 This command will create a blueprint from the component spec. The blueprint file name will be called Blueprintname.yaml and it will be in the directory OutputBlueprintPath. The blueprint will also contain the DMaaP plugin. 
35
36 ### Extra information:
37 - The component spec must be of the same format as stated in the onap [readthedocs](https://docs.onap.org/projects/onap-dcaegen2/en/latest/sections/design-components/component-specification/component-type-docker.html) page 
38 - If the tag says required then the program will not run without those tags being there
39 - If the tag says optional then it is not necessary to run the program with those tags
40 - If you do not add a -n tag the blueprint name will default to what it is in the component spec
41 - If the directory you specified in the -p tag does not already exist the directory will be created for you
42 - The -t flag will override the default imports set for the blueprints. Below you can see example content of the import file:
43 ```yaml
44 imports:
45   - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml
46   - plugin:k8splugin?version=3.6.0
47   - plugin:dcaepolicyplugin?version=2.4.0
48 ```
49
50 ## Instructions for policy models
51 In order to use BlueprintGenerator for policy models option: *-type policycreate* needs to be provided to the base
52 command. Other available options:
53 - -i: The path to the JSON spec file (required)
54 - -p: The output path for all of the models (required)
55
56 it will look like this:
57                    
58 ```bash
59 java -jar onap-executable/target/<JAR Filename>.jar app ONAP -type policycreate -i componentspec -p OutputPolicyPath
60 ```
61
62 This command will create a directory called models and put the policy models created from the component spec given in that directory. (A component spec may generate multiple policy models)
63
64 # Instructions for using BlueprintGenerator as a library
65 To use BlueprintGenerator you need to import the following artifact to your project:
66 ```xml
67 <dependency>
68     <groupId>org.onap.dcaegen2.platform.mod</groupId>
69     <artifactId>blueprint-generator-onap</artifactId>
70     <version>1.7.3</version>
71 </dependency>
72 ```
73 In order to see how to use the library in detail please see file:
74 *bpgenerator/onap-executable/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java*