Problem with an n-host, zero-switch topology in mininet

mininetopenflowsdn

I am experimenting a bit to gain a better understanding of Mininet and Openflow. I have built a topology with n hosts in a line and no switches. Strangely, host 1 and host 2 can ping each other but the remaining hosts can't.
Could somebody explain why this is and possibly if it is possible to get all nodes to be able to ping their neighbors without introducing switches into the network?

Here is my current code:

#!/usr/bin/python
from mininet.net import Mininet
from utils.FloodlightController import FloodlightController
from mininet.log import setLogLevel
import os,time

if __name__ == '__main__':
    #setLogLevel( 'info' )
    net = Mininet(controller=FloodlightController)
    #net.addController("controller1")

    num_nodes = 8
    for i in range(1,num_nodes):
        net.addHost("h%d"%i)
    for i in range(2,num_nodes):
        net.addLink("h%d"%i, "h%d"%(i-1))

    net.start()
    net.pingAll()
    net.stop()

This is the output:

*** Ping: testing ping reachability
h1 -> h2 X X X X X 
h2 -> h1 X X X X X 
h3 -> X X X X X X 
h4 -> X X X X X X 
h5 -> X X X X X X 
h6 -> X X X X X X 
h7 -> X X X X X X 
*** Results: 95% dropped (2/42 received)

Best Answer

Perhaps the first two hosts get an IP assigned in the same subnet. Hence, they may be communicating over traditional network. Since, you didn't add a switch, the question of loops shouldn't arise.

You have a misconfigured code. The Controller object needs to be 'built' and only Switches have to be 'started'. Use net.build() instead of net.start(). The start() function is for switches.