Commit c7300b4f authored by Marvin Meiers's avatar Marvin Meiers Committed by Antoine Kaufmann
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 c3a68a84
......@@ -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].wait = True
net.init_network()
print(e.name)
experiments.append(e)
......@@ -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].wait = True
left_net.init_network()
right_net.init_network()
print(e.name)
experiments.append(e)
......@@ -935,27 +935,30 @@ class NS3E2ENet(NetSim):
self, e2e_sim.simbricks_component
)
def run_cmd(self, env):
if self.first_run:
for topo in self.e2e_topologies:
topo.add_to_network(self)
def init_network(self) -> None:
# add all components from topologies to the network
for topo in self.e2e_topologies:
topo.add_to_network(self)
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:
if isinstance(c, e2e.E2ESimbricksHost):
self.resolve_socket_paths(env, c)
elif isinstance(c, e2e.E2ESimbricksNetworkNetIf):
self.resolve_socket_paths(env, c)
if self.first_run:
self.connect_network(c.simbricks_component)
elif isinstance(c, e2e.E2ESimbricksNetworkNicIf):
self.resolve_socket_paths(env, c, True)
self.first_run = False
params: tp.List[str] = []
for component in self.e2e_components:
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