Launching CCSDK

SDN-R is an extension of CCSDK (Common Controller Software Development KIt), and SDN-R uses the same procedure as CCSDK to create a running instance.  To begin, clone the ccsdk/distribution repository and look at the docker-compose.yml file in ccsdk/distribution/src/main/yaml.

The file is shown below with annotations.  It creates a running instance of CCSDK that is made up of three containers:

Here are annotated contents of that file (master branch Dec. 4, 2018).  The current value of the CCSDK_DOCKER_IMAGE_VERSION environment variable can be found in the version manifest file of the ONAP integration repository in the directory integration/version-manifest /src/main/resources/docker-manifest.csv (for releases; docker-manifest-staging for current images).

Executing this docker-compose.yml file will create and launch the containers.  Navigate to <path>/ccsdk/distribution/src/main/yaml and enter the commands as in the sample terminal session below (the credentials to login to NEXUS_DOCKER_REPO are docker:docker).  If you are executing this command for the first time, you will see output as the images are downloaded and extracted.

%: cd ~/git/ccsdk/distribution/src/main/yaml/
%: echo $NEXUS_DOCKER_REPO
nexus3.onap.org:10001
%: echo $CCSDK_DOCKER_IMAGE_VERSION
0.3-STAGING-latest
%: docker login $NEXUS_DOCKER_REPO
Username (docker): docker
Password:
Login Succeeded
%: docker-compose up -d
Pulling db (mysql/mysql-server:5.6)...
5.6: Pulling from mysql/mysql-server
b0efbbec3b2e: Pull complete
8e6e4f7af9b1: Pull complete
eec4656740d1: Pull complete
8b211b61b1a0: Pull complete
Digest: sha256:7b98e112b35984811ca7bca963568508d6ff8bcc2f5b6b2ab27c7904e7bddb88
Status: Downloaded newer image for mysql/mysql-server:5.6
Pulling odlsli (nexus3.onap.org:10001/onap/ccsdk-odlsli-image:0.3-STAGING-latest)...
0.3-STAGING-latest: Pulling from onap/ccsdk-odlsli-image
6b51aaaf6d73: Pull complete
3f7a200f3556: Pull complete
d9a877cba71d: Pull complete
0d15639f94e1: Pull complete
4ea4d2cfdc50: Pull complete
75911c07ee2c: Pull complete
3bf025c6f4b3: Pull complete
212f5bf640e1: Pull complete
dcc9199ca5f6: Pull complete
b1db6eee88e2: Pull complete
05aa0c1f0ab6: Pull complete
f6e603372fc5: Pull complete
c4b04e9e266e: Pull complete
343aebc23b49: Pull complete
f0979cbb6c3b: Pull complete
9792711a23f5: Pull complete
d79e6928e946: Pull complete
e890641574b8: Pull complete
33a73540ec6c: Pull complete
Digest: sha256:f9e5c94dcbd2d4082d096f56750148233d9734731a3bf86da98fd6ac3e9b01fd
Status: Downloaded newer image for nexus3.onap.org:10001/onap/ccsdk-odlsli-image:0.3-STAGING-latest
Pulling dgbuilder (nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:0.3-STAGING-latest)...
0.3-STAGING-latest: Pulling from onap/ccsdk-dgbuilder-image
6b51aaaf6d73: Already exists
3f7a200f3556: Already exists
d9a877cba71d: Already exists
0d15639f94e1: Already exists
4ea4d2cfdc50: Already exists
75911c07ee2c: Already exists
0b529c7bd296: Pull complete
Creating ccsdk_db_container ... done
Creating ccsdk_odlsli_container ... done
Creating ccsdk_dgbuilder_container ... done
Creating ccsdk_odlsli_container ...
Creating ccsdk_dgbuilder_container ...
%:

Concurrently, in an other terminal session, you can observe the progress of the launching of the CCSDK containers by using the command 'docker-compose logs -f,' which is similar to a 'tail -f' command.

%: cd ~/git/ccsdk/distribution/src/main/yaml/
%: docker-compose logs -f
Attaching to ccsdk_dgbuilder_container, ccsdk_odlsli_container, ccsdk_db_container
ccsdk_odlsli_container | Waiting for mysql
ccsdk_dgbuilder_container | ReleaseDir:sdnc1.0
ccsdk_dgbuilder_container | tput: No value for $TERM and no -T specified
ccsdk_dgbuilder_container | tput: No value for $TERM and no -T specified
ccsdk_dgbuilder_container | tput: No value for $TERM and no -T specified
ccsdk_dgbuilder_container | tput: No value for $TERM and no -T specified
ccsdk_odlsli_container | ..........
...
voluminous logging
...
ccsdk_dgbuilder_container | Welcome to Node-RED
ccsdk_dgbuilder_container | ===================
ccsdk_dgbuilder_container |
ccsdk_dgbuilder_container | 26 Jul 18:26:29 - [red] Version: 0.9.1
ccsdk_dgbuilder_container | 26 Jul 18:26:29 - [red] Loading palette nodes
ccsdk_dgbuilder_container | 26 Jul 18:26:30 - [red] Server now running at http://127.0.0.1:3100/

...

There may be additional messages, but you can check the status CCSDK containers as shown below:

%: docker ps
CONTAINER ID        IMAGE                                                                 COMMAND                  CREATED             STATUS                   PORTS                     NAMES
7fd4d8d8ab15        nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:0.3-STAGING-latest   "/bin/bash -c 'cd /o…"   2 minutes ago       Up 2 minutes             0.0.0.0:3000->3100/tcp    ccsdk_dgbuilder_container
cded16733254        nexus3.onap.org:10001/onap/ccsdk-odlsli-image:0.3-STAGING-latest      "/opt/onap/ccsdk/bin…"   2 minutes ago       Up 2 minutes             0.0.0.0:8383->8181/tcp    ccsdk_odlsli_container
1880decd2cfc        mysql/mysql-server:5.6                                                "/entrypoint.sh mysq…"   2 minutes ago       Up 2 minutes (healthy)   0.0.0.0:32789->3306/tcp   ccsdk_db_container

