Commit f75b9e3e authored by Jonas Kaufmann's avatar Jonas Kaufmann Committed by Antoine Kaufmann
Browse files

fix auto_dist missing nic attribute on Experiment and HostSim

parent fab5ce15
...@@ -59,6 +59,10 @@ class Experiment(object): ...@@ -59,6 +59,10 @@ class Experiment(object):
"""The network simulators to run.""" """The network simulators to run."""
self.metadata = {} self.metadata = {}
@property
def nics(self):
return filter(lambda pcidev: pcidev.is_nic(), self.pcidevs)
def add_host(self, sim: HostSim): def add_host(self, sim: HostSim):
for h in self.hosts: for h in self.hosts:
if h.name == sim.name: if h.name == sim.name:
......
...@@ -140,14 +140,14 @@ def auto_dist( ...@@ -140,14 +140,14 @@ def auto_dist(
for h in e.hosts: for h in e.hosts:
de.add_host(h) de.add_host(h)
de.assign_sim_host(h, k) de.assign_sim_host(h, k)
for nic in h.nics: # TODO h.nics does not exist in class HostSim for nic in h.nics:
de.assign_sim_host(nic, k) de.assign_sim_host(nic, k)
if k != 0: if k != 0:
cp.add_nic(nic) cp.add_nic(nic)
k = (k + 1) % 2 k = (k + 1) % 2
for nic in e.nics: # TODO: e.nics does not exist in class Experiment for nic in e.nics:
de.add_nic(nic) de.add_nic(nic)
return de return de
...@@ -94,6 +94,9 @@ class PCIDevSim(Simulator): ...@@ -94,6 +94,9 @@ class PCIDevSim(Simulator):
def full_name(self): def full_name(self):
return 'dev.' + self.name return 'dev.' + self.name
def is_nic(self):
return False
def sockets_cleanup(self, env): def sockets_cleanup(self, env):
return [env.dev_pci_path(self), env.dev_shm_path(self)] return [env.dev_pci_path(self), env.dev_shm_path(self)]
...@@ -135,6 +138,9 @@ class NICSim(PCIDevSim): ...@@ -135,6 +138,9 @@ class NICSim(PCIDevSim):
def full_name(self): def full_name(self):
return 'nic.' + self.name return 'nic.' + self.name
def is_nic(self):
return True
def sockets_cleanup(self, env): def sockets_cleanup(self, env):
return super().sockets_cleanup(env) + [env.nic_eth_path(self)] return super().sockets_cleanup(env) + [env.nic_eth_path(self)]
...@@ -215,6 +221,10 @@ class HostSim(Simulator): ...@@ -215,6 +221,10 @@ class HostSim(Simulator):
self.pcidevs: tp.List[PCIDevSim] = [] self.pcidevs: tp.List[PCIDevSim] = []
self.net_directs: tp.List[NetSim] = [] self.net_directs: tp.List[NetSim] = []
@property
def nics(self):
return filter(lambda pcidev: pcidev.is_nic(), self.pcidevs)
def full_name(self): def full_name(self):
return 'host.' + self.name return 'host.' + self.name
......
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