Improve error logging
[aai/model-loader.git] / Readme.md
1 # Introduction
2
3 The A&AI Model Loader Service is an application that facilitates the distribution and ingestion of 
4 new service and resource models and VNF catalogs from the SDC to the A&AI.
5
6 ## Features
7
8 The Model Loader:
9
10 * registers with the SDC to receive notification events 
11 * polls the UEB/DMaap cluster for notification events
12 * downloads artifacts from SDC upon receipt of a distribution event
13 * pushes distribution components to A&AI
14                     
15 ### VNF Catalog loading
16
17 The Model Loader supports two methods for supplying VNF Catalog data for loading into A&AI:
18
19 * Embedded TOSCA image and vendor data<br/>VNF Catalog data can be embedded within the TOSCA yaml files contained in the CSAR.
20
21
22 * VNF Catalog XML files<br/>VNF Catalog data in the form of XML files can be supplied in the CSAR under the path `Artifacts/Deployment/VNF_CATALOG`
23
24 **Note: Each CSAR should provide VNF Catalog information using only one of the above methods. If a CSAR contains both TOSCA and XML VNF Catalog information, a deploy failure will be logged and published to SDC, and no VNF Catalog data will be loaded into A&AI** 
25                     
26 ## Compiling Model Loader
27
28 Model Loader can be compiled by running `mvn clean install`
29 A Model Loader docker image can be created by running `docker build -t onap/model-loader target`
30
31 ## Running Model Loader 
32
33 Push the Docker image to your Docker repository. Pull this down to the host machine.
34
35 **Create the following directories on the host machine:**
36
37     ./logs
38     ./opt/app/model-loader/appconfig
39     ./opt/app/model-loader/appconfig/auth
40     
41 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)
42
43 **Populate these directories as follows:**
44
45 #### Contents of /opt/app/model-loader/appconfig
46
47 The following file must be present in this directory on the host machine:
48     
49 _model-loader.properties_  
50
51     # Always false.  TLS Auth currently not supported 
52     ml.distribution.ACTIVE_SERVER_TLS_AUTH=false
53     
54     # Address/port of the SDC
55     ml.distribution.ASDC_ADDRESS=<SDC-Hostname>:8443
56     
57     # DMaaP consumer group.  
58     ml.distribution.CONSUMER_GROUP=aai-ml-group
59     
60     # DMaaP consumer ID
61     ml.distribution.CONSUMER_ID=aai-ml
62     
63     # SDC Environment Name.  This must match the environment name configured on the SDC
64     ml.distribution.ENVIRONMENT_NAME=<Environment Name>
65     
66     # Currently not used
67     ml.distribution.KEYSTORE_PASSWORD=
68     
69     # Currently not used
70     ml.distribution.KEYSTORE_FILE=
71     
72     # Obfuscated password to connect to the SDC.  To obtain this value, use the following Jetty library to 
73     # obfuscate the cleartext password:  http://www.eclipse.org/jetty/documentation/9.4.x/configuring-security-secure-passwords.html
74     ml.distribution.PASSWORD=OBF:<password>
75     
76     # How often (in seconds) to poll the DMaaP cluster for new model events
77     ml.distribution.POLLING_INTERVAL=<integer>
78     
79     # Timeout value (in seconds) when polling DMaaP for new model events
80     ml.distribution.POLLING_TIMEOUT=<integer>
81     
82     # Username to use when connecting to the SDC
83     ml.distribution.USER=<username>
84     
85     # Artifact type we want to download from the SDC (the values below will typically suffice)
86     ml.distribution.ARTIFACT_TYPES=MODEL_QUERY_SPEC,TOSCA_CSAR
87     
88     # List of message bus addresses on which to listen for distribution events
89     ml.distribution.MSG_BUS_ADDRESSES=<host1>,<host2>
90
91     # URL of the A&AI
92     ml.aai.BASE_URL=https://<AAI-Hostname>:8443
93     
94     # A&AI endpoint to post models
95     ml.aai.MODEL_URL=/aai/v*/service-design-and-creation/models/model/
96     
97     # A&AI endpoint to post named queries
98     ml.aai.NAMED_QUERY_URL=/aai/v*/service-design-and-creation/named-queries/named-query/
99     
100     # A&AI endpoint to post vnf images
101     ml.aai.VNF_IMAGE_URL=/aai/v*/service-design-and-creation/vnf-images
102     
103     # Name of certificate to use in connecting to the A&AI
104     ml.aai.KEYSTORE_FILE=aai-os-cert.p12
105     
106     # Obfuscated keystore password to connect to the A&AI.  This is only required if using 2-way SSL (not basic auth).
107     # To obtain this value, use the following Jetty library to obfuscate the cleartext password:
108     # http://www.eclipse.org/jetty/documentation/9.4.x/configuring-security-secure-passwords.html
109     ml.aai.KEYSTORE_PASSWORD=OBF:<password>
110     
111     # Name of user to use when connecting to the A&AI.  This is only required if using basic auth (not 2-way SSL).
112     ml.aai.AUTH_USER=<username>
113     
114     # Obfuscated password to connect to the A&AI.  This is only required if using basic auth (not 2-way SSL).
115     # To obtain this value, use the following Jetty library to obfuscate the cleartext password:
116     # http://www.eclipse.org/jetty/documentation/9.4.x/configuring-security-secure-passwords.html
117     ml.aai.AUTH_PASSWORD=OBF:<password>
118     
119
120
121 ##### Contents of the /opt/app/model-loader/app-config/auth Directory
122
123 The following files must be present in this directory on the host machine:
124
125 _aai-os-cert.p12_
126
127 The certificate used to connected to the A&AI
128
129 **Start the service:**
130
131 You can now start the Docker container for the _Model Loader Service_, e.g:
132
133         docker run -d \
134                 -e CONFIG_HOME=/opt/app/model-loader/config/ \
135             -v /logs:/logs \
136             -v /opt/app/model-loader/appconfig:/opt/app/model-loader/config \
137             --name model-loader \
138             {{your docker repo}}/model-loader
139     
140 where
141
142     {{your docker repo}}
143 is the Docker repository you have published your image to.