== Emulator for Next-Generation Smart Grid Network Management Tutorial == This wiki page contains tutorial for: "Software Defined Network Management for Dynamic Smart Grid Traffic". === Description === For this tutorial we will use ORBIT SB9 test bed to execute a test with two types of supported flows (stream and command flows) on test topology shown on image below. Source code for SDN Control Framework and Smart Grid Communication Evaluation Platform is available [http://www.orbit-lab.org/attachment/wiki/Tutorials/qNSE/aNgSgEmulator/sg-sdn.zip here]. [[Image(tutorial_topo.png)]] Environment setup, test execution and results collecting is covered in this tutorial. === Prerequisites === VM that will be used in ORBIT environment should be pre-configured and we suggest using Ubuntu 14.04. There are two approaches for running the SG network emulation: [[CollapsibleStart(1. Configure VM manually)]] Following items should be installed and configured: 1. Git, distributed version controll system. Installed by executing: `sudo apt-get install git` 2. Mininet with POX, available at [https://github.com/mininet/mininet this GitHub page]. In short it can be installed with: `./install.sh -a`. 3. Python package management system, [https://packaging.python.org/tutorials/installing-packages/ pip].Installed by executing: `sudo apt-get install python-pip`. 3. [https://github.com/jsonpickle/jsonpickle jsonpickle], used for JSON configuration deserialization. Installed using pip: `pip install jsonpickle`. 4. [https://github.com/phaag/nfdump nfdump], needed for Net Flow results parsing. It can be installed using: `sudo apt-get install nfdump`. 5. emulator, provided at following [http://www.orbit-lab.org/attachment/wiki/Tutorials/qNSE/aNgSgEmulator/sg-sdn.zip here]. 5. Configure ssh to allow tunneling by adding following line to `/etc/ssh/sshd_config`: `PermitTunnel yes` VM that can be used as base and is already available at ORBIT catalog is `ubuntu-14-04-64bit-2017-06-09.ndz`. These steps can be simplified if prepared VM is saved and reused. [[CollapsibleEnd]] [[CollapsibleStart(1. Use prepared VM)]] Use already prepared VM that should be the quickest way. The VM is named `sg-comm-emulation.ndz`. [[CollapsibleEnd]] === Setting up the environment === Setting up the environment is mostly automated. First, time slot at ORBIT should be scheduled. This is explained [http://www.orbit-lab.org/wiki/Documentation/CGettingStarted Getting Started Wiki page]. Once the registrations has been approved via email, prepared VM can be loaded onto the SB9 test bed and the machines can be started. Ubuntu 14.04 VM image is available at ORBIT VM catalog. 1. Load VM image: `omf load -i -t all`. 2. Start SB9 nodes: `omf tell -a on -t all`. Once the VM image has been loaded and the nodes are up and running, the only thing left is to exchange ssh authorization keys. This is done by executing following script `~/sg-sdn/environment/ssh_config/setup_ssh.sh ~/nodes.` Provided nodes file contains the list of ORBIT nodes that are up and running and will be used for running mininet nodes. File is provided in attached archive and should be updated if different nodes are used. === Running the experiment === Sample experiment is described in sample_test.py file. Controller is started with: `sudo ~/sg-sdn/controller/start_controllers.sh` Test is run by executing `SG-CommTestBed.py` script on node1-1: `sudo -E ~/sg-sdn/execution/SG-CommTestBed.py`. === Results analysis === Results are grouped by node name and there are two types of results: 1. Traffic generators, 2. Net Flow data. Results are collected by calling a script `copy_results.sh` on ORBIT gateway box. It will collect all the results and copy it locally. Once the results are collected they can be analyzed. Traffic generators can be opened using any text editor while Net Flow can be opened using excel.