Compare commits

...

20 Commits

Author SHA1 Message Date
Renato Monteiro 6eb8973c0b Fix typo in test_switchdpidassignment.py (#1195)
* Fix typo in test_switchdpidassignment.py

* Fix another typo in test_switchdpidassignment.py
2023-09-16 18:50:27 -07:00
Renato Monteiro 0848c5f3c1 Fix typo in test_hifi.py (#1194) 2023-09-16 18:48:51 -07:00
Renato Monteiro 41ac7c4a6e Remove unused import setup.py (#1203) 2023-09-16 18:48:21 -07:00
Renato Monteiro 5ae59fdbc9 Add missing option to usage string install.sh (#1207)
Also reordered the x and y options to be in alphabetical order.
2023-09-16 16:12:33 -07:00
Renato Monteiro ac7c68089b Fix typo in node.py (#1199)
* Fix typo in node.py

* Fix another typo in node.py
2023-09-16 16:11:46 -07:00
Renato Monteiro ba569f4d82 Fix typo in net.py (#1198) 2023-09-16 16:11:21 -07:00
Renato Monteiro 615f37dbbe Fix typo in build.py (#1204)
* Fix typo in build.py

* Fix another typo in build.py
2023-09-16 16:10:37 -07:00
Renato Monteiro aaa8886328 Fix typo in clustersetup.sh (#1205) 2023-09-16 16:10:11 -07:00
Renato Monteiro 05ee42ee3c Fix typo in install.sh (#1206)
* Fix typo in install.sh

* Fix another typo in install.sh
2023-09-16 16:09:38 -07:00
Renato Monteiro 7685e41a3e Fix typo in INSTALL (#1202) 2023-09-16 16:08:58 -07:00
lantz 39103f4c9d Fix typo in install.sh/mn_deps for Fedora/RHEL
thanks to Andy Fingerhut

closes #1188
2023-07-06 06:49:40 -07:00
lantz 5b1b376336 fix typo in miniedit.py (#1187)
globals.get(...) -> globals().get(...)

fixes #1186
2023-05-28 15:27:56 -07:00
lantz 8725056d7b Debugging for failing test_simpleperf (#1185) 2023-05-02 19:12:33 -07:00
lantz 88f14e946a 2.3.1b4 (#1184)
Including changes to mnexec -c to reduce the number of
close() system calls, which may help with performance in
containers on Ubuntu 22.04.

Note that systemd-udevd also seems to be a cause of performance issues
and should probably be disabled while running Mininet.

Adding dbeug logging to test_simpleperf because it is failing
intermittently. (Note with packet loss it can fail, but this
is not how we should be testing it.)
2023-05-02 18:29:26 -07:00
lantz 0cefa0b8de Add fallback to old mnexec -c method (#1183)
If opendir("/proc/self/fd") fails, fall back to the old
method of closing all file decriptors from 3-1024 (getdtablesize()).
2023-05-02 16:17:49 -07:00
lantz 1b4c7d706d Use /proc/self/fd for open fd list (#1182)
mnexec -c attempts to close all open files except for
standard in/out/error.

Previously we just closed every fd>2, but this seems to take
a long time on docker. So now we read /proc/self/fd to see which
file descriptors are actually in use.
2023-05-02 15:27:27 -07:00
lantz 5e909c6e4f 2.3.1b3 (#1181) 2023-05-02 13:05:56 -07:00
lantz 740acfb350 Unlimit cfs hosts for startup/shutdown config (#1178)
We defer cfs cgroup bandwidth limiting until
CPULimitedHost.configDefault(), and we change
Mininet.stop() to call a new host.unlimit()
method if available.
2023-04-28 18:48:35 -07:00
lantz a978ce9484 Disable udevd to speed up tests; reinstate slow tests (#1177)
systemd-udevd appears to drastically increase
Mininet startup time.

With systemd-udevd disabled,

mn --topo single,100 --test none

takes 8s rather than 40s (31s with NM_UNMANAGED) on
my test VM.

We need a way of disabling it globally and always for
Mininet interfaces, but this is a start for github
actions at least.

For now, we execute this command before running the CI tests:

systemctl stop systemd-udevd systemd-udevd-kernel.socket \
             systemd-udevd-control.socket

We also restore the "slow" examples tests, including
test_tree1024.
2023-04-28 14:44:52 -07:00
lantz 1e546cb73b Fix list of processes to kill in cleanup() (#1173)
The list is specified as a string, but when it was
split across lines spaces were not properly added.

Probably it should actually be a list to make it more
robust to adding additional process names.

For now we are adding spaces to all of the lines, so
hopefully anyone who updates it will follow the pattern.

This should fix the problem of ovs-testcontroller processes
not being killed.

Thanks to Rwitick Ghosh.

Closes #1164
2023-04-25 17:48:01 -07:00
16 changed files with 86 additions and 42 deletions
+7 -2
View File
@@ -22,6 +22,11 @@ jobs:
# This seems too slow unfortunately:
# sudo apt-get upgrade -y -qq
PYTHON=${{ matrix.py }} util/install.sh -nv
- name: Disable slow udevd
run: sudo systemctl stop systemd-udevd
systemd-udevd-kernel.socket
systemd-udevd-control.socket
|| echo "couldn't disable udevd"
- name: Sanity test
run: |
export sudo="sudo env PATH=$PATH"
@@ -39,8 +44,8 @@ jobs:
export sudo="sudo env PATH=$PATH"
export PYTHON=${{ matrix.py }}
$sudo $PYTHON mininet/test/runner.py -v
- name: Run examples tests (quick)
- name: Run examples tests
run: |
export sudo="sudo env PATH=$PATH"
export PYTHON=${{ matrix.py }}
$sudo $PYTHON examples/test/runner.py -v -quick
$sudo $PYTHON examples/test/runner.py -v
+2 -2
View File
@@ -2,7 +2,7 @@
Mininet Installation/Configuration Notes
----------------------------------------
Mininet 2.3.1b2
Mininet 2.3.1b4
---
The supported installation methods for Mininet are 1) using a
@@ -112,7 +112,7 @@ like to contribute an installation script, we would welcome it!)
Mininet supports Python 3 and Python 2. By default, `install.sh`
will use whatever `python` is on your system. To specify a
specific version of Pythonm, you can set the PYTHON environment
specific version of Python, you can set the PYTHON environment
variable:
PYTHON=python3 util/install.sh -fnv
+2 -2
View File
@@ -2,7 +2,7 @@ Mininet: Rapid Prototyping for Software Defined Networks
========================================================
*The best way to emulate almost any network on your laptop!*
Mininet 2.3.1b2
Mininet 2.3.1b4
[![Build Status][1]](https://github.com/mininet/mininet/actions)
@@ -70,7 +70,7 @@ Mininet includes:
### Python 3 Support
- Mininet 2.3.1b2 supports Python 3 and Python 2
- Mininet 2.3.1b4 supports Python 3 and Python 2
- You can install both the Python 3 and Python 2 versions of
Mininet side by side, but the most recent installation will
+1 -1
View File
@@ -1420,7 +1420,7 @@ class MiniEdit( Frame ):
def convertJsonUnicode(self, text):
"Some part of Mininet don't like Unicode"
unicode = globals.get( 'unicode', str )
unicode = globals().get( 'unicode', str )
if isinstance(text, dict):
return {self.convertJsonUnicode(key): self.convertJsonUnicode(value) for key, value in text.items()}
if isinstance(text, list):
+7 -1
View File
@@ -49,13 +49,19 @@ def perfTest( lossy=True ):
net.start()
info( "Dumping host connections\n" )
dumpNodeConnections(net.hosts)
info( "Testing bandwidth between h1 and h4\n" )
info( "Testing bandwidth between h1 and h4 (lossy=%s)\n" % lossy )
h1, h4 = net.getNodeByName('h1', 'h4')
net.iperf( ( h1, h4 ), l4Type='UDP' )
# Debugging
h1.cmd('jobs')
h4.cmd('jobs')
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
# Debug for now
if 'testmode' in argv:
setLogLevel( 'debug' )
# Prevent test_simpleperf from failing due to packet loss
perfTest( lossy=( 'testmode' not in argv ) )
+6 -3
View File
@@ -19,9 +19,12 @@ class testSimplePerf( unittest.TestCase ):
# 10 Mb/s, plus or minus 20% tolerance
BW = 10
TOLERANCE = .2
p = pexpect.spawn( 'python -m mininet.examples.simpleperf testmode' )
p = pexpect.spawn(
'python -m mininet.examples.simpleperf testmode' )
# Log since this seems to be failing intermittently
p.logfile = sys.stdout
# check iperf results
p.expect( "Results: \['10M', '([\d\.]+) .bits/sec", timeout=480 )
p.expect( "Results: \['10M', '([\d\.]+) .bits/sec", timeout=90 )
measuredBw = float( p.match.group( 1 ) )
lowerBound = BW * ( 1 - TOLERANCE )
upperBound = BW + ( 1 + TOLERANCE )
@@ -30,5 +33,5 @@ class testSimplePerf( unittest.TestCase ):
p.wait()
if __name__ == '__main__':
setLogLevel( 'warning' )
setLogLevel( 'debug' )
unittest.main()
+3 -3
View File
@@ -53,9 +53,9 @@ class Cleanup( object ):
info( "*** Removing excess controllers/ofprotocols/ofdatapaths/"
"pings/noxes\n" )
zombies = ( 'controller ofprotocol ofdatapath ping nox_core'
'lt-nox_core ovs-openflowd ovs-controller'
'ovs-testcontroller udpbwtest mnexec ivs ryu-manager' )
zombies = ( 'controller ofprotocol ofdatapath ping nox_core '
'lt-nox_core ovs-openflowd ovs-controller '
'ovs-testcontroller udpbwtest mnexec ivs ryu-manager ' )
# Note: real zombie processes can't actually be killed, since they
# are already (un)dead. Then again,
# you can't connect to them either, so they're mostly harmless.
+9 -3
View File
@@ -98,7 +98,7 @@ from itertools import chain, groupby
from math import ceil
from mininet.cli import CLI
from mininet.log import info, error, output, warn
from mininet.log import info, error, output, warn, debug
from mininet.node import ( Node, Host, OVSKernelSwitch, DefaultController,
Controller )
from mininet.nodelib import NAT
@@ -109,7 +109,7 @@ from mininet.util import ( quietRun, fixLimits, numCores, ensureRoot,
from mininet.term import cleanUpScreens, makeTerms
# Mininet version: should be consistent with README and LICENSE
VERSION = "2.3.1b2"
VERSION = "2.3.1b4"
class Mininet( object ):
"Network emulation with hosts spawned in network namespaces."
@@ -443,7 +443,7 @@ class Mininet( object ):
host.configDefault( ip=None, mac=None )
# You're low priority, dude!
# BL: do we want to do this here or not?
# May not make sense if we have CPU lmiting...
# May not make sense if we have CPU limiting...
# quietRun( 'renice +18 -p ' + repr( host.pid ) )
# This may not be the right place to do this, but
# it needs to be done somewhere.
@@ -572,6 +572,10 @@ class Mininet( object ):
info( controller.name + ' ' )
controller.stop()
info( '\n' )
# Unlimit cfs hosts to speed up shutdown
for h in self.hosts:
if hasattr( h, 'unlimit' ):
h.unlimit()
if self.terms:
info( '*** Stopping %i terms\n' % len( self.terms ) )
self.stopXterms()
@@ -839,6 +843,7 @@ class Mininet( object ):
cliout = client.cmd( iperfArgs + '-t %d -c ' % seconds +
server.IP() + ' ' + bwArgs )
cvals = self._iperfVals( cliout, serverip )
debug( 'iperf client output:', cliout, cvals )
serverout = ''
# Wait for output from the client session
while True:
@@ -848,6 +853,7 @@ class Mininet( object ):
if ( svals and cvals[ 'sport' ] == svals[ 'sport' ]
and int( svals[ 'rate' ] ) > 0 ):
break
debug( 'iperf server output:', serverout, svals )
server.sendInt()
serverout += server.waitOutput()
result = [ fmtBps( svals[ 'rate'], fmt ),
+23 -10
View File
@@ -99,7 +99,7 @@ class Node( object ):
# Stash configuration parameters for future reference
self.params = params
# dict of port numbers to interfacse
# dict of port numbers to interfaces
self.intfs = {}
# dict of interfaces to port numbers
@@ -685,8 +685,21 @@ class CPULimitedHost( Host ):
"CPU limited host"
def __init__( self, name, sched='cfs', **kwargs ):
Host.__init__( self, name, **kwargs )
def __init__( self, name, sched='cfs', **params ):
Host.__init__( self, name, **params )
# BL: Setting the correct period/quota is tricky, particularly
# for RT. RT allows very small quotas, but the overhead
# seems to be high. CFS has a minimum quota of 1 ms, but
# still does better with larger period values.
self.period_us = params.get( 'period_us', 100000 )
self.sched = sched
self.cgroupsInited = False
self.cgroup, self.rtprio = None, None
def initCgroups( self ):
"Deferred cgroup initialization"
if self.cgroupsInited:
return
# Initialize class if necessary
if not CPULimitedHost.inited:
CPULimitedHost.init()
@@ -696,13 +709,7 @@ class CPULimitedHost( Host ):
# We don't add ourselves to a cpuset because you must
# specify the cpu and memory placement first
errFail( 'cgclassify -g cpu,cpuacct:/%s %s' % ( self.name, self.pid ) )
# BL: Setting the correct period/quota is tricky, particularly
# for RT. RT allows very small quotas, but the overhead
# seems to be high. CFS has a mininimum quota of 1 ms, but
# still does better with larger period values.
self.period_us = kwargs.get( 'period_us', 100000 )
self.sched = sched
if sched == 'rt':
if self.sched == 'rt':
self.checkRtGroupSched()
self.rtprio = 20
@@ -863,6 +870,7 @@ class CPULimitedHost( Host ):
cores: (real) core(s) this host can run on
params: parameters for Node.config()"""
r = Node.config( self, **params )
self.initCgroups()
# Was considering cpu={'cpu': cpu , 'sched': sched}, but
# that seems redundant
self.setParam( r, 'setCPUFrac', cpu=cpu )
@@ -878,6 +886,11 @@ class CPULimitedHost( Host ):
cls.cgversion = mountCgroups()
cls.inited = True
def unlimit( self ):
"Unlimit cpu for cfs"
if self.sched == 'cfs' and self.params.get( 'cpu', -1 ) != -1:
self.setCPUFrac( -1, sched=self.sched )
# Some important things to note:
#
+1 -1
View File
@@ -131,7 +131,7 @@ class testOptionsTopoCommon( object ):
BW_TOLERANCE = 0.8 # BW fraction below which test should fail
# Verify ability to create limited-link topo first;
lopts = { 'bw': BW, 'use_htb': True }
# Also verify correctness of limit limitng within a bound.
# Also verify correctness of limit limiting within a bound.
mn = Mininet( SingleSwitchOptionsTopo( n=N, lopts=lopts ),
link=TCLink, switch=self.switchClass,
waitConnected=True )
+2 -2
View File
@@ -51,7 +51,7 @@ class TestSwitchDpidAssignmentOVS( unittest.TestCase ):
def testDefaultDpidAssignmentFailure( self ):
"""Verify that Default dpid assignment raises an Exception if the
name of the switch does not contin a digit. Also verify the
name of the switch does not contain a digit. Also verify the
exception message."""
net = Mininet( Topo(), self.switchClass, Host, Controller )
with self.assertRaises( Exception ) as raises_cm:
@@ -80,7 +80,7 @@ class OVSUser( OVSSwitch):
OVSSwitch.__init__( self, *args, **kwargs )
class testSwitchOVSUser( TestSwitchDpidAssignmentOVS ):
"Test dpid assignnment of OVS User Switch."
"Test dpid assignment of OVS User Switch."
switchClass = OVSUser
@unittest.skipUnless( quietRun( 'which ivs-ctl' ),
+14 -3
View File
@@ -24,6 +24,9 @@
#include <sched.h>
#include <ctype.h>
#include <sys/mount.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#if !defined(VERSION)
#define VERSION "(devel)"
@@ -96,18 +99,26 @@ int main(int argc, char *argv[])
{
int c;
int fd;
DIR *dir;
struct dirent *de;
char path[PATH_MAX];
int nsid;
int pid;
char *cwd = get_current_dir_name();
static struct sched_param sp;
while ((c = getopt(argc, argv, "+cdnpa:g:r:vh")) != -1)
switch(c) {
case 'c':
/* close file descriptors except stdin/out/error */
for (fd = getdtablesize(); fd > 2; fd--)
close(fd);
if ((dir = opendir("/proc/self/fd"))) {
while ((de = readdir(dir)))
if ((fd = atoi(de->d_name)) > 2)
close(fd);
}
/* fall back to old method if needed */
else for (fd = getdtablesize(); fd > 2; fd--)
close(fd);
break;
case 'd':
/* detach from tty */
+1 -1
View File
@@ -2,7 +2,7 @@
"Setuptools params"
from setuptools import setup, find_packages
from setuptools import setup
from os.path import join
# Get version number from source tree
+1 -1
View File
@@ -169,7 +169,7 @@ echo
if $persistent; then
echo '***Setting up persistent SSH configuration between all nodes'
persistentSetup
echo $'\n*** Sucessfully set up ssh throughout the cluster!'
echo $'\n*** Successfully set up ssh throughout the cluster!'
else
echo '*** Setting up temporary SSH configuration between all nodes'
+5 -5
View File
@@ -17,7 +17,7 @@ MININET_DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd -P )"
# in which case we use the directory containing mininet
BUILD_DIR="$(pwd -P)"
case $BUILD_DIR in
$MININET_DIR/*) BUILD_DIR=$MININET_DIR;; # currect directory is a subdirectory
$MININET_DIR/*) BUILD_DIR=$MININET_DIR;; # current directory is a subdirectory
*) BUILD_DIR=$BUILD_DIR;;
esac
@@ -165,7 +165,7 @@ function mn_deps {
$install gcc make socat psmisc xterm openssh-clients iperf \
iproute telnet python-setuptools libcgroup-tools \
ethtool help2man net-tools
$install ${PYPKG}-pyflakes pylint ${PYPKG}-pep8-naming
$install ${PYPKG}-pyflakes pylint ${PYPKG}-pep8-naming \
${PYPKG}-pexpect
elif [ "$DIST" = "SUSE LINUX" ]; then
$install gcc make socat psmisc xterm openssh iperf \
@@ -798,7 +798,7 @@ function vm_clean {
sudo rm -rf /tmp/*
sudo rm -rf openvswitch*.tar.gz
# Remove sensistive files
# Remove sensitive files
history -c # note this won't work if you have multiple bash sessions
rm -f ~/.bash_history # need to clear in memory and remove on disk
rm -f ~/.ssh/id_rsa* ~/.ssh/known_hosts
@@ -842,7 +842,7 @@ exit 0
}
function usage {
printf '\nUsage: %s [-abcdfhikmnprtvVwxy03]\n\n' $(basename $0) >&2
printf '\nUsage: %s [-abcdefhikmnprtvVwxy03]\n\n' $(basename $0) >&2
printf 'This install script attempts to install useful packages\n' >&2
printf 'for Mininet. It should (hopefully) work on Ubuntu 11.10+\n' >&2
@@ -869,8 +869,8 @@ function usage {
printf -- ' -v: install Open (V)switch\n' >&2
printf -- ' -V <version>: install a particular version of Open (V)switch on Ubuntu\n' >&2
printf -- ' -w: install OpenFlow (W)ireshark dissector\n' >&2
printf -- ' -x: install NO(X) Classic OpenFlow controller\n' >&2
printf -- ' -y: install R(y)u Controller\n' >&2
printf -- ' -x: install NO(X) Classic OpenFlow controller\n' >&2
printf -- ' -0: (default) -0[fx] installs OpenFlow 1.0 versions\n' >&2
printf -- ' -3: -3[fx] installs OpenFlow 1.3 versions\n' >&2
exit 2
+2 -2
View File
@@ -64,7 +64,7 @@ VMImageDir = os.environ[ 'HOME' ] + '/vm-images'
Prompt = '\$ ' # Shell prompt that pexpect will wait for
# URLs for Ubunto .iso images
# URLs for Ubuntu .iso images
def serverURL( version, arch ):
"Return .iso URL for Ubuntu version and arch"
@@ -227,7 +227,7 @@ def attachNBD( cow, flags='' ):
def detachNBD( nbd ):
"Detatch an nbd device"
"Detach an nbd device"
srun( 'qemu-nbd -d ' + nbd )