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

HostSim: pass node_config in __init__

parent 74a9f167
......@@ -89,16 +89,16 @@ for mtu in types_of_mtu:
elif host == 'qt':
freq = cpu_freq_qemu
def qemu_timing():
h = sim.QemuHost()
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
HostClass = qemu_timing
elif host == 'gt':
def gem5_timing():
h = sim.Gem5Host()
def gem5_timing(node_config: node.NodeConfig):
h = sim.Gem5Host(node_config)
#h.sys_clock = sys_clock
return h
......@@ -106,8 +106,8 @@ for mtu in types_of_mtu:
e.checkpoint = True
elif host == 'gO3':
def gem5_o3():
h = sim.Gem5Host()
def gem5_o3(node_config: node.NodeConfig):
h = sim.Gem5Host(node_config)
h.cpu_type = 'DerivO3CPU'
h.sys_clock = sys_clock
return h
......
......@@ -86,8 +86,8 @@ for n_client in num_client_types:
HostClass = sim.QemuHost
elif host_type == 'qt':
def qemu_timing():
h = sim.QemuHost()
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
......
......@@ -39,9 +39,6 @@ for app_type in app_types:
NcClass = node.I40eLinuxNode
# create servers and clients
host = HostClass()
host.name = 'host.0'
host.cpu_freq = '3GHz'
node_config = NcClass()
node_config.ip = '10.0.0.1'
node_config.app = node.NoTraffic()
......@@ -53,7 +50,10 @@ for app_type in app_types:
else:
node_config.app.is_sleep = 0
host.set_config(node_config)
host = HostClass(node_config)
host.name = 'host.0'
host.cpu_freq = '3GHz'
e.add_host(host)
host.wait = True
......
......@@ -59,8 +59,8 @@ for host_type in host_types:
HostClass = sim.QemuHost
elif host_type == 'qt':
def qemu_timing():
h = sim.QemuHost()
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
......
......@@ -62,8 +62,8 @@ for proto_config in proto_configs:
e.checkpoint = True
elif host_config == 'qt':
def qemu_timing():
h = sim.QemuHost()
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
......
......@@ -73,8 +73,8 @@ for host_type in host_types:
HostClass = sim.QemuHost
elif host_type == 'qt':
def qemu_timing():
h = sim.QemuHost()
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
......
......@@ -77,16 +77,16 @@ for mtu in types_of_mtu:
elif host == 'qt':
freq = cpu_freq_qemu
def qemu_timing():
h = sim.QemuHost()
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
HostClass = qemu_timing
elif host == 'gt':
def gem5_timing():
h = sim.Gem5Host()
def gem5_timing(node_config: node.NodeConfig):
h = sim.Gem5Host(node_config)
#h.sys_clock = sys_clock
return h
......@@ -94,8 +94,8 @@ for mtu in types_of_mtu:
e.checkpoint = True
elif host == 'gO3':
def gem5_o3():
h = sim.Gem5Host()
def gem5_o3(node_config: node.NodeConfig):
h = sim.Gem5Host(node_config)
h.cpu_type = 'DerivO3CPU'
h.sys_clock = sys_clock
return h
......
......@@ -78,8 +78,8 @@ for host_type in host_types:
HostClass = sim.QemuHost
elif host_type == 'qt':
def qemu_timing():
h = sim.QemuHost()
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
......
......@@ -46,8 +46,8 @@ for host_type in host_types:
HostClass = sim.QemuHost
elif host_type == 'qt':
def qemu_timing():
h = sim.QemuHost()
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
......
......@@ -47,8 +47,8 @@ for host_type in host_types:
net.sync = False
elif host_type == 'qt':
def qemu_timing():
h = sim.QemuHost()
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
......
......@@ -30,18 +30,17 @@ for h in ['qk', 'gk']:
e = exp.Experiment('femutest-' + h)
e.checkpoint = False
if h == 'gk':
host = sim.Gem5Host()
host.cpu_type = 'X86KvmCPU'
elif h == 'qk':
host = sim.QemuHost()
host.name = 'host.0'
node_config = node.LinuxFEMUNode()
node_config.app = node.NVMEFsTest()
node_config.cores = 1
node_config.app.is_sleep = 1
host.set_config(node_config)
if h == 'gk':
host = sim.Gem5Host(node_config)
host.cpu_type = 'X86KvmCPU'
elif h == 'qk':
host = sim.QemuHost(node_config)
host.name = 'host.0'
e.add_host(host)
host.wait = True
......
......@@ -62,16 +62,16 @@ for mode in types_of_mode:
HostClass = sim.QemuHost
elif host == 'qt':
def qemu_timing():
h = sim.QemuHost()
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
HostClass = qemu_timing
elif host == 'gt':
def gem5_timing():
h = sim.Gem5Host()
def gem5_timing(node_config: node.NodeConfig):
h = sim.Gem5Host(node_config)
return h
HostClass = gem5_timing
......
......@@ -60,8 +60,8 @@ for host_type in host_types:
HostClass = sim.QemuHost
elif host_type == 'qt':
def qemu_timing():
h = sim.QemuHost()
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
......
......@@ -39,8 +39,6 @@ for app_type in app_types:
NcClass = node.I40eLinuxNode
# create servers and clients
host = HostClass()
host.name = 'host.0'
node_config = NcClass()
node_config.ip = '10.0.0.1'
node_config.app = node.NoTraffic()
......@@ -52,7 +50,9 @@ for app_type in app_types:
else:
node_config.app.is_sleep = 0
host.set_config(node_config)
host = HostClass(node_config)
host.name = 'host.0'
e.add_host(host)
host.wait = True
......
......@@ -66,8 +66,8 @@ for host_type in host_types:
HostClass = sim.QemuHost
elif host_type == 'qt':
def qemu_timing():
h = sim.QemuHost()
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
......
......@@ -62,8 +62,8 @@ for proto_config in proto_configs:
e.checkpoint = True
elif host_config == 'qt':
def qemu_timing():
h = sim.QemuHost()
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
......
......@@ -39,18 +39,18 @@ for internal in [True, False]:
net = sim.SwitchNet()
e.add_network(net)
server = sim.Gem5Host()
server.name = 'server'
# server
nc_server = node.E1000LinuxNode()
nc_server.prefix = 24
nc_server.ip = '10.0.0.1'
nc_server.force_mac_addr = '00:90:00:00:00:01'
nc_server.app = node.NetperfServer()
server.set_config(nc_server)
server = sim.Gem5Host(nc_server)
server.name = 'server'
e.add_host(server)
client = sim.Gem5Host()
client.name = 'client'
# client
nc_client = node.E1000LinuxNode()
nc_client.prefix = 24
nc_client.ip = '10.0.0.2'
......@@ -59,7 +59,9 @@ for internal in [True, False]:
nc_client.app.server_ip = '10.0.0.1'
nc_client.app.duration_tp = -1000000
nc_client.app.duration_lat = -1000
client.set_config(nc_client)
client = sim.Gem5Host(nc_client)
client.name = 'client'
client.wait = True
e.add_host(client)
......
......@@ -74,8 +74,8 @@ for n_client in num_client_types:
HostClass = sim.QemuHost
elif host_type == 'qt':
def qemu_timing():
h = sim.QemuHost()
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
......
......@@ -72,8 +72,8 @@ for rate in rate_types:
HostClass = sim.QemuHost
elif host_type == 'qt':
def qemu_timing():
h = sim.QemuHost()
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
......
......@@ -54,15 +54,14 @@ def create_basic_hosts(
#nic.name = '%s.%d' % (name_prefix, i)
nic.set_network(net)
host = host_class()
host.name = f'{name_prefix}.{i}'
node_config = nc_class()
node_config.prefix = ip_prefix
ip = ip_start + i
node_config.ip = f'10.0.{int(ip / 256)}.{ip % 256}'
node_config.app = app_class()
host.set_config(node_config)
host = host_class(node_config)
host.name = f'{name_prefix}.{i}'
host.add_nic(nic)
e.add_nic(nic)
......@@ -103,15 +102,14 @@ def create_multinic_hosts(
#nic.name = '%s.%d' % (name_prefix, i)
nic.set_network(net)
host = host_class()
host.name = f'{name_prefix}.{i}'
node_config = nc_class()
node_config.prefix = ip_prefix
ip = ip_start + i
node_config.ip = f'10.0.{int(ip / 256)}.{ip % 256}'
node_config.app = app_class()
host.set_config(node_config)
host = host_class(node_config)
host.name = f'{name_prefix}.{i}'
host.add_nic(nic)
e.add_host(host)
......@@ -148,15 +146,14 @@ def create_dctcp_hosts(
#nic.name = '%s.%d' % (name_prefix, i)
nic.set_network(net)
host = host_class()
host.name = f'{name_prefix}.{i}'
host.cpu_freq = cpu_freq
node_config = nc_class()
node_config.mtu = mtu
node_config.ip = f'192.168.64.{ip_start + i}'
node_config.app = app_class()
host.set_config(node_config)
host = host_class(node_config)
host.name = f'{name_prefix}.{i}'
host.cpu_freq = cpu_freq
host.add_nic(nic)
e.add_nic(nic)
......
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