I built a simple network topology using mininet python script. However, I want to extend this code by using networkX to build the topology in mininet script. Thus, firstly, I should import the networx as nx. The reason for using networkX is to find the shortest path very easy and simple between any source and destination hosts.
The topology code:
#!/usr/bin/env python
from mininet.net import Mininet # IMPORT Mininet
from mininet.cli import CLI ## IMPORT COMMAND LINE
from mininet.link import TCLink
from mininet.log import setLogLevel # FOR DEPUG
from mininet.node import RemoteController # TO BE ABLE O ADD REMOTE CONTROLLER
net = Mininet(link=TCLink)
# ADDING hosts with given MAC
h1 = net.addHost("h1",mac='00:00:00:00:00:01')
h2 = net.addHost("h2",mac='00:00:00:00:00:02')
h3 = net.addHost("h3",mac='00:00:00:00:00:03')
# ADDING Switch
s1 = net.addSwitch("s1")
net.addLink(h1,s1,bw=10, delay='5ms' )
net.addLink(h2,s1,bw=10, delay='5ms' )
net.addLink(h3,s1,bw=10, delay='5ms' )
# ADDING COTROLLER
net.addController("c0",controller=RemoteController,ip="127.0.0.1",port=6633)
# START Mininet
net.start()
CLI(net)
net.stop()
# EXIT Miminet
Any of you can help me to modify and connect networkX with mininet in building the toplogy?
Your assistance is appreciated.