update scripts to remove NSC and regression trace components (as of ns-3.17 release)
--- a/README Fri Dec 07 13:18:03 2012 -0800
+++ b/README Wed Jun 19 09:18:52 2013 -0700
@@ -3,36 +3,17 @@
If you have downloaded this in tarball release format, this directory
contains some released ns-3 version, along with 3rd party components
necessary to support all optional ns-3 features, such as Python
-bindings and Network Simulation Cradle. In this case, just run the
+bindings and the Network Animator. In this case, just run the
script build.py; all the components, plus ns-3 itself, will thus be
-built.
-
-If, on the other hand, you have obtained this by cloning the mercurial
-repository, this directory only contains a few python scripts:
-
- download.py:
-
- This script will take care of downloading all necessary
- components, including pybindgen and NSC, along with cloning an
- ns-3 repository. By default, the main development ns-3 branch,
- ns-3-dev, will be cloned, so most users should simply call:
-
- ./download.py
+built. This directory also contains the bake build tool, which allows
+access to several additional modules including the Network Simulation
+Cradle, Direct Code Execution environment, and click and openflow
+extensions for ns-3.
- but the ns-3-dev repository can be overridden via the -n
- command line option. For example:
-
- ./download.py -n jabraham3/netanim
-
- will clone the repository http://code.nsnam.org/jabraham3/netanim
- into the allinone directory.
-
- build.py:
-
- This script will get all external components that need to be
- built, and then will build ns-3 using the downloaded components.
-
- ./build.py
-
- The most recently downloaded components will be built, according
- to the .config file that is written by download.py.
+If you have downloaded this from mercurial, the download.py script will
+download bake, netanim, pybindgen, and ns-3-dev. The usage to use
+basic ns-3 (netanim and ns-3-dev) is to type:
+./download.py
+./build.py
+and cd into ns-3-dev for further work. Consult the bake documentation
+on how to use bake to access optional ns-3 components.
--- a/build.py Fri Dec 07 13:18:03 2012 -0800
+++ b/build.py Wed Jun 19 09:18:52 2013 -0700
@@ -9,10 +9,6 @@
from util import run_command, fatal, CommandError
-def build_nsc():
- run_command([sys.executable, 'scons.py'])
-
-
def build_netanim(qmakepath):
qmake = 'qmake'
qmakeFound = False
@@ -81,30 +77,12 @@
"--with-pybindgen", os.path.join("..", pybindgen.getAttribute("dir")),
])
- try:
- nsc, = config.getElementsByTagName("nsc")
- except ValueError:
- print "Note: configuring ns-3 without NSC"
- else:
- # Build NSC if the architecture supports it
- if sys.platform not in ['linux2']:
- arch = None
- else:
- arch = os.uname()[4]
- if arch == 'x86_64' or arch == 'i686' or arch == 'i586' or arch == 'i486' or arch == 'i386':
- cmd.extend(["--with-nsc", os.path.join("..", nsc.getAttribute("dir"))])
- else:
- print "Note: configuring ns-3 without NSC (architecture not supported)"
-
run_command(cmd) # waf configure ...
run_command([sys.executable, "waf", "build"] + build_options)
def main(argv):
parser = OptionParser()
- parser.add_option('--disable-nsc',
- help=("Don't try to build NSC (built by default on Linux)"), action="store_true", default=False,
- dest='disable_nsc')
parser.add_option('--disable-netanim',
help=("Don't try to build NetAnim (built by default)"), action="store_true", default=False,
dest='disable_netanim')
@@ -133,30 +111,6 @@
config = dom.parse(dot_config)
dot_config.close()
- if options.disable_nsc:
- print "# Skip NSC (by user request)"
- for node in config.getElementsByTagName("nsc"):
- config.documentElement.removeChild(node)
- elif sys.platform in ['darwin', 'win32']:
- print "# Skip NSC (platform not supported)"
- else:
- nsc_config_elems = config.getElementsByTagName("nsc")
- if nsc_config_elems:
- nsc_config, = nsc_config_elems
- nsc_dir = nsc_config.getAttribute("dir")
- print "# Build NSC"
- os.chdir(nsc_dir)
- print "Entering directory `%s'" % nsc_dir
- try:
- try:
- build_nsc()
- except CommandError:
- print "# Build NSC: failure (ignoring NSC)"
- config.documentElement.removeChild(nsc_config)
- finally:
- os.chdir(cwd)
- print "Leaving directory `%s'" % nsc_dir
-
if options.disable_netanim:
print "# Skip NetAnimC (by user request)"
for node in config.getElementsByTagName("netanim"):
--- a/constants.py Fri Dec 07 13:18:03 2012 -0800
+++ b/constants.py Wed Jun 19 09:18:52 2013 -0700
@@ -4,43 +4,12 @@
LOCAL_PYBINDGEN_PATH = 'pybindgen'
#
-# The directory in which the tarball of the reference traces lives. This is
-# used if Mercurial is not on the system.
-#
-REGRESSION_TRACES_URL = "http://www.nsnam.org/releases/"
-
-#
-# The path to the Mercurial repository used to find the reference traces if
-# we find "hg" on the system. We expect that the repository will be named
-# identically to refDirName below
-#
-REGRESSION_TRACES_REPO = "http://code.nsnam.org/"
-
-#
-# Name of the local directory where the regression code lives.
-#
-REGRESSION_DIR = "regression"
-
-#
-# The last part of the path name to use to find the regression traces. The
-# path will be APPNAME + '-' + VERSION + REGRESSION_SUFFIX, e.g.,
-# ns-3-dev-ref-traces
-#
-REGRESSION_SUFFIX = "-ref-traces"
-
-#
# The last part of the path name to use to find the regression traces tarball.
# path will be APPNAME + '-' + VERSION + REGRESSION_SUFFIX + TRACEBALL_SUFFIX,
# e.g., ns-3-dev-ref-traces.tar.bz2
#
TRACEBALL_SUFFIX = ".tar.bz2"
-# network simulation cradle
-NSC_REPO = "https://secure.wand.net.nz/mercurial/nsc"
-NSC_RELEASE_URL = "http://research.wand.net.nz/software/nsc"
-
-LOCAL_NSC_PATH = "nsc"
-
# NetAnim
NETANIM_REPO = "http://code.nsnam.org/netanim"
NETANIM_RELEASE_URL = "http://www.nsnam.org/tools/netanim"
--- a/dist.py Fri Dec 07 13:18:03 2012 -0800
+++ b/dist.py Wed Jun 19 09:18:52 2013 -0700
@@ -119,25 +119,6 @@
print "Adding %s as %s" % (pybindgen_dir, os.path.join(dist_dir, new_pybindgen_dir))
tar_add_tree(tar, pybindgen_dir, os.path.join(dist_dir, new_pybindgen_dir), dir_excl, file_excl)
- # add network simulation cradle
- nsc_dir = config.getElementsByTagName("nsc")[0].getAttribute("dir")
- new_nsc_dir = config.getElementsByTagName("nsc")[0].getAttribute("version")
- assert new_nsc_dir.startswith("nsc")
- new_config.getElementsByTagName("nsc")[0].setAttribute("dir", new_nsc_dir)
- def dir_excl(reldirpath, dirname):
- if dirname[0] == '.':
- return True
- # FIXME: which files or directories to exclude for NSC?
- return False
- def file_excl(reldirpath, filename):
- if filename.startswith('.'):
- return True
- if filename.endswith('~'):
- return True
- return False
- print "Adding %s as %s" % (nsc_dir, os.path.join(dist_dir, new_nsc_dir))
- tar_add_tree(tar, nsc_dir, os.path.join(dist_dir, new_nsc_dir), dir_excl, file_excl)
-
# add NetAnim
netanim_dir = config.getElementsByTagName("netanim")[0].getAttribute("dir");
new_netanim_dir = config.getElementsByTagName("netanim")[0].getAttribute("version")
--- a/download.py Fri Dec 07 13:18:03 2012 -0800
+++ b/download.py Wed Jun 19 09:18:52 2013 -0700
@@ -30,39 +30,6 @@
return ns3_dir
-
-def get_regression_traces(ns3_dir, regression_branch):
- print """
- #
- # Get the regression traces
- #
- """
- # ns3_dir is the directory into which we cloned the repo
- # regression_branch is the repo in which we will find the traces. Variations like this should work:
- # ns-3-dev-ref-traces
- # craigdo/ns-3-dev-ref-traces
- # craigdo/ns-3-tap-ref-traces
- regression_traces_dir = os.path.split(regression_branch)[-1]
- regression_branch_url = constants.REGRESSION_TRACES_REPO + regression_branch
-
- print "Synchronizing reference traces using Mercurial."
- try:
- if not os.path.exists(regression_traces_dir):
- run_command(["hg", "clone", regression_branch_url, regression_traces_dir])
- else:
- run_command(["hg", "-q", "pull", "--cwd", regression_traces_dir, regression_branch_url])
- run_command(["hg", "-q", "update", "--cwd", regression_traces_dir])
- except OSError: # this exception normally means mercurial is not found
- if not os.path.exists(regression_traces_dir_name):
- traceball = regression_tbranch + constants.TRACEBALL_SUFFIX
- print "Retrieving " + traceball + " from web."
- urllib.urlretrieve(constants.REGRESSION_TRACES_URL + traceball, traceball)
- run_command(["tar", "-xjf", traceball])
- print "Done."
-
- return regression_traces_dir
-
-
def get_pybindgen(ns3_dir):
print """
#
@@ -184,70 +151,11 @@
return (constants.LOCAL_NETANIM_PATH, required_netanim_version)
-def get_nsc(ns3_dir):
- print """
- #
- # Get NSC
- #
- """
-
- # Skip downloading NSC on OS X due to HFS+ case insensitive issues
- # Skip downloading NSC on Cygwin because of fundamental incompatibilities.
- if sys.platform in ['darwin', 'cygwin']:
- print "Architecture (%s) does not support NSC... skipping" % (sys.platform,)
- raise RuntimeError
-
- # (peek into the ns-3 wscript and extract the required nsc version)
- try:
- # For the recent versions
- internet_stack_wscript = open(os.path.join(ns3_dir, "src", "internet", "wscript"), "rt")
- except IOError:
- # For the old versions (ns-3.10 and before)
- internet_stack_wscript = open(os.path.join(ns3_dir, "src", "internet-stack", "wscript"), "rt")
- required_nsc_version = None
- for line in internet_stack_wscript:
- if 'NSC_RELEASE_NAME' in line:
- required_nsc_version = eval(line.split('=')[1].strip())
- break
- internet_stack_wscript.close()
- if required_nsc_version is None:
- fatal("Unable to detect NSC required version")
- print "Required NSC version: ", required_nsc_version
-
- def nsc_clone():
- print "Retrieving nsc from " + constants.NSC_REPO
- run_command(['hg', 'clone', constants.NSC_REPO, constants.LOCAL_NSC_PATH])
-
- def nsc_update():
- print "Pulling nsc updates from " + constants.NSC_REPO
- run_command(['hg', '--cwd', constants.LOCAL_NSC_PATH, 'pull', '-u', constants.NSC_REPO])
-
- def nsc_download():
- local_file = required_nsc_version + ".tar.bz2"
- remote_file = constants.NSC_RELEASE_URL + "/" + local_file
- print "Retrieving nsc from " + remote_file
- urllib.urlretrieve(remote_file, local_file)
- print "Uncompressing " + local_file
- run_command(["tar", "-xjf", local_file])
- print "Rename %s as %s" % (required_nsc_version, constants.LOCAL_NSC_PATH)
- os.rename(required_nsc_version, constants.LOCAL_NSC_PATH)
-
- if not os.path.exists(os.path.join(ns3_dir, '.hg')):
- nsc_download()
- elif not os.path.exists(constants.LOCAL_NSC_PATH):
- nsc_clone()
- else:
- nsc_update()
-
- return (constants.LOCAL_NSC_PATH, required_nsc_version)
-
def main():
parser = OptionParser()
parser.add_option("-n", "--ns3-branch", dest="ns3_branch", default="ns-3-dev",
help="Name of the ns-3 repository", metavar="BRANCH_NAME")
- parser.add_option("-r", "--regression-branch", dest="regression_branch", default="",
- help="Name of the ns-3 regression traces repository", metavar="REGRESSION_BRANCH_NAME")
(options, dummy_args) = parser.parse_args()
# first of all, change to the directory of the script
@@ -264,17 +172,6 @@
ns3_config.setAttribute("dir", ns3_dir)
ns3_config.setAttribute("branch", options.ns3_branch)
- # -- if requested, download regression reference traces for NS-3 --
- if options.regression_branch:
- try:
- traces_dir = get_regression_traces(ns3_dir, options.regression_branch)
- except CommandError:
- print " *** Did not fetch regression reference traces; regression testing will not be available."
- else:
- traces_config = config.documentElement.appendChild(config.createElement("ns-3-traces"))
- traces_config.setAttribute("dir", traces_dir)
- traces_config.setAttribute("branch", options.regression_branch)
-
# -- download pybindgen --
try:
pybindgen_dir, pybindgen_version = get_pybindgen(ns3_dir)
@@ -295,16 +192,6 @@
netanim_config.setAttribute("dir", netanim_dir)
netanim_config.setAttribute("version", netanim_version)
- # -- download network simulation cradle --
- try:
- nsc_dir, nsc_version = get_nsc(ns3_dir)
- except (CommandError, IOError, RuntimeError):
- print " *** Did not fetch NSC; NSC will not be available."
- else:
- nsc_config = config.documentElement.appendChild(config.createElement("nsc"))
- nsc_config.setAttribute("dir", nsc_dir)
- nsc_config.setAttribute("version", nsc_version)
-
# write the config to a file
dot_config = open(".config", "wt")
config.writexml(dot_config, addindent=" ", newl="\n")