[P4-discuss] P4 Tutorials - P4D2_2017_Fall/utils/mininet

Phanindra Palagummi phanindra.palagummi at gmail.com
Mon Oct 23 11:02:22 EDT 2017


Hello,

Please consider below single_switch_mininet.py python file.
https://github.com/p4lang/tutorials/blob/master/P4D2_2017_Fall/utils/mininet/single_switch_mininet.py

I put my own custom topology in the file single_switch_mininet.py, which is
working properly, but I'm wondering why this below code is put, I see no
link of this for any examples in tutorials, can any one please let me know
if I'm missing anything.

    """
    sw_mac = ["00:aa:bb:00:00:%02x" % n for n in xrange(num_hosts)]

    sw_addr = ["10.0.%d.1" % n for n in xrange(num_hosts)]

    for n in xrange(num_hosts):
        h = net.get('h%d' % (n + 1))
        if mode == "l2":
            h.setDefaultRoute("dev %s" % h.defaultIntf().name)
        else:
            h.setARP(sw_addr[n], sw_mac[n])
            h.setDefaultRoute("dev %s via %s" % (h.defaultIntf().name,
sw_addr[n]))

    for n in xrange(num_hosts):
        h = net.get('h%d' % (n + 1))
        h.describe(sw_addr[n], sw_mac[n])

    sleep(1)
    """

Thank you,
Phani
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-discuss_lists.p4.org/attachments/20171023/ac526eaf/attachment-0002.html>


More information about the P4-discuss mailing list