Example #1
0
 def init(cls):
     "Initialize Mininet"
     if cls.inited:
         return
     ensureRoot()
     fixLimits()
     cls.inited = True
Example #2
0
 def init(cls):
     "Initialize Mininet"
     if cls.inited:
         return
     ensureRoot()
     fixLimits()
     cls.inited = True
Example #3
0
def runTests(testDir, verbosity=1):
    "discover and run all tests in testDir"
    # ensure root and cleanup before starting tests
    ensureRoot()
    cleanup()
    # discover all tests in testDir
    testSuite = unittest.defaultTestLoader.discover(testDir)
    # run tests
    unittest.TextTestRunner(verbosity=verbosity).run(testSuite)
Example #4
0
def runTests( testDir, verbosity=1 ):
    "discover and run all tests in testDir"
    # ensure root and cleanup before starting tests
    ensureRoot()
    cleanup()
    # discover all tests in testDir
    testSuite = unittest.defaultTestLoader.discover( testDir )
    # run tests
    MininetTestRunner( verbosity=verbosity ).run( testSuite )
Example #5
0
def runTests( testDir, verbosity=1 ):
    "discover and run all tests in testDir"
    # ensure root and cleanup before starting tests
    ensureRoot()
    cleanup()
    # discover all tests in testDir
    testSuite = unittest.defaultTestLoader.discover( testDir )
    # run tests
    success = MininetTestRunner( verbosity=verbosity ).run( testSuite ).wasSuccessful()
    sys.exit( 0 if success else 1 )
def runTests(testDir, verbosity=1):
    "discover and run all tests in testDir"
    # ensure root and cleanup before starting tests
    ensureRoot()
    cleanup()
    # discover all tests in testDir
    testSuite = defaultTestLoader.discover(testDir)
    # run tests
    success = TextTestRunner(verbosity=verbosity).run(testSuite).wasSuccessful()
    sys.exit(0 if success else 1)
Example #7
0
def runTests(testDir, verbosity=1, dockeronly=False):
    "discover and run all tests in testDir"
    # ensure root and cleanup before starting tests
    ensureRoot()
    cleanup()
    # discover all tests in testDir
    testSuite = defaultTestLoader.discover(testDir)
    if dockeronly:
        testSuiteFiltered = [s for s in testSuite if "Docker" in str(s)]
        testSuite = TestSuite()
        testSuite.addTests(testSuiteFiltered)

    # run tests
    TextTestRunner(verbosity=verbosity).run(testSuite)
Example #8
0
#!/usr/bin/python

"This example doesn't use OpenFlow, but attempts to run sshd in a namespace."

from __future__ import print_function
import sys

from mininet.node import Host
from mininet.util import ensureRoot, waitListening

ensureRoot()
timeout = 5

print("*** Creating nodes")
h1 = Host('h1')

root = Host('root', inNamespace=False)

print("*** Creating links")
h1.linkTo(root)

print(h1)

print("*** Configuring nodes")
h1.setIP('10.0.0.1', 8)
root.setIP('10.0.0.2', 8)

print("*** Creating banner file")
f = open('/tmp/%s.banner' % h1.name, 'w')
f.write('Welcome to %s at %s\n' % (h1.name, h1.IP()))
f.close()
from mininet.net import Mininet
from mininet.node import Host
from mininet.link import Link
from mininet.cli import CLI
from mininet.util import dumpNodeConnections
from mininet.util import ensureRoot

from subprocess import Popen, PIPE
from time import sleep, time

import sys
import os
import math
import requests

ensureRoot()

class ProtoTester(Topo):
    def __init__(self):

        # Initialise topology
        Topo.__init__(self)

        # Add hosts and switches
        sender = self.addHost('sender', ip='10.0.1.1', mac='00:00:00:00:00:01')
        LTE = self.addHost('LTE', ip='0.0.0.0')
        receiver = self.addHost('receiver', ip='10.0.1.2', mac='00:00:00:00:00:02')

        s1 = self.addSwitch('s1')
        s2 = self.addSwitch('s2')