7 AAI Developer Environment Setup
8 ================================
10 This guide will illustrate setting up an A&AI development environment in
13 For this exercise, I set up a new instance of Ubuntu in Virtualbox and
14 gave it 16G RAM, 200GB dynamically allocated storage, and 3 processors.
20 sudo apt install openjdk-8-jdk
22 - Install single node hadoop/titan
26 wget http://s3.thinkaurelius.com/downloads/titan/titan-1.0.0-hadoop1.zip
28 unzip titan-1.0.0-hadoop1.zip
30 cd titan-1.0.0-hadoop1
32 sudo ./bin/titan.sh start
38 sudo apt-get -y install haproxy
41 HA-Proxy version 1.6.3 2015/12/25
42 Copyright 2000-2015 Willy Tarreau
43 willy@haproxy.org http://haproxy.org/
45 - Install this haproxy.cfg file in /etc/haproxy
47 `haproxy.cfg <https://wiki.onap.org/download/attachments/10782088/haproxy.cfg?version=2&modificationDate=1501018863000&api=v2>`__
51 sudo cp aai.pem /etc/ssl/private/aai.pem
53 sudo chmod 640 /etc/ssl/private/aai.pem
55 sudo chown root:ssl-cert /etc/ssl/private/aai.pem
57 `aai.pem <https://wiki.onap.org/download/attachments/10782088/aai.pem?version=1&modificationDate=1501019585000&api=v2>`__
61 sudo mkdir /usr/local/etc/haproxy
63 - Add these hostnames to the loopback interface in /etc/hosts:
67 127.0.0.1 localhost aai-traversal.api.simpledemo.openecomp.org aai-resouces.api.simpledemo.openecomp.org
73 sudo service haproxy restart
75 - Set up repos. First, follow the initial setup instructions in
76 `Setting Up Your Development Environment <https://wiki.onap.org/display/DW/Setting+Up+Your+Development+Environment>`__
84 git clone ssh://<username>@gerrit.onap.org:29418/aai/aai-common
86 git clone ssh://<username>@gerrit.onap.org:29418/aai/traversal
88 git clone ssh://<username>@gerrit.onap.org:29418/aai/resources
90 git clone ssh://<username>@gerrit.onap.org:29418/aai/logging-service
92 - If you did not originally create a settings.xml file when setting
93 up the dev environment, you may get an error on some of the repos
94 saying that oparent is unresolvable. Using the example
95 settings.xml file should solve this problem:
96 `Setting Up Your Development Environment#MavenExamplesettings.xml <https://wiki.onap.org/display/DW/Setting+Up+Your+Development+Environment#SettingUpYourDevelopmentEnvironment-MavenExamplesettings.xml>`__
98 - Build aai-common, traversal, and resources
102 cd ~/LF/AAI/aai-common
104 mvn clean install # Should result in BUILD SUCCESS
106 cd ~/LF/AAI/resources
108 mvn clean install # Should result in BUILD SUCCESS
110 cd ~/LF/AAI/logging-service
112 mvn clean install # Should result in BUILD SUCCESS
114 cd ~/LF/AAI/traversal # I had to add the following to traversal/pom.xml to get
118 <repositories><repository><id>maven-restlet</id><name>Restlet repository</name><url>https://maven.restlet.com</url></repository></repositories>
120 mvn clean install # Should result in BUILD SUCCESS
124 1. Modify both titan-cached.properties and
125 titan-realtime.properties to the following (for all MS’s that
126 will connect to the local Cassandra backend)
130 storage.backend=\ *cassandra*
131 storage.hostname=\ *localhost*
134 ~/LF/AAI/resources/aai-resources/bundleconfig-local/etc/appprops/titan-cached.properties
137 ~/LF/AAI/resources/aai-resources/bundleconfig-local/etc/appprops/titan-realtime.properties
140 ~/LF/AAI/traversal/aai-traversal/bundleconfig-local/etc/appprops/titan-cached.properties
143 ~/LF/AAI/traversal/aai-traversal/bundleconfig-local/etc/appprops/titan-realtime.properties
145 6. The following property can be added to specify the keyspace
146 name, each time you do this step (g) should be done. If not
147 specified Titan will try to create/use a defaulted keyspace
152 storage.cassandra.keyspace=<keyspace name>
154 7. From the resources MS run the create db schema standalone program.
156 8. ***NOTE***: The first thing that would need to be done is adding
157 the schema to the local instance. (this will need to be done
158 whenever using a new keyspace or after wiping the data).
160 Runnable class org.onap.aai.dbgen.GenTester with the following vm
165 -DAJSC_HOME=~/LF/AAI/resources -DBUNDLECONFIG\_DIR="bundleconfig-local"
167 9. Here's the command I used, and it worked:
171 cd ~/LF/AAI; java -DAJSC_HOME=/home/jimmy/LF/AAI/resources/aai-resources
172 -DBUNDLECONFIG_DIR="bundleconfig-local" -cp
173 aai-common/aai-core/target/aai-core-1.1.0-SNAPSHOT.jar:resources/aai-resources/target/aai-resources.jar:resources/aai-resources/target/userjars/\*
174 org.onap.aai.dbgen.GenTester
176 - Start the "resources" microservice
178 1. Resources runs on port 8446. Go to the resources directory
181 cd ~/LF/AAI/resources
183 2. Set the debug port to 9446
187 export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m
188 -Xdebug -Xnoagent -Djava.compiler=NONE
189 -Xrunjdwp:transport=dt_socket,address=9446,server=y,suspend=n"
191 3. Start the microservice
197 16. Verify the resources microservice (this example uses Postman utility
200 1. | Use basic auth, user = AAI, pw = AAI
202 2. | Set the X-TransactionId header (in the example below, the value is
205 3. | Set the X-FromAppId header (in the example below, the value is
208 4. | Perform a GET of https://127.0.0.1:8443/aai/v11/network/vces
210 5. | You should see an error as below, 404 Not Found, ERR.5.4.6114.
211 | This indicates that the service is functioning normally:
213 +------------------------------------------+
215 +------------------------------------------+
218 18. Start the "traversal" microservice
220 1. | Traversal runs on port 8447. Go to the traversal directory
222 $ cd ~/LF/AAI/traversal
224 2. | Set the debug port to 9447
225 | $ export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m
226 -Xdebug -Xnoagent -Djava.compiler=NONE
227 -Xrunjdwp:transport=dt_socket,address=9447,server=y,suspend=n"
229 3. | Start the microservice
231 | Should see something like this: 2017-07-26
232 12:46:35.524:INFO:oejs.Server:com.att.ajsc.runner.Runner.main():
235 - Verify the traversal microservice
237 1. | Set up the widget models
238 | This will set up the postman to add widget models: `Add Widget Models.postman_collection.json <https://wiki.onap.org/download/attachments/10782088/Add%20Widget%20Models.postman_collection.json?version=2&modificationDate=1501102559000&api=v2>`__ `NamedQuery.postman_collection.json <https://wiki.onap.org/download/attachments/10782088/NamedQuery.postman_collection.json?version=2&modificationDate=1501102582000&api=v2>`__
240 2. | Create a runner using this file:
241 `models.csv <https://wiki.onap.org/download/attachments/10782088/models.csv?version=1&modificationDate=1501100140000&api=v2>`__
243 3. | Run the test runner
246 4. | Add a named query called "getComponentList" (this named query is used by VID):
247 `NamedQuery.postman_collection.json <ificationDate=1501102582000&api=v2>`__
251 `Add Instances for Named Query.postman_collection.json <https://wiki.onap.org/download/attachments/10782088/Add%20Instances%20for%20Named%20Query.postman_collection.json?version=1&modificationDate=1501102617000&api=v2>`__
253 6. | Execute named-query:
254 `Execute Named Query.postman_collection.json <https://wiki.onap.org/download/attachments/10782088/Execute%20Named%20Query.postman_collection.json?version=1&modificationDate=1501102658000&api=v2>`__
255 | You should see something like the following:
258 - Your A&AI instance is now running, both the resources and traversal
259 microservices are working properly with a local titan graph.
261 - Next: `Tutorial: Making and Testing a Schema Change in A&AI <https://wiki.onap.org/pages/viewpage.action?pageId=10783023>`__
263 .. |image1| image:: media/image1.png
266 .. |image2| image:: media/image2.png
269 .. |image3| image:: media/image3.png
272 .. |image4| image:: media/image4.png