simple_ping_sysconf.py 1.38 KB
Newer Older
Hejing Li's avatar
Hejing Li committed
1
import simbricks.orchestration.experiments as exp
2
import simbricks.splitsim.specification as spec
Hejing Li's avatar
Hejing Li committed
3
import simbricks.splitsim.impl as impl
4
5
6
7
8
9
10
11
12
13
14
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

"""
Simple Ping Example:
Host 0 pings Host1

HOST0 -- NIC0 ------ SWITCH ------ NIC1 -- HOST1

"""
system = spec.System()

# create a host instance and a NIC instance then install the NIC on the host
host0 = spec.Host(system)
nic0 = spec.i40eNIC(system)
host0.nic_driver = 'i40e'
host0.ip = '10.0.0.1'
pcichannel0 = spec.PCI(system)
pcichannel0.install(host0, nic0)

host1 = spec.Host(system)
nic1 = spec.i40eNIC(system)
host1.nic_driver = 'i40e'
host1.ip = '10.0.0.2'
pcichannel1 = spec.PCI(system)
pcichannel1.install(host1, nic1)

port0 = spec.NetDev()
port1 = spec.NetDev()
switch = spec.Switch(system)
switch.install_netdev(port0)
switch.install_netdev(port1)

ethchannel0 = spec.Eth(system)
ethchannel0.install(nic0, port0)
ethchannel1 = spec.Eth(system)
ethchannel1.install(nic1, port1)

# configure the software to run on the host
Hejing Li's avatar
Hejing Li committed
41
42
43
44
45
46
47
48
49
50
host0.app = spec.PingClient('10.0.0.2')
host1.app = spec.Sleep()

"""
Execution Config
"""
experiments = []

e = exp.Experiment('simple_ping_sysconf')
host_inst0 = impl.Gem5Sim(e)
51
host_inst0.add(host0)
Hejing Li's avatar
Hejing Li committed
52
53

host_inst1 = impl.Gem5Sim(e)
54
host_inst1.add(host1)
Hejing Li's avatar
Hejing Li committed
55
56

nic_inst0 = impl.I40eNicSim(e)
57
nic_inst0.add(nic0)
Hejing Li's avatar
Hejing Li committed
58
nic_inst1 = impl.I40eNicSim(e)
59
nic_inst1.add(nic1)
Hejing Li's avatar
Hejing Li committed
60
61

net_inst = impl.SwitchBMSim(e)
62
net_inst.add(switch)
Hejing Li's avatar
Hejing Li committed
63
64

experiments.append(e)