本文整理汇总了Python中mininet.util.ensureRoot函数的典型用法代码示例。如果您正苦于以下问题:Python ensureRoot函数的具体用法?Python ensureRoot怎么用?Python ensureRoot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ensureRoot函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
def init(cls):
"Initialize Mininet"
if cls.inited:
return
ensureRoot()
fixLimits()
cls.inited = True
示例2: runTests
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 )
示例3: runTests
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 )
示例4: runTests
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)
示例5: ensureRoot
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')