And you can browse to the OpenDaylight apidoc/explorer (http://localhost:8383/apidoc/explorer/index.html).  Note that port 8383 in the host is forwarded to port 8181 in the odlsli container, and the credentials are not the usual "admin:admin."  The password is shown below in the annotated startODL.sh file below (user name: admin; password: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U).

Working with the CCSDK containers

You can work with the CCSDK containers as you would any docker container, for example:

%: docker exec -t -i ccsdk_odlsli_container /bin/bash -c 'TERM=xterm exec /bin/bash'
root@744e3cc8a7fb:/# pwd
/
root@744e3cc8a7fb:/# echo $ODL_HOME
/opt/opendaylight/current
root@744e3cc8a7fb:/# echo $SDNC_CONFIG_DIR/
/opt/onap/ccsdk/data/properties/
root@744e3cc8a7fb:/# ps -elf | grep opendaylight
4 S root         1     0  0  80   0 -  1126 wait   18:34 ?        00:00:00 /bin/sh /opt/opendaylight/current/bin/karaf
0 S root        96     1  8  80   0 - 2002545 futex_ 18:34 ?      00:10:07 /usr/lib/jvm/java-8-openjdk-amd64/bin/java -Djava.security.properties=/opt/opendaylight/current/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.security.egd=file:/dev/./urandom -Djava.endorsed.dirs=/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/endorsed:/usr/lib/jvm/java-8-openjdk-amd64/lib/endorsed:/opt/opendaylight/current/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext:/usr/lib/jvm/java-8-openjdk-amd64/lib/ext:/opt/opendaylight/current/lib/ext -Dkaraf.instances=/opt/opendaylight/current/instances -Dkaraf.home=/opt/opendaylight/current -Dkaraf.base=/opt/opendaylight/current -Dkaraf.data=/opt/opendaylight/current/data -Dkaraf.etc=/opt/opendaylight/current/etc -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/opt/opendaylight/current/data/tmp -Djava.util.logging.config.file=/opt/opendaylight/current/etc/java.util.logging.properties -Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight/current/lib/boot/org.apache.karaf.diagnostic.boot-4.0.10.jar:/opt/opendaylight/current/lib/boot/org.apache.karaf.jaas.boot-4.0.10.jar:/opt/opendaylight/current/lib/boot/org.apache.karaf.main-4.0.10.jar:/opt/opendaylight/current/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main
0 S root      1186  1164  0  80   0 -  2821 pipe_w 20:30 pts/0    00:00:00 grep --color=auto opendaylight
root@744e3cc8a7fb:/# cd $ODL_HOME
root@cded16733254:/opt/opendaylight# ls -l
total 76
-rw-r--r-- 1 root root  1126 Apr 19 02:59 CONTRIBUTING.markdown
-rw-r--r-- 1 root root 11266 Apr 19 02:59 LICENSE
-rw-r--r-- 1 root root   172 Apr 19 02:59 README.markdown
drwxr-xr-x 1 root root  4096 Jul 26 18:26 bin
-rw-r--r-- 1 root root    76 Apr 19 02:59 build.url
drwxr-xr-x 1 root root  4096 Jul 26 18:26 configuration
lrwxrwxrwx 1 root root    17 Jul 26 12:47 current -> /opt/opendaylight
drwxr-xr-x 3 root root  4096 Jul 26 18:26 daexim
drwxr-xr-x 1 root root  4096 Jul 26 18:26 data
drwxr-xr-x 2 root root  4096 Apr 19 02:59 deploy
drwxr-xr-x 1 root root  4096 Jul 26 18:26 etc
drwxr-xr-x 2 root root  4096 Jul 26 18:25 instances
drwxr-xr-x 2 root root  4096 Jul 26 18:26 journal
lrwxrwxrwx 1 root root    17 Jul 26 12:47 karaf-0.8.1 -> /opt/opendaylight
-rw-r--r-- 1 root root     3 Jul 26 18:25 karaf.pid
drwxr-xr-x 5 root root  4096 Apr 19 02:59 lib
-rw-r--r-- 1 root root     0 Jul 26 18:25 lock
drwxr-xr-x 2 root root  4096 Jul 26 18:26 snapshots
drwxr-xr-x 1 root root  4096 Jul 26 13:00 system
-rw-r--r-- 1 root root  1926 Apr 19 02:59 taglist.log
root@cded16733254:/opt/opendaylight# ls -l bin
total 3316
-rwxr-xr-x 1 root root 3231548 Apr 19 02:59 aaa-cli-jar.jar
-rwxr-xr-x 1 root root    3243 Apr 19 02:59 client
-rw-r--r-- 1 root root    4334 Apr 19 02:59 client.bat
-rwxr-xr-x 1 root root    8328 Apr 19 02:59 configure-cluster-ipdetect.sh
-rwxr-xr-x 1 root root    7388 Apr 19 02:59 configure_cluster.sh
drwxr-xr-x 2 root root    4096 Apr 19 02:59 contrib
-rwxr-xr-x 1 root root     722 Apr 19 02:59 custom_shard_config.txt
-rw-r--r-- 1 root root   16071 Jul 26 18:26 idmtool
-rwxr-xr-x 1 root root    9999 Apr 19 02:59 inc
-rwxr-xr-x 1 root root    4090 Apr 19 02:59 instance
-rw-r--r-- 1 root root    5364 Apr 19 02:59 instance.bat
-rwxr-xr-x 1 root root   11560 Apr 19 02:59 karaf
-rw-r--r-- 1 root root   16816 Apr 19 02:59 karaf.bat
-rwxr-xr-x 1 root root    2924 Apr 19 02:59 set_persistence.sh
-rwxr-xr-x 1 root root    2284 Apr 19 02:59 setenv
-rw-r--r-- 1 root root    2330 Apr 19 02:59 setenv.bat
-rwxr-xr-x 1 root root    3227 Apr 19 02:59 shell
-rw-r--r-- 1 root root    4702 Apr 19 02:59 shell.bat
-rwxr-xr-x 1 root root    2016 Apr 19 02:59 start
-rw-r--r-- 1 root root    2495 Apr 19 02:59 start.bat
-rwxr-xr-x 1 root root    1865 Apr 19 02:59 status
-rw-r--r-- 1 root root    2448 Apr 19 02:59 status.bat
-rwxr-xr-x 1 root root    1867 Apr 19 02:59 stop
-rw-r--r-- 1 root root    2444 Apr 19 02:59 stop.bat
root@744e3cc8a7fb:/opt/opendaylight/current# ./bin/client
Logging in as karaf

    ________                       ________                .__  .__       .__     __
    \_____  \ ______   ____   ____ \______ \ _____  ___.__.|  | |__| ____ |  |___/  |_
     /   |   \\____ \_/ __ \ /    \ |    |  \\__  \<   |  ||  | |  |/ ___\|  |  \   __\
    /    |    \  |_> >  ___/|   |  \|    `   \/ __ \\___  ||  |_|  / /_/  >   Y  \  |
    \_______  /   __/ \___  >___|  /_______  (____  / ____||____/__\___  /|___|  /__|
            \/|__|        \/     \/        \/     \/\/            /_____/      \/


Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown OpenDaylight.

opendaylight-user@root>

The entrypoint script for the odlsli container

The entrypoint script for the odlsli container is /opt/onap/ccsdk/bin/startODL.sh.  Here is the home directory and bin directory for the user ccsdk.

root@744e3cc8a7fb:~# cd /opt/onap/ccsdk
root@744e3cc8a7fb:/opt/onap/ccsdk# ls -l
total 28
drwxrwxr-x  1 root root 4096 Jun 28 23:58 ./
drwxrwxr-x  1 root root 4096 Jun  1 12:26 ../
-rw-r--r--  1 root root   42 Jun 28 23:58 .installed
drwxrwxr-x  2 root root 4096 Jun  1 12:26 bin/
drwxrwxr-x  4 root root 4096 Jun  1 12:26 data/
drwxrwxr-x 16 root root 4096 Jun  1 12:26 features/
drwxrwxr-x  6 root root 4096 Jun  1 12:26 svclogic/
root@744e3cc8a7fb:/opt/onap/ccsdk# ls -l bin
total 36
drwxrwxr-x 2 root root 4096 Jun  1 12:26 ./
drwxrwxr-x 1 root root 4096 Jun 28 23:58 ../
-rwxrwxr-x 1 root root 3131 Jun  1 12:26 installCcsdkFeatures.sh*
-rwxrwxr-x 1 root root 1082 Jun  1 12:26 installFeatures.sh*
-rwxrwxr-x 1 root root 1438 Jun  1 12:26 installOdlHostKey.sh*
-rwxrwxr-x 1 root root 1814 Jun  1 12:26 installSdncDb.sh*
-rwxrwxr-x 1 root root 4510 Jun  1 12:26 installZips.sh*
-rwxrwxr-x 1 root root 2311 Jun  1 12:26 startODL.sh*

And here is the startODL.sh file:

Creating the ODLSLI Container

To see how the ODLSLI container is constructed, we look at the pom.xml file in the directory ccsdk/distribution/odlsli.

ODLSLI pom.xml initialization and dependencies

Master branch, Nov 7, 2018

ODLSLI pom.xml: Preliminaries and setting the version value of the ODLSLI docker image

ODLSLI pom.xml: Prepare the directories and files for a 'docker build' command

Rather than annotate this section of the pom.xml file - which is straightforward - I summarize the actions in the text below.  The pom.xml file uses three phases in the build life cycle to prepare the directory structure and files in ./target/docker-stage prior to building the docker image.  They are:

ODLSLI pom.xml: Docker Profile

The "docker" profile defines the additional "package" phase in which the docker image is built.  There is also a "deploy" phase in which the generated image is pushed to NEXUS_DOCKER_REPO, but this requires special privileges.  We discuss this section below.

The Dockerfile

We have seen how the pom.xml file creates the ~/ccsdk/distribution/odlsli/target/docker-stage directory in preparation for building the docker image.  The next step is to inspect the Dockerfile that creates the image, discussed here.

Building the docker image

Using maven

One can create the image using the maven command "mvn --activate-profiles docker clean package" or equivalently "mvn -P docker clean package."  This generates these images:

We see that a single image (all have the same IMAGE ID) is given four tags.

Using maven and 'docker build'

By running the command 'mvn clean process-sources' and getting a BUILD SUCCESS, a properly constructed directory will be created at ~/git/ccsdk/distribution/odlsli/target/docker-stage/.

Before building the image, remember that the Dockerfile begins with a local image of OpenDaylight Oxygen: onap/ccsdk-odl-oxygen-image${project.version} (currently 0.3.0-SNAPSHOT).  One can download the image from NEXUS_DOCKER_IMAGE and then rename it as a local image using the commands below.

%: docker pull ${NEXUS_DOCKER_REPO}/onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT
0.3.0-SNAPSHOT: Pulling from onap/ccsdk-odl-oxygen-image
95871a411089: Pull complete
f7253e37cce8: Pull complete
12d05d7bd5c4: Pull complete
db27ec99c6c2: Pull complete
8fd62e3405ff: Pull complete
ce430a842b90: Pull complete
de7dcf5d4be1: Pull complete
e3de3d1054ec: Pull complete
d66bd2234856: Pull complete
6be70fc7e3a6: Pull complete
Digest: sha256:80da6c8e0f70d0dddd2be462634b297fc0dc5256cb93619b30a66441d1a89cb8
Status: Downloaded newer image for nexus3.onap.org:10001/onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT
%: docker tag ${NEXUS_DOCKER_REPO}/onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT
%: docker images
REPOSITORY                                                 TAG                  IMAGE ID            CREATED             SIZE
onap/ccsdk-odl-oxygen-image                                0.3.0-SNAPSHOT       bb02ebe49933        8 hours ago         1.72GB
nexus3.onap.org:10001/onap/ccsdk-odl-oxygen-image          0.3.0-SNAPSHOT       bb02ebe49933        8 hours ago         1.72GB
nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image           0.3-STAGING-latest   eb208aa7f163        4 days ago          1.04GB
nexus3.onap.org:10001/onap/ccsdk-odlsli-image              0.3-STAGING-latest   665a42becd61        4 days ago          1.8GB
mysql/mysql-server                                         5.6                  8d97ef4de156        3 months ago        226MB

Running the ODLSLI pom.xml file

One can now navigate to to the ~/ccsdk/distribution/odlsli/target/docker-stage directory and build the docker image as shown here.  We tag the image with the name onap/sdnr:0.3.0-SNAPSHOT.

%: pwd
~/git/ccsdk/distribution/odlsli/target/docker-stage
%: docker build --tag onap/sdnr:0.3.0-SNAPSHOT .
Sending build context to Docker daemon  55.83MB
Step 1/21 : FROM onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT
 ---> bb02ebe49933
Step 2/21 : MAINTAINER CCSDK Team (onap-ccsdk@lists.onap.org)
 ---> Running in 53c7a075af9e
Removing intermediate container 53c7a075af9e
 ---> 9a53d8633de9
Step 3/21 : ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
 ---> Running in fc2c568526be
Removing intermediate container fc2c568526be
 ---> 15899d4e7cc9
Step 4/21 : ENV ODL_HOME /opt/opendaylight
 ---> Running in 615c57b21e5f
Removing intermediate container 615c57b21e5f
 ---> a64fa9d9330c
Step 5/21 : ENV SDNC_CONFIG_DIR /opt/onap/ccsdk/data/properties
 ---> Running in 89dc0febedb7
Removing intermediate container 89dc0febedb7
 ---> ca823ba18f85
Step 6/21 : ENV CCSDK_SLI_CORE_REPO mvn:org.onap.ccsdk.sli.core/ccsdk-sli-core-all/0.3.0-SNAPSHOT/xml/features
 ---> Running in 8ea3b1ecefc9
Removing intermediate container 8ea3b1ecefc9
 ---> c786ac0d9a80
Step 7/21 : ENV CCSDK_SLI_ADAPTORS_REPO mvn:org.onap.ccsdk.sli.adaptors/ccsdk-sli-adaptors-all/0.3.0-SNAPSHOT/xml/features
 ---> Running in aabf49f35e52
Removing intermediate container aabf49f35e52
 ---> 910373c6697f
Step 8/21 : ENV CCSDK_SLI_NORTHBOUND_REPO mvn:org.onap.ccsdk.sli.northbound/ccsdk-sli-northbound-all/0.3.0-SNAPSHOT/xml/features
 ---> Running in 6501bdd82056
Removing intermediate container 6501bdd82056
 ---> 7b0d785416d8
Step 9/21 : ENV CCSDK_SLI_PLUGINS_REPO mvn:org.onap.ccsdk.sli.plugins/ccsdk-sli-plugins-all/0.3.0-SNAPSHOT/xml/features
 ---> Running in 47475306a7bd
Removing intermediate container 47475306a7bd
 ---> 701ef990e4be
Step 10/21 : ENV ANSIBLE_GPG_KEY 93C4A3FD7BB9C367
 ---> Running in 57f328a63e52
Removing intermediate container 57f328a63e52
 ---> 3d9bfd557bdc
Step 11/21 : COPY idmlight.db.mv.db $ODL_HOME/data
 ---> c9cc49e5e720
Step 12/21 : COPY system /tmp/system
 ---> 896e83ab462d
Step 13/21 : RUN rsync -a /tmp/system $ODL_HOME && rm -rf /tmp/system
 ---> Running in 3dc894642df7
Removing intermediate container 3dc894642df7
 ---> 08607a4ce498
Step 14/21 : RUN cp $ODL_HOME/etc/org.apache.karaf.features.cfg $ODL_HOME/etc/org.apache.karaf.features.cfg.orig
 ---> Running in 2693ca9a78ad
Removing intermediate container 2693ca9a78ad
 ---> 9bd7f358f988
Step 15/21 : RUN cat $ODL_HOME/etc/org.apache.karaf.features.cfg.orig | sed -e "\|featuresRepositories|s|$|, ${CCSDK_SLI_CORE_REPO}, ${CCSDK_SLI_ADAPTORS_REPO}, ${CCSDK_SLI_NORTHBOUND_REPO}, ${CCSDK_SLI_PLUGINS_REPO}|" > $ODL_HOME/etc/org.apache.karaf.features.cfg
 ---> Running in c146dfabcba8
Removing intermediate container c146dfabcba8
 ---> 0998b89e66b1
Step 16/21 : RUN echo featuresBoot=config,standard,region,package,kar,ssh,management,odl-restconf-all,odl-mdsal-all,odl-mdsal-apidocs,odl-daexim-all,ccsdk-sli-core-all,ccsdk-sli-adaptors-all,ccsdk-sli-northbound-all,ccsdk-sli-plugins-all >> $ODL_HOME/etc/org.apache.karaf.features.cfg
 ---> Running in 3734bb36ecf4
Removing intermediate container 3734bb36ecf4
 ---> 9136e8973268
Step 17/21 : RUN useradd odl
 ---> Running in 4133971b9022
Removing intermediate container 4133971b9022
 ---> ba1a79490ec7
Step 18/21 : COPY opt /opt
 ---> 9cee59b90658
Step 19/21 : COPY org.ops4j.pax.logging.cfg /opt/opendaylight/etc/org.ops4j.pax.logging.cfg
 ---> 2988c82b7851
Step 20/21 : ENTRYPOINT /opt/onap/ccsdk/bin/startODL.sh
 ---> Running in d71effd4e8dc
Removing intermediate container d71effd4e8dc
 ---> 0fc9beea32f3
Step 21/21 : EXPOSE 8181
 ---> Running in 654509364e8f
Removing intermediate container 654509364e8f
 ---> f5aa4c5644d0
Successfully built f5aa4c5644d0
Successfully tagged onap/sdnr:0.3.0-SNAPSHOT
gc731h@ant-vm-45/docker-stage 84338: docker images
REPOSITORY                                                 TAG                  IMAGE ID            CREATED             SIZE
onap/sdnr                                                  0.3.0-SNAPSHOT       f5aa4c5644d0        48 seconds ago      1.8GB
onap/ccsdk-odl-oxygen-image                                0.3.0-SNAPSHOT       bb02ebe49933        9 hours ago         1.72GB
nexus3.onap.org:10001/onap/ccsdk-odl-oxygen-image          0.3.0-SNAPSHOT       bb02ebe49933        9 hours ago         1.72GB
nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image           0.3-STAGING-latest   eb208aa7f163        4 days ago          1.04GB
nexus3.onap.org:10001/onap/ccsdk-odlsli-image              0.3-STAGING-latest   665a42becd61        4 days ago          1.8GB
mysql/mysql-server                                         5.6                  8d97ef4de156        3 months ago        226MB
%:

We are now in a position to run the image.  First, we shut down ccsdk_odlsli_container to avoid conflicts.

%: docker ps
CONTAINER ID        IMAGE                                                                 COMMAND                  CREATED             STATUS                PORTS                     NAMES
4e3ba68fb7bb        nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:0.3-STAGING-latest   "/bin/bash -c 'cd /o…"   3 days ago          Up 3 days             0.0.0.0:3000->3100/tcp    ccsdk_dgbuilder_container
a68fc2f266e6        nexus3.onap.org:10001/onap/ccsdk-odlsli-image:0.3-STAGING-latest      "/opt/onap/ccsdk/bin…"   3 days ago          Up 3 days             0.0.0.0:8383->8181/tcp    ccsdk_odlsli_container
26e84acaae56        mysql/mysql-server:5.6                                                "/entrypoint.sh mysq…"   3 days ago          Up 3 days (healthy)   0.0.0.0:32790->3306/tcp   ccsdk_db_container
%: docker stop ccsdk_odlsli_container
ccsdk_odlsli_container
%: docker ps
CONTAINER ID        IMAGE                                                                 COMMAND                  CREATED             STATUS                PORTS                     NAMES
4e3ba68fb7bb        nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:0.3-STAGING-latest   "/bin/bash -c 'cd /o…"   3 days ago          Up 3 days             0.0.0.0:3000->3100/tcp    ccsdk_dgbuilder_container
26e84acaae56        mysql/mysql-server:5.6                                                "/entrypoint.sh mysq…"   3 days ago          Up 3 days (healthy)   0.0.0.0:32790->3306/tcp   ccsdk_db_container
%: docker ps -a
CONTAINER ID        IMAGE                                                                 COMMAND                  CREATED             STATUS                        PORTS                     NAMES
4e3ba68fb7bb        nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:0.3-STAGING-latest   "/bin/bash -c 'cd /o…"   3 days ago          Up 3 days                     0.0.0.0:3000->3100/tcp    ccsdk_dgbuilder_container
a68fc2f266e6        nexus3.onap.org:10001/onap/ccsdk-odlsli-image:0.3-STAGING-latest      "/opt/onap/ccsdk/bin…"   3 days ago          Exited (137) 9 seconds ago                              ccsdk_odlsli_container
26e84acaae56        mysql/mysql-server:5.6                                                "/entrypoint.sh mysq…"   3 days ago          Up 3 days (healthy)           0.0.0.0:32790->3306/tcp   ccsdk_db_container
%:

Remember that the entrypoint script /opt/onap/ccsdk/bin/startODL.sh will execute and that it waits to login to the db server, so SDNR will not progress if it cannot login to the MySQL server.  We want to connect SDNR to ccsdk_db_container, and we inspect the CCSDK containers to learn about their network.

We now have the information we need to start the container, and we use the command described here to launch it.

Alternatively, one can edit the docker-compose.yml file to use the newly created onap/sndr:0.3.0-SNAPSHOT image rather than the ccsdk-odlsli-image pulled from NEXUS_DOCKER_REPO.  That will also create and launch the new SDNR container.

Creating the zip installation files for karaf features

We have seen how the karaf features for CCSDK are included in the dependencies section of the pom.xml file in ~/ccsdk/distribution/odlsli/ and that the features are referenced as files with the name structure <feature-name>-installer.<version>-repo.zip.  The next step is to understand how these zip installation files are created.  A good example is the "sliapi" feature, which is in the gerrit repository ccsdk/sli/core, shown here.

The sliapi directory contains the usual directories for a karaf feature with an additional directory "installer."  This directory contains the code that creates the installation zip file that is referenced in the dependencies section of the ODLSLI pom.xml file.

Context for the installer

OpenDaylight Guidelines and Component Meta-Features

CCSDK is based on OpenDaylight and follows the recommended practices of that group.  There are documented guidelines for karaf features, and another aspect is what OpenDaylight calls "component meta-features," in which several related features are grouped together to simplify their installation.  For example, these features implement NETCONF in OpenDaylight:

Rather than install each feature individually in the karaf client, one can use the component meta-feature "odl-netconf-all" and install all of the features with the single command "feature:install odl-netconf-all."  Recall that the Dockerfile for ccsdk_odlsli_container sets these environment variables:

ENV CCSDK_SLI_CORE_REPO mvn:org.onap.ccsdk.sli.core/ccsdk-sli-core-all/${ccsdk.sli.core.version}/xml/features
ENV CCSDK_SLI_ADAPTORS_REPO mvn:org.onap.ccsdk.sli.adaptors/ccsdk-sli-adaptors-all/${ccsdk.sli.adaptors.version}/xml/features
ENV CCSDK_SLI_NORTHBOUND_REPO mvn:org.onap.ccsdk.sli.northbound/ccsdk-sli-northbound-all/${ccsdk.sli.northbound.version}/xml/features
ENV CCSDK_SLI_PLUGINS_REPO mvn:org.onap.ccsdk.sli.plugins/ccsdk-sli-plugins-all/${ccsdk.sli.plugins.version}/xml/features

So CCSDK has created a component meta-feature for each of the SLI repositories, and we will encounter commands in the Maven pom.xml files and directory and file structures to implement them.

Procedure to install CCSDK features prior to Casablanca

Another aspect for the context of the installer is that CCSDK changed the procedure to install karaf features from Beijing to Casablanca, but some elements of the prior procedure are still present.  Prior to Casablanca, all of the CCSDK features were copied into the CCSDK home directory (/opt/onap/ccsdk) in the folder '/opt/onap/ccsdk/features/,' and the entry point script in the Docker container installed them.  The contents of the CCSDK home directory and features directory for Beijing are shown here.

As we can see, each feature is in a directory with the name "ccsdk-<feature-name>," and the directory contains a zip file with the name "ccsdk-<feature-name>-<version>.zip" and an 'install-feature.sh' script.  The zip file is simply the maven repository for the feature, as shown here for ccsdk-sliapi.

And here is the 'install-feature.sh' script.

Inspecting the installer pom.xml file

Below is the annotated pom.xml file, which executes three maven phases in sequence: validate, prepare-package and package.  However, the commands in the code do not appear in the sequence in which they are executed.  For the sake of clarity, we discuss the commands in the sequence in which are executed.

Installer pom.xml file part 0

install-feature.sh script

As we described in a previous section, the installation folder (<features.boot>) for a particular feature contains the zipped maven repository and an installation script for that feature.  The script is below, and as you can see, it references the <features.respositories> and <features.boot> properties in commands sent to the karaf client.

ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client}
INSTALLERDIR=$(dirname $0)

REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip

if [ -f ${REPOZIP} ]
then
        unzip -d ${ODL_HOME} ${REPOZIP}
else
        echo "ERROR : repo zip ($REPOZIP) not found"
        exit 1
fi

${ODL_KARAF_CLIENT} feature:repo-add ${features.repositories}
${ODL_KARAF_CLIENT} feature:install ${features.boot}

Installer pom.xml file part 1

Continuing with the pom.xml file in the installer module, we now discuss the command first executed in the "validate" phase.

To see the result of this command, we show the changes in the installer directory after it is executed.  We begin with 'mvn clean' and then execute part one and show the result.

As expected, install-feature.sh has been copied into target/stage and the parameter values have been inserted into the placeholders.

Installer pom.xml file part 2

Now the command executed in the "prepare-package" phase.

And we show the result of executing the command.

The maven repositories have been copied into installer/target/assembly with the correct structure and properly rooted at system/, although, as mentioned, the artifact "features-sliapi" in not included.

Installer pom.xml part 3

Parts 1 and 2 have copied all of the necessary maven repositories and scripts into the correct folder structure and with the correct parameter values.  The pom.xml file now zips them up.

assemble_mvnrepo_zip.xml

And after it is executed...

The repositories have been properly zipped up into installer/target/stage/ccsdk-sliapi-0.3.0-SNAPSHOT-repo.zip.

Installer pom.xml part 4

And the final step.

assemble_installer_zip.xml

And after it is executed...

Voilà!

Installation in Casablanca

Setting the startup features

We have described the installation procedure prior to Casablanca, and we now turn to the procedure beginning in Casablanca.  As we mentioned earlier, OpenDaylight is configured in Casablanca to install the CCSDK features upon booting up rather than afterwards in a bash script, and "component meta-features" are used rather than the individual features. OpenDaylight boots up much more quickly using this procedure.  Features to install at boot time are configured in $ODL_HOME/etc/org.apache.karaf.features.cfg in two parameters: featuresRepositories and featuresBoot.  We begin by looking in ccsdk/distribution/odlsli/src/main/docker/Dockerfile for the FROM IMAGE of the CCSDK container (master branch, 8/25/2018)::

%: head Dockerfile
# Base ubuntu with added packages needed for open ecomp
FROM onap/ccsdk-odl-oxygen-image:${project.version}
MAINTAINER CCSDK Team (onap-ccsdk@lists.onap.org)
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
ENV ODL_HOME /opt/opendaylight
ENV SDNC_CONFIG_DIR /opt/onap/ccsdk/data/properties
ENV CCSDK_SLI_CORE_REPO mvn:org.onap.ccsdk.sli.core/ccsdk-sli-core-all/${ccsdk.sli.core.version}/xml/features
ENV CCSDK_SLI_ADAPTORS_REPO mvn:org.onap.ccsdk.sli.adaptors/ccsdk-sli-adaptors-all/${ccsdk.sli.adaptors.version}/xml/features
ENV CCSDK_SLI_NORTHBOUND_REPO mvn:org.onap.ccsdk.sli.northbound/ccsdk-sli-northbound-all/${ccsdk.sli.northbound.version}/xml/features
ENV CCSDK_SLI_PLUGINS_REPO mvn:org.onap.ccsdk.sli.plugins/ccsdk-sli-plugins-all/${ccsdk.sli.plugins.version}/xml/features

In "onap/ccsdk-odl-oxygen-image," the file $ODL_HOME/etc/org.apache.karaf.features.cfg sets these values for the two startup parameters:

Startup features in the Dockerfile FROM IMAGE

These universally unique identifiers (UUIDs) identify the startup features.  featuresRepositories references the file $ODL_HOME/etc/290021b0-51f7-4e02-8efa-007cad16f73a.xml, shown here.

root@6cd44c751205:/opt/opendaylight/current/etc# cat $ODL_HOME/etc/290021b0-51f7-4e02-8efa-007cad16f73a.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
     <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="290021b0-51f7-4e02-8efa-007cad16f73a">
     <repository>mvn:org.apache.karaf.features/framework/4.1.5/xml/features</repository>
     <repository>mvn:org.opendaylight.integration/features-index/0.8.1/xml/features</repository>
     <repository>mvn:org.apache.karaf.features/standard/4.1.5/xml/features</repository>
     <feature name="0af5d86a-980c-48a9-a02d-bdac71ff8529" version="0.0.0">
           <feature prerequisite="false" dependency="false">framework</feature>
          <feature prerequisite="false" dependency="false">standard</feature>
          <feature prerequisite="false" dependency="false">ssh</feature>
          <bundle>mvn:org.apache.aries.quiesce/org.apache.aries.quiesce.api/1.0.0</bundle>
          <bundle>mvn:org.osgi/org.osgi.service.event/1.3.1</bundle>
          <bundle>mvn:org.bouncycastle/bcprov-jdk15on/1.59</bundle>
          <bundle>mvn:org.bouncycastle/bcpkix-jdk15on/1.59</bundle>
          <bundle>mvn:org.bouncycastle/bcprov-ext-jdk15on/1.59</bundle>
          <bundle>mvn:org.apache.felix/org.apache.felix.metatype/1.1.6</bundle>
          <bundle>mvn:org.opendaylight.odlparent/karaf.branding/3.1.0</bundle>
     </feature>
</features>

And the featuresBoot value of 0af5d86a-980c-48a9-a02d-bdac71ff8529 references the name of the feature in the xml file and pulls in all of the features and bundles included in that file.  After logging into a running docker container of the ODL oxygen image, we see that these relatively few features are installed.

opendaylight-user@root>feature:list -i
Name                                 | Version | Required | State   | Repository                           | Description
-------------------------------------+---------+----------+---------+--------------------------------------+--------------------------------------------------
aries-proxy                          | 4.1.5   |          | Started | standard-4.1.5                       | Aries Proxy
aries-blueprint                      | 4.1.5   |          | Started | standard-4.1.5                       | Aries Blueprint
feature                              | 4.1.5   |          | Started | standard-4.1.5                       | Features Support
shell                                | 4.1.5   |          | Started | standard-4.1.5                       | Karaf Shell
shell-compat                         | 4.1.5   |          | Started | standard-4.1.5                       | Karaf Shell Compatibility
deployer                             | 4.1.5   |          | Started | standard-4.1.5                       | Karaf Deployer
bundle                               | 4.1.5   |          | Started | standard-4.1.5                       | Provide Bundle support
config                               | 4.1.5   |          | Started | standard-4.1.5                       | Provide OSGi ConfigAdmin support
diagnostic                           | 4.1.5   |          | Started | standard-4.1.5                       | Provide Diagnostic support
instance                             | 4.1.5   |          | Started | standard-4.1.5                       | Provide Instance support
jaas                                 | 4.1.5   |          | Started | standard-4.1.5                       | Provide JAAS support
log                                  | 4.1.5   |          | Started | standard-4.1.5                       | Provide Log support
package                              | 4.1.5   |          | Started | standard-4.1.5                       | Package commands and mbeans
service                              | 4.1.5   |          | Started | standard-4.1.5                       | Provide Service support
system                               | 4.1.5   |          | Started | standard-4.1.5                       | Provide System support
kar                                  | 4.1.5   |          | Started | standard-4.1.5                       | Provide KAR (KARaf archive) support
ssh                                  | 4.1.5   |          | Started | standard-4.1.5                       | Provide a SSHd server on Karaf
management                           | 4.1.5   |          | Started | standard-4.1.5                       | Provide a JMX MBeanServer and a set of MBeans in
wrap                                 | 0.0.0   |          | Started | standard-4.1.5                       | Wrap URL handler
standard                             | 4.1.5   |          | Started | standard-4.1.5                       | Wrap feature describing all features part of a st
0af5d86a-980c-48a9-a02d-bdac71ff8529 | 0.0.0   | x        | Started | 290021b0-51f7-4e02-8efa-007cad16f73a |

Editing the parameters for the startup karaf features

The above is the starting point for the CCSDK image.  Recall that the Dockerfile for the CCSDK image contains these commands:

ENV ODL_HOME /opt/opendaylight
ENV SDNC_CONFIG_DIR /opt/onap/ccsdk/data/properties
ENV CCSDK_SLI_CORE_REPO mvn:org.onap.ccsdk.sli.core/ccsdk-sli-core-all/${ccsdk.sli.core.version}/xml/features
ENV CCSDK_SLI_ADAPTORS_REPO mvn:org.onap.ccsdk.sli.adaptors/ccsdk-sli-adaptors-all/${ccsdk.sli.adaptors.version}/xml/features
ENV CCSDK_SLI_NORTHBOUND_REPO mvn:org.onap.ccsdk.sli.northbound/ccsdk-sli-northbound-all/${ccsdk.sli.northbound.version}/xml/features
ENV CCSDK_SLI_PLUGINS_REPO mvn:org.onap.ccsdk.sli.plugins/ccsdk-sli-plugins-all/${ccsdk.sli.plugins.version}/xml/features
...
RUN cat $ODL_HOME/etc/org.apache.karaf.features.cfg.orig | sed -e "\|featuresRepositories|s|$|, ${CCSDK_SLI_CORE_REPO}, ${CCSDK_SLI_ADAPTORS_REPO}, ${CCSDK_SLI_NORTHBOUND_REPO}, ${CCSDK_SLI_PLUGINS_REPO}|" > $ODL_HOME/etc/org.apache.karaf.features.cfg
RUN echo featuresBoot=config,standard,region,package,kar,ssh,management,odl-restconf-all,odl-mdsal-all,odl-mdsal-apidocs,odl-daexim-all,ccsdk-sli-core-all,ccsdk-sli-adaptors-all,ccsdk-sli-northbound-all,ccsdk-sli-plugins-all >> $ODL_HOME/etc/org.apache.karaf.features.cfg

These commands append new repositories to featuresRepositories and set featuresBoot to the desired feature names. (Note: the final content of the file is not what I expect from these commands, but the objective is achieved, i.e., the parameters are set to the correct values.)  We inspect the features.xml file for the repository containing our example feature sliapi.

ENV CCSDK_SLI_CORE_REPO mvn:org.onap.ccsdk.sli.core/ccsdk-sli-core-all/${ccsdk.sli.core.version}/xml/features

% cd ~/.m2/repository/org/onap/ccsdk/sli/core/ccsdk-sli-core-all/0.3.0-SNAPSHOT
% cat ccsdk-sli-core-all-0.3.0-SNAPSHOT-features.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="ccsdk-sli-core-all">
    <repository>mvn:org.onap.ccsdk.sli.core/ccsdk-slicore-utils/0.3.0-SNAPSHOT/xml/features</repository>
    <repository>mvn:org.onap.ccsdk.sli.core/ccsdk-dblib/0.3.0-SNAPSHOT/xml/features</repository>
    <repository>mvn:org.onap.ccsdk.sli.core/ccsdk-filters/0.3.0-SNAPSHOT/xml/features</repository>
    <repository>mvn:org.onap.ccsdk.sli.core/ccsdk-sli/0.3.0-SNAPSHOT/xml/features</repository>
    <repository>mvn:org.onap.ccsdk.sli.core/ccsdk-sliapi/0.3.0-SNAPSHOT/xml/features</repository>
    <repository>mvn:org.onap.ccsdk.sli.core/ccsdk-sliPluginUtils/0.3.0-SNAPSHOT/xml/features</repository>
    <feature name="ccsdk-sli-core-all" description="ccsdk-sli-core :: features :: ccsdk-sli-core-all" version="0.3.0.SNAPSHOT">
        <details>Root POM to be used in place of odlparent for CCSDK based projects</details>
        <feature version="0.3.0.SNAPSHOT" prerequisite="false" dependency="false">ccsdk-slicore-utils</feature>
        <feature version="0.3.0.SNAPSHOT" prerequisite="false" dependency="false">ccsdk-dblib</feature>
        <feature version="0.3.0.SNAPSHOT" prerequisite="false" dependency="false">ccsdk-filters</feature>
        <feature version="0.3.0.SNAPSHOT" prerequisite="false" dependency="false">ccsdk-sli</feature>
        <feature version="0.3.0.SNAPSHOT" prerequisite="false" dependency="false">ccsdk-sliapi</feature>
        <feature version="0.3.0.SNAPSHOT" prerequisite="false" dependency="false">ccsdk-sliPluginUtils</feature>
    </feature>
</features>

We see that the component meta-feature ccsdk-sli-core-all contains the repository and name for all of the features in the ccsdk/sli/core repository, including sliapi.

Constructing the component meta-feature

To see how the ccsdk-sli-core-all is constructed, we inspect the features directory in ccsdk/sli/core.

The pom.xml file of interest is features/ccsdk-sli-core-all/pom.xml, which we show here in its entirety.

%: cat pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>

        <parent>
                <groupId>org.onap.ccsdk.parent</groupId>
                <artifactId>single-feature-parent</artifactId>
                <version>1.1.0-SNAPSHOT</version>
                <relativePath />
        </parent>

        <groupId>org.onap.ccsdk.sli.core</groupId>
        <artifactId>ccsdk-sli-core-all</artifactId>
        <version>0.3.0-SNAPSHOT</version>
        <packaging>feature</packaging>

        <name>ccsdk-sli-core :: features :: ${project.artifactId}</name>
        <dependencyManagement>
                <dependencies>
                        <dependency>
                                <groupId>org.opendaylight.mdsal.model</groupId>
                                <artifactId>mdsal-model-artifacts</artifactId>
                                <version>${odl.mdsal.model.version}</version>
                                <type>pom</type>
                                <scope>import</scope>
                        </dependency>
                        <dependency>
                                <groupId>org.opendaylight.controller</groupId>
                                <artifactId>mdsal-artifacts</artifactId>
                                <version>${odl.mdsal.version}</version>
                                <type>pom</type>
                                <scope>import</scope>
                        </dependency>
                </dependencies>
        </dependencyManagement>

        <dependencies>
                <dependency>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>ccsdk-slicore-utils</artifactId>
                        <version>${project.version}</version>
                        <type>xml</type>
                        <classifier>features</classifier>
                </dependency>
                <dependency>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>ccsdk-dblib</artifactId>
                        <version>${project.version}</version>
                        <type>xml</type>
                        <classifier>features</classifier>
                </dependency>
                <dependency>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>ccsdk-filters</artifactId>
                        <version>${project.version}</version>
                        <type>xml</type>
                        <classifier>features</classifier>
                </dependency>
                <dependency>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>ccsdk-sli</artifactId>
                        <version>${project.version}</version>
                        <type>xml</type>
                        <classifier>features</classifier>
                </dependency>
                <dependency>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>ccsdk-sliapi</artifactId>
                        <version>${project.version}</version>
                        <type>xml</type>
                        <classifier>features</classifier>
                </dependency>
                <dependency>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>ccsdk-sliPluginUtils</artifactId>
                        <version>${project.version}</version>
                        <type>xml</type>
                        <classifier>features</classifier>
                </dependency>
        </dependencies>
</project>

We see that it includes dependencies for the feature.xml file for each feature in the ccsdk/sli/core repository and generates the feature.xml file (packaging>feature</packaging>) for ccsdk-sli-core-all.  I believe that all of the other folders in ccsdk/sli/core/features are vestigial or - at least - uninvolved in the installation of features in ccsdk_odlsli_container.