Beispiel #1
0
from emulation_lib.emulation import Emulation
from emulation_lib.network_blocks.network_block import NetworkBlock
from emulation_lib.apps.udperf_app import UdperfApp
from emulation_lib.linkcmd_backends.l_ import L_

emu = Emulation("../example.config.py", [0, 1])
emu.setLinkCmdBackend(L_())
n0 = emu.getNode(0)
n1 = emu.getNode(1)

# http://dashif.org/wp-content/uploads/2015/04/DASH-AVC-264-Test-Vectors-v09-CommunityReview.pdf
nb1 = NetworkBlock("./blocks/flicflac")
nb1.setNodes([n0, n1])
nb1.selectInterval(1000)

emu.addNetworkBlocks([nb1])

udperf_app = UdperfApp(n1, n0, 0.0, 12, 10000, 6000, 6001)

n1.addUserResult("/home/nfd/cmdScheduler.log",
                 "cmdSched" + str(n1.getId()) + ".log_%RUN%")

emu.setDuration(14)

emu.addApplications([udperf_app])

emu.setName('flicflac_loss')
emu.setOutputDirectory('./results/' + emu.getName())
emu.setNumberOfRuns(10)
emu.setSecondsBetweenRuns(5)
Beispiel #2
0
from emulation_lib.emulation import Emulation
from emulation_lib.network_blocks.network_block import NetworkBlock
from emulation_lib.apps.udperf_app import UdperfApp
from emulation_lib.linkcmd_backends.b_ import B_
#    ==> n0
#   |^|
#   n1==> n2
#   |v|
#    ==> n3

emu = Emulation("../example.config.py", [0, 1, 2, 3])
emu.setLinkCmdBackend(B_())
n0 = emu.getNode(0)
n1 = emu.getNode(1)
n2 = emu.getNode(2)
n3 = emu.getNode(3)


nb1 = NetworkBlock("./blocks/symmetric")
nb1.setNodes([n0, n1])
nb1.selectInterval(1000)

nb2 = NetworkBlock("./blocks/symmetric")
nb2.setNodes([n2, n1])
nb2.selectInterval(1000)

nb3 = NetworkBlock("./blocks/symmetric")
nb3.setNodes([n3, n1])
nb3.selectInterval(1000)

emu.addNetworkBlocks([nb1, nb2, nb3])
                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()

            groups = {emu.getNode(serverNode): []}
            clientGatewayAssoc = {}

            # add blocks for "last-miles"
            for client_num in range(0, len(client_gateways)):

                gateway_id = client_gateways[client_num]
                client_id = 12 + client_num
                groups[emu.getNode(serverNode)].append(emu.getNode(client_id))
                print("server/client: " + str(serverNode) + "," + str(client_id))

                clientGatewayAssoc[client_id] = emu.getNode(gateway_id)

                wifiNetwork = NetworkBlock(wifi_block)
                wifiNetwork.setNodes([emu.getNode(gateway_id), emu.getNode(client_id)]) # 2 nodes?
                wifiNetwork.selectInterval(WIFI_EMU_CMD_INTERVAL)
# 10.000000	0	0	5522.400
# 11.000000	0	0	5632.848
# 12.000000	0	0	3522.064

# add the network block to the emulation
emu.addNetworkBlocks([wlan])

#
# configure the applications to be run
#
# Perform iperf bandwidth measurement (UDP) from client_node to server_node.
# Create a new application functional block, passing node references.
# This application block takes care of the application lifecycle (here starting/stopping an iperf UDP bandwidth test)
# as well as the collection of results.
# server, client, client_runtime[s], client_bandwidth[Mbps]
iperfApp = iperf_logapp.IperfLogApp(server=emu.getNode(0),
                                    client=emu.getNode(1),
                                    client_runtime=EMULATION_DURATION - 1,
                                    client_bandwidth=100)

# add the application to the emulation object
emu.addApplications([iperfApp])

# schedule some arbitrary commands at three time points (second 0, 30 and 90 of the emulation)
for node in emu.getNodes():
    node.scheduleUserCmd(0, "date > /home/nfd/cmdExample.txt")
    node.scheduleUserCmd(30, "date >> /home/nfd/cmdExample.txt")
    node.scheduleUserCmd(90, "date >> /home/nfd/cmdExample.txt")

# Fetch the files created by the previous commands, additionally fetch the logfiles of the command scheduler.
# addUserResult() adds a file to the emulation results that are to be fetched from the nodes.