I have did this code for topology:
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.log import setLogLevel, info
from mininet.node import OVSSwitch, Controller, RemoteController
from mininet.cli import CLI
class Project( Topo ):
def build (self, **_opts ):
# Add hosts
h11 = self.addHost('h11', ip='192.168.1.10')
h12 = self.addHost('h12', ip='192.168.1.11')
h13 = self.addHost('h13', ip='192.168.1.12')
h14 = self.addHost('h14', ip='192.168.1.13')
h21 = self.addHost('h21', ip='192.168.2.10')
h22 = self.addHost('h22', ip='192.168.2.11')
h23 = self.addHost('h23', ip='192.168.2.12')
h24 = self.addHost('h24', ip='192.168.2.13')
h31 = self.addHost('h31', ip='192.168.3.10')
h32 = self.addHost('h32', ip='192.168.3.11')
h33 = self.addHost('h33', ip='192.168.3.12')
h34 = self.addHost('h34', ip='192.168.3.13')
# Add switches
s1 = self.addSwitch('s1', cls=OVSSwitch, protocols ="OpenFlow13", ip='192.168.1.1')
s2 = self.addSwitch('s2', cls=OVSSwitch, protocols ="OpenFlow13", ip='192.168.2.1')
s3 = self.addSwitch('s3', cls=OVSSwitch, protocols ="OpenFlow13", ip='192.168.3.1')
# Add links
self.addLink(h11,s1)
self.addLink(h12,s1)
self.addLink(h13,s1)
self.addLink(h14,s1)
self.addLink(h21,s2)
self.addLink(h22,s2)
self.addLink(h23,s2)
self.addLink(h24,s2)
self.addLink(h31,s3)
self.addLink(h32,s3)
self.addLink(h33,s3)
self.addLink(h34,s3)
self.addLink(s1,s2)
self.addLink(s1,s3)
self.addLink(s2,s3)
def run():
topo = Project()
net = Mininet (topo=topo, controller=None)
c1 = net.addController( 'c1', controller=RemoteController, ip='172.17.0.7')
c1.start()
net.start()
CLI ( net )
net.stop()
if '_main_':
setLogLevel( 'info')
run()
I run the script with: "sudo python topology.py"
Creating network
Adding controller
Adding hosts: h11 h12 h13 h14 h21 h22 h23 h24 h31 h32 h33 h34
Adding switches: s1 s2 s3
Adding links: (h11, s1) (h12, s1) (h13, s1) (h14, s1) (h21, s2) (h22, s2) (h23, s2) (h24, s2) (h31, s3) (h32, s3) (h33, s3) (h34, s3) (s1, s2) (s1, s3) (s2, s3)
Configuring hosts h11 h12 h13 h14 h21 h22 h23 h24 h31 h32 h33 h34 Connecting to remote controller at 172.17.0.7:6653
Starting controller c1
Starting 3 switches s1 s2 s3 ...
Starting CLI:
mininet>
Everything is alright until now, but when I am in the ONOS CLI (Controller that I am using), it can't detect the hosts on the network... I am using the ONOS tutorial OVA (for version 1.15.0).
After just installed the VM and ran the script above I ran the command on ONOS to activate the reactive forwarding:
onos > app activate org.onosproject.fwd
I could ping the hosts on the CLI of mininet after:
mininet > h11 ping -c 3 h31
...
mininet > pingall
Only after this pings the Controller could see/show the information about the hosts on the topology... How the controller do it from the beggining of the implementation of the topology?