55ffad9fd0a065df3aa3b215816c1a0fa79c85b2
[dcaegen2/platform/cli.git] / blueprint-generator / README.md
1 # Blueprint Generator 
2
3 This tool allows the user to create a blueprint from a component spec json file 
4
5 # Instructions for building the tool locally
6 - cd into the root directory of the project (where the pom is located)
7 - Run the command: mvn clean install
8 - This will create a jar file and a tar file
9 - Unzip the tar file within this target directory
10 - cd into the folder that was created
11 - Instructions on how to run the tool from this folder are below
12 - If you're on windows type this out before you add your flags 
13
14 ```bash
15 java -cp "lib/blueprint-generator-1.0.0-SNAPSHOT.jar;lib/*" org.onap.blueprintgenerator.core.BlueprintGenerator
16 ```
17
18 -If you're on linux type this out before you add your flags
19
20 ```bash
21 java -cp blueprint-generator/lib/blueprint-generator-1.0.0-SNAPSHOT.jar:blueprint-generator/lib/* org.onap.blueprintgenerator.core.BlueprintGenerator
22 ```
23
24
25 # Instructions for running BlueprintGenerator:
26
27 ## Instructions for running:
28
29
30 -Run the program on the command line with the following tags:
31 OPTIONS:
32 - -p: The path to where the final blueprint yaml file will be created (Required)
33 - -i: The path to the JSON spec file (required)
34 - -n: Name of the blueprint (optional)
35 - -t: the path to the import yaml file (optional)
36 - -d: Onvoke the dmaap plugin (optional)
37 - -o: The service component name override (optional)
38
39
40 If you're on windows it will look like this:
41  
42 ```bash
43 java -cp "lib/blueprint-generator-onap-0.0.1-SNAPSHOT.jar;lib/*" org.onap.blueprintgenerator.core.BlueprintGenerator -p Blueprints -i ComponentSpecs/TestComponentSpec.json -n HelloWorld -d
44 ```
45
46 If you're on linux it will look like this
47
48 ```bash
49 java -cp blueprint-generator/lib/blueprint-generator-0.0.1-SNAPSHOT.jar:blueprint-generator/lib/* org.onap.blueprintgenerator.core.BlueprintGenerator -p Blueprints -i ComponentSpecs/TestComponentSpec.json -n HelloWorld -d
50 ```
51
52 This command will create a blueprint from the component spec TestComponentSpec. The blueprint file name will be called HelloWorld.yaml and it will be in the directory Blueprints.THe blueprint will also contain the dmaap plugin.
53
54 ## Extra information:
55 - The component spec must be of the same format as stated in the onap [readthedocs](https://onap.readthedocs.io/en/latest/submodules/dcaegen2.git/docs/sections/components/component-specification/common-specification.html#working-with-component-specs) page 
56 - If the tag says required then the program will not run without those tags being there
57 - If the tag says optional then it is not necessary to run the program with those tags
58 - If you do not add a -n tag the blueprint name will default to what it is in the component spec
59 - If the directory you specified in the -p tag does not already exist the directory will be created for you
60 - The -t flag will override the default imports set for the blueprints. To see an example of how the import yaml file should be structured see the testImports.yaml file under the folder TestCases.
61
62
63 #Instructions for policy models
64
65 -Run the program on the command line with the following tags:
66 OPTIONS:
67 - -i: The path to the JSON spec file (required)
68 - -p: The output path for all of the models (required)
69
70 If you're on windows it will look like this:
71  
72 ```bash
73 java -cp "lib/blueprint-generator-onap-0.0.1-SNAPSHOT.jar;lib/*" org.onap.blueprintgenerator.core.PolicyCreate -p models -i ComponentSpecs/TestComponentSpec.json
74 ```
75
76 If you're on linux it will look like this
77
78 ```bash
79 java -cp blueprint-generator/lib/blueprint-generator-0.0.1-SNAPSHOT.jar:blueprint-generator/lib/* org.onap.blueprintgenerator.core.PolicyCreate -i ComponentSpecs/TestComponentSpec.json
80 ```
81
82 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)