"...composable_kernel_rocm.git" did not exist on "01055d95d9df0fd79eeaa02336593d6432b09a7f"
Commit f819b1f1 authored by Hejing Li's avatar Hejing Li Committed by Jonas Kaufmann
Browse files

impl.py: add netsim base class

parent 3e72b1ca
...@@ -360,12 +360,12 @@ class QemuSim(HostSim): ...@@ -360,12 +360,12 @@ class QemuSim(HostSim):
return cmd return cmd
class NetSim(Simulator):
"""Base class for network simulators."""
class SwitchBMSim(Simulator): def __init__(self, e: exp.Experiment) -> None:
def __init__(self, e: exp.Experiment):
super().__init__(e) super().__init__(e)
self.experiment = e self.opt = ''
self.switches: tp.List[spec.Switch] = [] self.switches: tp.List[spec.Switch] = []
self.nicSim: tp.List[I40eNicSim] = [] self.nicSim: tp.List[I40eNicSim] = []
self.wait = False self.wait = False
...@@ -373,11 +373,11 @@ class SwitchBMSim(Simulator): ...@@ -373,11 +373,11 @@ class SwitchBMSim(Simulator):
def full_name(self) -> str: def full_name(self) -> str:
return 'net.' + self.name return 'net.' + self.name
def add(self, switch: spec.Switch): def add(self, switch: spec.Switch):
self.switches.append(switch) self.switches.append(switch)
switch.sim = self switch.sim = self
self.experiment.add_network(self) self.experiment.add_network(self)
self.name = f'{switch.id}'
for s in self.switches: for s in self.switches:
for n in s.netdevs: for n in s.netdevs:
...@@ -411,6 +411,13 @@ class SwitchBMSim(Simulator): ...@@ -411,6 +411,13 @@ class SwitchBMSim(Simulator):
def sockets_cleanup(self, env: ExpEnv) -> tp.List[str]: def sockets_cleanup(self, env: ExpEnv) -> tp.List[str]:
cleanup = [] cleanup = []
return cleanup return cleanup
class SwitchBMSim(NetSim):
def __init__(self, e: exp.Experiment):
super().__init__(e)
def run_cmd(self, env: ExpEnv) -> str: def run_cmd(self, env: ExpEnv) -> str:
cmd = env.repodir + '/sims/net/switch/net_switch' cmd = env.repodir + '/sims/net/switch/net_switch'
......
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