=== Using Mininet Mininet creates a realistic virtual network, running real kernel, switch and application code, on a single machine (VM, cloud or native) with a single command and within a short time. Using Mininet, you can easily interact with your network using the Mininet CLI (and API), customize it, share it with others, or deploy it on real hardware, Mininet is useful for development, teaching, and research. Mininet is also a great way to develop, share, and experiment with OpenFlow and Software-Defined Networking systems. NOTE: To know more about Mininet, see http://mininet.org/walkthrough/[Mininet Walkthrough]. To use Mininet for OpenDaylight, . Download http://mininet.github.com/download/[Mininet] . OpenDaylight controller is tested against the Mininet VM (Option 1). It has not been tested against other Mininet installation options. . Launch the Mininet VM with VirtualBox or another virtualization application. . Log on to the Mininet VM with the following credentials: *** *user*: mininet *** *password*: mininet . Determine the IP address of the server hosting the OpenDaylight controller, and use it to start a virtual network by running the following command: [literal] sudo mn --controller=remote,ip=controller-ip --topo tree,3 Mininet connects to OpenDaylight controller and sets up a three-level tree topology. [literal] mininet@mininet-vm:~$ sudo mn --controller=remote,ip=172.16.102.161 --topo tree,3 *** Creating network *** Adding controller *** Adding hosts: h1 h2 h3 h4 h5 h6 h7 h8 *** Adding switches: s1 s2 s3 s4 s5 s6 s7 *** Adding links: (h1, s3) (h2, s3) (h3, s4) (h4, s4) (h5, s6) (h6, s6) (h7, s7) (h8, s7) (s1, s2) (s1, s5) (s2, s3) (s2, s4) (s5, s6) (s5, s7) *** Configuring hosts h1 h2 h3 h4 h5 h6 h7 h8 *** Starting controller *** Starting 7 switches s1 s2 s3 s4 s5 s6 s7 *** Starting CLI: mininet> NOTE: See the http://mininet.github.com/walkthrough/Mininet[Mininet Walkthrough] for a more detailed explanation of Mininet configuration options. There is an appendix that explains how to configure Mininet to use a remote controller. === Troubleshooting Mininet If you are running VirtualBox on the same host or desktop where the controller is running, and trying to start the virtual network on Mininet VM, the following error is displayed `"Unable to contact the remote controller at ...",` then the following steps resolves the issue: . In VirtualBox, go to File > Preferences > Network and make sure you have at least one interface defined as *Host-Only*. Lets say its name is `vboxnet0`. . In VirtualBox > Mininet VM > Settings > Network, check that the adapter is of type *Host-Only*, and is connected to the interface from item 1 `(vboxnet0)`. . On your host where the controller and VirtualBox run, run the `ifconfig` command to display all network interfaces on the machine. Search for the interface as in item 1 (`vboxnet0` in our example). Take the ip address specified (most probably 192.168.56.1 - default), and use that as the correct remote controller ip address when starting a VM in mininet as stated in the example above (--controller=remote,ip=192.168.56.1). . If you are still not able to connect, you might want to consider temporarily disabling firewall on the host running the controller (on Linux, for example, `iptables -F` will do the job). . Sometimes, the way you start the mininet is can be an issue. It does not give an error, but does not connect to the remote server either. Here is such an example: [literal] sudo mn --topo=tree,3 --mac --switch=ovsk --controller=remote, ip=192.168.16.10 Here is the correct example: [literal] sudo mn --topo=tree,3 --mac --switch=ovsk --controller=remote,ip=192.168.16.10 NOTE: The difference is the "SPACE" between "remote," and "ip". If Mininet crashes or if you lose your console from a remote connection, the switches remain configured in the database. Run the following command to clean up: [literal] $ sudo mn -c === Resetting Mininet Here's a perl from the appendix mentioned above: If Mininet crashes or if you lose your console from a remote connection, the switches remain configured in the database and you'll want to clean them up. [literal] $ sudo mn -c === Using the Simple Forwarding Application The OpenDaylight Controller includes an application called Simple Forwarding that lets you use the basic services for making forwarding decisions and install flows across all devices on the Openflow network. This application discovers the presence of a host via ARP message and installs dest-only /32 entries across all switches in the network, with the corresponding output ports toward the host. . With OpenDaylight Controller and Mininet running as described in previous sections, log into the web interface. image::Devices1.jpg[title="OpenDaylight GUI", alt="OpenDaylight GUI"] [start=2] . Drag and drop devices to organize the topology into its logical arrangement, then save the configuration. image::Devices2.jpg[title="Clicking Save", alt="Clicking Save"] [start=3] . Click the *Add Gateway IP Address* (shown in the figure above) and add the IP and subnet of `10.0.0.254/8`. image::GatewayIP.jpg[title="Adding the Gateway IP Address", alt="Adding the Gateway IP Address"] [start=4] . Confirm that hosts are now reachable from one another. On the console where Mininet is running, have one host ping another. [literal] mininet> h1 ping h7 PING 10.0.0.7 (10.0.0.7) 56(84) bytes of data. 64 bytes from 10.0.0.7: icmp_req=1 ttl=64 time=1.52 ms 64 bytes from 10.0.0.7: icmp_req=2 ttl=64 time=0.054 ms 64 bytes from 10.0.0.7: icmp_req=3 ttl=64 time=0.060 ms 64 bytes from 10.0.0.7: icmp_req=4 ttl=64 time=0.052 ms --- 10.0.0.7 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 2999ms rtt min/avg/max/mdev = 0.052/0.422/1.523/0.635 ms mininet> [start=5] . Click the *Troubleshooting* tab and then load the *Flows* for one of the switches. image::FlowStatitistics.jpg[title="Flow statistics", alt="Flow statistics"] [start=6] . View the *Ports* details. image::PortsStatistics.jpg[title="Port Statistics", alt="Port Statistics"] [start=7] . On the OSGI console, type `ss simple`. You will see that the Simple Forwarding application is ACTIVE. [literal] osgi> ss simple "Framework is launched." id State Bundle 45 ACTIVE org.opendaylight.controller.samples.simpleforwarding_0.4.0.SNAPSHOT