Mininet Python API Reference Manual
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
mininet.topo.Topo Class Reference

Data center network representation for structured multi-trees. More...

Inheritance diagram for mininet.topo.Topo:
mininet.topo.LinearTopo mininet.topo.SingleSwitchReversedTopo mininet.topo.SingleSwitchTopo mininet.topolib.TorusTopo mininet.topolib.TreeTopo mininet.topo.MinimalTopo

Public Member Functions

def __init__
 Topo object. More...
 
def build
 Override this method to build your topology. More...
 
def addNode
 Add Node to graph. More...
 
def addHost
 Convenience. More...
 
def addSwitch
 Convenience. More...
 
def addLink
 node1, More...
 
def nodes
 Return nodes in graph.
 
def isSwitch
 Returns true if node is a switch. More...
 
def switches
 Return switches. More...
 
def hosts
 Return hosts. More...
 
def iterLinks
 Return links (iterator) More...
 
def links
 Return links. More...
 
def addPort
 Generate port mapping for new edge. More...
 
def port
 Get port numbers. More...
 
def linkInfo
 Return link metadata dict.
 
def setlinkInfo
 Set link metadata dict.
 
def nodeInfo
 Return metadata (dict) for node.
 
def setNodeInfo
 Set metadata (dict) for node.
 
def convertTo
 Convert to a new object of networkx.MultiGraph-like class cls. More...
 

Static Public Member Functions

def sorted
 Items sorted in natural (i.e. More...
 

Public Attributes

 g
 
 hopts
 
 sopts
 
 lopts
 
 ports
 

Detailed Description

Data center network representation for structured multi-trees.

Constructor & Destructor Documentation

def mininet.topo.Topo.__init__ (   self,
  args,
  params 
)

Topo object.

Optional named

Parameters
parameters
hinfodefault host options
soptsdefault switch options
loptsdefault link options calls build()

Member Function Documentation

def mininet.topo.Topo.addHost (   self,
  name,
  opts 
)

Convenience.

Parameters
methodAdd host to graph.
namehost name
optshost options
Returns
host name
def mininet.topo.Topo.addLink (   self,
  node1,
  node2,
  port1 = None,
  port2 = None,
  key = None,
  opts 
)

node1,

Parameters
node2nodes to link together port1,
port2ports (optional)
optslink options (optional)
Returns
link info key
def mininet.topo.Topo.addNode (   self,
  name,
  opts 
)

Add Node to graph.

Parameters
namename
optsnode options
Returns
node name
def mininet.topo.Topo.addPort (   self,
  src,
  dst,
  sport = None,
  dport = None 
)

Generate port mapping for new edge.

Parameters
srcsource switch name
dstdestination switch name
def mininet.topo.Topo.addSwitch (   self,
  name,
  opts 
)

Convenience.

Parameters
methodAdd switch to graph.
nameswitch name
optsswitch options
Returns
switch name
def mininet.topo.Topo.build (   self,
  args,
  params 
)

Override this method to build your topology.

def mininet.topo.Topo.convertTo (   self,
  cls,
  data = True,
  keys = True 
)

Convert to a new object of networkx.MultiGraph-like class cls.

Parameters
datainclude node and edge data (default True)
keysinclude edge keys as well as edge data (default True)
def mininet.topo.Topo.hosts (   self,
  sort = True 
)

Return hosts.

Parameters
sortsort hosts alphabetically
Returns
list of hosts
def mininet.topo.Topo.isSwitch (   self,
  n 
)

Returns true if node is a switch.

def mininet.topo.Topo.iterLinks (   self,
  withKeys = False,
  withInfo = False 
)

Return links (iterator)

Parameters
withKeysreturn link keys
withInforeturn link info
Returns
list of ( src, dst [,key, info ] )
def mininet.topo.Topo.links (   self,
  sort = False,
  withKeys = False,
  withInfo = False 
)

Return links.

Parameters
sortsort links alphabetically, preserving (src, dst) order
withKeysreturn link keys
withInforeturn link info
Returns
list of ( src, dst [,key, info ] )
def mininet.topo.Topo.port (   self,
  src,
  dst 
)

Get port numbers.

Parameters
srcsource switch name
dstdestination switch name
sportoptional source port (otherwise use lowest src port)
Returns
tuple (sport, dport), where sport = port on source switch leading to the destination switch dport = port on destination switch leading to the source switch Note that you can also look up ports using linkInfo()
def mininet.topo.Topo.sorted (   items)
static

Items sorted in natural (i.e.

alphabetical) order

def mininet.topo.Topo.switches (   self,
  sort = True 
)

Return switches.

Parameters
sortsort switches alphabetically
Returns
dpids list of dpids

The documentation for this class was generated from the following file: