Exemple #1
0
def makefile(cmb):
    """\
# 
# This is an automatically generated makefile
#

SIMHOME={{! simhome}}
OMNETPP_PATH={{! opp_path}}
CASTALIA_PATH={{! cast_path}}

PATH:=/bin:/usr/bin:$(OMNETPP_PATH)/bin
LD_LIBRARY_PATH=$(OMNETPP_PATH)/lib

SIMEXEC=simexec

.PHONY: all compile run

all: compile run

makefrag:
\tln -s $(CASTALIA_PATH)/makefrag.inc makefrag

compile: makefrag
\topp_makemake -f -r --deep -o $(SIMEXEC) -u Cmdenv -P $(SIMHOME) -M release -X./Simulations -X./src -L$(CASTALIA_PATH) -lnetsim
\t$(MAKE)

run:
\t./$(SIMEXEC) --cmdenv-output-file=simout.txt -c Main

"""
    cast_path = castalia_path()
    opp_path = omnetpp_path()
    simhome = context.fileloc
    return locals()
Exemple #2
0
def setupCastalia():
    assertCastaliaSetup()
    augmentEnvironment()

    print("Configuration: omnetpp  in %s" % omnetpp_path())
    print("Configuration: castalia in %s" % castalia_path())
    for evar in ("PATH", "LD_LIBRARY_PATH"):
        print(evar, '=', os.getenv(evar))

    buildCastaliaSharedLib()
    buildIncludePath()

    print("Castalia has been set up successfully")
Exemple #3
0
 def init_omnetpp_general(self):
     '''
     Create Omnetpp model from NSD
     '''
     self.opp.sim_time_limit = self.nsd.parameters.sim_time_limit
     self.opp.simtime_scale = self.nsd.parameters.simtime_scale
     self.opp.cpu_time_limit = self.nsd.parameters.cpu_time_limit
     if not self.nsd.parameters.random_seed:
         random.seed()
     else:
         random.seed(self.nsd.parameters.random_seed)
     self.opp.seeds = [random.randrange(1000000) for i in range(11)]
     self.opp.castalia_path = castalia_path()
Exemple #4
0
 def make_opp_makemake_args(cls, fileloc):
     return [
         os.path.join(omnetpp_path(), "bin/opp_makemake"),
         "-f",
         "-r",
         "--deep",
         "-o",
         cls.SIMEXEC,
         "-u",
         "Cmdenv",
         "-P",
         fileloc,  ### Fileloc must be injected here
         "-M",
         "release",
         "-X./Simulations",
         "-X./src",
         "-L" + castalia_path(),
         "-lcastalia"
     ]
Exemple #5
0
 def link_path(src, fileloc, dst):
     asrc = os.path.join(castalia_path(), src)
     adst = os.path.join(fileloc, dst)
     os.symlink(asrc, adst)
Exemple #6
0
def buildIncludePath():
    cmd = 'find ' + castalia_path(
    ) + '/src -name "*.h" |xargs dirname |uniq|xargs printf "INCLUDE_PATH+= -I%s\n" > makefrag.inc'
    echoExec(cmd)
Exemple #7
0
def buildCastaliaSharedLib():
    cmd = "opp_makemake -f -r --deep -s -o castalia -u Cmdenv -P %s -M release -X Simulations -X out -X bin" % castalia_path(
    )
    os.chdir(castalia_path())
    echoExec(cmd)
    echoExec("make -j4")
Exemple #8
0
def assertCastaliaSetup():
    assertFileExists(omnetpp_path(), "include/omnetpp.h")
    assertFileExists(castalia_path(), "bin/Castalia")