= [wiki:GENIExperimenter/Tutorials/NFV/Execute NFV Tutorial Part II: Execute] = == Experiment 1: Load Balancing using Round Robin Control == In the first experiment, we will look at a Round Robin load balancer for a VNF Snort application. Snort will be running as IDS on VNF1 and VNF2 and we will try to balance the load across the two VNF instances by directing each new flow request to one of the two VNF instances in a round robin fashion. 
 We will use the '''Netcat''' application to generate traffic between a source and destination. Netcat is a useful application for network debugging and investigation. It is used for reading from and writing to network connections using TCP or UDP. In other words, it is like talking on the phone. One (a node) talks and another one, on the other side, listens and talks back. Using netcat, you can see the communication between a source and destination. 1. Open the ''controller'' window and execute the following: {{{ #!html         cd /tmp/pox/ext
        nano port.config
}}} Here change the controller_type to '''RR''' as shown below: {{{ #!html }}} 2. Run the NFV_controller in the ''controller'' window: {{{ #!html         cd /tmp/pox/
        python pox.py --verbose NFV_controller
}}} 3. Open the ''VNF1'' and ''VNF2'' windows and run Snort IDS on each of the VNFs as shown below: {{{ #!html         sudo /usr/local/bin/snort -A console -v -c / -i eth1
}}} You should see the window shown below on the ''VNF1'' and ''VNF2'' windows. {{{ #!html }}} 4. In the destination window, run the netcat server: {{{ #!html         nc -u -l 5000
}}} 5. In the ''s1'' window, run the netcat client to send traffic to the ''destination'' node: {{{ #!html         nc -u destination 5000
}}} 6. Type something on the ''s1'' window and you should see it on the ''destination'' window. Now if you look at the ''VNF1'' and ''VNF2'' windows running Snort IDS, you could see packets arriving at the VNF1 and VNF2 nodes in a Round Robin fashion. An example of such an output is shown below on the VNF window running Snort IDS. {{{ #!html }}} In the ''controller'' window, you can see that the controller chooses VNF1 and VNF2 in a Round Robin fashion as shown below: {{{ #!html }}} [[BR]][[BR]][[BR]] {{{ #!html
OPTIONAL: Review the RR Controller Code:
}}} The Round Robin code is based on the following algorithm: {{{ #!html }}} If you want to see the code for the Round Robin load balancer, you can see it by executing: {{{ #!html         cd /tmp/pox/ext
        cat NFV_controller.py
}}} The code that corresponds to Round Robin control is shown below: {{{ #!html }}} Here if the VNF selected for the previous flow was VNF1, VNF2 is selected for the next flow, and vice versa. Once a VNF is selected, packets are sent to the selected VNF: {{{ #!html }}} '''[wiki:GENIExperimenter/Tutorials/NFV/Pox/Execute Back to Part II: Execute]'''[[BR]] '''[wiki:GENIExperimenter/Tutorials/NFV/Pox/Execute/LoadBalancePI Experiment 2: Load Balancing using Proportional Integral (PI) Control]'''[[BR]] == [wiki:GENIExperimenter/Tutorials/NFV/Finish Next: Finish] ==