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
c2896bf3
Commit
c2896bf3
authored
May 08, 2024
by
Marvin Meiers
Committed by
Antoine Kaufmann
May 08, 2024
Browse files
experiments: reformat python code
parent
1ea0f3bf
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
245 additions
and
246 deletions
+245
-246
experiments/pyexps/e2e_automatic_split.py
experiments/pyexps/e2e_automatic_split.py
+2
-2
experiments/pyexps/e2e_cc.py
experiments/pyexps/e2e_cc.py
+6
-6
experiments/pyexps/e2e_split.py
experiments/pyexps/e2e_split.py
+1
-1
experiments/simbricks/orchestration/e2e_components.py
experiments/simbricks/orchestration/e2e_components.py
+188
-188
experiments/simbricks/orchestration/e2e_helpers.py
experiments/simbricks/orchestration/e2e_helpers.py
+38
-40
experiments/simbricks/orchestration/e2e_topologies.py
experiments/simbricks/orchestration/e2e_topologies.py
+3
-3
experiments/simbricks/orchestration/experiment/experiment_environment.py
...bricks/orchestration/experiment/experiment_environment.py
+3
-1
experiments/simbricks/orchestration/nodeconfig.py
experiments/simbricks/orchestration/nodeconfig.py
+1
-2
experiments/simbricks/orchestration/runners.py
experiments/simbricks/orchestration/runners.py
+1
-1
experiments/simbricks/orchestration/simulators.py
experiments/simbricks/orchestration/simulators.py
+2
-2
No files found.
experiments/pyexps/e2e_automatic_split.py
View file @
c2896bf3
...
@@ -22,12 +22,12 @@
...
@@ -22,12 +22,12 @@
import
typing
as
tp
import
typing
as
tp
import
simbricks.orchestration.e2e_components
as
e2e
import
simbricks.orchestration.experiments
as
exp
import
simbricks.orchestration.experiments
as
exp
import
simbricks.orchestration.nodeconfig
as
node
import
simbricks.orchestration.nodeconfig
as
node
import
simbricks.orchestration.simulators
as
sim
import
simbricks.orchestration.simulators
as
sim
import
simbricks.orchestration.e2e_components
as
e2e
from
simbricks.orchestration.simulator_utils
import
create_tcp_cong_hosts
from
simbricks.orchestration.e2e_helpers
import
E2ELinkAssigner
,
E2ELinkType
from
simbricks.orchestration.e2e_helpers
import
E2ELinkAssigner
,
E2ELinkType
from
simbricks.orchestration.simulator_utils
import
create_tcp_cong_hosts
mtu
=
1500
mtu
=
1500
congestion_control
=
e2e
.
CongestionControl
.
CUBIC
congestion_control
=
e2e
.
CongestionControl
.
CUBIC
...
...
experiments/pyexps/e2e_cc.py
View file @
c2896bf3
...
@@ -20,12 +20,12 @@
...
@@ -20,12 +20,12 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
simbricks.orchestration.e2e_components
as
e2e
import
simbricks.orchestration.experiments
as
exp
import
simbricks.orchestration.experiments
as
exp
import
simbricks.orchestration.nodeconfig
as
node
import
simbricks.orchestration.nodeconfig
as
node
import
simbricks.orchestration.simulators
as
sim
import
simbricks.orchestration.simulators
as
sim
import
simbricks.orchestration.e2e_components
as
e2e
from
simbricks.orchestration.simulator_utils
import
create_tcp_cong_hosts
from
simbricks.orchestration.e2e_topologies
import
E2EDumbbellTopology
from
simbricks.orchestration.e2e_topologies
import
E2EDumbbellTopology
from
simbricks.orchestration.simulator_utils
import
create_tcp_cong_hosts
# iperf TCP_multi_client test
# iperf TCP_multi_client test
# naming convention following host-nic-net-app
# naming convention following host-nic-net-app
...
@@ -160,7 +160,7 @@ for congestion_control in types_of_congestion_control:
...
@@ -160,7 +160,7 @@ for congestion_control in types_of_congestion_control:
freq
,
freq
,
mtu
,
mtu
,
congestion_control
.
gem5
,
congestion_control
.
gem5
,
ip_start
=
2
*
num_ns3_hosts
+
num_simbricks_hosts
+
1
ip_start
=
2
*
num_ns3_hosts
+
num_simbricks_hosts
+
1
)
)
for
i
,
server
in
enumerate
(
servers
,
1
):
for
i
,
server
in
enumerate
(
servers
,
1
):
...
...
experiments/pyexps/e2e_split.py
View file @
c2896bf3
...
@@ -20,10 +20,10 @@
...
@@ -20,10 +20,10 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import
simbricks.orchestration.e2e_components
as
e2e
import
simbricks.orchestration.experiments
as
exp
import
simbricks.orchestration.experiments
as
exp
import
simbricks.orchestration.nodeconfig
as
node
import
simbricks.orchestration.nodeconfig
as
node
import
simbricks.orchestration.simulators
as
sim
import
simbricks.orchestration.simulators
as
sim
import
simbricks.orchestration.e2e_components
as
e2e
from
simbricks.orchestration.simulator_utils
import
create_tcp_cong_hosts
from
simbricks.orchestration.simulator_utils
import
create_tcp_cong_hosts
# iperf TCP_multi_client test
# iperf TCP_multi_client test
...
...
experiments/simbricks/orchestration/e2e_components.py
View file @
c2896bf3
...
@@ -29,23 +29,23 @@ from enum import Enum
...
@@ -29,23 +29,23 @@ from enum import Enum
class
CongestionControl
(
Enum
):
class
CongestionControl
(
Enum
):
RENO
=
(
"
ns3::TcpLinuxReno
"
,
"
reno
"
)
RENO
=
(
'
ns3::TcpLinuxReno
'
,
'
reno
'
)
WESTWOOD
=
(
"
ns3::TcpWestwoodPlus
"
,
"
westwood
"
)
WESTWOOD
=
(
'
ns3::TcpWestwoodPlus
'
,
'
westwood
'
)
BIC
=
(
"
ns3::TcpBic
"
,
"
bic
"
)
BIC
=
(
'
ns3::TcpBic
'
,
'
bic
'
)
CUBIC
=
(
"
ns3::TcpCubic
"
,
"
cubic
"
)
CUBIC
=
(
'
ns3::TcpCubic
'
,
'
cubic
'
)
HTCP
=
(
"
ns3::TcpHtcp
"
,
"
htcp
"
)
HTCP
=
(
'
ns3::TcpHtcp
'
,
'
htcp
'
)
HYBLA
=
(
"
ns3::TcpHybla
"
,
"
hybla
"
)
HYBLA
=
(
'
ns3::TcpHybla
'
,
'
hybla
'
)
VEGAS
=
(
"
ns3::TcpVegas
"
,
"
vegas
"
)
VEGAS
=
(
'
ns3::TcpVegas
'
,
'
vegas
'
)
NV
=
(
""
,
"
nv
"
)
NV
=
(
''
,
'
nv
'
)
SCALABLE
=
(
"
ns3::TcpScalable
"
,
"
scalable
"
)
SCALABLE
=
(
'
ns3::TcpScalable
'
,
'
scalable
'
)
LP
=
(
"
ns3::TcpLp
"
,
"
lp
"
)
LP
=
(
'
ns3::TcpLp
'
,
'
lp
'
)
VENO
=
(
"
ns3::TcpVeno
"
,
"
veno
"
)
VENO
=
(
'
ns3::TcpVeno
'
,
'
veno
'
)
YEAH
=
(
"
ns3::TcpYeah
"
,
"
yeah
"
)
YEAH
=
(
'
ns3::TcpYeah
'
,
'
yeah
'
)
ILLINOIS
=
(
"
ns3::TcpIllinois
"
,
"
illinois
"
)
ILLINOIS
=
(
'
ns3::TcpIllinois
'
,
'
illinois
'
)
DCTCP
=
(
"
ns3::TcpDctcp
"
,
"
dctcp
"
)
DCTCP
=
(
'
ns3::TcpDctcp
'
,
'
dctcp
'
)
CDG
=
(
""
,
"
cdg
"
)
CDG
=
(
''
,
'
cdg
'
)
BBR
=
(
"
ns3::TcpBbr
"
,
"
bbr
"
)
BBR
=
(
'
ns3::TcpBbr
'
,
'
bbr
'
)
HIGHSPEED
=
(
"
ns3::TcpHighSpeed
"
,
"
highspeed
"
)
HIGHSPEED
=
(
'
ns3::TcpHighSpeed
'
,
'
highspeed
'
)
def
__init__
(
self
,
ns3_str
,
gem5_str
):
def
__init__
(
self
,
ns3_str
,
gem5_str
):
self
.
ns3_str
=
ns3_str
self
.
ns3_str
=
ns3_str
...
@@ -56,10 +56,10 @@ class CongestionControl(Enum):
...
@@ -56,10 +56,10 @@ class CongestionControl(Enum):
@
property
@
property
def
ns3
(
self
):
def
ns3
(
self
):
if
self
.
ns3_str
==
""
:
if
self
.
ns3_str
==
''
:
raise
AttributeError
(
raise
AttributeError
(
f
"
There is no ns3 implementation for
"
f
'
There is no ns3 implementation for
'
f
"
{
self
.
name
}
available
"
f
'
{
self
.
name
}
available
'
)
)
return
self
.
ns3_str
return
self
.
ns3_str
...
@@ -81,25 +81,25 @@ class SimbricksSyncMode(Enum):
...
@@ -81,25 +81,25 @@ class SimbricksSyncMode(Enum):
class
Ns3LoggingLevel
(
Enum
):
class
Ns3LoggingLevel
(
Enum
):
ERROR
=
"
error
"
ERROR
=
'
error
'
LEVEL_ERROR
=
"
level_error
"
LEVEL_ERROR
=
'
level_error
'
WARN
=
"
warn
"
WARN
=
'
warn
'
LEVEL_WARN
=
"
level_warn
"
LEVEL_WARN
=
'
level_warn
'
DEBUG
=
"
debug
"
DEBUG
=
'
debug
'
LEVEL_DEBUG
=
"
level_debug
"
LEVEL_DEBUG
=
'
level_debug
'
INFO
=
"
info
"
INFO
=
'
info
'
LEVEL_INFO
=
"
level_info
"
LEVEL_INFO
=
'
level_info
'
FUNCTION
=
"
function
"
FUNCTION
=
'
function
'
LEVEL_FUNCTION
=
"
level_function
"
LEVEL_FUNCTION
=
'
level_function
'
LOGIC
=
"
logic
"
LOGIC
=
'
logic
'
LEVEL_LOGIC
=
"
level_logic
"
LEVEL_LOGIC
=
'
level_logic
'
ALL
=
"
all
"
ALL
=
'
all
'
LEVEL_ALL
=
"
level_all
"
LEVEL_ALL
=
'
level_all
'
PREFIX_FUNC
=
"
prefix_func
"
PREFIX_FUNC
=
'
prefix_func
'
PREFIX_TIME
=
"
prefix_time
"
PREFIX_TIME
=
'
prefix_time
'
PREFIX_NODE
=
"
prefix_node
"
PREFIX_NODE
=
'
prefix_node
'
PREFIX_LEVEL
=
"
prefix_level
"
PREFIX_LEVEL
=
'
prefix_level
'
PREFIX_ALL
=
"
prefix_all
"
PREFIX_ALL
=
'
prefix_all
'
class
E2EBase
(
ABC
):
class
E2EBase
(
ABC
):
...
@@ -112,16 +112,16 @@ class E2EBase(ABC):
...
@@ -112,16 +112,16 @@ class E2EBase(ABC):
def
ns3_config
(
self
)
->
str
:
def
ns3_config
(
self
)
->
str
:
config_list
=
[]
config_list
=
[]
for
key
,
value
in
self
.
mapping
.
items
():
for
key
,
value
in
self
.
mapping
.
items
():
if
value
==
""
:
if
value
==
''
:
continue
continue
config_list
.
append
(
f
"
{
key
}
:
{
value
}
"
)
config_list
.
append
(
f
'
{
key
}
:
{
value
}
'
)
config
=
";"
.
join
(
config_list
)
config
=
';'
.
join
(
config_list
)
child_configs
=
" "
.
join
([
child_configs
=
' '
.
join
([
child
.
ns3_config
()
for
child
in
self
.
components
child
.
ns3_config
()
for
child
in
self
.
components
])
])
return
f
"
--
{
self
.
category
}
=
\
"
{
config
}
\
"
{
child_configs
}
"
return
f
'
--
{
self
.
category
}
="
{
config
}
"
{
child_configs
}
'
@
abstractmethod
@
abstractmethod
def
add_component
(
self
,
component
:
E2EComponent
)
->
None
:
def
add_component
(
self
,
component
:
E2EComponent
)
->
None
:
...
@@ -132,13 +132,13 @@ class E2EGlobalConfig(E2EBase):
...
@@ -132,13 +132,13 @@ class E2EGlobalConfig(E2EBase):
def
__init__
(
self
)
->
None
:
def
__init__
(
self
)
->
None
:
super
().
__init__
()
super
().
__init__
()
self
.
category
=
"
Global
"
self
.
category
=
'
Global
'
self
.
stop_time
=
""
self
.
stop_time
=
''
self
.
mac_start
=
0
self
.
mac_start
=
0
def
ns3_config
(
self
)
->
str
:
def
ns3_config
(
self
)
->
str
:
self
.
mapping
.
update
({
self
.
mapping
.
update
({
"
StopTime
"
:
self
.
stop_time
,
"
MACStart
"
:
str
(
self
.
mac_start
)
'
StopTime
'
:
self
.
stop_time
,
'
MACStart
'
:
str
(
self
.
mac_start
)
})
})
return
super
().
ns3_config
()
return
super
().
ns3_config
()
...
@@ -150,12 +150,12 @@ class E2ENs3Logging(E2EBase):
...
@@ -150,12 +150,12 @@ class E2ENs3Logging(E2EBase):
def
__init__
(
self
)
->
None
:
def
__init__
(
self
)
->
None
:
super
().
__init__
()
super
().
__init__
()
self
.
category
=
"
Logging
"
self
.
category
=
'
Logging
'
self
.
logging
:
tp
.
Dict
[
str
,
tp
.
List
[
Ns3LoggingLevel
]]
=
{}
self
.
logging
:
tp
.
Dict
[
str
,
tp
.
List
[
Ns3LoggingLevel
]]
=
{}
def
ns3_config
(
self
)
->
str
:
def
ns3_config
(
self
)
->
str
:
for
component
,
levels
in
self
.
logging
.
items
():
for
component
,
levels
in
self
.
logging
.
items
():
levels_str
=
"|"
.
join
([
level
.
value
for
level
in
levels
])
levels_str
=
'|'
.
join
([
level
.
value
for
level
in
levels
])
self
.
mapping
.
update
([(
component
,
levels_str
)])
self
.
mapping
.
update
([(
component
,
levels_str
)])
return
super
().
ns3_config
()
return
super
().
ns3_config
()
...
@@ -176,12 +176,12 @@ class E2EComponent(E2EBase):
...
@@ -176,12 +176,12 @@ class E2EComponent(E2EBase):
self
.
name
=
idd
self
.
name
=
idd
self
.
id
=
idd
self
.
id
=
idd
self
.
has_path
=
False
self
.
has_path
=
False
self
.
type
=
""
self
.
type
=
''
def
ns3_config
(
self
)
->
str
:
def
ns3_config
(
self
)
->
str
:
if
self
.
id
==
""
or
self
.
type
==
""
:
if
self
.
id
==
''
or
self
.
type
==
''
:
raise
AttributeError
(
"
Id or Type cannot be empty
"
)
raise
AttributeError
(
'
Id or Type cannot be empty
'
)
self
.
mapping
.
update
({
"
Id
"
:
self
.
id
,
"
Type
"
:
self
.
type
})
self
.
mapping
.
update
({
'
Id
'
:
self
.
id
,
'
Type
'
:
self
.
type
})
return
super
().
ns3_config
()
return
super
().
ns3_config
()
...
@@ -191,12 +191,12 @@ class E2EComponent(E2EBase):
...
@@ -191,12 +191,12 @@ class E2EComponent(E2EBase):
def
resolve_paths
(
self
)
->
None
:
def
resolve_paths
(
self
)
->
None
:
self
.
has_path
=
True
self
.
has_path
=
True
for
component
in
self
.
components
:
for
component
in
self
.
components
:
path
=
f
"
{
self
.
id
}
/
{
component
.
id
}
"
path
=
f
'
{
self
.
id
}
/
{
component
.
id
}
'
if
component
.
has_path
:
if
component
.
has_path
:
raise
AttributeError
(
raise
AttributeError
(
f
"
Component
{
component
.
id
}
was already
"
f
'
Component
{
component
.
id
}
was already
'
f
"
added to another component (while trying
"
f
'
added to another component (while trying
'
f
"
to assign
{
path
}
).
"
f
'
to assign
{
path
}
).
'
)
)
component
.
id
=
path
component
.
id
=
path
component
.
resolve_paths
()
component
.
resolve_paths
()
...
@@ -206,7 +206,7 @@ class E2ETopologyNode(E2EComponent):
...
@@ -206,7 +206,7 @@ class E2ETopologyNode(E2EComponent):
def
__init__
(
self
,
idd
:
str
)
->
None
:
def
__init__
(
self
,
idd
:
str
)
->
None
:
super
().
__init__
(
idd
)
super
().
__init__
(
idd
)
self
.
category
=
"
TopologyNode
"
self
.
category
=
'
TopologyNode
'
self
.
network
=
None
self
.
network
=
None
...
@@ -214,12 +214,12 @@ class E2ESwitchNode(E2ETopologyNode):
...
@@ -214,12 +214,12 @@ class E2ESwitchNode(E2ETopologyNode):
def
__init__
(
self
,
idd
:
str
)
->
None
:
def
__init__
(
self
,
idd
:
str
)
->
None
:
super
().
__init__
(
idd
)
super
().
__init__
(
idd
)
self
.
type
=
"
Switch
"
self
.
type
=
'
Switch
'
self
.
mtu
=
""
self
.
mtu
=
''
def
ns3_config
(
self
)
->
str
:
def
ns3_config
(
self
)
->
str
:
self
.
mapping
.
update
({
self
.
mapping
.
update
({
"
Mtu
"
:
self
.
mtu
,
'
Mtu
'
:
self
.
mtu
,
})
})
return
super
().
ns3_config
()
return
super
().
ns3_config
()
...
@@ -228,49 +228,49 @@ class E2ETopologyChannel(E2EComponent):
...
@@ -228,49 +228,49 @@ class E2ETopologyChannel(E2EComponent):
def
__init__
(
self
,
idd
:
str
)
->
None
:
def
__init__
(
self
,
idd
:
str
)
->
None
:
super
().
__init__
(
idd
)
super
().
__init__
(
idd
)
self
.
category
=
"
TopologyChannel
"
self
.
category
=
'
TopologyChannel
'
class
E2ESimpleChannel
(
E2ETopologyChannel
):
class
E2ESimpleChannel
(
E2ETopologyChannel
):
def
__init__
(
self
,
idd
:
str
)
->
None
:
def
__init__
(
self
,
idd
:
str
)
->
None
:
super
().
__init__
(
idd
)
super
().
__init__
(
idd
)
self
.
type
=
"
Simple
"
self
.
type
=
'
Simple
'
self
.
data_rate
=
""
self
.
data_rate
=
''
self
.
queue_type
=
"
ns3::DropTailQueue
"
self
.
queue_type
=
'
ns3::DropTailQueue
'
self
.
queue_size
=
""
self
.
queue_size
=
''
self
.
channel_type
=
"
ns3::SimpleChannel
"
self
.
channel_type
=
'
ns3::SimpleChannel
'
self
.
delay
=
""
self
.
delay
=
''
self
.
left_node
:
E2ETopologyNode
self
.
left_node
:
E2ETopologyNode
self
.
right_node
:
E2ETopologyNode
self
.
right_node
:
E2ETopologyNode
def
ns3_config
(
self
)
->
str
:
def
ns3_config
(
self
)
->
str
:
if
self
.
left_node
is
None
or
self
.
right_node
is
None
:
if
self
.
left_node
is
None
or
self
.
right_node
is
None
:
raise
AttributeError
(
f
"
Not all nodes for channel
{
self
.
id
}
given
"
)
raise
AttributeError
(
f
'
Not all nodes for channel
{
self
.
id
}
given
'
)
self
.
mapping
.
update
({
self
.
mapping
.
update
({
"
Device-DataRate
"
:
self
.
data_rate
,
'
Device-DataRate
'
:
self
.
data_rate
,
"
QueueType
"
:
self
.
queue_type
,
'
QueueType
'
:
self
.
queue_type
,
"
Queue-MaxSize
"
:
self
.
queue_size
,
'
Queue-MaxSize
'
:
self
.
queue_size
,
"
ChannelType
"
:
self
.
channel_type
,
'
ChannelType
'
:
self
.
channel_type
,
"
Channel-Delay
"
:
self
.
delay
,
'
Channel-Delay
'
:
self
.
delay
,
"
LeftNode
"
:
self
.
left_node
.
id
,
'
LeftNode
'
:
self
.
left_node
.
id
,
"
RightNode
"
:
self
.
right_node
.
id
,
'
RightNode
'
:
self
.
right_node
.
id
,
})
})
return
super
().
ns3_config
()
return
super
().
ns3_config
()
def
add_device_attr
(
self
,
key
:
str
,
value
:
str
)
->
None
:
def
add_device_attr
(
self
,
key
:
str
,
value
:
str
)
->
None
:
if
not
key
.
startswith
(
"
Device-
"
):
if
not
key
.
startswith
(
'
Device-
'
):
key
=
f
"
Device-
{
key
}
"
key
=
f
'
Device-
{
key
}
'
self
.
mapping
.
update
({
key
:
value
})
self
.
mapping
.
update
({
key
:
value
})
def
add_queue_attr
(
self
,
key
:
str
,
value
:
str
)
->
None
:
def
add_queue_attr
(
self
,
key
:
str
,
value
:
str
)
->
None
:
if
not
key
.
startswith
(
"
Queue-
"
):
if
not
key
.
startswith
(
'
Queue-
'
):
key
=
f
"
Queue-
{
key
}
"
key
=
f
'
Queue-
{
key
}
'
self
.
mapping
.
update
({
key
:
value
})
self
.
mapping
.
update
({
key
:
value
})
def
add_channel_attr
(
self
,
key
:
str
,
value
:
str
)
->
None
:
def
add_channel_attr
(
self
,
key
:
str
,
value
:
str
)
->
None
:
if
not
key
.
startswith
(
"
Channel-
"
):
if
not
key
.
startswith
(
'
Channel-
'
):
key
=
f
"
Channel-
{
key
}
"
key
=
f
'
Channel-
{
key
}
'
self
.
mapping
.
update
({
key
:
value
})
self
.
mapping
.
update
({
key
:
value
})
...
@@ -278,7 +278,7 @@ class E2ENetwork(E2EComponent):
...
@@ -278,7 +278,7 @@ class E2ENetwork(E2EComponent):
def
__init__
(
self
,
idd
:
str
)
->
None
:
def
__init__
(
self
,
idd
:
str
)
->
None
:
super
().
__init__
(
idd
)
super
().
__init__
(
idd
)
self
.
category
=
"
Network
"
self
.
category
=
'
Network
'
self
.
peer
=
None
self
.
peer
=
None
def
set_peer
(
self
,
peer
:
E2ENetwork
):
def
set_peer
(
self
,
peer
:
E2ENetwork
):
...
@@ -290,14 +290,14 @@ class E2ENetworkSimbricks(E2ENetwork):
...
@@ -290,14 +290,14 @@ class E2ENetworkSimbricks(E2ENetwork):
def
__init__
(
self
,
idd
:
str
)
->
None
:
def
__init__
(
self
,
idd
:
str
)
->
None
:
super
().
__init__
(
idd
)
super
().
__init__
(
idd
)
self
.
type
=
"
Simbricks
"
self
.
type
=
'
Simbricks
'
self
.
adapter_type
=
SimbricksAdapterType
.
NETWORK
self
.
adapter_type
=
SimbricksAdapterType
.
NETWORK
self
.
unix_socket
=
""
self
.
unix_socket
=
''
self
.
sync_delay
=
""
self
.
sync_delay
=
''
self
.
poll_delay
=
""
self
.
poll_delay
=
''
self
.
eth_latency
=
""
self
.
eth_latency
=
''
self
.
listen
:
tp
.
Optional
[
bool
]
=
None
self
.
listen
:
tp
.
Optional
[
bool
]
=
None
self
.
shm_path
=
""
self
.
shm_path
=
''
self
.
sync
:
SimbricksSyncMode
=
SimbricksSyncMode
.
SYNC_OPTIONAL
self
.
sync
:
SimbricksSyncMode
=
SimbricksSyncMode
.
SYNC_OPTIONAL
self
.
simbricks_component
=
None
self
.
simbricks_component
=
None
...
@@ -305,16 +305,16 @@ class E2ENetworkSimbricks(E2ENetwork):
...
@@ -305,16 +305,16 @@ class E2ENetworkSimbricks(E2ENetwork):
def
ns3_config
(
self
)
->
str
:
def
ns3_config
(
self
)
->
str
:
if
self
.
listen
is
None
:
if
self
.
listen
is
None
:
raise
AttributeError
(
raise
AttributeError
(
f
"
Listen mode not specified for simbricks adapter
{
self
.
id
}
"
f
'
Listen mode not specified for simbricks adapter
{
self
.
id
}
'
)
)
self
.
mapping
.
update
({
self
.
mapping
.
update
({
"
UnixSocket
"
:
self
.
unix_socket
,
'
UnixSocket
'
:
self
.
unix_socket
,
"
SyncDelay
"
:
self
.
sync_delay
,
'
SyncDelay
'
:
self
.
sync_delay
,
"
PollDelay
"
:
self
.
poll_delay
,
'
PollDelay
'
:
self
.
poll_delay
,
"
EthLatency
"
:
self
.
eth_latency
,
'
EthLatency
'
:
self
.
eth_latency
,
"
Listen
"
:
"
true
"
if
self
.
listen
else
"
false
"
,
'
Listen
'
:
'
true
'
if
self
.
listen
else
'
false
'
,
"
ShmPath
"
:
self
.
shm_path
,
'
ShmPath
'
:
self
.
shm_path
,
"
Sync
"
:
""
if
self
.
sync
is
None
else
f
"
{
self
.
sync
.
value
}
"
,
'
Sync
'
:
''
if
self
.
sync
is
None
else
f
'
{
self
.
sync
.
value
}
'
,
})
})
return
super
().
ns3_config
()
return
super
().
ns3_config
()
...
@@ -323,30 +323,30 @@ class E2EHost(E2EComponent):
...
@@ -323,30 +323,30 @@ class E2EHost(E2EComponent):
def
__init__
(
self
,
idd
:
str
)
->
None
:
def
__init__
(
self
,
idd
:
str
)
->
None
:
super
().
__init__
(
idd
)
super
().
__init__
(
idd
)
self
.
category
=
"
Host
"
self
.
category
=
'
Host
'
class
E2ESimbricksHost
(
E2EHost
):
class
E2ESimbricksHost
(
E2EHost
):
def
__init__
(
self
,
idd
:
str
)
->
None
:
def
__init__
(
self
,
idd
:
str
)
->
None
:
super
().
__init__
(
idd
)
super
().
__init__
(
idd
)
self
.
type
=
"
Simbricks
"
self
.
type
=
'
Simbricks
'
self
.
adapter_type
=
SimbricksAdapterType
.
NIC
self
.
adapter_type
=
SimbricksAdapterType
.
NIC
self
.
unix_socket
=
""
self
.
unix_socket
=
''
self
.
sync_delay
=
""
self
.
sync_delay
=
''
self
.
poll_delay
=
""
self
.
poll_delay
=
''
self
.
eth_latency
=
""
self
.
eth_latency
=
''
self
.
sync
:
SimbricksSyncMode
=
SimbricksSyncMode
.
SYNC_OPTIONAL
self
.
sync
:
SimbricksSyncMode
=
SimbricksSyncMode
.
SYNC_OPTIONAL
self
.
simbricks_component
=
None
self
.
simbricks_component
=
None
def
ns3_config
(
self
)
->
str
:
def
ns3_config
(
self
)
->
str
:
self
.
mapping
.
update
({
self
.
mapping
.
update
({
"
UnixSocket
"
:
self
.
unix_socket
,
'
UnixSocket
'
:
self
.
unix_socket
,
"
SyncDelay
"
:
self
.
sync_delay
,
'
SyncDelay
'
:
self
.
sync_delay
,
"
PollDelay
"
:
self
.
poll_delay
,
'
PollDelay
'
:
self
.
poll_delay
,
"
EthLatency
"
:
self
.
eth_latency
,
'
EthLatency
'
:
self
.
eth_latency
,
"
Sync
"
:
""
if
self
.
sync
is
None
else
f
"
{
self
.
sync
.
value
}
"
,
'
Sync
'
:
''
if
self
.
sync
is
None
else
f
'
{
self
.
sync
.
value
}
'
,
})
})
return
super
().
ns3_config
()
return
super
().
ns3_config
()
...
@@ -355,44 +355,44 @@ class E2ESimpleNs3Host(E2EHost):
...
@@ -355,44 +355,44 @@ class E2ESimpleNs3Host(E2EHost):
def
__init__
(
self
,
idd
:
str
)
->
None
:
def
__init__
(
self
,
idd
:
str
)
->
None
:
super
().
__init__
(
idd
)
super
().
__init__
(
idd
)
self
.
type
=
"
SimpleNs3
"
self
.
type
=
'
SimpleNs3
'
self
.
data_rate
=
""
self
.
data_rate
=
''
self
.
queue_type
=
"
ns3::DropTailQueue
"
self
.
queue_type
=
'
ns3::DropTailQueue
'
self
.
queue_size
=
""
self
.
queue_size
=
''
self
.
channel_type
=
"
ns3::SimpleChannel
"
self
.
channel_type
=
'
ns3::SimpleChannel
'
self
.
delay
=
""
self
.
delay
=
''
self
.
congestion_control
:
CongestionControl
=
None
self
.
congestion_control
:
CongestionControl
=
None
self
.
ip
=
""
self
.
ip
=
''
def
ns3_config
(
self
)
->
str
:
def
ns3_config
(
self
)
->
str
:
if
self
.
congestion_control
is
None
:
if
self
.
congestion_control
is
None
:
cc
=
""
cc
=
''
else
:
else
:
cc
=
self
.
congestion_control
.
ns3
cc
=
self
.
congestion_control
.
ns3
self
.
mapping
.
update
({
self
.
mapping
.
update
({
"
Device-DataRate
"
:
self
.
data_rate
,
'
Device-DataRate
'
:
self
.
data_rate
,
"
QueueType
"
:
self
.
queue_type
,
'
QueueType
'
:
self
.
queue_type
,
"
Queue-MaxSize
"
:
self
.
queue_size
,
'
Queue-MaxSize
'
:
self
.
queue_size
,
"
ChannelType
"
:
self
.
channel_type
,
'
ChannelType
'
:
self
.
channel_type
,
"
Channel-Delay
"
:
self
.
delay
,
'
Channel-Delay
'
:
self
.
delay
,
"
CongestionControl
"
:
cc
,
'
CongestionControl
'
:
cc
,
"
Ip
"
:
self
.
ip
,
'
Ip
'
:
self
.
ip
,
})
})
return
super
().
ns3_config
()
return
super
().
ns3_config
()
def
add_device_attr
(
self
,
key
:
str
,
value
:
str
)
->
None
:
def
add_device_attr
(
self
,
key
:
str
,
value
:
str
)
->
None
:
if
not
key
.
startswith
(
"
Device-
"
):
if
not
key
.
startswith
(
'
Device-
'
):
key
=
f
"
Device-
{
key
}
"
key
=
f
'
Device-
{
key
}
'
self
.
mapping
.
update
({
key
:
value
})
self
.
mapping
.
update
({
key
:
value
})
def
add_queue_attr
(
self
,
key
:
str
,
value
:
str
)
->
None
:
def
add_queue_attr
(
self
,
key
:
str
,
value
:
str
)
->
None
:
if
not
key
.
startswith
(
"
Queue-
"
):
if
not
key
.
startswith
(
'
Queue-
'
):
key
=
f
"
Queue-
{
key
}
"
key
=
f
'
Queue-
{
key
}
'
self
.
mapping
.
update
({
key
:
value
})
self
.
mapping
.
update
({
key
:
value
})
def
add_channel_attr
(
self
,
key
:
str
,
value
:
str
)
->
None
:
def
add_channel_attr
(
self
,
key
:
str
,
value
:
str
)
->
None
:
if
not
key
.
startswith
(
"
Channel-
"
):
if
not
key
.
startswith
(
'
Channel-
'
):
key
=
f
"
Channel-
{
key
}
"
key
=
f
'
Channel-
{
key
}
'
self
.
mapping
.
update
({
key
:
value
})
self
.
mapping
.
update
({
key
:
value
})
...
@@ -400,14 +400,14 @@ class E2EApplication(E2EComponent):
...
@@ -400,14 +400,14 @@ class E2EApplication(E2EComponent):
def
__init__
(
self
,
idd
:
str
)
->
None
:
def
__init__
(
self
,
idd
:
str
)
->
None
:
super
().
__init__
(
idd
)
super
().
__init__
(
idd
)
self
.
category
=
"
App
"
self
.
category
=
'
App
'
self
.
start_time
=
""
self
.
start_time
=
''
self
.
stop_time
=
""
self
.
stop_time
=
''
def
ns3_config
(
self
)
->
str
:
def
ns3_config
(
self
)
->
str
:
self
.
mapping
.
update
({
self
.
mapping
.
update
({
"
StartTime
"
:
self
.
start_time
,
'
StartTime
'
:
self
.
start_time
,
"
StopTime
"
:
self
.
stop_time
,
'
StopTime
'
:
self
.
stop_time
,
})
})
return
super
().
ns3_config
()
return
super
().
ns3_config
()
...
@@ -416,14 +416,14 @@ class E2EPacketSinkApplication(E2EApplication):
...
@@ -416,14 +416,14 @@ class E2EPacketSinkApplication(E2EApplication):
def
__init__
(
self
,
idd
:
str
)
->
None
:
def
__init__
(
self
,
idd
:
str
)
->
None
:
super
().
__init__
(
idd
)
super
().
__init__
(
idd
)
self
.
type
=
"
PacketSink
"
self
.
type
=
'
PacketSink
'
self
.
protocol
=
"
ns3::TcpSocketFactory
"
self
.
protocol
=
'
ns3::TcpSocketFactory
'
self
.
local_ip
=
""
self
.
local_ip
=
''
def
ns3_config
(
self
)
->
str
:
def
ns3_config
(
self
)
->
str
:
self
.
mapping
.
update
({
self
.
mapping
.
update
({
"
Protocol
"
:
self
.
protocol
,
'
Protocol
'
:
self
.
protocol
,
"
Local
"
:
self
.
local_ip
,
'
Local
'
:
self
.
local_ip
,
})
})
return
super
().
ns3_config
()
return
super
().
ns3_config
()
...
@@ -432,14 +432,14 @@ class E2EBulkSendApplication(E2EApplication):
...
@@ -432,14 +432,14 @@ class E2EBulkSendApplication(E2EApplication):
def
__init__
(
self
,
idd
:
str
)
->
None
:
def
__init__
(
self
,
idd
:
str
)
->
None
:
super
().
__init__
(
idd
)
super
().
__init__
(
idd
)
self
.
type
=
"
BulkSender
"
self
.
type
=
'
BulkSender
'
self
.
protocol
=
"
ns3::TcpSocketFactory
"
self
.
protocol
=
'
ns3::TcpSocketFactory
'
self
.
remote_ip
=
""
self
.
remote_ip
=
''
def
ns3_config
(
self
)
->
str
:
def
ns3_config
(
self
)
->
str
:
self
.
mapping
.
update
({
self
.
mapping
.
update
({
"
Protocol
"
:
self
.
protocol
,
'
Protocol
'
:
self
.
protocol
,
"
Remote
"
:
self
.
remote_ip
,
'
Remote
'
:
self
.
remote_ip
,
})
})
return
super
().
ns3_config
()
return
super
().
ns3_config
()
...
@@ -447,12 +447,12 @@ class E2EBulkSendApplication(E2EApplication):
...
@@ -447,12 +447,12 @@ class E2EBulkSendApplication(E2EApplication):
class
E2ENs3RandomVariable
(
ABC
):
class
E2ENs3RandomVariable
(
ABC
):
def
__init__
(
self
)
->
None
:
def
__init__
(
self
)
->
None
:
self
.
type_id
=
""
self
.
type_id
=
''
def
get_config
(
self
)
->
str
:
def
get_config
(
self
)
->
str
:
params
=
self
.
get_parameters
()
params
=
self
.
get_parameters
()
if
params
:
if
params
:
return
f
"
{
self
.
type_id
}
[
{
params
}
]
"
return
f
'
{
self
.
type_id
}
[
{
params
}
]
'
else
:
else
:
return
self
.
type_id
return
self
.
type_id
...
@@ -465,55 +465,55 @@ class E2ENs3ConstantRandomVariable(E2ENs3RandomVariable):
...
@@ -465,55 +465,55 @@ class E2ENs3ConstantRandomVariable(E2ENs3RandomVariable):
def
__init__
(
self
)
->
None
:
def
__init__
(
self
)
->
None
:
super
().
__init__
()
super
().
__init__
()
self
.
type_id
=
"
ns3::ConstantRandomVariable
"
self
.
type_id
=
'
ns3::ConstantRandomVariable
'
self
.
constant
:
tp
.
Optional
[
float
]
=
None
self
.
constant
:
tp
.
Optional
[
float
]
=
None
def
get_parameters
(
self
)
->
str
:
def
get_parameters
(
self
)
->
str
:
params
=
[]
params
=
[]
if
self
.
constant
:
if
self
.
constant
:
params
.
append
(
f
"
Constant=
{
self
.
constant
}
"
)
params
.
append
(
f
'
Constant=
{
self
.
constant
}
'
)
return
"|"
.
join
(
params
)
return
'|'
.
join
(
params
)
class
E2ENs3UniformRandomVariable
(
E2ENs3RandomVariable
):
class
E2ENs3UniformRandomVariable
(
E2ENs3RandomVariable
):
def
__init__
(
self
)
->
None
:
def
__init__
(
self
)
->
None
:
super
().
__init__
()
super
().
__init__
()
self
.
type_id
=
"
ns3::UniformRandomVariable
"
self
.
type_id
=
'
ns3::UniformRandomVariable
'
self
.
min
:
tp
.
Optional
[
float
]
=
None
self
.
min
:
tp
.
Optional
[
float
]
=
None
self
.
max
:
tp
.
Optional
[
float
]
=
None
self
.
max
:
tp
.
Optional
[
float
]
=
None
def
get_parameters
(
self
)
->
str
:
def
get_parameters
(
self
)
->
str
:
params
=
[]
params
=
[]
if
self
.
min
:
if
self
.
min
:
params
.
append
(
f
"
Min=
{
self
.
min
}
"
)
params
.
append
(
f
'
Min=
{
self
.
min
}
'
)
if
self
.
max
:
if
self
.
max
:
params
.
append
(
f
"
Max=
{
self
.
max
}
"
)
params
.
append
(
f
'
Max=
{
self
.
max
}
'
)
return
"|"
.
join
(
params
)
return
'|'
.
join
(
params
)
class
E2ENs3ExponentialRandomVariable
(
E2ENs3RandomVariable
):
class
E2ENs3ExponentialRandomVariable
(
E2ENs3RandomVariable
):
def
__init__
(
self
)
->
None
:
def
__init__
(
self
)
->
None
:
super
().
__init__
()
super
().
__init__
()
self
.
type_id
=
"
ns3::ExponentialRandomVariable
"
self
.
type_id
=
'
ns3::ExponentialRandomVariable
'
self
.
mean
:
tp
.
Optional
[
float
]
=
None
self
.
mean
:
tp
.
Optional
[
float
]
=
None
self
.
bound
:
tp
.
Optional
[
float
]
=
None
self
.
bound
:
tp
.
Optional
[
float
]
=
None
def
get_parameters
(
self
)
->
str
:
def
get_parameters
(
self
)
->
str
:
params
=
[]
params
=
[]
if
self
.
mean
:
if
self
.
mean
:
params
.
append
(
f
"
Mean=
{
self
.
mean
}
"
)
params
.
append
(
f
'
Mean=
{
self
.
mean
}
'
)
if
self
.
bound
:
if
self
.
bound
:
params
.
append
(
f
"
Bound=
{
self
.
bound
}
"
)
params
.
append
(
f
'
Bound=
{
self
.
bound
}
'
)
return
"|"
.
join
(
params
)
return
'|'
.
join
(
params
)
class
E2ENs3NormalRandomVariable
(
E2ENs3RandomVariable
):
class
E2ENs3NormalRandomVariable
(
E2ENs3RandomVariable
):
def
__init__
(
self
)
->
None
:
def
__init__
(
self
)
->
None
:
super
().
__init__
()
super
().
__init__
()
self
.
type_id
=
"
ns3::NormalRandomVariable
"
self
.
type_id
=
'
ns3::NormalRandomVariable
'
self
.
mean
:
tp
.
Optional
[
float
]
=
None
self
.
mean
:
tp
.
Optional
[
float
]
=
None
self
.
variance
:
tp
.
Optional
[
float
]
=
None
self
.
variance
:
tp
.
Optional
[
float
]
=
None
self
.
bound
:
tp
.
Optional
[
float
]
=
None
self
.
bound
:
tp
.
Optional
[
float
]
=
None
...
@@ -521,24 +521,24 @@ class E2ENs3NormalRandomVariable(E2ENs3RandomVariable):
...
@@ -521,24 +521,24 @@ class E2ENs3NormalRandomVariable(E2ENs3RandomVariable):
def
get_parameters
(
self
)
->
str
:
def
get_parameters
(
self
)
->
str
:
params
=
[]
params
=
[]
if
self
.
mean
:
if
self
.
mean
:
params
.
append
(
f
"
Mean=
{
self
.
mean
}
"
)
params
.
append
(
f
'
Mean=
{
self
.
mean
}
'
)
if
self
.
variance
:
if
self
.
variance
:
params
.
append
(
f
"
Variance=
{
self
.
variance
}
"
)
params
.
append
(
f
'
Variance=
{
self
.
variance
}
'
)
if
self
.
bound
:
if
self
.
bound
:
params
.
append
(
f
"
Bound=
{
self
.
bound
}
"
)
params
.
append
(
f
'
Bound=
{
self
.
bound
}
'
)
return
"|"
.
join
(
params
)
return
'|'
.
join
(
params
)
class
E2EOnOffApplication
(
E2EApplication
):
class
E2EOnOffApplication
(
E2EApplication
):
def
__init__
(
self
,
idd
:
str
)
->
None
:
def
__init__
(
self
,
idd
:
str
)
->
None
:
super
().
__init__
(
idd
)
super
().
__init__
(
idd
)
self
.
type
=
"
OnOff
"
self
.
type
=
'
OnOff
'
self
.
protocol
=
"
ns3::TcpSocketFactory
"
self
.
protocol
=
'
ns3::TcpSocketFactory
'
self
.
remote_ip
=
""
self
.
remote_ip
=
''
self
.
data_rate
=
""
self
.
data_rate
=
''
self
.
max_bytes
=
""
self
.
max_bytes
=
''
self
.
packet_size
=
""
self
.
packet_size
=
''
self
.
on_time
:
tp
.
Optional
[
E2ENs3RandomVariable
]
=
None
self
.
on_time
:
tp
.
Optional
[
E2ENs3RandomVariable
]
=
None
self
.
off_time
:
tp
.
Optional
[
E2ENs3RandomVariable
]
=
None
self
.
off_time
:
tp
.
Optional
[
E2ENs3RandomVariable
]
=
None
...
@@ -546,19 +546,19 @@ class E2EOnOffApplication(E2EApplication):
...
@@ -546,19 +546,19 @@ class E2EOnOffApplication(E2EApplication):
if
self
.
on_time
:
if
self
.
on_time
:
on
=
self
.
on_time
.
get_config
()
on
=
self
.
on_time
.
get_config
()
else
:
else
:
on
=
""
on
=
''
if
self
.
off_time
:
if
self
.
off_time
:
off
=
self
.
off_time
.
get_config
()
off
=
self
.
off_time
.
get_config
()
else
:
else
:
off
=
""
off
=
''
self
.
mapping
.
update
({
self
.
mapping
.
update
({
"
Protocol
"
:
self
.
protocol
,
'
Protocol
'
:
self
.
protocol
,
"
Remote
"
:
self
.
remote_ip
,
'
Remote
'
:
self
.
remote_ip
,
"
DataRate
"
:
self
.
data_rate
,
'
DataRate
'
:
self
.
data_rate
,
"
MaxBytes
"
:
self
.
max_bytes
,
'
MaxBytes
'
:
self
.
max_bytes
,
"
PacketSize
"
:
self
.
packet_size
,
'
PacketSize
'
:
self
.
packet_size
,
"
OnTime
"
:
on
,
'
OnTime
'
:
on
,
"
OffTime
"
:
off
,
'
OffTime
'
:
off
,
})
})
return
super
().
ns3_config
()
return
super
().
ns3_config
()
...
@@ -567,7 +567,7 @@ class E2EProbe(E2EComponent):
...
@@ -567,7 +567,7 @@ class E2EProbe(E2EComponent):
def
__init__
(
self
,
idd
:
str
)
->
None
:
def
__init__
(
self
,
idd
:
str
)
->
None
:
super
().
__init__
(
idd
)
super
().
__init__
(
idd
)
self
.
category
=
"
Probe
"
self
.
category
=
'
Probe
'
class
E2EPeriodicSampleProbe
(
E2EProbe
):
class
E2EPeriodicSampleProbe
(
E2EProbe
):
...
@@ -575,18 +575,18 @@ class E2EPeriodicSampleProbe(E2EProbe):
...
@@ -575,18 +575,18 @@ class E2EPeriodicSampleProbe(E2EProbe):
def
__init__
(
self
,
idd
:
str
,
probe_type
:
str
)
->
None
:
def
__init__
(
self
,
idd
:
str
,
probe_type
:
str
)
->
None
:
super
().
__init__
(
idd
)
super
().
__init__
(
idd
)
self
.
type
=
probe_type
self
.
type
=
probe_type
self
.
file
=
""
self
.
file
=
''
self
.
header
=
""
self
.
header
=
''
self
.
unit
=
""
self
.
unit
=
''
self
.
start
=
""
self
.
start
=
''
self
.
interval
=
""
self
.
interval
=
''
def
ns3_config
(
self
)
->
str
:
def
ns3_config
(
self
)
->
str
:
self
.
mapping
.
update
({
self
.
mapping
.
update
({
"
File
"
:
self
.
file
,
'
File
'
:
self
.
file
,
"
Header
"
:
self
.
header
,
'
Header
'
:
self
.
header
,
"
Unit
"
:
self
.
unit
,
'
Unit
'
:
self
.
unit
,
"
Start
"
:
self
.
start
,
'
Start
'
:
self
.
start
,
"
Interval
"
:
self
.
interval
'
Interval
'
:
self
.
interval
})
})
return
super
().
ns3_config
()
return
super
().
ns3_config
()
experiments/simbricks/orchestration/e2e_helpers.py
View file @
c2896bf3
...
@@ -51,14 +51,14 @@ class E2ELinkAssigner():
...
@@ -51,14 +51,14 @@ class E2ELinkAssigner():
create_link
:
bool
=
True
create_link
:
bool
=
True
):
):
if
create_link
and
link_type
is
None
:
if
create_link
and
link_type
is
None
:
raise
RuntimeError
(
"
Cannot create a link without link type
"
)
raise
RuntimeError
(
'
Cannot create a link without link type
'
)
if
idd
in
self
.
links
:
if
idd
in
self
.
links
:
raise
RuntimeError
(
f
"
Link
{
idd
}
already exists
"
)
raise
RuntimeError
(
f
'
Link
{
idd
}
already exists
'
)
link
=
{
link
=
{
"
left
"
:
left_switch
,
'
left
'
:
left_switch
,
"
right
"
:
right_switch
,
'
right
'
:
right_switch
,
"
type
"
:
link_type
,
'
type
'
:
link_type
,
"
created
"
:
create_link
'
created
'
:
create_link
}
}
if
create_link
:
if
create_link
:
self
.
_create_link
(
idd
,
link
)
self
.
_create_link
(
idd
,
link
)
...
@@ -76,42 +76,40 @@ class E2ELinkAssigner():
...
@@ -76,42 +76,40 @@ class E2ELinkAssigner():
# TODO: set properties like latency
# TODO: set properties like latency
def
_create_link
(
self
,
idd
:
str
,
link
):
def
_create_link
(
self
,
idd
:
str
,
link
):
left_switch
=
link
[
"
left
"
]
left_switch
=
link
[
'
left
'
]
right_switch
=
link
[
"
right
"
]
right_switch
=
link
[
'
right
'
]
link_type
=
link
[
"
type
"
]
link_type
=
link
[
'
type
'
]
if
link_type
==
E2ELinkType
.
SIMBRICKS
:
if
link_type
==
E2ELinkType
.
SIMBRICKS
:
left_adapter
=
e2e
.
E2ENetworkSimbricks
(
f
"
_
{
idd
}
_left_adapter
"
)
left_adapter
=
e2e
.
E2ENetworkSimbricks
(
f
'
_
{
idd
}
_left_adapter
'
)
left_adapter
.
listen
=
False
left_adapter
.
listen
=
False
left_switch
.
add_component
(
left_adapter
)
left_switch
.
add_component
(
left_adapter
)
link
[
"left_adapter"
]
=
left_adapter
link
[
'left_adapter'
]
=
left_adapter
right_adapter
=
e2e
.
E2ENetworkSimbricks
(
right_adapter
=
e2e
.
E2ENetworkSimbricks
(
f
'_
{
idd
}
_right_adapter'
)
f
"_
{
idd
}
_right_adapter"
)
right_adapter
.
listen
=
True
right_adapter
.
listen
=
True
right_switch
.
add_component
(
right_adapter
)
right_switch
.
add_component
(
right_adapter
)
link
[
"
right_adapter
"
]
=
right_adapter
link
[
'
right_adapter
'
]
=
right_adapter
elif
link_type
==
E2ELinkType
.
NS3_SIMPLE_CHANNEL
:
elif
link_type
==
E2ELinkType
.
NS3_SIMPLE_CHANNEL
:
ns3link
=
e2e
.
E2ESimpleChannel
(
f
"
_
{
idd
}
_link
"
)
ns3link
=
e2e
.
E2ESimpleChannel
(
f
'
_
{
idd
}
_link
'
)
ns3link
.
left_node
=
left_switch
ns3link
.
left_node
=
left_switch
ns3link
.
right_node
=
right_switch
ns3link
.
right_node
=
right_switch
link
[
"
ns3link
"
]
=
ns3link
link
[
'
ns3link
'
]
=
ns3link
def
set_link_type
(
self
,
idd
:
str
,
link_type
:
E2ELinkType
):
def
set_link_type
(
self
,
idd
:
str
,
link_type
:
E2ELinkType
):
if
idd
not
in
self
.
links
:
if
idd
not
in
self
.
links
:
raise
RuntimeError
(
f
"
Link
{
idd
}
not found
"
)
raise
RuntimeError
(
f
'
Link
{
idd
}
not found
'
)
link
=
self
.
links
[
idd
]
link
=
self
.
links
[
idd
]
if
link
[
"
created
"
]:
if
link
[
'
created
'
]:
raise
RuntimeError
(
"
Cannot change type of already existing link
"
)
raise
RuntimeError
(
'
Cannot change type of already existing link
'
)
link
[
"
type
"
]
=
link_type
link
[
'
type
'
]
=
link_type
def
create_missing_links
(
self
):
def
create_missing_links
(
self
):
for
idd
,
link
in
self
.
links
.
items
():
for
idd
,
link
in
self
.
links
.
items
():
if
link
[
"
created
"
]:
if
link
[
'
created
'
]:
continue
continue
if
link
[
"
type
"
]
is
None
:
if
link
[
'
type
'
]
is
None
:
raise
RuntimeError
(
f
"
Link
{
idd
}
has no type
"
)
raise
RuntimeError
(
f
'
Link
{
idd
}
has no type
'
)
self
.
_create_link
(
idd
,
link
)
self
.
_create_link
(
idd
,
link
)
link
[
"
created
"
]
=
True
link
[
'
created
'
]
=
True
def
assign_networks
(
self
)
->
tp
.
List
[
NS3E2ENet
]:
def
assign_networks
(
self
)
->
tp
.
List
[
NS3E2ENet
]:
networks
=
[]
networks
=
[]
...
@@ -119,7 +117,7 @@ class E2ELinkAssigner():
...
@@ -119,7 +117,7 @@ class E2ELinkAssigner():
while
len
(
self
.
connected_switches
)
>
0
:
while
len
(
self
.
connected_switches
)
>
0
:
# create network and take next (random) switch
# create network and take next (random) switch
net
=
NS3E2ENet
()
net
=
NS3E2ENet
()
net
.
name
=
f
"
_network_
{
len
(
networks
)
}
"
net
.
name
=
f
'
_network_
{
len
(
networks
)
}
'
networks
.
append
(
net
)
networks
.
append
(
net
)
next_switches
=
set
()
next_switches
=
set
()
next_switches
.
add
(
self
.
connected_switches
.
pop
())
next_switches
.
add
(
self
.
connected_switches
.
pop
())
...
@@ -129,28 +127,28 @@ class E2ELinkAssigner():
...
@@ -129,28 +127,28 @@ class E2ELinkAssigner():
switch
=
next_switches
.
pop
()
switch
=
next_switches
.
pop
()
net
.
add_component
(
switch
)
net
.
add_component
(
switch
)
for
link
in
self
.
switch_links
[
switch
]:
for
link
in
self
.
switch_links
[
switch
]:
if
link
[
"
type
"
]
==
E2ELinkType
.
SIMBRICKS
:
if
link
[
'
type
'
]
==
E2ELinkType
.
SIMBRICKS
:
if
link
[
"
left
"
]
==
switch
:
if
link
[
'
left
'
]
==
switch
:
link
[
"
right_adapter
"
].
simbricks_component
=
net
link
[
'
right_adapter
'
].
simbricks_component
=
net
else
:
else
:
assert
link
[
"
right
"
]
==
switch
assert
link
[
'
right
'
]
==
switch
link
[
"
left_adapter
"
].
simbricks_component
=
net
link
[
'
left_adapter
'
].
simbricks_component
=
net
elif
link
[
"
type
"
]
==
E2ELinkType
.
NS3_SIMPLE_CHANNEL
:
elif
link
[
'
type
'
]
==
E2ELinkType
.
NS3_SIMPLE_CHANNEL
:
not_visited_switches
=
0
not_visited_switches
=
0
if
link
[
"
left
"
]
in
self
.
connected_switches
:
if
link
[
'
left
'
]
in
self
.
connected_switches
:
next_switches
.
add
(
link
[
"
left
"
])
next_switches
.
add
(
link
[
'
left
'
])
self
.
connected_switches
.
remove
(
link
[
"
left
"
])
self
.
connected_switches
.
remove
(
link
[
'
left
'
])
not_visited_switches
+=
1
not_visited_switches
+=
1
if
link
[
"
right
"
]
in
self
.
connected_switches
:
if
link
[
'
right
'
]
in
self
.
connected_switches
:
next_switches
.
add
(
link
[
"
right
"
])
next_switches
.
add
(
link
[
'
right
'
])
self
.
connected_switches
.
remove
(
link
[
"
right
"
])
self
.
connected_switches
.
remove
(
link
[
'
right
'
])
not_visited_switches
+=
1
not_visited_switches
+=
1
assert
not_visited_switches
<
2
assert
not_visited_switches
<
2
# if only one switch has been visited (namely the
# if only one switch has been visited (namely the
# current switch), we see this link for the first time
# current switch), we see this link for the first time
if
not_visited_switches
==
1
:
if
not_visited_switches
==
1
:
net
.
add_component
(
link
[
"
ns3link
"
])
net
.
add_component
(
link
[
'
ns3link
'
])
else
:
else
:
raise
RuntimeError
(
"
Unknown link type
"
)
raise
RuntimeError
(
'
Unknown link type
'
)
return
networks
return
networks
experiments/simbricks/orchestration/e2e_topologies.py
View file @
c2896bf3
...
@@ -38,9 +38,9 @@ class E2ETopology(ABC):
...
@@ -38,9 +38,9 @@ class E2ETopology(ABC):
class
E2EDumbbellTopology
(
E2ETopology
):
class
E2EDumbbellTopology
(
E2ETopology
):
def
__init__
(
self
):
def
__init__
(
self
):
self
.
left_switch
=
e2e
.
E2ESwitchNode
(
"
_leftSwitch
"
)
self
.
left_switch
=
e2e
.
E2ESwitchNode
(
'
_leftSwitch
'
)
self
.
right_switch
=
e2e
.
E2ESwitchNode
(
"
_rightSwitch
"
)
self
.
right_switch
=
e2e
.
E2ESwitchNode
(
'
_rightSwitch
'
)
self
.
link
=
e2e
.
E2ESimpleChannel
(
"
_link
"
)
self
.
link
=
e2e
.
E2ESimpleChannel
(
'
_link
'
)
self
.
link
.
left_node
=
self
.
left_switch
self
.
link
.
left_node
=
self
.
left_switch
self
.
link
.
right_node
=
self
.
right_switch
self
.
link
.
right_node
=
self
.
right_switch
...
...
experiments/simbricks/orchestration/experiment/experiment_environment.py
View file @
c2896bf3
...
@@ -102,7 +102,9 @@ class ExpEnv(object):
...
@@ -102,7 +102,9 @@ class ExpEnv(object):
return
f
'
{
self
.
shm_base
}
/dev.shm.
{
sim
.
name
}
'
return
f
'
{
self
.
shm_base
}
/dev.shm.
{
sim
.
name
}
'
def
n2n_eth_path
(
def
n2n_eth_path
(
self
,
sim_l
:
'simulators.Simulator'
,
sim_c
:
'simulators.Simulator'
,
self
,
sim_l
:
'simulators.Simulator'
,
sim_c
:
'simulators.Simulator'
,
suffix
=
''
suffix
=
''
)
->
str
:
)
->
str
:
return
f
'
{
self
.
workdir
}
/n2n.eth.
{
sim_l
.
name
}
.
{
sim_c
.
name
}
.
{
suffix
}
'
return
f
'
{
self
.
workdir
}
/n2n.eth.
{
sim_l
.
name
}
.
{
sim_c
.
name
}
.
{
suffix
}
'
...
...
experiments/simbricks/orchestration/nodeconfig.py
View file @
c2896bf3
...
@@ -378,8 +378,7 @@ class I40eTCPCongNode(NodeConfig):
...
@@ -378,8 +378,7 @@ class I40eTCPCongNode(NodeConfig):
return
super
().
prepare_post_cp
()
+
[
return
super
().
prepare_post_cp
()
+
[
'modprobe i40e'
,
'modprobe i40e'
,
'ethtool -G eth0 rx 4096 tx 4096'
,
'ethtool -G eth0 rx 4096 tx 4096'
,
'ethtool -K eth0 tso off'
,
'ethtool -K eth0 tso off'
,
# 'ip link set eth0 txqueuelen 13888',
# 'ip link set eth0 txqueuelen 13888',
f
'ip link set dev eth0 mtu
{
self
.
mtu
}
up'
,
f
'ip link set dev eth0 mtu
{
self
.
mtu
}
up'
,
f
'ip addr add
{
self
.
ip
}
/
{
self
.
prefix
}
dev eth0'
,
f
'ip addr add
{
self
.
ip
}
/
{
self
.
prefix
}
dev eth0'
,
]
]
...
...
experiments/simbricks/orchestration/runners.py
View file @
c2896bf3
...
@@ -187,7 +187,7 @@ class ExperimentBaseRunner(ABC):
...
@@ -187,7 +187,7 @@ class ExperimentBaseRunner(ABC):
assert
self
.
profile_int
assert
self
.
profile_int
while
True
:
while
True
:
await
asyncio
.
sleep
(
self
.
profile_int
)
await
asyncio
.
sleep
(
self
.
profile_int
)
for
(
_
,
sc
)
in
self
.
running
:
for
(
_
,
sc
)
in
self
.
running
:
await
sc
.
sigusr1
()
await
sc
.
sigusr1
()
async
def
run
(
self
)
->
ExpOutput
:
async
def
run
(
self
)
->
ExpOutput
:
...
...
experiments/simbricks/orchestration/simulators.py
View file @
c2896bf3
...
@@ -26,10 +26,10 @@ from __future__ import annotations
...
@@ -26,10 +26,10 @@ from __future__ import annotations
import
math
import
math
import
typing
as
tp
import
typing
as
tp
from
simbricks.orchestration
import
e2e_components
as
e2e
from
simbricks.orchestration.e2e_topologies
import
E2ETopology
from
simbricks.orchestration.experiment.experiment_environment
import
ExpEnv
from
simbricks.orchestration.experiment.experiment_environment
import
ExpEnv
from
simbricks.orchestration.nodeconfig
import
NodeConfig
from
simbricks.orchestration.nodeconfig
import
NodeConfig
from
simbricks.orchestration.e2e_topologies
import
E2ETopology
from
simbricks.orchestration
import
e2e_components
as
e2e
class
Simulator
(
object
):
class
Simulator
(
object
):
...
...
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