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.
This file creates a running instance of CCSDK that is made up of three containers:
- db: standard MySQL container; used by Directed Graphs
- odlsli: OpenDaylight with Service Logic Interpreter installed
- dgbuilder: Directed Graph builder
Here are annotated contents of that file (master branch July 24, 2018).
Executing this docker-compose.yml file will create and launch the containers. Below is a sample terminal session. Navigate to <path>/ccsdk/distribution/src/main/yml and enter these commands (note that the credentials to login to NEXUS_DOCKER_REPO are docker:docker):
%: cd ~/git/ccsdk/distribution/src/main/yaml/ %: echo $NEXUS_DOCKER_REPO nexus3.onap.org:10001 %: echo $CCSDK_DOCKER_IMAGE_VERSION 0.2.4 %: docker login $NEXUS_DOCKER_REPO Username (docker): docker Password: Login Succeeded %: docker-compose up -d Removing happy_noether Removing ccsdk_sdnr_container ccsdk_db_container is up-to-date Starting ccsdk_odlsli_container ... done Starting ccsdk_dgbuilder_container ... done %:
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_odlsli_container | opendaylight-user@root>Waiting for mysql ccsdk_odlsli_container | ccsdk_odlsli_container | mysql ready ccsdk_odlsli_container | Apache Karaf starting up. Press Enter to open the shell now... ccsdk_odlsli_container | log4j:WARN No such property [maxBackupIndex] in org.apache.log4j.sift.MDCSiftingAppender. ccsdk_odlsli_container | log4j:WARN No such property [maxFileSize] in org.apache.log4j.sift.MDCSiftingAppender. ccsdk_odlsli_container | log4j:WARN No such property [maxFileSize] in org.apache.log4j.sift.MDCSiftingAppender. ccsdk_odlsli_container | log4j:WARN No such property [maxBackupIndex] in org.apache.log4j.sift.MDCSiftingAppender. ccsdk_dgbuilder_container | npm WARN node-red@0.9.1 license should be a valid SPDX license expression ccsdk_dgbuilder_container | ccsdk_dgbuilder_container | Welcome to Node-RED ccsdk_dgbuilder_container | =================== ccsdk_dgbuilder_container | ccsdk_dgbuilder_container | 24 Jul 18:34:15 - [red] Version: 0.9.1 ccsdk_dgbuilder_container | 24 Jul 18:34:15 - [red] Loading palette nodes ccsdk_dgbuilder_container | 24 Jul 18:34:15 - [red] Server now running at http://127.0.0.1:3100/ ccsdk_dgbuilder_container | 24 Jul 18:34:15 - [red] Flows file not found : /opt/onap/ccsdk/dgbuilder/releases/sdnc1.0/flows/flows.json 100% [========================================================================] ccsdk_odlsli_container | ccsdk_odlsli_container | ________ ________ .__ .__ .__ __ ccsdk_odlsli_container | \_____ \ ______ ____ ____ \______ \ _____ ___.__.| | |__| ____ | |___/ |_ ccsdk_odlsli_container | / | \\____ \_/ __ \ / \ | | \\__ \< | || | | |/ ___\| | \ __\ ccsdk_odlsli_container | / | \ |_> > ___/| | \| ` \/ __ \\___ || |_| / /_/ > Y \ | ccsdk_odlsli_container | \_______ / __/ \___ >___| /_______ (____ / ____||____/__\___ /|___| /__| ccsdk_odlsli_container | \/|__| \/ \/ \/ \/\/ /_____/ \/ ccsdk_odlsli_container | ccsdk_odlsli_container | ccsdk_odlsli_container | Hit '<tab>' for a list of available commands ccsdk_odlsli_container | and '[cmd] --help' for help on a specific command. ccsdk_odlsli_container | Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown OpenDaylight. ccsdk_odlsli_container | ccsdk_odlsli_container | Karaf started in 10s. Bundle stats: 365 active, 366 total
When you see the OpenDaylight banner, the CCSDK containers are running in your host, e.g.:
%: docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a2f93b2a812a nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:0.2.4 "/bin/bash -c 'cd /o…" 3 weeks ago Up 2 hours 0.0.0.0:3000->3100/tcp ccsdk_dgbuilder_container 744e3cc8a7fb nexus3.onap.org:10001/onap/ccsdk-odlsli-image:0.2.4 "/opt/onap/ccsdk/bin…" 3 weeks ago Up 2 hours 0.0.0.0:8383->8181/tcp ccsdk_odlsli_container 232ec2acbd1b mysql/mysql-server:5.6 "/entrypoint.sh mysq…" 3 weeks ago Up 3 weeks (healthy) 0.0.0.0:32787->3306/tcp ccsdk_db_container
And you can browse to the OpenDaylight apidoc/explorer. Note that port 8383 in the host is forwarded to port 8181 in the odlsli container.
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@744e3cc8a7fb:/opt/opendaylight/current# ls CONTRIBUTING.markdown configuration etc lib taglist.log LICENSE daexim idmlight.db.mv.db lock README.markdown data instances patches bin deploy journal snapshots build.url derby.log karaf.pid system 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>
Taking a look at 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 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:
The features installation script
The installFeatures.sh script in CCSDK_HOME/bin installs the features into OpenDaylight. That script is:
root@744e3cc8a7fb:/opt/onap/ccsdk/bin# cat $CCSDK_HOME/bin/installFeatures.sh #!/bin/bash ### # ============LICENSE_START======================================================= # openECOMP : SDN-C # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights # reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============LICENSE_END========================================================= ### CCSDK_HOME=${CCSDK_HOME:-/opt/onap/ccsdk} ${CCSDK_HOME}/bin/installCcsdkFeatures.sh
So that script simply calls another script, possibly for backwards compatibility. The installCcsdkFeatures.sh script contains:
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.
Let's take a look at the pom.xml file.