nopaxos.py 2.66 KB
Newer Older
1
2
3
4
import modes.experiments as exp
import modes.simulators as sim
import modes.nodeconfig as node

5
host_configs = ['qemu', 'gt']
6
seq_configs = ['swseq', 'ehseq']
7
nic_configs = ['ib', 'cb', 'cv']
8
9
experiments = []

10
11
12
link_rate_opt = '--LinkRate=100Gb/s ' # don't forget space at the end
link_latency_opt = '--LinkLatency=500ns '

13
14
for host_config in host_configs:
    for seq_config in seq_configs:
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
        for nic_config in nic_configs:
            e = exp.Experiment('nopaxos-' + host_config + '-' + nic_config + '-' + seq_config)
            net = sim.NS3SequencerNet()
            net.opt = link_rate_opt + link_latency_opt
            e.add_network(net)

            # host
            if host_config == 'qemu':
                host_class = sim.QemuHost
                # nic
                if nic_config == 'ib':
                    nic_class = sim.I40eNIC
                    nc_class = node.I40eLinuxNode
                elif nic_config == 'cb':
                    nic_class = sim.CorundumBMNIC
                    nc_class = node.CorundumLinuxNode
                else:
                    continue
                
            elif host_config == 'gt':
                host_class = sim.Gem5Host
                e.checkpoint = False
                # nic
                if nic_config == 'ib':
                    nic_class = sim.I40eNIC
                    nc_class = node.I40eLinuxNode
                elif nic_config == 'cb':
                    nic_class = sim.CorundumBMNIC
                    nc_class = node.CorundumLinuxNode
                elif nic_config == 'cv':
                    nic_class = sim.CorundumVerilatorNIC
                    nc_class = node.CorundumLinuxNode
                else:
                    raise NameError(nic_config)
            else:
                raise NameError(host_config)


            nc_class.disk_image = 'nopaxos'

            if seq_config == 'ehseq':
                sequencer = sim.create_basic_hosts(e, 1, 'sequencer', net, nic_class,
                        host_class, nc_class, node.NOPaxosSequencer, ip_start = 100)
                sequencer[0].sleep = 1

            replicas = sim.create_basic_hosts(e, 3, 'replica', net, nic_class,
                    host_class, nc_class, node.NOPaxosReplica)
            for i in range(len(replicas)):
                replicas[i].node_config.app.index = i
                replicas[i].sleep = 1

            clients = sim.create_basic_hosts(e, 1, 'client', net, nic_class,
                    host_class, nc_class, node.NOPaxosClient, ip_start = 4)
            for c in clients:
                c.node_config.app.server_ips = ['10.0.0.1', '10.0.0.2', '10.0.0.3']
                c.wait = True

            experiments.append(e)