Incorporate the ECOMP SDC Artefact Generator code
[aai/babel.git] / README.md
1 # ONAP aai/babel
2
3 ## Introduction
4 Babel is a microservice in the AAI project that can be used by clients that work with TOSCA CSAR files.
5
6 It parses the TOSCA CSAR to generate xml files from a set of YAML files found in the TOSCA CSAR file.
7
8 ## Compiling Babel
9 Babel service can be compiled easily using maven command `mvn clean install`  
10
11 The compiled results will be the following artifacts in the "target" folder:
12
13 * babel_v{major-version}.zip
14 * babel_v{major-version}_props.zip
15 * babel-{version}.jar
16 * babel-{version}-client.jar
17 * babel-{version}-runtimeEnvironment.zip
18 * Dockerfile
19 * start.sh
20
21 Maven will install the following artifacts in the local repository:
22 * babel-{version}.jar
23 * babel-{version}-client.jar
24 * babel-{version}-runtimeEnvironment.zip 
25
26 Create the docker image:
27 docker build -t aai/babel target
28
29 ## Babel Client
30 The project will build a client jar that can be used by clients when using the Babel service.   
31
32 The client jar contains two objects that are used in the Babel service API.
33
34 BabelRequest is used to supply the inputs into the Babel service.
35 BabelArtifact is the response artifact in the list of artifacts returned from the Babel service.
36
37 ### Deploying The Micro Service 
38
39 Push the Docker image that you have built to your Docker repository and pull it down to the location that you will be running Babel from.
40
41 **Create the following directories on the host machine:**
42
43     ./logs
44     ./opt/app/babel/appconfig
45     ./opt/app/babel/appconfig/auth
46
47 You will be mounting these as data volumes when you start the Docker container.  For examples of the files required in these directories, see the aai/test/config repository (https://gerrit.onap.org/r/#/admin/projects/aai/test-config)
48
49 **Populate these directories as follows:**
50
51 ##### Contents of /opt/app/babel/appconfig
52
53 The following file must be present in this directory on the host machine:
54
55 The purpose of this configuration directory is to maintain configuration files specific to authentication/authorization for the _Babel_ service.
56 The following files must be present in this directory on the host machine:
57
58 _babel-auth.properties_
59
60     auth.policy.file=/auth/auth_policy.json
61     auth.authentication.disable=false
62
63
64 _artifact-generator.properties_ <br />
65 Contains model invariants ids used by SDC artifact generator library
66
67 ##### Contents of /opt/app/babel/appconfig/auth 
68 _auth_policy.json_
69  
70 Create a policy file defining the roles and users that will be allowed to access _Babel_ service.  This is a JSON format file which will look something like the following example:
71  
72      {
73          "roles": [
74              {
75                  "name": "admin",
76                  "functions": [
77                      {
78                          "name": "search", "methods": [ { "name": "GET" },{ "name": "DELETE" }, { "name": "PUT" }, { "name": "POST" } ]
79                      }
80                  ],
81                  "users": [
82                     {
83                          "username": "CN=babeladmin, OU=My Organization Unit, O=, L=Sometown, ST=SomeProvince, C=CA"
84                      }    
85                  ]
86              }
87          ]
88      }
89  
90  _tomcatkeystore_
91  
92 Create a keystore with this name containing whatever CA certificates that you want your instance of the _Babel_ service to accept for HTTPS traffic.
93
94
95 ## Dependency Information
96
97 To include the Babel service client jar in your project add the following maven dependency to your project's pom:
98
99                 <dependency>
100                         <groupId>org.onap.aai</groupId>
101                         <artifactId>babel</artifactId>
102                         <version>*</version>
103                         <classifier>client</classifier>
104                 </dependency>
105