CREATE CUSTOM TOPOLOGY IN MININET
To create a custom topology in the mininet environment, we are going to use a python code.
It is very simple, no need to acquire deep knowledge of python programming language especially for this task.
1. Import necessary packages
*Topo
from mininet.topo import Topo
subpackage topo is being imported from the package mininet.
2. Create a class object
class MYTOPO ( Topo ) :
(Don't forget to have a similar class name and filename)
3. Create init method
init method in python has similar functions as constructors in java.
def __init__( self ):
Topo.__init__( self )
Topo.__init__( self )
4. Add Hosts
Hostname=self.addHost ( "hostname" )
5. Add switches
switch_name=self.addSwitch ( "switch name" )
6. Add links
self.addLink ( "node name 1", "node name 2" )
7. Name your topology
Finally, we name the topo to call it in the command line.
topos = { 'cust': ( lambda: MYTOPO() )}
Here 'cust' is the topology name and MYTOPO is the class name and filename.
8. Save the file.
To run the topology in mininet use,
sudo mn --custom MYTOPO.py --topo cust
Our custom topology is ready to use!
Hope this was helpful!
Feel free to express your remarks in the comments.
Good luck!


Comments
Post a Comment