Merge branch 'master' of github.com:mininet/mininet
This commit is contained in:
@@ -1090,6 +1090,7 @@ class IVSSwitch(Switch):
|
|||||||
args.extend( ['-c', '%s:%d' % (c.IP(), c.port)] )
|
args.extend( ['-c', '%s:%d' % (c.IP(), c.port)] )
|
||||||
if self.listenPort:
|
if self.listenPort:
|
||||||
args.extend( ['--listen', '127.0.0.1:%i' % self.listenPort] )
|
args.extend( ['--listen', '127.0.0.1:%i' % self.listenPort] )
|
||||||
|
args.append( self.opts )
|
||||||
|
|
||||||
logfile = '/tmp/ivs.%s.log' % self.name
|
logfile = '/tmp/ivs.%s.log' % self.name
|
||||||
|
|
||||||
|
|||||||
+23
-8
@@ -261,12 +261,20 @@ function wireshark_version_check {
|
|||||||
function wireshark {
|
function wireshark {
|
||||||
echo "Installing Wireshark dissector..."
|
echo "Installing Wireshark dissector..."
|
||||||
|
|
||||||
sudo apt-get install -y wireshark tshark libgtk2.0-dev
|
if [ "$DIST" = "Fedora" ]; then
|
||||||
|
# Just install Fedora's wireshark RPMS
|
||||||
|
# Fedora's wirehark >= 1.10.2-2 includes an OF dissector
|
||||||
|
# (it has been backported from the future Wireshark 1.12 code base)
|
||||||
|
$install wireshark wireshark-gnome
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
$install wireshark tshark libgtk2.0-dev
|
||||||
|
|
||||||
if [ "$DIST" = "Ubuntu" ] && [ "$RELEASE" != "10.04" ]; then
|
if [ "$DIST" = "Ubuntu" ] && [ "$RELEASE" != "10.04" ]; then
|
||||||
# Install newer version
|
# Install newer version
|
||||||
sudo apt-get install -y scons mercurial libglib2.0-dev
|
$install scons mercurial libglib2.0-dev
|
||||||
sudo apt-get install -y libwiretap-dev libwireshark-dev
|
$install libwiretap-dev libwireshark-dev
|
||||||
cd $BUILD_DIR
|
cd $BUILD_DIR
|
||||||
hg clone https://bitbucket.org/barnstorm/of-dissector
|
hg clone https://bitbucket.org/barnstorm/of-dissector
|
||||||
if [[ -z "$WS_DISSECTOR_REV" ]]; then
|
if [[ -z "$WS_DISSECTOR_REV" ]]; then
|
||||||
@@ -304,6 +312,12 @@ function wireshark {
|
|||||||
function ovs {
|
function ovs {
|
||||||
echo "Installing Open vSwitch..."
|
echo "Installing Open vSwitch..."
|
||||||
|
|
||||||
|
if [ "$DIST" = "Fedora" ]; then
|
||||||
|
# Just install Fedora's openvswitch RPMS
|
||||||
|
$install openvswitch openvswitch-controller
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
OVS_SRC=$BUILD_DIR/openvswitch
|
OVS_SRC=$BUILD_DIR/openvswitch
|
||||||
OVS_BUILD=$OVS_SRC/build-$KERNEL_NAME
|
OVS_BUILD=$OVS_SRC/build-$KERNEL_NAME
|
||||||
OVS_KMODS=($OVS_BUILD/datapath/linux/{openvswitch_mod.ko,brcompat_mod.ko})
|
OVS_KMODS=($OVS_BUILD/datapath/linux/{openvswitch_mod.ko,brcompat_mod.ko})
|
||||||
@@ -638,11 +652,12 @@ function modprobe {
|
|||||||
|
|
||||||
function all {
|
function all {
|
||||||
if [ "$DIST" = "Fedora" ]; then
|
if [ "$DIST" = "Fedora" ]; then
|
||||||
printf "\nFedora 19 support status:\n"
|
printf "\nFedora 18+ support (still work in progress):\n"
|
||||||
printf "the install script options -b, -f, -n, and -p should work.\n\n"
|
printf " * Fedora 18+ has kernel 3.10 RPMS in the updates repositories\n"
|
||||||
printf "Just try:\n"
|
printf " * Fedora 18+ has openvswitch 1.10 RPMS in the updates repositories\n"
|
||||||
printf " install.sh -fnp\n"
|
printf " * the install.sh script options [-bfnpvw] should work.\n"
|
||||||
printf "with Fedora's kernel (3.10) and openvswitch (1.10.0) packages.\n"
|
printf " * for a basic setup just try:\n"
|
||||||
|
printf " install.sh -fnpv\n\n"
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
echo "Installing all packages except for -eix (doxypy, ivs, nox-classic)..."
|
echo "Installing all packages except for -eix (doxypy, ivs, nox-classic)..."
|
||||||
|
|||||||
+35
-6
@@ -52,6 +52,7 @@ LogToConsole = False # VM output to console rather than log file
|
|||||||
SaveQCOW2 = False # Save QCOW2 image rather than deleting it
|
SaveQCOW2 = False # Save QCOW2 image rather than deleting it
|
||||||
NoKVM = False # Don't use kvm and use emulation instead
|
NoKVM = False # Don't use kvm and use emulation instead
|
||||||
Branch = None # Branch to update and check out before testing
|
Branch = None # Branch to update and check out before testing
|
||||||
|
Zip = False # Archive .ovf and .vmdk into a .zip file
|
||||||
|
|
||||||
VMImageDir = os.environ[ 'HOME' ] + '/vm-images'
|
VMImageDir = os.environ[ 'HOME' ] + '/vm-images'
|
||||||
|
|
||||||
@@ -85,6 +86,12 @@ isoURLs = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def OSVersion( flavor ):
|
||||||
|
"Return full OS version string for build flavor"
|
||||||
|
urlbase = path.basename( isoURLs.get( flavor, 'unknown' ) )
|
||||||
|
return path.splitext( urlbase )[ 0 ]
|
||||||
|
|
||||||
|
|
||||||
LogStartTime = time()
|
LogStartTime = time()
|
||||||
LogFile = None
|
LogFile = None
|
||||||
|
|
||||||
@@ -135,7 +142,7 @@ def depend():
|
|||||||
' kvm cloud-utils genisoimage qemu-kvm qemu-utils'
|
' kvm cloud-utils genisoimage qemu-kvm qemu-utils'
|
||||||
' e2fsprogs '
|
' e2fsprogs '
|
||||||
' landscape-client'
|
' landscape-client'
|
||||||
' python-setuptools mtools' )
|
' python-setuptools mtools zip' )
|
||||||
run( 'sudo easy_install pexpect' )
|
run( 'sudo easy_install pexpect' )
|
||||||
|
|
||||||
|
|
||||||
@@ -514,6 +521,9 @@ def interact( vm, prompt=Prompt ):
|
|||||||
vm.expect( 'Done preparing Mininet', timeout=3600 )
|
vm.expect( 'Done preparing Mininet', timeout=3600 )
|
||||||
log( '* Completed successfully' )
|
log( '* Completed successfully' )
|
||||||
vm.expect( prompt )
|
vm.expect( prompt )
|
||||||
|
version = getMininetVersion( vm )
|
||||||
|
vm.expect( prompt )
|
||||||
|
log( '* Mininet version: ', version )
|
||||||
log( '* Testing Mininet' )
|
log( '* Testing Mininet' )
|
||||||
runTests( vm )
|
runTests( vm )
|
||||||
log( '* Shutting down' )
|
log( '* Shutting down' )
|
||||||
@@ -521,6 +531,7 @@ def interact( vm, prompt=Prompt ):
|
|||||||
log( '* Waiting for EOF/shutdown' )
|
log( '* Waiting for EOF/shutdown' )
|
||||||
vm.read()
|
vm.read()
|
||||||
log( '* Interaction complete' )
|
log( '* Interaction complete' )
|
||||||
|
return version
|
||||||
|
|
||||||
|
|
||||||
def cleanup():
|
def cleanup():
|
||||||
@@ -652,7 +663,7 @@ def qcow2size( qcow2 ):
|
|||||||
|
|
||||||
def build( flavor='raring32server' ):
|
def build( flavor='raring32server' ):
|
||||||
"Build a Mininet VM; return vmdk and vdisk size"
|
"Build a Mininet VM; return vmdk and vdisk size"
|
||||||
global LogFile
|
global LogFile, Zip
|
||||||
start = time()
|
start = time()
|
||||||
date = strftime( '%y%m%d-%H-%M-%S', localtime())
|
date = strftime( '%y%m%d-%H-%M-%S', localtime())
|
||||||
dir = 'mn-%s-%s' % ( flavor, date )
|
dir = 'mn-%s-%s' % ( flavor, date )
|
||||||
@@ -675,15 +686,19 @@ def build( flavor='raring32server' ):
|
|||||||
logfile = open( flavor + '.log', 'w+' )
|
logfile = open( flavor + '.log', 'w+' )
|
||||||
log( '* Logging results to', abspath( logfile.name ) )
|
log( '* Logging results to', abspath( logfile.name ) )
|
||||||
vm = boot( volume, kernel, initrd, logfile )
|
vm = boot( volume, kernel, initrd, logfile )
|
||||||
interact( vm )
|
version = interact( vm )
|
||||||
size = qcow2size( volume )
|
size = qcow2size( volume )
|
||||||
vmdk = convert( volume, basename=basename )
|
vmdk = convert( volume, basename='mininet-vm' )
|
||||||
if not SaveQCOW2:
|
if not SaveQCOW2:
|
||||||
log( '* Removing qcow2 volume', volume )
|
log( '* Removing qcow2 volume', volume )
|
||||||
os.remove( volume )
|
os.remove( volume )
|
||||||
log( '* Converted VM image stored as', abspath( vmdk ) )
|
log( '* Converted VM image stored as', abspath( vmdk ) )
|
||||||
ovf = generateOVF( diskname=vmdk, disksize=size, name=basename )
|
ovfname = 'mininet-%s-%s' % ( version, OSVersion( flavor ) )
|
||||||
|
ovf = generateOVF( diskname=vmdk, disksize=size, name=ovfname )
|
||||||
log( '* Generated OVF descriptor file', ovf )
|
log( '* Generated OVF descriptor file', ovf )
|
||||||
|
if Zip:
|
||||||
|
log( '* Generating .zip file' )
|
||||||
|
run( 'zip %s-ovf.zip %s %s' % ( ovfname, ovf, vmdk ) )
|
||||||
end = time()
|
end = time()
|
||||||
elapsed = end - start
|
elapsed = end - start
|
||||||
log( '* Results logged to', abspath( logfile.name ) )
|
log( '* Results logged to', abspath( logfile.name ) )
|
||||||
@@ -706,6 +721,15 @@ def runTests( vm, tests=None, prompt=Prompt ):
|
|||||||
vm.expect( prompt )
|
vm.expect( prompt )
|
||||||
|
|
||||||
|
|
||||||
|
def getMininetVersion( vm ):
|
||||||
|
"Run mn to find Mininet version in VM"
|
||||||
|
vm.sendline( '~/mininet/bin/mn --version' )
|
||||||
|
# Eat command line echo, then read output line
|
||||||
|
vm.readline()
|
||||||
|
version = vm.readline().strip()
|
||||||
|
return version
|
||||||
|
|
||||||
|
|
||||||
def bootAndRunTests( image, tests=None ):
|
def bootAndRunTests( image, tests=None ):
|
||||||
"""Boot and test VM
|
"""Boot and test VM
|
||||||
tests: list of tests (default: sanity, core)"""
|
tests: list of tests (default: sanity, core)"""
|
||||||
@@ -733,6 +757,7 @@ def bootAndRunTests( image, tests=None ):
|
|||||||
if Branch:
|
if Branch:
|
||||||
checkOutBranch( vm, branch=Branch )
|
checkOutBranch( vm, branch=Branch )
|
||||||
vm.expect( prompt )
|
vm.expect( prompt )
|
||||||
|
vm.expect( prompt )
|
||||||
log( '* Running tests' )
|
log( '* Running tests' )
|
||||||
runTests( vm, tests=tests )
|
runTests( vm, tests=tests )
|
||||||
# runTests eats its last prompt, but maybe it shouldn't...
|
# runTests eats its last prompt, but maybe it shouldn't...
|
||||||
@@ -769,7 +794,7 @@ def testString():
|
|||||||
|
|
||||||
def parseArgs():
|
def parseArgs():
|
||||||
"Parse command line arguments and run"
|
"Parse command line arguments and run"
|
||||||
global LogToConsole, NoKVM, Branch
|
global LogToConsole, NoKVM, Branch, Zip
|
||||||
parser = argparse.ArgumentParser( description='Mininet VM build script',
|
parser = argparse.ArgumentParser( description='Mininet VM build script',
|
||||||
epilog=buildFlavorString() + ' ' +
|
epilog=buildFlavorString() + ' ' +
|
||||||
testString() )
|
testString() )
|
||||||
@@ -796,6 +821,8 @@ def parseArgs():
|
|||||||
' this branch before testing' )
|
' this branch before testing' )
|
||||||
parser.add_argument( 'flavor', nargs='*',
|
parser.add_argument( 'flavor', nargs='*',
|
||||||
help='VM flavor(s) to build (e.g. raring32server)' )
|
help='VM flavor(s) to build (e.g. raring32server)' )
|
||||||
|
parser.add_argument( '-z', '--zip', action='store_true',
|
||||||
|
help='archive .ovf and .vmdk into .zip file' )
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if args.depend:
|
if args.depend:
|
||||||
depend()
|
depend()
|
||||||
@@ -809,6 +836,8 @@ def parseArgs():
|
|||||||
NoKVM = True
|
NoKVM = True
|
||||||
if args.branch:
|
if args.branch:
|
||||||
Branch = args.branch
|
Branch = args.branch
|
||||||
|
if args.zip:
|
||||||
|
Zip = True
|
||||||
for flavor in args.flavor:
|
for flavor in args.flavor:
|
||||||
if flavor not in isoURLs:
|
if flavor not in isoURLs:
|
||||||
print "Unknown build flavor:", flavor
|
print "Unknown build flavor:", flavor
|
||||||
|
|||||||
Reference in New Issue
Block a user