Table of Contents |
---|
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 To begin, clone the ccsdk/distribution repository and look at the docker-compose.yml file in ccsdk/distribution/src/main/yaml.
...
Here are annotated contents of that file (master branch July 25, 2018, version 0.3.0-SNAPSHOTDec. 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.
...
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:
Code Block | ||
---|---|---|
| ||
%: 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.
...
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 pom.xml file
...
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:
- validate
- plugin: org.codehaus.groovy.maven : gmavin-plugin (described above)
- set the version of the ODLSLI docker image to be used in NEXUS_DOCKER_REPO
- Note: the name of the image is set in the property 'image.name' in the pom.xml properties section.
- 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:
idmlight.db.mv.db
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 (described above)
- 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 into 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
The "docker" profile defines an the additional "package" phase in which the docker image is built and deployed . There is also a "deploy" phase in which the generated image is pushed to NEXUS_DOCKER_REPO with the image name ${image.name}:${project.docker.latesttag.version}, which currently translates to "onap/ccsdk-odlsli-image:0.3-STAGING-latest." I expect that the "docker build profile" in the pom.xml file requires special privileges because it deploys the image to NEXUS_DOCKER_REPO.
The Dockerfile
, 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 We have seen how the pom.xml file create 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.
Code Block | ||
---|---|---|
| ||
%: 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.
Code Block | ||
---|---|---|
| ||
%: 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.
Code Block | ||||
---|---|---|---|---|
| ||||
%: 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
Anchor | ||||
---|---|---|---|---|
|
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:
odl-netconf-api
odl-netconf-mapping-api
odl-netconf-util
odl-netconf-impl
odl-netconf-netty-util
odl-netconf-client
odl-netconf-monitoring
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.
Anchor | ||||
---|---|---|---|---|
|
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.
Anchor | ||||
---|---|---|---|---|
|
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.
Code Block | ||||
---|---|---|---|---|
| ||||
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:
- featuresRepositories = file:${karaf.home}/etc/290021b0-51f7-4e02-8efa-007cad16f73a.xml
- featuresBoot = 0af5d86a-980c-48a9-a02d-bdac71ff8529
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.
No Format |
---|
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 |
The section of the Dockerfile that sets the environment variables for the features for the repositories is repeated here.
Code Block | ||
---|---|---|
| ||
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 |
These variables enable all of the features in a repository to be installed using a single reference, e.g., <repository-name>-all.
Building the docker image
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.
Code Block | ||
---|---|---|
| ||
%: 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 | Provide Service support system TAG | 4.1.5 | | Started IMAGE ID| standard-4.1.5 CREATED | Provide System SIZE onap/ccsdk-odl-oxygen-imagesupport kar | 04.3.0-SNAPSHOT1.5 | | Started | standard-4.1.5 bb02ebe49933 8 hours ago | Provide 1.72GB nexus3.onap.org:10001/onap/ccsdk-odl-oxygen-image KAR (KARaf archive) support ssh 0.3.0-SNAPSHOT bb02ebe49933 8 hours ago | 1.72GB nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image 4.1.5 | 0.3-STAGING-latest eb208aa7f163| Started | standard-4.1.5 4 days ago 1.04GB nexus3.onap.org:10001/onap/ccsdk-odlsli-image | Provide a SSHd server on Karaf management 0.3-STAGING-latest 665a42becd61 4 days ago | 4.1.8GB mysql/mysql-server5 | | Started | standard-4.1.5 | Provide a 5.6JMX MBeanServer and a set of MBeans in wrap 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.
Code Block | ||
---|---|---|
| ||
%: pwd ~/git/ccsdk/distribution/odlsli/target/docker-stage %: docker build --tag onap/sdnr:| 0.30.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 : | | 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:
No Format |
---|
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/0.3.0-SNAPSHOT${ccsdk.sli.core.version}/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 : ${ccsdk.sli.adaptors.version}/xml/features ENV CCSDK_SLI_NORTHBOUND_REPO mvn:org.onap.ccsdk.sli.northbound/ccsdk-sli-northbound-all/0.3.0-SNAPSHOT${ccsdk.sli.northbound.version}/xml/features ENV CCSDK_SLI_PLUGINS_REPO mvn:org.onap.ccsdk.sli.plugins/ccsdk-sli--> Running in 6501bdd82056 Removing intermediate container 6501bdd82056 ---> 7b0d785416d8 Step 9/21 : ENV 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 mvn:}|" > $ODL_HOME/etc/org.onapapache.ccsdkkaraf.sli.plugins/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-pluginscore-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
No Format |
---|
% 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.
No Format |
---|
%: 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> /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 <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> 0<version>1.31.0-SNAPSHOTSNAPSHOT</version> f5aa4c5644d0 <relativePath 48/> seconds ago 1.8GB onap/ccsdk-odl-oxygen-image</parent> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>ccsdk-sli-core-all</artifactId> <version>0.3.0-SNAPSHOT</version> 0.3.0-SNAPSHOT<packaging>feature</packaging> bb02ebe49933 <name>ccsdk-sli-core :: features 9 hours ago:: ${project.artifactId}</name> <dependencyManagement> 1.72GB nexus3.onap.org:10001/onap/ccsdk-odl-oxygen-image 0.3.0-SNAPSHOT <dependencies> bb02ebe49933 9 hours ago 1.72GB nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image<dependency> 0.3-STAGING-latest eb208aa7f163 4 days ago 1.04GB nexus3.onap.org:10001/onap/ccsdk-odlsli-image <groupId>org.opendaylight.mdsal.model</groupId> 0.3-STAGING-latest 665a42becd61 4 days ago 1.8GB mysql/mysql-server<artifactId>mdsal-model-artifacts</artifactId> <version>${odl.mdsal.model.version}</version> 5.6 8d97ef4de156<type>pom</type> 3 months ago 226MB %: |
We are now in a position to run the image. First, we shut down ccsdk_odlsli_container to avoid conflicts.
Code Block | ||||
---|---|---|---|---|
| ||||
%: docker ps CONTAINER ID IMAGE <scope>import</scope> </dependency> <dependency> COMMAND CREATED<groupId>org.opendaylight.controller</groupId> STATUS PORTS <artifactId>mdsal-artifacts</artifactId> NAMES 4e3ba68fb7bb nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:0.3-STAGING-latest "/bin/bash -c 'cd /o…" <version>${odl.mdsal.version}</version> 3 days ago Up 3 days 0.0.0.0:3000->3100/tcp ccsdk_dgbuilder_container a68fc2f266e6 <type>pom</type> nexus3.onap.org:10001/onap/ccsdk-odlsli-image:0.3-STAGING-latest "/opt/onap/ccsdk/bin…" 3 days ago Up 3 days <scope>import</scope> 0.0.0.0:8383->8181/tcp ccsdk_odlsli_container 26e84acaae56 mysql/mysql-server:5.6 </dependency> </dependencies> </dependencyManagement> <dependencies> "/entrypoint.sh mysq…" 3<dependency> 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 <groupId>${project.groupId}</groupId> IMAGE <artifactId>ccsdk-slicore-utils</artifactId> <version>${project.version}</version> <type>xml</type> COMMAND CREATED <classifier>features</classifier> STATUS </dependency> PORTS <dependency> NAMES 4e3ba68fb7bb nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:0.3-STAGING-latest "/bin/bash -c 'cd /o…" 3 days ago<groupId>${project.groupId}</groupId> Up 3 days <artifactId>ccsdk-dblib</artifactId> 0.0.0.0:3000->3100/tcp ccsdk_dgbuilder_container 26e84acaae56 mysql/mysql-server:5.6<version>${project.version}</version> <type>xml</type> "/entrypoint.sh mysq…"<classifier>features</classifier> 3 days ago Up</dependency> 3 days (healthy) 0.0.0.0:32790->3306/tcp ccsdk_db_container %: docker ps -a CONTAINER ID <dependency> IMAGE <groupId>${project.groupId}</groupId> <artifactId>ccsdk-filters</artifactId> COMMAND <version>${project.version}</version> CREATED <type>xml</type> STATUS <classifier>features</classifier> PORTS </dependency> NAMES f550d9a98fb7 onap/sdnr:0.3.0-SNAPSHOT<dependency> <groupId>${project.groupId}</groupId> "/bin/sh -c /opt/ona…"<artifactId>ccsdk-sli</artifactId> 10 minutes ago Exited (130) 52 seconds ago <version>${project.version}</version> sdnr 4e3ba68fb7bb<type>xml</type> nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:0.3-STAGING-latest "/bin/bash -c 'cd <classifier>features</o…"classifier> 3 days ago Up</dependency> 3 days <dependency> 0.0.0.0:3000->3100/tcp ccsdk_dgbuilder_container a68fc2f266e6 nexus3.onap.org:10001/onap/ccsdk-odlsli-image:0.3-STAGING-latest<groupId>${project.groupId}</groupId> "/opt/onap/ccsdk/bin…" 3 days ago Exited (137) 9 seconds ago <artifactId>ccsdk-sliapi</artifactId> <version>${project.version}</version> ccsdk_odlsli_container 26e84acaae56 mysql/mysql-server:5.6 <type>xml</type> <classifier>features</classifier> "/entrypoint.sh mysq…"</dependency> 3 days ago Up<dependency> 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, so 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.
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.
<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.