qemu_tcp_single.py 3.43 KB
Newer Older
Antoine Kaufmann's avatar
Antoine Kaufmann committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Copyright 2021 Max Planck Institute for Software Systems, and
# National University of Singapore
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

23
24
25
import simbricks.experiments as exp
import simbricks.simulators as sim
import simbricks.nodeconfig as node
26
from simbricks.simulator_utils import create_basic_hosts
27
28
29
30
31
32
33
34
35
36
37


# iperf TCP_single test
# naming convention following host-nic-net-app
# host: qemu
# nic:  cv/cb/ib
# net:  wire/switch/dumbbell/bridge
# app: TCPs

kinds_of_host = ['qemu']
kinds_of_nic = ['cv','cb','ib']
38
kinds_of_net = ['wire', 'switch', 'dumbbell', 'bridge', 'tofino']
39
40
41
42
43
44
45
46
47
48
49
50
kinds_of_app = ['TCPs']

experiments = []

# set network sim
for n in kinds_of_net:
    if n == 'wire':
        net_class = sim.WireNet
    if n == 'switch':
        net_class = sim.SwitchNet
    if n == 'dumbbell':
        net_class = sim.NS3DumbbellNet
51
    if n == 'bridge':
Hejing Li's avatar
Hejing Li committed
52
        net_class = sim.NS3BridgeNet
53
54
    if n == 'tofino':
        net_class = sim.TofinoNet
55
56
57
58
59
60
61


    # set nic sim
    for c in kinds_of_nic:
        net = net_class()
        e = exp.Experiment('qemu-'  + c + '-' + n + '-' + 'TCPs')
        e.add_network(net)
62

63
        if c == 'cv':
64
            servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumVerilatorNIC, sim.QemuHost,
65
                                             node.CorundumLinuxNode, node.IperfTCPServer)
66
            clients = create_basic_hosts(e, 1, 'client', net, sim.CorundumVerilatorNIC, sim.QemuHost,
67
68
                                             node.CorundumLinuxNode, node.IperfTCPClient, ip_start = 2)

69

70
        if c == 'cb':
71
            servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumBMNIC, sim.QemuHost,
72
                                             node.CorundumLinuxNode, node.IperfTCPServer)
73
            clients = create_basic_hosts(e, 1, 'client', net, sim.CorundumBMNIC, sim.QemuHost,
74
                                             node.CorundumLinuxNode, node.IperfTCPClient, ip_start = 2)
75
76


77
78

        if c == 'ib':
79
            servers = create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost,
80
                                             node.I40eLinuxNode, node.IperfTCPServer)
81
            clients = create_basic_hosts(e, 1, 'client', net, sim.I40eNIC, sim.QemuHost,
82
                                             node.I40eLinuxNode, node.IperfTCPClient, ip_start = 2)
83

84
85
86
87
88
89
        clients[0].wait = True
        clients[0].node_config.app.server_ip = servers[0].node_config.ip

        print(e.name)
        experiments.append(e)