Skip to content

Mininet constructor: intf option is not effective #515

Closed

Description

@yoursunny

Mininet constructor accepts 'intf' option, described as:

intf: default Intf class/constructor

but this option is not effective.
Constructed interface is always mininet.link.Intf type, unless 'link' option is overridden with a subclass.

Snippet to reproduce:

from mininet.topo import MinimalTopo
from mininet.net import Mininet
from mininet.node import Intf

class MyIntf(Intf):
    def __init__(self, *opts, **params):
        Intf.__init__(self, opts, params)

topo = MinimalTopo()
net = Mininet(topo, intf=MyIntf)
net.start()
print type(net.hosts[0].intf())
net.stop()

Expected: <class 'MyIntf'>
Actual: <class 'mininet.link.Intf'>

Activity

  1. lantz commented on May 2, 2015

    @lantz
    Member

    You should probably just use TCLink, but:

    1. Added to 2.2.0 release notes.
    2. Fixed in c5f6d0f
    $ cat intftest.py
    #!/usr/bin/python
    from mininet.topo import MinimalTopo
    from mininet.net import Mininet
    from mininet.link import TCIntf
    from functools import partial
    topo = MinimalTopo()
    net = Mininet(topo, intf=partial(TCIntf,bw=10))
    net.start()
    net.iperf()
    net.stop()
    $ sudo python intftest.py
    *** Iperf: testing TCP bandwidth between h1 and h2 
    *** Results: ['9.57 Mbits/sec', '11.1 Mbits/sec']
    
  2. yoursunny commented on May 3, 2015

    @yoursunny
    Author

    Yes this issue was indeed discovered when I attempted to use TCIntf. I found TCLink afterwards, but believed there would be legit cases when intf= would be useful.
    Thanks for quick response!

  3. added a commit that references this issue on May 22, 2025
    c5f6d0f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions