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

move simulator helper functions to own module

moved functions:
- create_basic_hosts()
- create_multinic_hosts()
- create_dctcp_hosts()
parent f9113631
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
import simbricks.experiments as exp import simbricks.experiments as exp
import simbricks.simulators as sim import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
from simbricks.simulator_utils import create_basic_hosts
# iperf TCP_multi_client test # iperf TCP_multi_client test
...@@ -58,24 +59,24 @@ for n in kinds_of_net: ...@@ -58,24 +59,24 @@ for n in kinds_of_net:
e.add_network(net) e.add_network(net)
if c == 'cv': if c == 'cv':
servers = sim.create_basic_hosts(e, 1, 'server', net, sim.CorundumVerilatorNIC, sim.QemuHost, servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumVerilatorNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfTCPServer) node.CorundumLinuxNode, node.IperfTCPServer)
clients = sim.create_basic_hosts(e, num_client, 'client', net, sim.CorundumVerilatorNIC, sim.QemuHost, clients = create_basic_hosts(e, num_client, 'client', net, sim.CorundumVerilatorNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfTCPClient, ip_start = 2) node.CorundumLinuxNode, node.IperfTCPClient, ip_start = 2)
if c == 'cb': if c == 'cb':
servers = sim.create_basic_hosts(e, 1, 'server', net, sim.CorundumBMNIC, sim.QemuHost, servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumBMNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfTCPServer) node.CorundumLinuxNode, node.IperfTCPServer)
clients = sim.create_basic_hosts(e, num_client, 'client', net, sim.CorundumBMNIC, sim.QemuHost, clients = create_basic_hosts(e, num_client, 'client', net, sim.CorundumBMNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfTCPClient, ip_start = 2) node.CorundumLinuxNode, node.IperfTCPClient, ip_start = 2)
if c == 'ib': if c == 'ib':
servers = sim.create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost, servers = create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost,
node.I40eLinuxNode, node.IperfTCPServer) node.I40eLinuxNode, node.IperfTCPServer)
clients = sim.create_basic_hosts(e, num_client, 'client', net, sim.I40eNIC, sim.QemuHost, clients = create_basic_hosts(e, num_client, 'client', net, sim.I40eNIC, sim.QemuHost,
node.I40eLinuxNode, node.IperfTCPClient, ip_start = 2) node.I40eLinuxNode, node.IperfTCPClient, ip_start = 2)
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
import simbricks.experiments as exp import simbricks.experiments as exp
import simbricks.simulators as sim import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
from simbricks.simulator_utils import create_basic_hosts
# iperf TCP_single test # iperf TCP_single test
...@@ -60,24 +61,24 @@ for n in kinds_of_net: ...@@ -60,24 +61,24 @@ for n in kinds_of_net:
e.add_network(net) e.add_network(net)
if c == 'cv': if c == 'cv':
servers = sim.create_basic_hosts(e, 1, 'server', net, sim.CorundumVerilatorNIC, sim.QemuHost, servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumVerilatorNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfTCPServer) node.CorundumLinuxNode, node.IperfTCPServer)
clients = sim.create_basic_hosts(e, 1, 'client', net, sim.CorundumVerilatorNIC, sim.QemuHost, clients = create_basic_hosts(e, 1, 'client', net, sim.CorundumVerilatorNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfTCPClient, ip_start = 2) node.CorundumLinuxNode, node.IperfTCPClient, ip_start = 2)
if c == 'cb': if c == 'cb':
servers = sim.create_basic_hosts(e, 1, 'server', net, sim.CorundumBMNIC, sim.QemuHost, servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumBMNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfTCPServer) node.CorundumLinuxNode, node.IperfTCPServer)
clients = sim.create_basic_hosts(e, 1, 'client', net, sim.CorundumBMNIC, sim.QemuHost, clients = create_basic_hosts(e, 1, 'client', net, sim.CorundumBMNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfTCPClient, ip_start = 2) node.CorundumLinuxNode, node.IperfTCPClient, ip_start = 2)
if c == 'ib': if c == 'ib':
servers = sim.create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost, servers = create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost,
node.I40eLinuxNode, node.IperfTCPServer) node.I40eLinuxNode, node.IperfTCPServer)
clients = sim.create_basic_hosts(e, 1, 'client', net, sim.I40eNIC, sim.QemuHost, clients = create_basic_hosts(e, 1, 'client', net, sim.I40eNIC, sim.QemuHost,
node.I40eLinuxNode, node.IperfTCPClient, ip_start = 2) node.I40eLinuxNode, node.IperfTCPClient, ip_start = 2)
clients[0].wait = True clients[0].wait = True
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
import simbricks.experiments as exp import simbricks.experiments as exp
import simbricks.simulators as sim import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
from simbricks.simulator_utils import create_basic_hosts
# iperf TCP_multi_client test # iperf TCP_multi_client test
...@@ -60,24 +61,24 @@ for n in kinds_of_net: ...@@ -60,24 +61,24 @@ for n in kinds_of_net:
e.add_network(net) e.add_network(net)
if c == 'cv': if c == 'cv':
servers = sim.create_basic_hosts(e, 1, 'server', net, sim.CorundumVerilatorNIC, sim.QemuHost, servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumVerilatorNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfUDPServer) node.CorundumLinuxNode, node.IperfUDPServer)
clients = sim.create_basic_hosts(e, num_client, 'client', net, sim.CorundumVerilatorNIC, sim.QemuHost, clients = create_basic_hosts(e, num_client, 'client', net, sim.CorundumVerilatorNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfUDPClient, ip_start = 2) node.CorundumLinuxNode, node.IperfUDPClient, ip_start = 2)
if c == 'cb': if c == 'cb':
servers = sim.create_basic_hosts(e, 1, 'server', net, sim.CorundumBMNIC, sim.QemuHost, servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumBMNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfUDPServer) node.CorundumLinuxNode, node.IperfUDPServer)
clients = sim.create_basic_hosts(e, num_client, 'client', net, sim.CorundumBMNIC, sim.QemuHost, clients = create_basic_hosts(e, num_client, 'client', net, sim.CorundumBMNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfUDPClient, ip_start = 2) node.CorundumLinuxNode, node.IperfUDPClient, ip_start = 2)
if c == 'ib': if c == 'ib':
servers = sim.create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost, servers = create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost,
node.I40eLinuxNode, node.IperfUDPServer) node.I40eLinuxNode, node.IperfUDPServer)
clients = sim.create_basic_hosts(e, num_client, 'client', net, sim.I40eNIC, sim.QemuHost, clients = create_basic_hosts(e, num_client, 'client', net, sim.I40eNIC, sim.QemuHost,
node.I40eLinuxNode, node.IperfUDPClient, ip_start = 2) node.I40eLinuxNode, node.IperfUDPClient, ip_start = 2)
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
import simbricks.experiments as exp import simbricks.experiments as exp
import simbricks.simulators as sim import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
from simbricks.simulator_utils import create_basic_hosts
# iperf TCP_single test # iperf TCP_single test
...@@ -62,24 +63,24 @@ for n in kinds_of_net: ...@@ -62,24 +63,24 @@ for n in kinds_of_net:
e.add_network(net) e.add_network(net)
if c == 'cv': if c == 'cv':
servers = sim.create_basic_hosts(e, 1, 'server', net, sim.CorundumVerilatorNIC, sim.QemuHost, servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumVerilatorNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfUDPServer) node.CorundumLinuxNode, node.IperfUDPServer)
clients = sim.create_basic_hosts(e, 1, 'client', net, sim.CorundumVerilatorNIC, sim.QemuHost, clients = create_basic_hosts(e, 1, 'client', net, sim.CorundumVerilatorNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfUDPClient, ip_start = 2) node.CorundumLinuxNode, node.IperfUDPClient, ip_start = 2)
if c == 'cb': if c == 'cb':
servers = sim.create_basic_hosts(e, 1, 'server', net, sim.CorundumBMNIC, sim.QemuHost, servers = create_basic_hosts(e, 1, 'server', net, sim.CorundumBMNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfUDPServer) node.CorundumLinuxNode, node.IperfUDPServer)
clients = sim.create_basic_hosts(e, 1, 'client', net, sim.CorundumBMNIC, sim.QemuHost, clients = create_basic_hosts(e, 1, 'client', net, sim.CorundumBMNIC, sim.QemuHost,
node.CorundumLinuxNode, node.IperfUDPClient, ip_start = 2) node.CorundumLinuxNode, node.IperfUDPClient, ip_start = 2)
if c == 'ib': if c == 'ib':
servers = sim.create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost, servers = create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost,
node.I40eLinuxNode, node.IperfUDPServer) node.I40eLinuxNode, node.IperfUDPServer)
clients = sim.create_basic_hosts(e, 1, 'client', net, sim.I40eNIC, sim.QemuHost, clients = create_basic_hosts(e, 1, 'client', net, sim.I40eNIC, sim.QemuHost,
node.I40eLinuxNode, node.IperfUDPClient, ip_start = 2) node.I40eLinuxNode, node.IperfUDPClient, ip_start = 2)
clients[0].wait = True clients[0].wait = True
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
import simbricks.experiments as exp import simbricks.experiments as exp
import simbricks.simulators as sim import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
from simbricks.simulator_utils import create_basic_hosts
msg_sizes = [64, 1024, 8092] msg_sizes = [64, 1024, 8092]
...@@ -43,10 +44,10 @@ for msg_size in msg_sizes: ...@@ -43,10 +44,10 @@ for msg_size in msg_sizes:
else: else:
n = node.I40eLinuxNode n = node.I40eLinuxNode
servers = sim.create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost, servers = create_basic_hosts(e, 1, 'server', net, sim.I40eNIC, sim.QemuHost,
n, node.RPCServer) n, node.RPCServer)
clients = sim.create_basic_hosts(e, num_clients, 'client', net, sim.I40eNIC, clients = create_basic_hosts(e, num_clients, 'client', net, sim.I40eNIC,
sim.QemuHost, n, node.RPCClient, ip_start = 2) sim.QemuHost, n, node.RPCClient, ip_start = 2)
for h in servers + clients: for h in servers + clients:
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
import simbricks.experiments as exp import simbricks.experiments as exp
import simbricks.simulators as sim import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
from simbricks.simulator_utils import create_basic_hosts
host_configs = ['bm', 'cycle'] host_configs = ['bm', 'cycle']
n_clients = [1, 2, 4, 8] n_clients = [1, 2, 4, 8]
...@@ -49,10 +50,10 @@ for host_config in host_configs: ...@@ -49,10 +50,10 @@ for host_config in host_configs:
e.add_network(net) e.add_network(net)
servers = sim.create_basic_hosts(e, 1, 'server', net, nic_class, host_class, servers = create_basic_hosts(e, 1, 'server', net, nic_class, host_class,
nc_class, node.IperfUDPServer) nc_class, node.IperfUDPServer)
clients = sim.create_basic_hosts(e, nc, 'client', net, nic_class, host_class, clients = create_basic_hosts(e, nc, 'client', net, nic_class, host_class,
nc_class, node.IperfUDPClient) nc_class, node.IperfUDPClient)
for c in clients: for c in clients:
......
# Copyright 2021 Max Planck Institute for Software Systems, and
# National University of Singapore
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""Provides utility functions for assembling host simulators."""
import typing as tp
from simbricks.experiments import Experiment
from simbricks.nodeconfig import NodeConfig, AppConfig
from simbricks.simulators import NetSim, NICSim, HostSim, I40eMultiNIC
def create_basic_hosts(
e: Experiment,
num: int,
name_prefix: str,
net: NetSim,
nic_class: NICSim,
host_class: HostSim,
nc_class: NodeConfig,
app_class: AppConfig,
ip_start: int = 1,
ip_prefix: int = 24
):
"""Creates and configures multiple hosts to be simulated using the given parameters.
Args:
`num`: number of hosts to create
"""
hosts: tp.List[HostSim] = []
for i in range(0, num):
nic = nic_class()
#nic.name = '%s.%d' % (name_prefix, i)
nic.set_network(net)
host = host_class()
host.name = '%s.%d' % (name_prefix, i)
node_config = nc_class()
node_config.prefix = ip_prefix
ip = ip_start + i
node_config.ip = '10.0.%d.%d' % (int(ip / 256), ip % 256)
node_config.app = app_class()
host.set_config(node_config)
host.add_nic(nic)
e.add_nic(nic)
e.add_host(host)
hosts.append(host)
return hosts
def create_multinic_hosts(
e: Experiment,
num: int,
name_prefix: str,
net: NetSim,
host_class: HostSim,
nc_class: NodeConfig,
app_class: AppConfig,
ip_start: int = 1,
ip_prefix: int = 24
):
# TODO modify docstring
"""Creates and configures multiple hosts to be simulated using the given parameters.
Args:
num: number of hosts to create
"""
hosts: tp.List[HostSim] = []
mn = I40eMultiNIC()
mn.name = name_prefix
e.add_nic(mn)
for i in range(0, num):
nic = mn.create_subnic()
#nic.name = '%s.%d' % (name_prefix, i)
nic.set_network(net)
host = host_class()
host.name = '%s.%d' % (name_prefix, i)
node_config = nc_class()
node_config.prefix = ip_prefix
ip = ip_start + i
node_config.ip = '10.0.%d.%d' % (int(ip / 256), ip % 256)
node_config.app = app_class()
host.set_config(node_config)
host.add_nic(nic)
e.add_host(host)
hosts.append(host)
return hosts
def create_dctcp_hosts(
e: Experiment,
num: int,
name_prefix: str,
net: NetSim,
nic_class: NICSim,
host_class: HostSim,
nc_class: NodeConfig,
app_class: AppConfig,
cpu_freq: str,
mtu: int,
ip_start: int = 1
):
# TODO modify docstring
"""Creates and configures multiple hosts to be simulated using the given parameters.
Args:
num: number of hosts to create
cpu_freq: CPU frequency to simulate, e.g. '5GHz'
"""
hosts = []
for i in range(0, num):
nic = nic_class()
#nic.name = '%s.%d' % (name_prefix, i)
nic.set_network(net)
host = host_class()
host.name = '%s.%d' % (name_prefix, i)
host.cpu_freq = cpu_freq
node_config = nc_class()
node_config.mtu = mtu
node_config.ip = '192.168.64.%d' % (ip_start + i)
node_config.app = app_class()
host.set_config(node_config)
host.add_nic(nic)
e.add_nic(nic)
e.add_host(host)
hosts.append(host)
return hosts
\ No newline at end of file
...@@ -21,8 +21,14 @@ ...@@ -21,8 +21,14 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import math import math
import typing as tp
from simbricks.nodeconfig import NodeConfig
class Simulator(object): class Simulator(object):
"""Base class for all simulators."""
def __init__(self): def __init__(self):
self.extra_deps = [] self.extra_deps = []
...@@ -58,45 +64,6 @@ class Simulator(object): ...@@ -58,45 +64,6 @@ class Simulator(object):
def wait_terminate(self): def wait_terminate(self):
return False return False
class HostSim(Simulator):
node_config = None
name = ''
wait = False
sleep = 0
cpu_freq = '8GHz'
sync_mode = 0
sync_period = 500
pci_latency = 500
def __init__(self):
self.pcidevs = []
super().__init__()
def full_name(self):
return 'host.' + self.name
def add_nic(self, dev):
self.add_pcidev(dev)
def add_pcidev(self, dev):
dev.name = self.name + '.' + dev.name
self.pcidevs.append(dev)
def set_config(self, nc):
self.node_config = nc
def dependencies(self):
deps = []
for dev in self.pcidevs:
deps.append(dev)
if isinstance(dev, NICSim):
deps.append(dev.network)
return deps
def wait_terminate(self):
return self.wait
class PCIDevSim(Simulator): class PCIDevSim(Simulator):
name = '' name = ''
...@@ -155,6 +122,7 @@ class NICSim(PCIDevSim): ...@@ -155,6 +122,7 @@ class NICSim(PCIDevSim):
return super().sockets_wait(env) + [env.nic_eth_path(self)] return super().sockets_wait(env) + [env.nic_eth_path(self)]
class NetSim(Simulator): class NetSim(Simulator):
"""Base class for network simulators."""
name = '' name = ''
opt = '' opt = ''
sync_mode = 0 sync_mode = 0
...@@ -170,8 +138,8 @@ class NetSim(Simulator): ...@@ -170,8 +138,8 @@ class NetSim(Simulator):
def full_name(self): def full_name(self):
return 'net.' + self.name return 'net.' + self.name
# Connect this netwrok to the listening peer `net`
def connect_network(self, net): def connect_network(self, net):
"""Connect this network to the listening peer `net`"""
net.net_listen.append(self) net.net_listen.append(self)
self.net_connect.append(net) self.net_connect.append(net)
...@@ -199,6 +167,51 @@ class NetSim(Simulator): ...@@ -199,6 +167,51 @@ class NetSim(Simulator):
return [s for (_,s) in self.listen_sockets(env)] return [s for (_,s) in self.listen_sockets(env)]
class HostSim(Simulator):
node_config: NodeConfig
"""Config for this node. """
name = ''
wait = False
"""
`True` - Wait for process of simulator to exit.
`False` - Don't wait and instead stop the process.
"""
sleep = 0
cpu_freq = '8GHz'
sync_mode = 0
sync_period = 500
pci_latency = 500
def __init__(self):
self.pcidevs: tp.List[PCIDevSim] = []
super().__init__()
def full_name(self):
return 'host.' + self.name
def add_nic(self, dev: NICSim):
self.add_pcidev(dev)
def add_pcidev(self, dev: NICSim):
dev.name = self.name + '.' + dev.name
self.pcidevs.append(dev)
def set_config(self, nc: NodeConfig):
self.node_config = nc
def dependencies(self):
deps = []
for dev in self.pcidevs:
deps.append(dev)
if isinstance(dev, NICSim):
deps.append(dev.network)
return deps
def wait_terminate(self):
return self.wait
class QemuHost(HostSim): class QemuHost(HostSim):
sync = False sync = False
cpu_freq = '4GHz' cpu_freq = '4GHz'
...@@ -535,87 +548,3 @@ class FEMUDev(PCIDevSim): ...@@ -535,87 +548,3 @@ class FEMUDev(PCIDevSim):
(env.repodir, '/sims/external/femu/femu-simbricks', (env.repodir, '/sims/external/femu/femu-simbricks',
env.dev_pci_path(self), env.dev_shm_path(self)) env.dev_pci_path(self), env.dev_shm_path(self))
return cmd return cmd
def create_basic_hosts(e, num, name_prefix, net, nic_class, host_class,
nc_class, app_class, ip_start=1, ip_prefix=24):
hosts = []
for i in range(0, num):
nic = nic_class()
#nic.name = '%s.%d' % (name_prefix, i)
nic.set_network(net)
host = host_class()
host.name = '%s.%d' % (name_prefix, i)
node_config = nc_class()
node_config.prefix = ip_prefix
ip = ip_start + i
node_config.ip = '10.0.%d.%d' % (int(ip / 256), ip % 256)
node_config.app = app_class()
host.set_config(node_config)
host.add_nic(nic)
e.add_nic(nic)
e.add_host(host)
hosts.append(host)
return hosts
def create_multinic_hosts(e, num, name_prefix, net, host_class,
nc_class, app_class, ip_start=1, ip_prefix=24):
hosts = []
mn = I40eMultiNIC()
mn.name = name_prefix
e.add_nic(mn)
for i in range(0, num):
nic = mn.create_subnic()
#nic.name = '%s.%d' % (name_prefix, i)
nic.set_network(net)
host = host_class()
host.name = '%s.%d' % (name_prefix, i)
node_config = nc_class()
node_config.prefix = ip_prefix
ip = ip_start + i
node_config.ip = '10.0.%d.%d' % (int(ip / 256), ip % 256)
node_config.app = app_class()
host.set_config(node_config)
host.add_nic(nic)
e.add_host(host)
hosts.append(host)
return hosts
def create_dctcp_hosts(e, num, name_prefix, net, nic_class, host_class,
nc_class, app_class, cpu_freq, mtu, ip_start=1):
hosts = []
for i in range(0, num):
nic = nic_class()
#nic.name = '%s.%d' % (name_prefix, i)
nic.set_network(net)
host = host_class()
host.name = '%s.%d' % (name_prefix, i)
host.cpu_freq = cpu_freq
node_config = nc_class()
node_config.mtu = mtu
node_config.ip = '192.168.64.%d' % (ip_start + i)
node_config.app = app_class()
host.set_config(node_config)
host.add_nic(nic)
e.add_nic(nic)
e.add_host(host)
hosts.append(host)
return hosts
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