Merge "BUG-6844: BGP Server re-configuration"
[docs.git] / manuals / developer-guide / src / main / asciidoc / core / using_mininet.adoc
1 === Using Mininet\r
2 \r
3 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.\r
4 \r
5 Mininet is also a great way to develop, share, and experiment with OpenFlow and Software-Defined Networking systems.\r
6 \r
7 NOTE: To know more about Mininet, see http://mininet.org/walkthrough/[Mininet Walkthrough].\r
8 \r
9 To use Mininet for OpenDaylight, \r
10 \r
11 . 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.\r
12 \r
13 . Launch the Mininet VM with VirtualBox or another virtualization application.\r
14 \r
15 . Log on to the Mininet VM with the following credentials:\r
16 \r
17 *** *user*: mininet\r
18 \r
19 *** *password*: mininet\r
20 \r
21 . Determine the IP address of the server hosting the OpenDaylight controller, and use it to start a virtual network by running the following command:\r
22 \r
23 [literal]\r
24 \r
25 sudo mn --controller=remote,ip=controller-ip --topo tree,3\r
26 \r
27 Mininet connects to OpenDaylight controller and sets up a three-level tree topology.\r
28 \r
29 \r
30 [literal]\r
31 mininet@mininet-vm:~$ sudo mn --controller=remote,ip=172.16.102.161 --topo tree,3\r
32 *** Creating network\r
33 *** Adding controller\r
34 *** Adding hosts:\r
35 h1 h2 h3 h4 h5 h6 h7 h8 \r
36 *** Adding switches:\r
37 s1 s2 s3 s4 s5 s6 s7 \r
38 *** Adding links:\r
39 (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) \r
40 *** Configuring hosts \r
41 h1 h2 h3 h4 h5 h6 h7 h8 \r
42 *** Starting controller\r
43 *** Starting 7 switches\r
44 s1 s2 s3 s4 s5 s6 s7 \r
45 *** Starting CLI:\r
46 mininet>\r
47 \r
48 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.\r
49 \r
50 === Troubleshooting Mininet\r
51 \r
52 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:\r
53 \r
54 . 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`.\r
55 \r
56 . 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)`.\r
57 \r
58 . On your host where the controller and VirtualBox run, run the  `ifconfig` command to display all network interfaces on the machine.\r
59 \r
60 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).\r
61 \r
62 . 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).\r
63 \r
64 . 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:\r
65 \r
66 [literal]\r
67 sudo mn --topo=tree,3 --mac --switch=ovsk --controller=remote, ip=192.168.16.10\r
68 \r
69 Here is the correct example:\r
70 \r
71 [literal]\r
72 sudo mn --topo=tree,3 --mac --switch=ovsk --controller=remote,ip=192.168.16.10\r
73 \r
74 NOTE: The difference is the "SPACE" between "remote," and "ip".\r
75 \r
76 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:\r
77 \r
78 [literal]\r
79 \r
80 $ sudo mn -c\r
81 \r
82 === Resetting Mininet\r
83 \r
84 Here's a perl from the appendix mentioned above:\r
85 \r
86 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.\r
87 \r
88 [literal]\r
89 \r
90 $ sudo mn -c\r
91 \r
92 \r
93 \r
94 === Using the Simple Forwarding Application\r
95 \r
96 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.\r
97 \r
98 . With OpenDaylight Controller and Mininet running as described in previous sections, log into the web interface.\r
99 \r
100 image::Devices1.jpg[title="OpenDaylight GUI", alt="OpenDaylight GUI"]\r
101 \r
102 [start=2]\r
103 . Drag and drop devices to organize the topology into its logical arrangement, then save the configuration.\r
104 \r
105 image::Devices2.jpg[title="Clicking Save", alt="Clicking Save"]\r
106 \r
107 \r
108 [start=3]\r
109 .  Click the *Add Gateway IP Address* (shown in the figure above) and add the IP and subnet of `10.0.0.254/8`.\r
110 \r
111 \r
112 image::GatewayIP.jpg[title="Adding the Gateway IP Address", alt="Adding the Gateway IP Address"]\r
113 \r
114 [start=4]\r
115 . Confirm that hosts are now reachable from one another. On the console where Mininet is running, have one host ping another.\r
116 \r
117 [literal]\r
118 \r
119 mininet> h1 ping h7\r
120 PING 10.0.0.7 (10.0.0.7) 56(84) bytes of data.\r
121 64 bytes from 10.0.0.7: icmp_req=1 ttl=64 time=1.52 ms\r
122 64 bytes from 10.0.0.7: icmp_req=2 ttl=64 time=0.054 ms\r
123 64 bytes from 10.0.0.7: icmp_req=3 ttl=64 time=0.060 ms\r
124 64 bytes from 10.0.0.7: icmp_req=4 ttl=64 time=0.052 ms\r
125 --- 10.0.0.7 ping statistics ---\r
126 4 packets transmitted, 4 received, 0% packet loss, time 2999ms\r
127 rtt min/avg/max/mdev = 0.052/0.422/1.523/0.635 ms\r
128 mininet> \r
129 \r
130 [start=5]\r
131 .  Click the *Troubleshooting* tab and then load the *Flows* for one of the switches.\r
132 \r
133 image::FlowStatitistics.jpg[title="Flow statistics", alt="Flow statistics"]\r
134 \r
135 \r
136 [start=6]\r
137 . View the *Ports* details.\r
138 image::PortsStatistics.jpg[title="Port Statistics", alt="Port Statistics"]\r
139 \r
140 \r
141 [start=7]\r
142 . On the OSGI console, type `ss simple`. You will see that the Simple Forwarding application is ACTIVE.\r
143 \r
144 [literal]\r
145 osgi> ss simple\r
146 "Framework is launched."\r
147 id      State       Bundle\r
148 45      ACTIVE      org.opendaylight.controller.samples.simpleforwarding_0.4.0.SNAPSHOT\r
149 \r
150 \r
151 \r