Commit 6ad9de5a authored by Antoine Kaufmann's avatar Antoine Kaufmann Committed by Hejing Li
Browse files

experiments: add connect_nic to NetSim

So far NIC sims would directly modify the NetSim's list, not giving the
opportunity for subclasses to override. This istead adds a method for this.
parent e5bd3b25
......@@ -141,7 +141,7 @@ class NICSim(PCIDevSim):
def set_network(self, net: NetSim) -> None:
"""Connect this NIC to a network simulator."""
self.network = net
net.nics.append(self)
net.connect_nic(self)
def basic_args(self, env: ExpEnv, extra: tp.Optional[str] = None) -> str:
cmd = (
......@@ -200,6 +200,9 @@ class NetSim(Simulator):
def full_name(self) -> str:
return 'net.' + self.name
def connect_nic(self, nic: NICSim) -> None:
self.nics.append(nic)
def connect_network(self, net: NetSim) -> None:
"""Connect this network to the listening peer `net`"""
net.net_listen.append(self)
......
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