Compare commits

...

9 Commits

Author SHA1 Message Date
lantz 008f62f6ce Merge branch 'master' into rc-local 2021-02-06 15:55:55 -08:00
lantz 06dae1adc1 fix bootAndRun() (#1024)
* rc.local: /usr/bin/bash -> /bin/bash

bash is (and should be) located in /bin

this may have caused ubuntu 18.04 to not execute
/etc/rc.local and regenerate ssh keys

* fix bootAndRun()
2021-02-06 15:55:40 -08:00
lantz f0c726a42f Use /usr/bin/env python for virtualenv (#1025)
This helps with virtualenv although it can open
up another security hole if you end up using an
unexpected python interpreter.

Overall it seems to make sense to err on the side
of usability but it's good to be aware of security.

However, for the remaining utility scripts that require
python 2, we explicitly note this with #!/usr/bin/python2.
2021-02-05 07:42:50 -08:00
Bob Lantz f33a8f0eea rc.local: /usr/bin/bash -> /bin/bash
bash is (and should be) located in /bin

this may have caused ubuntu 18.04 to not execute
/etc/rc.local and regenerate ssh keys
2021-02-01 16:21:43 -08:00
lantz a882d68a5f Update README.md 2021-01-30 16:42:03 -08:00
lantz 9b69c99f4e Update INSTALL 2021-01-30 16:40:40 -08:00
lantz 904796436d Update README.md 2021-01-30 16:38:36 -08:00
lantz ec2d93d482 2.3.0b2 (#1022)
+ text file updates
2021-01-30 15:41:20 -08:00
lantz dffddc338f Install python3 mn last in install-mininet-vm.sh (#1021)
This means that 'mn' will run be default in python3.

For python2, run

    sudo python2 `which mn`

Also:

- change mn execution line to /usr/bin/python
  (install seems to change it to python2 or python3)

- don't install python-is-python3 package
2021-01-29 22:39:19 -08:00
44 changed files with 147 additions and 93 deletions
+66 -21
View File
@@ -2,7 +2,7 @@
Mininet Installation/Configuration Notes
----------------------------------------
Mininet 2.3.0b1
Mininet 2.3.0b2
---
The supported installation methods for Mininet are 1) using a
@@ -36,12 +36,17 @@ like to contribute an installation script, we would welcome it!)
sudo apt-get install mininet
Note: this may install an older version of Mininet. If you would
like the latest version, consider a native install from source.
Note: this may install an older version of Mininet which may not
support Python 3. If you would like the latest version of Mininet,
consider installing from source as described in the next section.
3. Native installation from source
3.1. Native installation from source on Ubuntu 16.04+
If you are running Ubuntu, Debian, or Fedora, you may be able to use
our handy `install.sh` script, which is in `util/`. Please read the
following sections first.
3.1. Obtaining the Mininet source code
If you're reading this, you've probably already done so, but the
command to download the Mininet source code is:
@@ -49,8 +54,9 @@ like to contribute an installation script, we would welcome it!)
git clone git://github.com/mininet/mininet.git
Note that the above git command will check out the latest and greatest
Mininet (which we recommend!) If you want to run the last tagged/released
version of Mininet, you can look at the release tags using
Mininet (which we recommend!) If you want to run the last
tagged/released version of Mininet, you can look at the release tags
using
cd mininet
git tag
@@ -61,21 +67,38 @@ like to contribute an installation script, we would welcome it!)
where <release tag> is the release you want to check out.
If you are running Ubuntu, Debian, or Fedora, you may be able to use
our handy `install.sh` script, which is in `util/`.
3.1.1 *CAUTION: USE AT YOUR OWN RISK!*
*WARNING: USE AT YOUR OWN RISK!*
`install.sh` is a bit intrusive and may possibly damage your OS
`install.sh` can be a bit intrusive and may possibly damage your OS
and/or home directory, by creating/modifying several directories
such as `mininet`, `openflow`, `oftest`, `pox`, etc.. We recommend
trying it in a VM before trying it on a system you use from day to day.
trying it in a VM before trying it on a system you use from day to
day.
Although we hope it won't do anything completely terrible, you may
want to look at the script before you run it, and you should make
sure your system and home directory are backed up just in case!
To install Mininet itself, the OpenFlow reference implementation, and
You can change the directory where the dependencies are installed
using the -s <directory> flag.
util/install.sh -s <directory> ...
3.1.2 Running `install.sh`
Installing a "minimal" version of Mininet with Open vSwitch should
be reasonably non-perturbing since it should not create directories
for other tools:
util/install.sh -nv
Note this will not install a controller, so you will have to either
install your own controller, or use a switch such OVSBridge that does
not require a controller:
sudo mn --switch ovsbr --test pingall
To install Mininet itself, the OpenFlow reference controller, and
Open vSwitch, you may use:
util/install.sh -fnv
@@ -85,6 +108,27 @@ like to contribute an installation script, we would welcome it!)
sudo mn --test pingall
3.1.3 Python 3 and Python 2 support
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
variable:
PYTHON=python3 util/install.sh -fnv
You can install Mininet for both Python 3 and Python 2:
PYTHON=python2 util/install.sh -fnv
PYTHON=python3 util/install.sh -n
Whichever version was installed last will be the default for `mn`.
As long as Mininet is installed for the appropriate version of
Python, you can run it using that versinon of Python:
python3 `which mn`
python2 `which mn`
To install ALL of the software which we use for OpenFlow tutorials,
including POX, the OpenFlow WireShark dissector, the `oftest`
framework, and other potentially useful software, you may use:
@@ -93,13 +137,10 @@ like to contribute an installation script, we would welcome it!)
This takes about 4 minutes on our test system.
You can change the directory where the dependencies are installed using
the -s <directory> flag.
util/install.sh -s <directory> -a
3.2. Native installation from source on Fedora 18+.
*This may be out of date.*
As root execute the following operations:
* install git
@@ -152,7 +193,8 @@ like to contribute an installation script, we would welcome it!)
Although we don't support other Linux distributions directly, it
should be possible to install and run Mininet with some degree of
manual effort.
manual effort. People have even gotten `mn --switch user` to run
in a ChromeOS container.
In general, you must have:
@@ -169,8 +211,11 @@ like to contribute an installation script, we would welcome it!)
support other Linux distributions.
Good luck!
As always, please feel free to submit issues or pull requests for
installation-related features.
Mininet Team
Good luck, and have fun!
Mininet Developers
---
+1 -1
View File
@@ -1,4 +1,4 @@
Mininet 2.3.0b1 License
Mininet 2.3.0b2 License
Copyright (c) 2013-2020 Open Networking Foundation
Copyright (c) 2009-2012 Bob Lantz and The Board of Trustees of
+21 -8
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.0b1
Mininet 2.3.0b2
[![Build Status][1]](https://github.com/mininet/mininet/actions)
@@ -68,17 +68,30 @@ Mininet includes:
`mn -c`
### New features in this release
### Python 3 Support
This is primarily a performance improvement and bug fix release.
- Mininet 2.3.0b2 supports Python 3 and Python 2!
- Python 3 support (Python 2 is still supported as well)
- You can install both the Python 3 and Python 2 versions of
Mininet side by side, but the most recent installation will
determine which Python version is used by default by `mn`.
- Support for Ubuntu 20.04 LTS
- You can run `mn` directly with Python 2 or Python 3,
as long as the appropriate version of Mininet is installed,
e.g.
$ sudo python2 `which mn`
- More information regarding Python 3 and Python 2 support
may be found in the release notes on http://docs.mininet.org.
### Other Enhancements and Information
- Support for Ubuntu 20.04 LTS (and 18.04 and 16.04)
- More reliable testing and CI via github actions
- Additional information for this release and previous releases
- Additional information about this release and previous releases
may be found in the release notes on http://docs.mininet.org.
### Installation
@@ -116,8 +129,8 @@ hard work that Mininet continues to grow and improve.
### Enjoy Mininet
Best wishes, and we look forward to seeing what you can do with
Mininet to change the networking world!
Have fun! We look forward to seeing what you will do with Mininet
to change the networking world.
Bob Lantz
on behalf of the Mininet Contributors
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"This example doesn't use OpenFlow, but attempts to run sshd in a namespace."
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
bind.py: Bind mount example
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
cluster.py: prototyping/experimentation for distributed Mininet,
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"CLI for Mininet Cluster Edition prototype demo"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"clusterdemo.py: demo of Mininet Cluster Edition prototype"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"clusterperf.py compare the maximum throughput between SSH and GRE tunnels"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
consoles.py: bring up a bunch of miniature consoles on a virtual network
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
Create a network where different switches are connected to
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
This example creates a multi-controller network from semi-scratch by
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
controlnet.py: Mininet with a custom control network
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
cpu.py: test iperf bandwidth for varying cpu limits
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
This example shows how to create an empty Mininet object
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
This example shows how to add an interface (for example a real
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
'''
example of using various TCIntf options.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
limit.py: example of using link and CPU limits
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
Test bandwidth (using iperf) on linear networks of varying size,
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
linuxrouter.py: Example network with Linux IP router
+1 -1
View File
@@ -1704,7 +1704,7 @@ class MiniEdit( Frame ):
# debug( "Now saving under %s\n" % fileName )
f = open(fileName, 'wb')
f.write("#!/usr/bin/python\n")
f.write("#!/usr/bin/env python\n")
f.write("\n")
f.write("from mininet.net import Mininet\n")
f.write("from mininet.node import Controller, RemoteController, OVSController\n")
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
Simple example of Mobility with Mininet
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
This is a simple example that demonstrates multiple links
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
multiping.py: monitor multiple sets of hosts using ping
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
Simple example of sending output to multiple files and
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
This example shows how to create a network and run multiple tests.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
Example to create a Mininet topology and connect it to the internet via NAT
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
natnet.py: Example network with NATs
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
Create a network with 5 hosts, numbered 1-4 and 9.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
This example monitors a number of hosts using host.popen() and
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"Monitor multiple hosts using popen()/pmonitor()"
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
Build a simple network from scratch, using mininet primitives.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
Build a simple network from scratch, using mininet primitives.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
Simple example of setting network and CPU parameters
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
Create a network and start sshd(8) on each host.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"""
Create a 1024-host network, and run the CLI on it.
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
"Create a 64-node tree network, and test connectivity using ping."
+1 -1
View File
@@ -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.0b1"
VERSION = "2.3.0b2"
class Mininet( object ):
"Network emulation with hosts spawned in network namespaces."
+1 -5
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python2
"""
Convert simple documentation to epydoc/pydoctor-compatible markup
@@ -83,7 +83,3 @@ if __name__ == '__main__':
infile.close()
os.close( outfid )
call( [ 'doxypy', outname ] )
+1 -1
View File
@@ -791,7 +791,7 @@ function vm_clean {
echo 'Removing SSH keys from /etc/ssh/'
sudo rm -f /etc/ssh/*key*
if [ ! -e /etc/rc.local ]; then
echo '#!/usr/bin/bash' | sudo tee /etc/rc.local
echo '#!/bin/bash' | sudo tee /etc/rc.local
sudo chmod +x /etc/rc.local
fi
if ! grep mininet /etc/rc.local >& /dev/null; then
+15 -15
View File
@@ -1,7 +1,7 @@
#!/usr/bin/python
#!/usr/bin/python2
"""
Translate from PEP8 Python style to Mininet (i.e. Arista-like)
Translate from PEP8 Python style to Mininet (i.e. Arista-like)
Python style
usage: unpep8 < old.py > new.py
@@ -51,7 +51,7 @@ def fixUnderscoreTriplet( match ):
def reinstateCapWords( text ):
underscoreTriplet = re.compile( r'[A-Za-z0-9]_[A-Za-z0-9]' )
return underscoreTriplet.sub( fixUnderscoreTriplet, text )
def replaceTripleApostrophes( text ):
"Replace triple apostrophes with triple quotes."
return text.replace( "'''", '"""')
@@ -60,7 +60,7 @@ def simplifyTripleQuotes( text ):
"Fix single-line doc strings."
r = re.compile( r'"""([^\"\n]+)"""' )
return r.sub( r'"\1"', text )
def insertExtraSpaces( text ):
"Insert extra spaces inside of parentheses and brackets/curly braces."
lparen = re.compile( r'\((?![\s\)])' )
@@ -76,9 +76,9 @@ def insertExtraSpaces( text ):
lcurly = re.compile( r'\{(?![\s\}])' )
text = lcurly.sub( r'{ ', text )
rcurly = re.compile( r'([^\s\{])(?=\})' )
text = rcurly.sub( r'\1 ', text)
text = rcurly.sub( r'\1 ', text)
return text
def fixDoxygen( text ):
"""Translate @param foo to foo:, @return bar to returns: bar, and
@author me to author: me"""
@@ -96,11 +96,11 @@ def removeCommentFirstBlankLine( text ):
"Remove annoying blank lines after first line in comments."
line = re.compile( r'("""[^\n]*\n)\s*\n', re.MULTILINE )
return line.sub( r'\1', text )
def fixArgs( match, kwarg = re.compile( r'(\w+) = ' ) ):
"Replace foo = bar with foo=bar."
return kwarg.sub( r'\1=', match.group() )
def fixKeywords( text ):
"Change keyword argumentsfrom foo = bar to foo=bar."
args = re.compile( r'\(([^\)]+)\)', re.MULTILINE )
@@ -115,7 +115,7 @@ def fixKeywords( text ):
def lineIter( text ):
"Simple iterator over lines in text."
for line in text.splitlines(): yield line
def stringIter( strList ):
"Yield strings in strList."
for s in strList: yield s
@@ -134,7 +134,7 @@ def restoreRegex( regex, old, new ):
# This is a cheap hack, and it may not work 100%, since
# it doesn't handle multiline strings.
# However, it should be mostly harmless...
def restoreStrings( oldText, newText ):
"Restore strings from oldText into newText, returning result."
oldLines, newLines = lineIter( oldText ), lineIter( newText )
@@ -149,13 +149,13 @@ def restoreStrings( oldText, newText ):
newLine = restoreRegex( tickStrings, oldLine, newLine )
result += newLine + '\n'
return result
# This might be slightly controversial, since it uses
# three spaces to line up multiline comments. However,
# I much prefer it. Limitations: if you have deeper
# indents in comments, they will be eliminated. ;-(
def fixComment( match,
def fixComment( match,
indentExp=re.compile( r'\n([ ]*)(?=[^/s])', re.MULTILINE ),
trailingQuotes=re.compile( r'\s+"""' ) ):
"Re-indent comment, and join trailing quotes."
@@ -166,17 +166,17 @@ def fixComment( match,
if len( originalIndent ) is not 0: indent += ' '
comment = indentExp.sub( indent, comment )
return originalIndent + trailingQuotes.sub( '"""', comment )
def fixCommentIndents( text ):
"Fix multiline comment indentation."
comments = re.compile( r'^([ ]*)("""[^"]*""")$', re.MULTILINE )
return comments.sub( fixComment, text )
def removeBogusLinefeeds( text ):
"Remove extra linefeeds at the end of single-line comments."
bogusLfs = re.compile( r'"([^"\n]*)\n"', re.MULTILINE )
return bogusLfs.sub( '"\1"', text)
def convertFromPep8( program ):
oldProgram = program
# Program text transforms
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
from subprocess import check_output as co
from sys import exit, version_info
+4 -3
View File
@@ -1,4 +1,4 @@
#!/usr/bin/python2.7
#!/usr/bin/python2
"""
build.py: build a Mininet VM
@@ -954,7 +954,8 @@ def bootAndRun( image, prompt=Prompt, memory=1024, cpuCores=1, outputFile=None,
log( '* Creating COW disk', cow )
run( 'qemu-img create -f qcow2 -b %s %s' % ( image, cow ) )
log( '* Extracting kernel and initrd' )
kernel, initrd, part = extractKernel( image, flavor=basename, imageDir=tmpdir )
kernel, initrd, partnum = extractKernel(
image, flavor=basename, imageDir=tmpdir )
if LogToConsole:
logfile = stdout
else:
@@ -962,7 +963,7 @@ def bootAndRun( image, prompt=Prompt, memory=1024, cpuCores=1, outputFile=None,
suffix='.testlog', delete=False )
log( '* Logging VM output to', logfile.name )
vm = boot( cow=cow, kernel=kernel, initrd=initrd, logfile=logfile,
memory=memory, cpuCores=cpuCores, part=part )
memory=memory, cpuCores=cpuCores, partnum=partnum )
login( vm )
log( '* Waiting for prompt after login' )
vm.expect( prompt )
+2 -3
View File
@@ -36,11 +36,10 @@ fi
# Install Mininet for Python2 and Python3
APT="sudo apt-get -y -qq"
$APT install python3
$APT install python-is-python3 || true
$APT install python2 || $APT install python
python --version
time PYTHON=python3 mininet/util/install.sh
python --version || $APT install python-is-python3
time PYTHON=python2 mininet/util/install.sh -n
time PYTHON=python3 mininet/util/install.sh
# Finalize VM
time mininet/util/install.sh -tcd
# Ignoring this since NOX classic is deprecated