Пример #1
0
 def _convert_to_plain_topo(self, topo):
     r = Topo()
     for node in topo.nodes():
         r.addNode(node,**topo.nodeInfo(node))
     for edge in topo.links():
         r.addLink(edge[0],edge[1],**topo.linkInfo(edge[0],edge[1]))
     return r
Пример #2
0
 def _convert_to_plain_topo(self, topo):
     r = Topo()
     for node in topo.nodes():
         r.addNode(node, **topo.nodeInfo(node))
     for edge in topo.links():
         r.addLink(edge[0], edge[1], **topo.linkInfo(edge[0], edge[1]))
     return r
Пример #3
0
 def addHost(self, name, cls=Host, **opts):
     """Adds a host using the MiniNExT host constructor.
        name: host name
        cls: host constructor
        opts: host options
        returns: host name"""
     if not opts and self.hopts:
         opts = self.hopts
     return BaseTopo.addNode(self, name, cls=cls, **opts)
Пример #4
0
    def _convert_to_plain_topo(self, topo):
        """Convert topo to mininet.topo.Topo instance.

        This helper function allows the user to use topologys which are not
        direct instances of mininet.topo.Topo in MaxiNet. If the topology was
        not converted to a Topo instance the transfer via pyro most likely
        fails as the original class might not be available at the pyro remote.

        Args:
            topo: Instance which fullfills the interface of mininet.topo.Topo.

        Returns:
            Instance of mininet.topo.Topo,
        """
        r = Topo()
        for node in topo.nodes():
            r.addNode(node, **topo.nodeInfo(node))
        for edge in topo.links():
            r.addLink(**topo.linkInfo(edge[0], edge[1]))
        return r
Пример #5
0
    def _convert_to_plain_topo(self, topo):
        """Convert topo to mininet.topo.Topo instance.

        This helper function allows the user to use topologys which are not
        direct instances of mininet.topo.Topo in MaxiNet. If the topology was
        not converted to a Topo instance the transfer via pyro most likely
        fails as the original class might not be available at the pyro remote.

        Args:
            topo: Instance which fullfills the interface of mininet.topo.Topo.

        Returns:
            Instance of mininet.topo.Topo,
        """
        r = Topo()
        for node in topo.nodes():
            r.addNode(node, **topo.nodeInfo(node))
        for edge in topo.links():
            r.addLink(**topo.linkInfo(edge[0], edge[1]))
        return r
Пример #6
0
def createNet(args):
    # TODO
    # try to remove switches
    topo = Topo()

    h1 = topo.addNode('h1')#, ip='10.0.0.1/24')
    pep = topo.addHost('pep', cls=MyNode.PEPNode)#, ip='10.0.0.2/24')
    h2 = topo.addHost('h2')#, ip='10.0.1.90/24')

    topo.addLink(h1, pep,
                 intfName1 = 'h1-r',
                 params1 = {'ip': '10.0.1.1/24'},
                 intfName2 = 'pep-l',
                 params2 = {'ip':'10.0.1.2/24'})
    topo.addLink(pep, h2,
                 intfName1 = 'pep-r',
                 params1 = {'ip': '10.0.2.1/24',
                     'defaultRoute':'via 10.0.1.1'},
                 intfName2 = 'h2-l',
                 params2 = {'ip':'10.0.2.2/24'})

    return Mininet(topo)
Пример #7
0
              controller


"""

from mininet.net import Mininet
from mininet.topo import Topo
from mininet.node import OVSSwitch , OVSController, Ryu, RemoteController
from mininet.cli import CLI


topo = Topo()
s1 = topo.addSwitch('s1' , cls=OVSSwitch)
s2 = topo.addSwitch('s2' , cls=OVSSwitch)

h1 = topo.addNode('h1')
h2 = topo.addNode('h2')
h3 = topo.addNode('h3')
h4 = topo.addNode('h4')

c1 = RemoteController('c1',port=6633)

topo.addLink(s1 , h1)
topo.addLink(s1 , h2)
topo.addLink(s2 , h3)
topo.addLink(s2 , h4)
topo.addLink(s1 , s2)

net = Mininet(topo=topo, switch=OVSSwitch, build=False)
net.addController(c1)
net.build()