I thought I would spend few days on understanding the work that was already done in SDN (Software Defined Networking world). I am very familiar with device side architecture and development tools. I spent most of my time in the job on creating/architecting software required on the network devices - Briding, routing, L4 switching and even application level proxying device.
I have written few blog posts on SDN world in netsecinfo.blogpsot.com. Particularly, I have talked about Java role in SDN in this "Software Defined Networking - Java Role" post. Since I believe that this would be true as and when SDN picks up , I thought I would brush my Java skills and make my hands dirty. As part of that, I decided to spend some time on Beacon controller which is open source controller developed in Java to control openflow based hardware devices.
Of course, first step in that is to download and install beacon controller and associated development environment. There is good instruction sheet in beacon site, which talked about downloading source code, compiling/debugging in eclipse environment and developing new bundles. I am following that sheet and would give my experience and learning I had during this process in this post.
First step is downloading "openflow" java code as well as "beacon" java source code. Since I had cygwin installed on my Windows7 laptop, it just went through fine.
Now to installation of JDK. First step is to find out what version of JDK your system already has. It appears that beacon requires Java SDK 6. Note that, many systems have JRE installed, but not the JDK. JRE is meant to run the Java binaries. JDK is beyond JRE. It is development kit and intended to develop java based applications.
Typically, Java is installed in c:\"Program Files"\Java. Go to that directory and try to find whether there is any sub directory that starts with "jdk". The directory itself contains the version number in it. In my system, I only had JRE. I installed 64 bit JDK (J2SE SDK) for windows from this web site http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u29-oth-JPR. It is better to start from this site http://www.oracle.com/technetwork/java/javase/downloads/jdk6-jsp-136632.html to get the latest JDK6. Downloading requires user account with oracle.
Installation was a breeze. Just follow the steps. It is good to keep the default installation directory to c:\"program files"\java. After successful installation, you should see sub directory starting with "jdk". I see "jdk1.6.0_29" sub directory after JDK installation. The installation also creates "jre6" directory.
Beacon controller based development can happen using Eclipse. Eclipse is a integrated development environment where the java code can be edited, compiled, debugged and run without leaving the eclipse. There are many Eclipse packages, with each package meant to develop certain types of applications. Beacon suggests to download Eclipse for RCP and RAP. RCP and RAP are mainly to develop applications that require Rich Client experience. RCP (Rich Client Platform) is used to develop clients (non-web). RAP (Rich Ajax Platform) to develop RCP in browsers (Web based). Single code base can be developed to run applications as native non-web based rich clients or web based software.
Now onto download and installation of Eclipse for RCP and RAP: I selected 64 bit version as my system has 64 bit operating system. One Zip file gets downloaded. Once it is downloaded, extract it to directory of your choice. It creates 'eclipse' sub directory and all files get extracted to this. There is no installation program (setup) to install the eclipse. Extraction itself is good enough. You will see 'eclipse' executable in 'eclipse' directory. You could execute this to open eclipse.
Now that all the required packages are downloaded and installed, now it is time to compile the beacon and openflow source code and use it. Start 'eclipse' by running eclipse.exe from the eclipse directory.
Setting the Java compiler compliance level to 1.6: J2SE 1.5 version is major release which introduced many ease-of-development features (hence java language extensions) such as Annotations, Generic types, Auto-boxing, Loop enhancements, Varargs, concurrency utilities and many more. JDK 1.6 introduced some more features. For more information about features added in J2SE 1.5, check this out http://java.sun.com/developer/technicalArticles/releases/j2se15/ . For features that were added in J2SE 1.6, check this URL link http://www.oracle.com/technetwork/java/javase/features-141434.html.
Beacon may be using some of the features introduced in the J2SE 1.5 and 1.6. Hence it is required to have the java compiler compliance level to 1.6. To do this, in eclipse, click on "window" in top level menu. Select "Preferences" in window sub-menu. Expand 'java' in left panel. You would see "compiler' on the expanded pane. Click on "compiler". On the right pane, you will see "Compiler compliance level". CHnage the value to 1.6 if it is not already set to 1.6.
Import openflowj project in eclipse: This is simple job too. Click on "Import" in "File" menu. It pops up a screen to select the import source. Select General>Existing Projects into workspace. Select 'Select Root Directory'. Using "Browse" button, get the path to openflowj directory. Click on "Finish". It imports openflowj project into eclipse.
Do similar stuff to import 'beacon' project in eclipse. In both cases, don't select "Copy projects into workspace".
Once both projects are loaded into eclipse, you would see lots of errors. It is because, the dependency files are not yet downloaded and resolved. To do this, just follow these steps.
This will also start the web server on port 8080 on local machine. You could see beacon controller screens by going to your browser and typing http;//localhost:8080 in URL area.
I have written few blog posts on SDN world in netsecinfo.blogpsot.com. Particularly, I have talked about Java role in SDN in this "Software Defined Networking - Java Role" post. Since I believe that this would be true as and when SDN picks up , I thought I would brush my Java skills and make my hands dirty. As part of that, I decided to spend some time on Beacon controller which is open source controller developed in Java to control openflow based hardware devices.
Of course, first step in that is to download and install beacon controller and associated development environment. There is good instruction sheet in beacon site, which talked about downloading source code, compiling/debugging in eclipse environment and developing new bundles. I am following that sheet and would give my experience and learning I had during this process in this post.
First step is downloading "openflow" java code as well as "beacon" java source code. Since I had cygwin installed on my Windows7 laptop, it just went through fine.
- I created a directory using "mkdir -p /cygdrive/c/SDN/controller".
- Changed directory to just created directory "cd /cygdrive/c/SDN/controller".
- Executed both the steps given in the guide to download the sources.
- git clone git://gitosis.stanford.edu/openflowj.git
- git clone git://gitosis.stanford.edu/beacon.git
- git creates the two sub directories "openflowj" and "beacon" in the /cygdrive/c/SDN/controller directory.
Now to installation of JDK. First step is to find out what version of JDK your system already has. It appears that beacon requires Java SDK 6. Note that, many systems have JRE installed, but not the JDK. JRE is meant to run the Java binaries. JDK is beyond JRE. It is development kit and intended to develop java based applications.
Typically, Java is installed in c:\"Program Files"\Java. Go to that directory and try to find whether there is any sub directory that starts with "jdk". The directory itself contains the version number in it. In my system, I only had JRE. I installed 64 bit JDK (J2SE SDK) for windows from this web site http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u29-oth-JPR. It is better to start from this site http://www.oracle.com/technetwork/java/javase/downloads/jdk6-jsp-136632.html to get the latest JDK6. Downloading requires user account with oracle.
Installation was a breeze. Just follow the steps. It is good to keep the default installation directory to c:\"program files"\java. After successful installation, you should see sub directory starting with "jdk". I see "jdk1.6.0_29" sub directory after JDK installation. The installation also creates "jre6" directory.
Beacon controller based development can happen using Eclipse. Eclipse is a integrated development environment where the java code can be edited, compiled, debugged and run without leaving the eclipse. There are many Eclipse packages, with each package meant to develop certain types of applications. Beacon suggests to download Eclipse for RCP and RAP. RCP and RAP are mainly to develop applications that require Rich Client experience. RCP (Rich Client Platform) is used to develop clients (non-web). RAP (Rich Ajax Platform) to develop RCP in browsers (Web based). Single code base can be developed to run applications as native non-web based rich clients or web based software.
Now onto download and installation of Eclipse for RCP and RAP: I selected 64 bit version as my system has 64 bit operating system. One Zip file gets downloaded. Once it is downloaded, extract it to directory of your choice. It creates 'eclipse' sub directory and all files get extracted to this. There is no installation program (setup) to install the eclipse. Extraction itself is good enough. You will see 'eclipse' executable in 'eclipse' directory. You could execute this to open eclipse.
Now that all the required packages are downloaded and installed, now it is time to compile the beacon and openflow source code and use it. Start 'eclipse' by running eclipse.exe from the eclipse directory.
Setting the Java compiler compliance level to 1.6: J2SE 1.5 version is major release which introduced many ease-of-development features (hence java language extensions) such as Annotations, Generic types, Auto-boxing, Loop enhancements, Varargs, concurrency utilities and many more. JDK 1.6 introduced some more features. For more information about features added in J2SE 1.5, check this out http://java.sun.com/developer/technicalArticles/releases/j2se15/ . For features that were added in J2SE 1.6, check this URL link http://www.oracle.com/technetwork/java/javase/features-141434.html.
Beacon may be using some of the features introduced in the J2SE 1.5 and 1.6. Hence it is required to have the java compiler compliance level to 1.6. To do this, in eclipse, click on "window" in top level menu. Select "Preferences" in window sub-menu. Expand 'java' in left panel. You would see "compiler' on the expanded pane. Click on "compiler". On the right pane, you will see "Compiler compliance level". CHnage the value to 1.6 if it is not already set to 1.6.
Import openflowj project in eclipse: This is simple job too. Click on "Import" in "File" menu. It pops up a screen to select the import source. Select General>Existing Projects into workspace. Select 'Select Root Directory'. Using "Browse" button, get the path to openflowj directory. Click on "Finish". It imports openflowj project into eclipse.
Do similar stuff to import 'beacon' project in eclipse. In both cases, don't select "Copy projects into workspace".
Once both projects are loaded into eclipse, you would see lots of errors. It is because, the dependency files are not yet downloaded and resolved. To do this, just follow these steps.
- Open the Beacon Main Target project, double click the main.target file.
- It starts resolving, you can see this in right hand and lower corner of the screen "Resolving to Target Definition".
- Once it is resolved, click "Set as Target Platform" on the top right corner of the screen.
- It is expected that all compiler errors would go away.
- In my case, it showed me one error in Routing.java. I got an error "Uncatchable catch block for CloneNotSupportedException. This exception is never thrown from the try statement body". I don't know what this error is about. Just to move forward, I have removed everything from try and catch and just kept fm = fm.clone(); statement. Error went away. I need to revisit this and check what is right thing to do here.
- With above, all compilation errors went away.
This will also start the web server on port 8080 on local machine. You could see beacon controller screens by going to your browser and typing http;//localhost:8080 in URL area.
No comments:
Post a Comment