Commit 19d87d23 authored by Marvin Meiers's avatar Marvin Meiers Committed by Hejing Li
Browse files

experiment: add init_network method to NS3E2ENet

Add a new method init_network to NS3E2ENet that does some initialization
before the experiment is run. It should be called after all components
were added to the network.
parent 33566368
...@@ -189,5 +189,7 @@ for congestion_control in types_of_congestion_control: ...@@ -189,5 +189,7 @@ for congestion_control in types_of_congestion_control:
clients[num_simbricks_hosts - 1].node_config.app.is_last = True clients[num_simbricks_hosts - 1].node_config.app.is_last = True
clients[num_simbricks_hosts - 1].wait = True clients[num_simbricks_hosts - 1].wait = True
net.init_network()
print(e.name) print(e.name)
experiments.append(e) experiments.append(e)
...@@ -209,5 +209,8 @@ for congestion_control in types_of_congestion_control: ...@@ -209,5 +209,8 @@ for congestion_control in types_of_congestion_control:
clients[num_simbricks_hosts - 1].node_config.app.is_last = True clients[num_simbricks_hosts - 1].node_config.app.is_last = True
clients[num_simbricks_hosts - 1].wait = True clients[num_simbricks_hosts - 1].wait = True
left_net.init_network()
right_net.init_network()
print(e.name) print(e.name)
experiments.append(e) experiments.append(e)
...@@ -954,31 +954,30 @@ class NS3E2ENet(NetSim): ...@@ -954,31 +954,30 @@ class NS3E2ENet(NetSim):
self, e2e_sim.simbricks_component self, e2e_sim.simbricks_component
) )
def instantiate(self): def init_network(self) -> None:
pass # add all components from topologies to the network
for topo in self.e2e_topologies:
def run_cmd(self, env): topo.add_to_network(self)
if self.first_run:
self.instantiate()
for topo in self.e2e_topologies:
topo.add_to_network(self)
for component in self.e2e_components: for component in self.e2e_components:
if self.first_run: component.resolve_paths()
component.resolve_paths()
# add all connected networks
for c in component.components:
if isinstance(c, e2e.E2ESimbricksNetworkNetIf):
self.connect_network(c.simbricks_component)
def run_cmd(self, env):
# resolve all socket paths
for component in self.e2e_components:
for c in component.components: for c in component.components:
if isinstance(c, e2e.E2ESimbricksHost): if isinstance(c, e2e.E2ESimbricksHost):
self.resolve_socket_paths(env, c) self.resolve_socket_paths(env, c)
elif isinstance(c, e2e.E2ESimbricksNetworkNetIf): elif isinstance(c, e2e.E2ESimbricksNetworkNetIf):
self.resolve_socket_paths(env, c) self.resolve_socket_paths(env, c)
if self.first_run:
self.connect_network(c.simbricks_component)
elif isinstance(c, e2e.E2ESimbricksNetworkNicIf): elif isinstance(c, e2e.E2ESimbricksNetworkNicIf):
self.resolve_socket_paths(env, c, True) self.resolve_socket_paths(env, c, True)
self.first_run = False
params: tp.List[str] = [] params: tp.List[str] = []
for component in self.e2e_components: for component in self.e2e_components:
params.append(component.ns3_config()) params.append(component.ns3_config())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment