In this post, I would like to describe the steps needed to set up an development environment for an internal application for the HPE VAN SDN controller. My aim is to use this environment to start writing a simple application for the HPE VAN SDN controller later on. I will use Ubuntu as the development environment running eclipse. The controller itself can be used without any license for free as an virtual appliance, which can be used for testing, together with mininet, if you do not have OpenFlow capable hardware.
The first step, is to install Java on Ubuntu, to be able to run eclipse and develop the java appication later on. This is very simple by just issue this command to the CLI:
To check, if java is installed correctly, simply use this command:
If you see the above output, Java is installed successfully. There is already a new version of this SDK available, which is openjdk-9-jdk, but I still work with version 8, as I had problems with version 9.
The next step, is to install maven. Maven is needed to create and compile the application package. Install maven, using this command:
This should download and install maven, together with some dependencies. To check, if maven is installed correctly, with the correct version, as you need at least version 3.0.4, issue this command:
If you see the output above, maven is installed correctly.
To write your code, you need an development environment. From my study times I only know Eclipse and luckily, in the official documents from HPE this tool is also used as an example, so I will stick to Eclipse as well.
Download Eclipse from the official page, do not use the Package manager to install Eclipse, this version is far to old to be used.
Unpack the downloaded package and install Eclipse on your system. After Eclipse is installed successfully, you can add a very useful plugin, which is EclEmma. This plugin for Eclipse will help you testing your application, as it will show, which code parts are tested successfully, if you use Unit Test.
To install this plugin add the plugin repository to Eclipse, by opening the “Install New Software” manager. Go to “Help–>Install New Software”:
Press the “Add” button and add the location of the EclEmma repository, which is “http://update.eclemma.org”.
Select the plugin and go through the wizard to install the plugin. Afterwards, Eclipse needs to be restarted to activate the plugin.
The last step is to install the HPE VAN SDN Controller SDK. This is included in the download of the HPE VAN SDN Controller and needs to be unpacked and installed.
To unpack the package use this command:
To install the SDK change to the “bin” directory within the unpacked folder and start the “install-sdk” script:
This will download additional files from the web and create a new folder “.m2” in your home folder.
For those, who would like to jump start, I have created a VM, which has everything installed and ready to use and I uploaded it to my google drive. Everything, up to this step is prepared, just follow the steps below, to get startet.
You can download the OVA package here:
– Updated the SDK Version to the latest (2.7.18)
– Updated Eclipse to the latest version, as of today
– Updated the OS with the latest patches
– Include the SDN API documentation
Below is the old version.
I’m using the google url shortener to track the count of downloads. This is to get a feeling if it is helpful to provide this package.
I will make sure, that with a new version of the SDK, I will upload a new version of the VM.
Now, everything is ready to start with the first application. The next step is to prepare the controller.
Prepare the HPE VAN SDN Controller
Go to the buttom of the file and edit the last line to look like this:
This will enable the debug mode and you can now use Eclipse to connect to the controller. To get this working, open the debug configurations in Eclipse by clicking on “Run–>Debug Configurations” and create a new configuration for “Remote Java Application” configuration:
This will allow you to connect to the controller and debug your application code. You will not get the actual error messages, if something goes wrong. but this message can be found in the log file of the controller:
You should also be aware, that you can only connect once to the controller. There is no need to restart the debugging process after each test. To debug your code, simply set a breakpoint and refresh the web interface in the controller. If your code is used Eclipse will switch to the debug view and you are able to step into each instructions in the code.
Before you can test and debug your application, you need to install the application on the controller. As my applications are not officially signed, I need to allow the installation of unsigned applications on the controller.
To do so stop the corresponding service first:
Open this file:
and search for “JMX_OPTS” and add this line to the options “-Dsdn.signedJar=none”. It should look like this:
Line 8 adds the option to accept unsigned JAR packages. start the service again:
You can now add any application to the controller and the controller will not check if the application is signed. This is very helpful for development systems but should never be used for production systems.
You are now ready to start coding.
Write the First Application
Move to the root folder from the downloaded and unpacked SDK from above. There should be the script to generate a SDN app. With the following command, you can create your SDN app:
This will create the folder “dev” in your home directory. Within this directory, you will find everything needed to start coding your application. To get the code into Eclipse follow the steps below.
Start Ecipse and click “File–>Import” and select “Existing Maven Project”:
Click next and select the created Application root folder within the “dev” folder:
Click finish to start the import. It will take a while to import the application, Eclipse will download some additional files and you might get some messages like this:
You can stick to the supposed actions here and click finish. There will be a warning, which can be ignored. So click OK.
After restarting Eclipse it is possible that there are still errors with the project. It looks like this error is due to a bug within Eclipse together with maven-antrun. As this will not interfere with the build process, you can ignore this error:
After clicking “Finish” the error is gone and you can build the application. First step is to clean the target folders. No need to do this, if it is the first time you build the application but is good practice to do so before actually building the application. In the package explorer within Eclipse look for the root folder and right click on the “pom.xml” file:
Select “Run As” and click “Maven clean”.
After this has finished you can build the application:
Again, right click on the “pom.xml”, “Run As” and click “Maven build”. This will open a new windows, where you can configure some options. At this stage leave every thing as it is and add the goal “clean install”:
Click “Run” and the build process will start. This will take some time to finish. If the build is successfully, you should get the following console output:
You should also find the packages within the app folder:
This package can now be installed on the HPE VAN SDN Controller and your application should be ready to use.
If you have any questions please use the comment function below. If you would like to provide feedback please contact me or use the comment function as well.