...
Deploying New Code (based on the standard ONAP lab setup)
This tutotial talks about one way to deploy new sdnc code into the corresponding docker image which is based on the prevjous chapter "Deploying a Minimal ONAP SDN-C Environment"
Example: Deploy feature.zip file into docker image
The example is about adding a new rpc in the generic-resource-api which is a sub-module of northbound project.
Download Project
Download sdnc-northbound project and put it under integration/boostrap/vagrant-onap/opt/openecomp/sdnc
This step is not necssary which is used to align with the folder path where ONAP-integeration clone, complie project.
Add an new rpc
Edit northinboud/generic-resources-api/model/src/main/yang/GENERIC-RESOURCES-API.yang
For example
Code Block |
---|
...
rpc haok-sdnc-test {
output {
leaf hello-world {
type string;
mandatory true;
}
}
}
... |
Use maven to build project
build generic-resources-api/model
Write a simple implemenation
Implement the new rpc generated by YANG model in GenericResourcesApiProvider
For example
Code Block |
---|
@Override public Future<RpcResult<HaokSdncTestOutput>> haokSdncTest() {
HaokSdncTestOutputBuilder responseBuilder = new HaokSdncTestOutputBuilder();
responseBuilder.setHelloWorld("hello-world3");
RpcResult<HaokSdncTestOutput> rpcResult =
RpcResultBuilder.<HaokSdncTestOutput>status(true).withResult(responseBuilder.build()).build();
return Futures.immediateFuture(rpcResult);
} |
Copy and unzip feature
vagrant ssh $(vagrant global-status | grep sdnc | awk '{print $1}')
docker cp /opt/openecomp/sdnc/northbound/generic-resource-api/installer/target/sdnc-generic-resource-api-1.2.0-SNAPSHOT-installer.zip $(docker ps -a | grep "/sdnc-image" | awk '{print $1}'):/opt/sdnc/features
docker exec -it $(docker ps -a | grep "/sdnc-image" | awk '{print $1}') bash
cd /opt/sdnc/features
unzip -o sdnc-generic-resource-api-1.2.0-SNAPSHOT-installer.zip
unzip -o -d /opt/opendaylight/current sdnc-generic-resource-api/sdnc-generic-resource-api-1.2.0-SNAPSHOT.zip
rm sdnc-generic-resource-api-1.2.0-SNAPSHOT-installer.zip
rm -rf sdnc-generic-resource-api
/opt/opendaylight/current/bin/client -u karaf feature:uninstall sdnc-generic-resource-api
/opt/opendaylight/current/bin/client -u karaf feature:repo-remove mvn:org.onap.sdnc.northbound/generic-resource-api-features/1.2.0-SNAPSHOT/xml/features
/opt/opendaylight/current/bin/client -u karaf feature:repo-add mvn:org.onap.sdnc.northbound/generic-resource-api-features/1.2.0-SNAPSHOT/xml/features
/opt/opendaylight/current/bin/client -u karaf feature:install sdnc-generic-resource-api
docker restart $(docker ps -a | grep "/sdnc-image" | awk '{print $1}')
Hint: The version 1.2.0-SNAPSHOT could be updated in the future. Please update the version according to the current project version.
Verify new rpc
It takes a miniute to restart the karaf platform which really depends on the performance of your host machine.
coming soon
Remote Debugging
This is the tutorial about how to turn on the remote debug for sdnc docker instance.
...