Mininet and REST Router

The Mininet setup is pretty simple and straight forward, which is the beauty of OpenFlow and SDN. The intelligence is in the controller application. We have already seen most of the setup steps in Chapter 11, OpenFlow Advance Topics. I will just quickly show the steps that were taken.

For good measure, we will clean up the Mininet topology:

$ sudo mn --clean

The Mininet topology is located under chapter13_mininet_2.py, where we build the network with one controller and two hosts. Note that we change the default port of the controller to port 5555:

...
net = Mininet( controller=RemoteController, switch=OVSKernelSwitch )
c1 = net.addController('c2', controller=RemoteController, ip='127.0.0.1', port=5555)

h1 = net.addHost('h1', ip='10.20.1.10/24')
h2 = net.addHost('h2', ip='10.20.1.11/24')
s1 = net.addSwitch('s1')
...

We can start the Mininet network:

$ sudo python mastering_python_networking/Chapter13/chapter13_mininet_2.py

The hosts need to have a default gateway point to our router:

mininet> h1 ip route add default via 10.20.1.1
mininet> h2 ip route add default via 10.20.1.1

We can use the same REST_Router reference application for our lab:

$ ryu-manager --verbose --ofp-tcp-listen-port 5555 ryu/app/rest_router.py

We will add the addresses the router should listen for and respond to:

$ curl -X POST -d '{"address":"10.20.1.1/24"}' http://localhost:8080/router/0000000000000001

$ curl -X POST -d '{"address":"172.16.1.174/24"}' http://localhost:8080/router/0000000000000001

We can add the routes to the loopbacks and the server rack connected to leaf-1:

$ curl -X POST -d '{"destination": "192.168.0.1/32", "gateway": "172.16.1.250"}' http://localhost:8080/router/0000000000000001

$ curl -X POST -d '{"destination": "192.168.0.5/32", "gateway": "172.16.1.250"}' http://localhost:8080/router/0000000000000001

$ curl -X POST -d '{"destination": "10.0.0.0/17", "gateway": "172.16.1.250"}' http://localhost:8080/router/0000000000000001

$ curl -X POST -d '{"destination": "10.0.128.0/17", "gateway": "172.16.1.250"}' http://localhost:8080/router/0000000000000001

regarding our Mininet topology involves putting the interface connecting VMnet2 to OVS bridge, so spine-1 has visibility to it:

$ sudo ovs-vsctl add-port s1 eth1

We can verify the Mininet topology via ovs-vsctl:

$ sudo ovs-vsctl show
873c293e-912d-4067-82ad-d1116d2ad39f
Bridge "s1"
Controller "tcp:127.0.0.1:5555"
fail_mode: secure
Port "eth1"
Interface "eth1"
Port "s1-eth2"
Interface "s1-eth2"
Port "s1"
Interface "s1"
type: internal
Port "s1-eth1"
Interface "s1-eth1"
ovs_version: "2.3.90"

We can also verify the routes and addresses of our REST_Router:

$ curl http://localhost:8080/router/0000000000000001 | python -m json.tool
...
"internal_network": [
{
"address": [
{
"address": "172.16.1.174/24",
"address_id": 2
},
{
"address": "10.20.1.1/24",
"address_id": 1
}
],
...
"route": [
{
"destination": "10.0.128.0/17",
"gateway": "172.16.1.250",
"route_id": 4
},
...

After all that work, we are now ready to test the connectivity from our shining new OpenFlow rack to the rest of the network!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.208.97