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
104 If you get an error on some of the repos saying that oparent is
105 unresolvable, using the example settings.xml file should solve this
106 problem: `Setting Up Your Development
107 Environment#MavenExamplesettings.xml
108 <https://wiki.onap.org/display/DW/Setting+Up+Your+Development+Environment#SettingUpYourDevelopmentEnvironment-MavenExamplesettings.xml>`__
116 $ 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
118 6. Checkout the 'dublin' branch
119 -------------------------------
123 $ 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
125 7. Janus Setup (part 1)
126 -----------------------
128 Modify both janus-cached.properties and janus-realtime.properties to the following (for all MS’s that will connect to the local Cassandra backend)
132 storage.backend=cassandra
133 storage.hostname=localhost
134 storage.cassandra.keyspace=onap # or different keyspace name of your choosing
136 Edit the following files:
140 ~/src/aai/resources/aai-resources/src/main/resources/etc/appprops/janusgraph-cached.properties
141 ~/src/aai/resources/aai-resources/src/main/resources/etc/appprops/janusgraph-realtime.properties
142 ~/src/aai/traversal/aai-traversal/src/main/resources/etc/appprops/janusgraph-cached.properties
143 ~/src/aai/traversal/aai-traversal/src/main/resources/etc/appprops/janusgraph-realtime.properties
144 ~/src/aai/graphadmin/src/main/resources/etc/appprops/janusgraph-cached.properties
145 ~/src/aai/graphadmin/src/main/resources/etc/appprops/janusgraph-realtime.properties
147 8. Build all the modules
148 ------------------------
152 $ 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
154 $ grep -e "SUCCESS" -e "FAILURE" log.txt
160 [INFO] aai-schema ......................................... SUCCESS [ 32.504 s]
161 [INFO] aai-queries ........................................ SUCCESS [ 6.461 s]
162 [INFO] aai-schema-service ................................. SUCCESS [02:17 min]
164 [INFO] aai-resources ...................................... SUCCESS [ 1.190 s]
166 [INFO] aai-resources ...................................... SUCCESS [ 3.210 s]
167 [INFO] aai-resources ...................................... SUCCESS [ 41.213 s]
169 [INFO] aai-traversal ...................................... SUCCESS [ 1.090 s]
171 [INFO] aai-traversal ...................................... SUCCESS [ 3.181 s]
172 [INFO] aai-traversal ...................................... SUCCESS [ 58.001 s]
176 [INFO] aai-logging-service ................................ SUCCESS [ 1.101 s]
178 [INFO] aai-logging-service ................................ SUCCESS [ 5.230 s]
179 [INFO] Common Logging API ................................. SUCCESS [ 1.995 s]
180 [INFO] EELF Logging Implementation ........................ SUCCESS [ 4.235 s]
181 [INFO] Common Logging Distribution ........................ SUCCESS [ 0.530 s]
184 9. Janus setup (part 2)
185 -----------------------
187 Run this on the local instance on your first time running AAI and whenever using new keyspace or after wiping the data.
193 $ (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)
199 ---- NOTE --- about to open graph (takes a little while)--------;
200 -- Loading new schema elements into JanusGraph --
204 10. Start the "resources" microservice
205 --------------------------------------
207 Resources runs on port 8447. Go to the resources directory
211 $ cd ~/src/aai/resources
213 Set the debug port to 9447
217 $ export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9447,server=y,suspend=n"
219 Start the microservice - adjust your build version accordingly
223 $ 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
225 Should see something like this: Resources Microservice Started
228 11. Verify the resources microservice
229 -------------------------------------
231 This example uses curl from commandline
235 $ sudo apt-get install jq # for pretty output
237 Download :download:`script - test-complex <media/test-complex>`
238 Download :download:`data - data-complex.json <media/data-complex.json>`
242 $ sh ./test-complex 2>&1 | tee log.txt
244 Confirm log.txt contains:
248 > GET /aai/v16/cloud-infrastructure/complexes HTTP/1.1
254 "serviceException": {
255 "messageId": "SVC3001",
256 "text": "Resource not found for %1 using id %2 (msg=%3) (ec=%4)",
259 "cloud-infrastructure/complexes",
260 "Node Not Found:No Node of type complex found at: cloud-infrastructure/complexes",
271 > PUT /aai/v16/cloud-infrastructure/complexes/complex/clli2 HTTP/1.1
272 > GET /aai/v16/cloud-infrastructure/complexes/complex/clli2 HTTP/1.1
279 "physical-location-id": "clli2",
280 "data-center-code": "example-data-center-code-val-6667",
281 "complex-name": "clli2",
282 "identity-url": "example-identity-url-val-28399",
283 "resource-version": "1543408364646",
284 "physical-location-type": "example-physical-location-type-val-28399",
285 "street1": "example-street1-val-28399",
286 "street2": "example-street2-val-28399",
287 "city": "example-city-val-28399",
288 "state": "example-state-val-28399",
289 "postal-code": "example-postal-code-val-28399",
290 "country": "example-country-val-28399",
291 "region": "example-region-val-28399",
294 "elevation": "example-elevation-val-28399",
295 "lata": "example-lata-val-28399"
302 > DELETE /aai/v16/cloud-infrastructure/complexes/complex/clli2?resource-version=1543408364646 HTTP/1.1
303 > GET /aai/v16/cloud-infrastructure/complexes HTTP/1.1
311 "serviceException": {
312 "messageId": "SVC3001",
313 "text": "Resource not found for %1 using id %2 (msg=%3) (ec=%4)",
316 "cloud-infrastructure/complexes",
317 "Node Not Found:No Node of type complex found at: cloud-infrastructure/complexes",
324 12. Start the "traversal" microservice
325 --------------------------------------
327 Traversal runs on port 8446. Go to the traversal directory
331 $ cd ~/src/aai/traversal
333 Set the debug port to 9446
335 $ export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9446,server=y,suspend=n"
337 Start the microservice - adjust your build version accordingly
341 $ 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
343 Should see something like this: Traversal Microservice Started