Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
7ccfb9f0
Commit
7ccfb9f0
authored
Oct 21, 2022
by
Jonas Kaufmann
Committed by
Antoine Kaufmann
Nov 17, 2022
Browse files
add simple ping experiment
parent
f3fb7294
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
0 deletions
+71
-0
experiments/pyexps/simple_ping.py
experiments/pyexps/simple_ping.py
+71
-0
No files found.
experiments/pyexps/simple_ping.py
0 → 100644
View file @
7ccfb9f0
# Copyright 2022 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.
"""Simple example experiment, which sets up a client and a server host connected
through a switch. The client pings the server."""
from
simbricks.orchestration.simulators
import
Gem5Host
,
I40eNIC
,
SwitchNet
from
simbricks.orchestration.nodeconfig
import
I40eLinuxNode
,
IdleHost
,
PingClient
from
simbricks.orchestration.experiments
import
Experiment
e
=
Experiment
(
name
=
'simple_ping'
)
e
.
checkpoint
=
True
# use checkpoint and restore to speed up simulation
# create client
client_config
=
I40eLinuxNode
()
# boot Linux with i40e NIC driver
client_config
.
ip
=
'10.0.0.1'
client_config
.
app
=
PingClient
(
server_ip
=
'10.0.0.2'
)
client
=
Gem5Host
(
client_config
)
client
.
name
=
'client'
client
.
wait
=
True
# wait for client simulator to finish execution
e
.
add_host
(
client
)
# attach client's NIC
client_nic
=
I40eNIC
()
e
.
add_nic
(
client_nic
)
client
.
add_nic
(
client_nic
)
# create server
server_config
=
I40eLinuxNode
()
# boot Linux with i40e NIC driver
server_config
.
ip
=
'10.0.0.2'
server_config
.
app
=
IdleHost
()
server
=
Gem5Host
(
server_config
)
server
.
name
=
'server'
e
.
add_host
(
server
)
# attach server's NIC
server_nic
=
I40eNIC
()
e
.
add_nic
(
server_nic
)
server
.
add_nic
(
server_nic
)
# connect NICs over network
network
=
SwitchNet
()
e
.
add_network
(
network
)
client_nic
.
set_network
(
network
)
server_nic
.
set_network
(
network
)
# set more interesting link latencies than default
eth_latency
=
500
*
10
**
3
# 500 us
network
.
eth_latency
=
eth_latency
client_nic
.
eth_latency
=
eth_latency
server_nic
.
eth_latency
=
eth_latency
experiments
=
[
e
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment