7 AAI Developer Environment Setup
8 ================================
10 For this exercise, I set up a new instance of Ubuntu in Virtualbox and gave it 16G RAM, 200GB dynamically allocated storage, and 3 processors.
16 1. $ sudo apt install openjdk-8-jdk
18 2. Install single node hadoop/janusgraph
19 ----------------------------------------
22 1. $ wget http://github.com/JanusGraph/janusgraph/releases/download/v0.2.0/janusgraph-0.2.0-hadoop2.zip
23 2. $ unzip janusgraph-0.2.0-hadoop2.zip
24 3. $ cd janusgraph-0.2.0-hadoop2/
25 4. $ ./bin/janusgraph.sh start
27 Ensure you are not a root user as elasticsearch cannot be run as root.
33 Running `nodetool statusthrift`... OK (returned exit status 0 and printed string "running").
34 Forking Elasticsearch...
35 Connecting to Elasticsearch (127.0.0.1:9200)...... OK (connected to 127.0.0.1:9200).
36 Forking Gremlin-Server...
37 Connecting to Gremlin-Server (127.0.0.1:8182).... OK (connected to 127.0.0.1:8182).
38 Run gremlin.sh to connect.
40 You can verify whether everything is running by executing
44 ./bin/janusgraph.sh status
46 And the output looks like:
50 Gremlin-Server (org.apache.tinkerpop.gremlin.server.GremlinServer) is running with pid 9835
51 Elasticsearch (org.elasticsearch.bootstrap.Elasticsearch) is running with pid 9567
52 Cassandra (org.apache.cassandra.service.CassandraDaemon) is running with pid 9207
59 1. $ sudo apt-get -y install haproxy
60 2. $ <path-to-haproxy>/haproxy -v
66 HA-Proxy version 1.6.3 2015/12/25
67 Copyright 2000-2015 Willy Tarreau <willy@haproxy.org>
69 Install the attached :download:`haproxy.cfg <media/haproxy.cfg>` in /etc/haproxy
73 $ sudo cp haproxy.cfg /etc/haproxy
74 $ sudo mkdir /usr/local/etc/haproxy
76 Install the attached :download:`aai.pem <media/aai.pem>` file in /etc/ssl/private
80 $ sudo cp aai.pem /etc/ssl/private/aai.pem
81 $ sudo chmod 640 /etc/ssl/private/aai.pem
82 $ sudo chown root:ssl-cert /etc/ssl/private/aai.pem
84 Add these hostnames to the loopback interface in /etc/hosts:
86 127.0.0.1 localhost aai-traversal.api.simpledemo.openecomp.org aai-resources.api.simpledemo.openecomp.org aai-traversal.api.simpledemo.onap.org aai-resources.api.simpledemo.onap.org
90 $ sudo service haproxy restart
92 4. Follow the initial setup instructions in `Setting Up Your Development Environment <https://wiki.onap.org/display/DW/Setting+Up+Your+Development+Environment>`__ e.g.
93 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
96 $ sudo apt-get install git
97 $ sudo apt-get install npm
98 $ sudo apt-get install maven
99 $ sudo apt-get install docker.io
100 $ wget https://git.onap.org/oparent/plain/settings.xml
102 $ cp settings.xml ~/.m2
110 $ cd ~/src/aai ; for f in aai-common schema-service resources traversal graphadmin logging-service ; do git clone ssh://<username>@gerrit.onap.org:29418/aai/$f; done
112 6. Checkout the 'dublin' branch
113 -------------------------------
117 $ cd ~/src/aai ; for f in aai-common schema-service resources traversal graphadmin logging-service ; do (cd $f ; git checkout dublin) done | tee checkoutlog.txt
119 7. Janus Setup (part 1)
120 -----------------------
122 Modify both janus-cached.properties and janus-realtime.properties to the following (for all MS’s that will connect to the local Cassandra backend)
126 storage.backend=cassandra
127 storage.hostname=localhost
128 storage.cassandra.keyspace=onap # or different keyspace name of your choosing
130 Edit the following files:
134 ~/src/aai/resources/aai-resources/src/main/resources/etc/appprops/janusgraph-cached.properties
135 ~/src/aai/resources/aai-resources/src/main/resources/etc/appprops/janusgraph-realtime.properties
136 ~/src/aai/traversal/aai-traversal/src/main/resources/etc/appprops/janusgraph-cached.properties
137 ~/src/aai/traversal/aai-traversal/src/main/resources/etc/appprops/janusgraph-realtime.properties
138 ~/src/aai/graphadmin/src/main/resources/etc/appprops/janusgraph-cached.properties
139 ~/src/aai/graphadmin/src/main/resources/etc/appprops/janusgraph-realtime.properties
141 8. Build all the modules
142 ------------------------
146 $ cd ~/src/aai ; for f in aai-common schema-service resources traversal graphadmin logging-service ; do (cd $f ; mvn versions:set -DnewVersion=0.0.1-TEST-SNAPSHOT && mvn -DskipTests clean install -Daai.schema.version=0.0.1-TEST-SNAPSHOT) done | tee log.txt 2>&1
148 $ grep -e "SUCCESS" -e "FAILURE" log.txt
154 [INFO] aai-schema ......................................... SUCCESS [ 32.504 s]
155 [INFO] aai-queries ........................................ SUCCESS [ 6.461 s]
156 [INFO] aai-schema-service ................................. SUCCESS [02:17 min]
158 [INFO] aai-resources ...................................... SUCCESS [ 1.190 s]
160 [INFO] aai-resources ...................................... SUCCESS [ 3.210 s]
161 [INFO] aai-resources ...................................... SUCCESS [ 41.213 s]
163 [INFO] aai-traversal ...................................... SUCCESS [ 1.090 s]
165 [INFO] aai-traversal ...................................... SUCCESS [ 3.181 s]
166 [INFO] aai-traversal ...................................... SUCCESS [ 58.001 s]
170 [INFO] aai-logging-service ................................ SUCCESS [ 1.101 s]
172 [INFO] aai-logging-service ................................ SUCCESS [ 5.230 s]
173 [INFO] Common Logging API ................................. SUCCESS [ 1.995 s]
174 [INFO] EELF Logging Implementation ........................ SUCCESS [ 4.235 s]
175 [INFO] Common Logging Distribution ........................ SUCCESS [ 0.530 s]
178 9. Janus setup (part 2)
179 -----------------------
181 Run this on the local instance on your first time running AAI and whenever using new keyspace or after wiping the data.
187 $ (cd ~/src/aai/graphadmin/ && mvn -PrunAjsc -Dstart-class=org.onap.aai.schema.GenTester -Daai.schema.version=0.0.1-TEST-SNAPSHOT -Daai.schema.ingest.version=0.0.1-TEST-SNAPSHOT -DskipTests -Dcheckstyle.skip=true -DAJSC_HOME=$HOME/src/aai/graphadmin -DBUNDLECONFIG_DIR=src/main/resources)
193 ---- NOTE --- about to open graph (takes a little while)--------;
194 -- Loading new schema elements into JanusGraph --
198 10. Start the "resources" microservice
199 --------------------------------------
201 Resources runs on port 8447. Go to the resources directory
205 $ cd ~/src/aai/resources
207 Set the debug port to 9447
211 $ export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9447,server=y,suspend=n"
213 Start the microservice - adjust your build version accordingly
217 $ mvn -pl aai-resources -PrunAjsc -Daai.schema.version=0.0.1-TEST-SNAPSHOT -Daai.schema.ingest.version=0.0.1-TEST-SNAPSHOT -DskipTests -Dcheckstyle.skip=true
219 Should see something like this: Resources Microservice Started
222 11. Verify the resources microservice
223 -------------------------------------
225 This example uses curl from commandline
229 $ sudo apt-get install jq # for pretty output
231 Download :download:`script - test-complex <media/test-complex>`
232 Download :download:`data - data-complex.json <media/data-complex.json>`
236 $ sh ./test-complex 2>&1 | tee log.txt
238 Confirm log.txt contains:
242 > GET /aai/v16/cloud-infrastructure/complexes HTTP/1.1
248 "serviceException": {
249 "messageId": "SVC3001",
250 "text": "Resource not found for %1 using id %2 (msg=%3) (ec=%4)",
253 "cloud-infrastructure/complexes",
254 "Node Not Found:No Node of type complex found at: cloud-infrastructure/complexes",
265 > PUT /aai/v16/cloud-infrastructure/complexes/complex/clli2 HTTP/1.1
266 > GET /aai/v16/cloud-infrastructure/complexes/complex/clli2 HTTP/1.1
273 "physical-location-id": "clli2",
274 "data-center-code": "example-data-center-code-val-6667",
275 "complex-name": "clli2",
276 "identity-url": "example-identity-url-val-28399",
277 "resource-version": "1543408364646",
278 "physical-location-type": "example-physical-location-type-val-28399",
279 "street1": "example-street1-val-28399",
280 "street2": "example-street2-val-28399",
281 "city": "example-city-val-28399",
282 "state": "example-state-val-28399",
283 "postal-code": "example-postal-code-val-28399",
284 "country": "example-country-val-28399",
285 "region": "example-region-val-28399",
288 "elevation": "example-elevation-val-28399",
289 "lata": "example-lata-val-28399"
296 > DELETE /aai/v16/cloud-infrastructure/complexes/complex/clli2?resource-version=1543408364646 HTTP/1.1
297 > GET /aai/v16/cloud-infrastructure/complexes HTTP/1.1
305 "serviceException": {
306 "messageId": "SVC3001",
307 "text": "Resource not found for %1 using id %2 (msg=%3) (ec=%4)",
310 "cloud-infrastructure/complexes",
311 "Node Not Found:No Node of type complex found at: cloud-infrastructure/complexes",
318 12. Start the "traversal" microservice
319 --------------------------------------
321 Traversal runs on port 8446. Go to the traversal directory
325 $ cd ~/src/aai/traversal
327 Set the debug port to 9446
329 $ export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9446,server=y,suspend=n"
331 Start the microservice - adjust your build version accordingly
335 $ mvn -pl aai-traversal -PrunAjsc -Daai.schema.version=0.0.1-TEST-SNAPSHOT -Daai.schema.ingest.version=0.0.1-TEST-SNAPSHOT -DskipTests -Dcheckstyle.skip=true
337 Should see something like this: Traversal Microservice Started