Compare commits

...
8 changed files with 45 additions and 26 deletions

No files matched your search

+3
View File
@@ -1,3 +1,6 @@
mnexec
*.pyc
*~
mininet.egg-info
build
dist
+1 -1
View File
@@ -53,7 +53,7 @@ disable-msg-cat=IR
#enable-msg=
# Disable the message(s) with the given id(s).
disable-msg=W0704,C0103,W0231,E1102,W0511,W0142,R0902,R0903,R0904,R0913,R0914,R0801
disable=W0704,C0103,W0231,E1102,W0511,W0142,R0902,R0903,R0904,R0913,R0914,R0801,I0011
[REPORTS]
+2
View File
@@ -0,0 +1,2 @@
include mnexec.c
exclude bin/mnexec
+4 -2
View File
@@ -21,10 +21,12 @@ test: $(MININET) $(TEST)
-echo "Running tests"
mininet/test/test_nets.py
install: mnexec
cp mnexec bin/
install:
python setup.py install
develop:
python setup.py develop
doc:
doxygen doxygen.cfg
+1 -1
View File
@@ -602,7 +602,7 @@ class MiniEdit( Frame ):
cleanUpScreens()
self.net = None
def xterm( self, ignore=None ):
def xterm( self, _ignore=None ):
"Make an xterm when a button is pressed."
if ( self.selection is None or
self.net is None or
+7 -7
View File
@@ -116,19 +116,19 @@ class Node( object ):
self.shell = None
# Subshell I/O, commands and control
def read( self, bytes=1024 ):
def read( self, maxbytes=1024 ):
"""Buffered read from node, non-blocking.
bytes: maximum number of bytes to return"""
maxbytes: maximum number of bytes to return"""
count = len( self.readbuf )
if count < bytes:
data = os.read( self.stdout.fileno(), bytes - count )
if count < maxbytes:
data = os.read( self.stdout.fileno(), maxbytes - count )
self.readbuf += data
if bytes >= len( self.readbuf ):
if maxbytes >= len( self.readbuf ):
result = self.readbuf
self.readbuf = ''
else:
result = self.readbuf[ :bytes ]
self.readbuf = self.readbuf[ bytes: ]
result = self.readbuf[ :maxbytes ]
self.readbuf = self.readbuf[ maxbytes: ]
return result
def readline( self ):
+3 -3
View File
@@ -136,13 +136,13 @@ def createLink( node1, node2, port1=None, port2=None ):
# IP and Mac address formatting and parsing
def _colonHex( val, bytes ):
def _colonHex( val, count ):
"""Generate colon-hex string.
val: input as unsigned int
bytes: number of bytes to convert
count: number of bytes to convert
returns: chStr colon-hex string"""
pieces = []
for i in range( bytes - 1, -1, -1 ):
for i in range( count - 1, -1, -1 ):
piece = ( ( 0xff << ( i * 8 ) ) & val ) >> ( i * 8 )
pieces.append( '%02x' % piece )
chStr = ':'.join( pieces )
+24 -12
View File
@@ -2,26 +2,33 @@
"Setuptools params"
from setuptools import setup, find_packages
from os.path import join
scripts = [ join( 'bin', filename ) for filename in [
'mn', 'mnexec' ] ]
import os, setuptools
import distutils.command.build_scripts
import distutils.command.clean
import distutils.ccompiler
modname = distname = 'mininet'
setup(
class build_scripts(distutils.command.build_scripts.build_scripts):
def run(self):
distutils.ccompiler.new_compiler().link_executable(["mnexec.c"], "bin/mnexec")
distutils.command.build_scripts.build_scripts.run(self)
class clean(distutils.command.clean.clean):
def run(self):
if os.path.exists("bin/mnexec"):
os.unlink("bin/mnexec")
distutils.command.clean.clean.run(self)
setuptools.setup(
name=distname,
version='0.0.0',
description='Process-based OpenFlow emulator',
author='Bob Lantz',
author_email='rlantz@cs.stanford.edu',
packages=find_packages(exclude='test'),
long_description="""
Insert longer description here.
""",
packages=setuptools.find_packages(exclude='test'),
classifiers=[
"License :: OSI Approved :: GNU General Public License (GPL)",
"License :: OSI Approved :: BSD",
"Programming Language :: Python",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
@@ -33,5 +40,10 @@ Insert longer description here.
'setuptools',
'networkx'
],
scripts=scripts,
scripts=[
'bin/mn',
'bin/mnexec'
],
cmdclass={"build_scripts": build_scripts,
"clean": clean}
)