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
f1b6c9de
Commit
f1b6c9de
authored
Aug 24, 2021
by
Antoine Kaufmann
Browse files
experiments: support for network-to-network connections
parent
ceb1af0f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
experiments/simbricks/experiments.py
experiments/simbricks/experiments.py
+3
-0
experiments/simbricks/simulators.py
experiments/simbricks/simulators.py
+23
-1
No files found.
experiments/simbricks/experiments.py
View file @
f1b6c9de
...
@@ -341,6 +341,9 @@ class ExpEnv(object):
...
@@ -341,6 +341,9 @@ class ExpEnv(object):
def
nic_shm_path
(
self
,
sim
):
def
nic_shm_path
(
self
,
sim
):
return
'%s/nic.shm.%s'
%
(
self
.
workdir
,
sim
.
name
)
return
'%s/nic.shm.%s'
%
(
self
.
workdir
,
sim
.
name
)
def
n2n_eth_path
(
self
,
sim_l
,
sim_c
):
return
'%s/n2n.eth.%s.%s'
%
(
self
.
workdir
,
sim_l
.
name
,
sim_c
.
name
)
def
proxy_shm_path
(
self
,
sim
):
def
proxy_shm_path
(
self
,
sim
):
return
'%s/proxy.shm.%s'
%
(
self
.
workdir
,
sim
.
name
)
return
'%s/proxy.shm.%s'
%
(
self
.
workdir
,
sim
.
name
)
...
...
experiments/simbricks/simulators.py
View file @
f1b6c9de
...
@@ -138,18 +138,40 @@ class NetSim(Simulator):
...
@@ -138,18 +138,40 @@ class NetSim(Simulator):
def
__init__
(
self
):
def
__init__
(
self
):
self
.
nics
=
[]
self
.
nics
=
[]
self
.
net_listen
=
[]
self
.
net_connect
=
[]
super
().
__init__
()
def
full_name
(
self
):
def
full_name
(
self
):
return
'net.'
+
self
.
name
return
'net.'
+
self
.
name
# Connect this netwrok to the listening peer `net`
def
connect_network
(
self
,
net
):
net
.
net_listen
.
append
(
self
)
self
.
net_connect
.
append
(
net
)
def
connect_sockets
(
self
,
env
):
def
connect_sockets
(
self
,
env
):
sockets
=
[]
sockets
=
[]
for
n
in
self
.
nics
:
for
n
in
self
.
nics
:
sockets
.
append
((
n
,
env
.
nic_eth_path
(
n
)))
sockets
.
append
((
n
,
env
.
nic_eth_path
(
n
)))
for
n
in
self
.
net_connect
:
sockets
.
append
((
n
,
env
.
n2n_eth_path
(
n
,
self
)))
return
sockets
return
sockets
def
listen_sockets
(
self
,
env
):
listens
=
[]
for
net
in
self
.
net_listen
:
listens
.
append
((
net
,
env
.
n2n_eth_path
(
self
,
net
)))
return
listens
def
dependencies
(
self
):
def
dependencies
(
self
):
return
self
.
nics
return
self
.
nics
+
self
.
net_connect
def
sockets_cleanup
(
self
,
env
):
return
[
s
for
(
_
,
s
)
in
self
.
listen_sockets
(
env
)]
def
sockets_wait
(
self
,
env
):
return
[
s
for
(
_
,
s
)
in
self
.
listen_sockets
(
env
)]
class
QemuHost
(
HostSim
):
class
QemuHost
(
HostSim
):
...
...
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