for c in range(0, NUM_CLIENTS): client_gateways.append(random.randint(0,11)) client_startTimes = random.sample(range(0, int(EMULATION_DURATION / 2)), NUM_CLIENTS) print("client_start-times: " + str(client_startTimes)) # general emulation settings emu = Emulation("./example.config.py", list(range(0,12 + NUM_CLIENTS))) emu.setName(os.path.basename(wifi_block) + "_" + app_type + "_" + str(run)) emu.setLinkCmdBackend(BDL_()) emu.setSecondsBetweenRuns(5) emu.setOutputDirectory('./results/onlyNdnDemoApps_experiment/' + emu.getName()) emu.setDuration(EMULATION_DURATION) # seconds # ensure NFD-logfiles are cleaned up and wldrdaemons are shutdown for node in emu.getNodes(): node.scheduleUserCmd(constants.SETUP_TIME, "sudo rm /var/run/shm/nfd_packet_log/nfd_packet_log.csv") node.scheduleUserCmd(constants.SETUP_TIME, "sudo killall wldrdaemon_udp") node.scheduleUserCmd(constants.SETUP_TIME, "sudo killall tail") # set up network-blocks abileneNetwork = NetworkBlock("./blocks/abilene") abileneNetwork.setNodes(emu.getNodes()[0:12]) abileneNetwork.selectInterval(1000) # without consequence as network-properties are static anyway (in this scenario) abileneNetwork.addPreprocessingStep(RepeatIntermedFileUntil(EMULATION_DURATION, False)) network_blocks = [] # read topology from file with open("./topologies/abilene.txt","r") as topologyFile: topology = topologyFile.readlines()
emu.setLinkCmdBackend(BDL_()) emu.setSecondsBetweenRuns(5) emu.setOutputDirectory('./results/HelloWorld') # time in seconds, after which a run is to be considered finished, which triggers the fetching # of the results and the initiation of the next run emu.setDuration(EMULATION_DURATION) # seconds # # configure network block # # the folder containing the pre-calculated intermediate files to be used WIFI_BLOCK = "./blocks/simple_mobility_802.11G_AdHoc_constant" # create a new network block object based on the given intermediate file folder wlan = NetworkBlock(WIFI_BLOCK) wlan.setNodes( emu.getNodes() [0:NUMBER_OF_NODES]) # assign all two nodes to be part of the network # select interval of network condition changes # ./blocks/simple_mobility_802.11G_AdHoc_constant/0_1_1000.txt # ./blocks/simple_mobility_802.11G_AdHoc_constant/1_0_1000.txt wlan.selectInterval(1000) # preprocessing steps are ways to modify intermediate files without changing the originals (experimentation) # if the given intermediate files were too long, here we could use a preprocessing step to only take the first n seconds wlan.addPreprocessingStep(RepeatIntermedFileUntil(EMULATION_DURATION, False)) # for this example, we only want to restrict the bandwidth (column #3 in the intermediate file) # and therefore overwrite the columns for delay (#1) and loss (#2) with zeros using the following preprocessing steps wlan.addPreprocessingStep(SetConstantValueForColumn("", 1, 0)) wlan.addPreprocessingStep(SetConstantValueForColumn("", 2, 0)) # before (part of 1_0_1000.txt)