You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This guide will illustrate setting up an A&AI development environment in Ubuntu 16.04.  

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.

  1. install openjdk 8
    1. sudo apt install openjdk-8-jdk

  2. Install single node hadoop/titan
    1. $ wget http://s3.thinkaurelius.com/downloads/titan/titan-1.0.0-hadoop1.zip
    2. $ unzip titan-1.0.0-hadoop1.zip
    3. $ cd titan-1.0.0-hadoop1
    4. $ sudo ./bin/titan.sh start

  3. Install haproxy
    1. $ sudo apt-get -y install haproxy
    2. $ haproxy -v
      HA-Proxy version 1.6.3 2015/12/25
      Copyright 2000-2015 Willy Tarreau <willy@haproxy.org>
    3. Install this haproxy.cfg file in /etc/haproxy

      haproxy.cfg

    4. $ sudo cp aai.pem /etc/ssl/private/aai.pem
    5. $ sudo chmod 640 /etc/ssl/private/aai.pem
    6. $ sudo chown root:ssl-cert /etc/ssl/private/aai.pem
      aai.pem
    7. sudo mkdir /usr/local/etc/haproxy
    8. Add these hostnames to the loopback interface in /etc/hosts: 

      1. 127.0.0.1 localhost aai-traversal.api.simpledemo.openecomp.org aai-resources.api.simpledemo.openecomp.org

    9. $ sudo service haproxy restart

  4. Set up repos. First, follow the initial setup instructions in Setting Up Your Development Environment
    1. $ mkdir -p ~/LF/AAI
    2. $ cd ~/LF/AAI
    3. $ git clone ssh://<username>@gerrit.onap.org:29418/aai/aai-common
    4. $ git clone ssh://<username>@gerrit.onap.org:29418/aai/traversal
    5. $ git clone ssh://<username>@gerrit.onap.org:29418/aai/resources
    6. $ git clone ssh://<username>@gerrit.onap.org:29418/aai/logging-service
    7. If you did not originally create a settings.xml file when setting up the dev environment, you may get an error on some of the repos saying that oparent is unresolvable.  Using the example settings.xml file should solve this problem: Setting Up Your Development Environment#MavenExamplesettings.xml

  5. Build aai-common, traversal, and resources
    1. $ cd ~/LF/AAI/aai-common
    2. $ mvn -DskipTests clean install
      Should result in BUILD SUCCESS
    3. $ cd ~/LF/AAI/resources
    4. $ mvn -DskipTests clean install
      Should result in BUILD SUCCESS
    5. $ cd ~/LF/AAI/logging-service
    6. $ mvn -DskipTests clean install
      Should result in BUILD SUCCESS
    7. $ cd ~/LF/AAI/traversal
      I had to add the following to traversal/pom.xml to get traversal to build: 
      <repositories>
                  <repository>
                          <id>maven-restlet</id>
                          <name>Restlet repository</name>
                          <url>https://maven.restlet.com</url>
                  </repository>
      </repositories>
    8. mvn -DskipTests clean install
      Should result in BUILD SUCCESS

  6. Titan setup
    1. Modify both titan-cached.properties and titan-realtime.properties to the following (for all MS’s that will connect to the local Cassandra backend)
      storage.backend=cassandra
      storage.hostname=localhost
    2. update ~/LF/AAI/resources/aai-resources/bundleconfig-local/etc/appprops/titan-cached.properties
    3. update ~/LF/AAI/resources/aai-resources/bundleconfig-local/etc/appprops/titan-realtime.properties
    4. update ~/LF/AAI/traversal/aai-traversal/bundleconfig-local/etc/appprops/titan-cached.properties
    5. update ~/LF/AAI/traversal/aai-traversal/bundleconfig-local/etc/appprops/titan-realtime.properties
    6. The following property can be added to specify the keyspace name, each time you do this step (g) should be done. If not specified Titan will try to create/use a defaulted keyspace named titan.
      storage.cassandra.keyspace=<keyspace name>
    7. From the resources MS run the create db schema standalone program.
    8. NOTE: The first thing that would need to be done is adding the schema to the local instance. (this will need to be done whenever using a new keyspace or after wiping the data).

      Runnable class com.att.aai.dbgen.GenTester with the following vm args.

                      -DAJSC_HOME=~/LF/AAI/resources -DBUNDLECONFIG_DIR="bundleconfig-local"

    9. Here's the command I used, and it worked:
      $ cd ~/LF/AAI; java -DAJSC_HOME=/home/jimmy/LF/AAI/resources/aai-resources -DBUNDLECONFIG_DIR="bundleconfig-local" -cp aai-common/aai-core/target/aai-core-*.jar:resources/aai-resources/target/aai-resources.jar:resources/aai-resources/target/userjars/* org.onap.aai.dbgen.GenTester
  7. Start the "resources" microservice
    1. Resources runs on port 8447.  Go to the resources directory
      $ cd ~/LF/AAI/resources
    2. Set the debug port to 9447
      $ export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9447,server=y,suspend=n"
    3. Start the microservice
      $ mvn -P runAjsc

  8. Verify the resources microservice (this example uses Postman utility for Google Chrome)
    1. Use basic auth, user = AAI, pw = AAI
    2. Set the X-TransactionId header (in the example below, the value is 9999)
    3. Set the X-FromAppId header (in the example below, the value is jimmy-postman)
    4. Perform a GET of https://127.0.0.1:8443/aai/v11/network/vces
    5. You should see an error as below, 404 Not Found, ERR.5.4.6114.  This indicates that the service is functioning normally:



  9. Start the "traversal" microservice
    1. Traversal runs on port 8446.  Go to the traversal directory
      $ cd ~/LF/AAI/traversal
    2. Set the debug port to 9446
      $ export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9446,server=y,suspend=n"
    3. Start the microservice
      $ mvn -P runAjsc 
      Should see something like this: 2017-07-26 12:46:35.524:INFO:oejs.Server:com.att.ajsc.runner.Runner.main(): Started @25827ms

  10. Verify the traversal microservice
    1. Set up the widget models
      This will set up the postman to add widget models: Add Widget Models.postman_collection.jsonNamedQuery.postman_collection.json
    2. Create a runner using this file: models.csv
    3. Run the test runner
    4. Add a named query called "getComponentList" (this named query is used by VID): NamedQuery.postman_collection.json
    5. Add objects: Add Instances for Named Query.postman_collection.json (replacing the xmlns "http://org.openecomp.aai.inventory/v11" with "http://org.onap.aai.inventory/v11" in the Body of the PUT request)
    6. Execute named-query: Execute Named Query.postman_collection.json
      You should see something like the following:
  11. Your A&AI instance is now running, both the resources and traversal microservices are working properly with a local titan graph. 
  12. Next: Tutorial: Making and Testing a Schema Change in A&AI


  • No labels