2018-04-21 01:00:47 +01:00
|
|
|
#!/usr/bin/python
|
|
|
|
#
|
|
|
|
# run iperf to measure the effective throughput between two nodes when
|
|
|
|
# n nodes are connected to a virtual wlan; run test for testsec
|
|
|
|
# and repeat for minnodes <= n <= maxnodes with a step size of
|
|
|
|
# nodestep
|
2019-02-16 17:50:19 +00:00
|
|
|
from core import load_logging_config
|
2018-05-01 18:40:25 +01:00
|
|
|
from core.emulator.emudata import IpPrefixes
|
2018-04-21 01:00:47 +01:00
|
|
|
from core.enumerations import NodeTypes, EventTypes
|
|
|
|
|
2019-02-16 17:50:19 +00:00
|
|
|
load_logging_config()
|
|
|
|
|
2018-04-21 01:00:47 +01:00
|
|
|
|
|
|
|
def example(nodes):
|
|
|
|
# ip generator for example
|
2018-04-25 00:24:54 +01:00
|
|
|
prefixes = IpPrefixes("10.83.0.0/16")
|
2018-04-21 01:00:47 +01:00
|
|
|
|
|
|
|
# create emulator instance for creating sessions and utility methods
|
|
|
|
coreemu = globals()["coreemu"]
|
2018-04-25 18:55:48 +01:00
|
|
|
session = coreemu.create_session()
|
2018-04-21 01:00:47 +01:00
|
|
|
|
|
|
|
# must be in configuration state for nodes to start, when using "node_add" below
|
2018-04-26 00:33:58 +01:00
|
|
|
session.set_state(EventTypes.CONFIGURATION_STATE)
|
2018-04-21 01:00:47 +01:00
|
|
|
|
|
|
|
# create switch network node
|
2018-04-25 18:55:48 +01:00
|
|
|
switch = session.add_node(_type=NodeTypes.SWITCH)
|
2018-04-21 01:00:47 +01:00
|
|
|
|
|
|
|
# create nodes
|
|
|
|
for _ in xrange(nodes):
|
2018-04-25 18:55:48 +01:00
|
|
|
node = session.add_node()
|
2018-04-25 00:24:54 +01:00
|
|
|
interface = prefixes.create_interface(node)
|
|
|
|
session.add_link(node.objid, switch.objid, interface_one=interface)
|
2018-04-21 01:00:47 +01:00
|
|
|
|
|
|
|
# instantiate session
|
|
|
|
session.instantiate()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ in {"__main__", "__builtin__"}:
|
|
|
|
example(2)
|