Create and test custom feature with a minimal distribution

This tutorial shows how you can test your custom feature by creating and starting a minimal distribution. As example we will do it for the o-ran-sc for a o-ran radio unit front haul(ru-fh) devicemanager for ONAP Frankfurt.



Odl feature

To create an odl/ONAP feature you have to create at least three parts:

  • provider with your code

  • feature which defines the odl bundles to startup

  • installer which brings the artifacts into the container

A good example is the SDN-R helpserver which has only these parts or the o-ran ru-fh devicemanager.

Distribution

To create a distribution within our custom feature based on sdnc-image we need three files.

├── pom.xml ├── src │   └── main │   ├── docker │   │   └── Dockerfile │   └── scripts │   └── TagVersion.groovy



  • TagVersion.groovy

package org.oransc.oam.distribution def versionArray; if ( project.properties['o-ran-sc.project.version'] != null ) { versionArray = project.properties['o-ran-sc.project.version'].split('\\.'); } if ( project.properties['o-ran-sc.project.version'].endsWith("-SNAPSHOT") ) { patchArray = versionArray[2].split('-'); project.properties['project.docker.latestminortag.version']=versionArray[0] + '.' + versionArray[1] + "-SNAPSHOT-latest"; project.properties['project.docker.latestfulltag.version']=versionArray[0] + '.' + versionArray[1] + '.' + patchArray[0] + "-SNAPSHOT-latest"; project.properties['project.docker.latesttagtimestamp.version']=versionArray[0] + '.' + versionArray[1] + '.' + patchArray[0] + "-SNAPSHOT-"+project.properties['ccsdk.build.timestamp']; } else { project.properties['project.docker.latestminortag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest"; project.properties['project.docker.latestfulltag.version']=versionArray[0] + '.' + versionArray[1] + '.' + versionArray[2] + "-STAGING-latest"; project.properties['project.docker.latesttagtimestamp.version']=versionArray[0] + '.' + versionArray[1] + '.' + versionArray[2] + "-STAGING-"+project.properties['ccsdk.build.timestamp']; }
  • Dockerfile

# Base odl alpine with added packages needed for FROM ${base.image.repo} ENV SDNR_ORAN_REPO ${features.repo} RUN sed -i -e "\|featuresRepositories|s|$|,${SDNR_ORAN_REPO}|" $ODL_HOME/etc/org.apache.karaf.features.cfg ENV SDNRWT_BOOTFEATURES ${features.boot} USER root # copy CCSDK mvn artifacts to ODL repository COPY system /tmp/system RUN rsync -a /tmp/system $ODL_HOME && rm -rf /tmp/system RUN chown -R odl:odl $ODL_HOME USER odl
  • pom file

The only thing you have to do is to manipulate the properties and the dependencies in the pom.xml.

  • base-image: on which you want to run your custom feature

  • o-ran-sc.features: which is the feature repo you have to add (should look like this mvn:org.something.more/myartifact-feature/version/xml/features

  • features.boot: which will add the features to the odl boot features on startup

  • and you have to add the dependency (in this case devicemanager-oran-ru-fh-installer) to inject the artifacts into the container during build process.