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 (master branch, July 25, 2014). It creates a running instance of CCSDK that is made up of three containers:
- db: standard MySQL container
- odlsli: OpenDaylight with Service Logic Interpreter features installed
- dgbuilder: Directed Graph builder
Here are annotated contents of that file (master branch July 25, 2018, version 0.3.0-SNAPSHOT).
Executing this docker-compose.yml file will create and launch the containers. Navigate to <path>/ccsdk/distribution/src/main/yml 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
You can browse to the OpenDaylight apidoc/explorer. 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.
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.
The ~/git/ccsdk/distribution/odlsli pom.xml file
This pom.xml file contructs the odlsli docker container. We will discuss the file in sections.
ODLSLI pom.xml initialization and dependencies
ODLSLI pom.xml: Build Phases
The pom.xml file has three phases in the default life cycle. They are:
- validate
- plugin: org.codehaus.groovy.maven : gmavin-plugin
- set the name of the ODLSLI docker image to be used in NEXUS_DOCKER_REPO
- plugin: maven-resources-plugin
- goal: copy-resources
- id: copy-dockerfile
- copy Docker file
- from ./src/main/docker/
- to ./target/docker-stage/
- id: copy-scripts
- copy all of the scripts (*.sh files)
- from ./src/main/scripts/
- to ./target/docker-stage/opt/onap/ccsdk/bin/
- id: copy-odl-resources
- copy the files:
org.ops4j.pax.logging.cfg
install_ccsdk.yml
ansible-sources.list
- from ./src/main/resources/
- to ./target/docker-stage/
- copy the files:
- id: copy-config
- copy the file org.ops4j.pax.logging.cfg
- from ./src/main/resources/
- to ./target/docker-stage/
- id: copy-data
- copy all of the MySQL databases (*.dump)
- from ./src/main/resources/
- to ./target/docker-stage/opt/onap/ccsdk/data/
- id: copy-properties
- copy all of the properties files (*.properties)
- from ./src/main/properties/
- to ./target/docker-stage/opt/onap/ccsdk/data/properties/
- id: copy-keystores
- copy all *.jks files
- from ./src/main/stores/
- to ./target/docker-stage/opt/onap/ccsdk/data/stores/
- id: copy-dockerfile
- goal: copy-resources
- plugin: org.codehaus.groovy.maven : gmavin-plugin
- generate-sources
- plugin: org.apache.maven.plugins : maven-dependency-plugin
- goal: unpack-dependencies
- id: "unpack features"
- unzip all of the dependencies
- from a local or remote Maven repository
- to ./target/docker-stage
- Note: all of the zipped features are rooted at the "system" folder, so they will be unzipped in the proper structure for the OpenDaylight feature repository.
- id: "unpack features"
- goal: unpack
- id: "unpack dgs"
- Unzip the zipped artifact org.onap.ccsdk.distribution : platform-logic-installer : ${project.version}
- from a local or remote Maven repository
- to .target/docker-stage/opt/onap/ccsdk/
- Note: this unzips the artifact into the home directory of user ccsdk in the docker container
- id: "unpack dgs"
- goal: unpack-dependencies
- plugin: org.apache.maven.plugins : maven-dependency-plugin
- process-sources
- plugin: org.codehaus.mojo : exec-maven-plugin
- goal: exec
- id: "change shell permissions"
- This executes the following command in the local computer:
- find ./target/docker-stage/opt/onap/ccsdk -name "*.sh" -exec chmod +x {} \;
- I.e., make all of the bash scripts in the ccsdk home directory executable.
- id: "change shell permissions"
- goal: exec
- plugin: org.codehaus.mojo : exec-maven-plugin
ODLSLI pom.xml: Docker Profile
And then, within the "docker" profile, there are two phases to package and push the docker image to NEXUS_DOCKER_REPO
We now see how the karaf features for OpenDaylight are structured so they can be installed and OpenDaylight launched. The next step is to understand how the installation folders in CCSDK_HOME/features are created. A good example is the 'sliapi' feature that is part of the CCSDK_CORE_FEATURES. In the gerrit repository, this code appears in ccsdk/sli/core/sliapi.
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 folder stored in the CCSDK_HOME/features folder in the ODLSLI container.
Taking a look at the pom.xml file.
Inspecting the installer pom.xml file
Below is the annotated pom.xml file. It executes two maven phases: prepare-package and package. Maven executes the prepare-package phase before the package phase, although, in the pom.xml file, the prepare-package code appears after the prepare code. In the annotations, the sequence is indicated by number.