removed session.create_wireless_node, can be achieved simply without needing this function
This commit is contained in:
parent
c1bb9ed5d8
commit
ce411a07d7
9 changed files with 56 additions and 74 deletions
|
@ -8,7 +8,7 @@ from core.emulator.enumerations import EventTypes, NodeTypes
|
|||
from core.location.mobility import BasicRangeModel
|
||||
|
||||
|
||||
def example(options):
|
||||
def example(args):
|
||||
# ip generator for example
|
||||
prefixes = IpPrefixes("10.83.0.0/16")
|
||||
|
||||
|
@ -24,10 +24,10 @@ def example(options):
|
|||
session.mobility.set_model(wlan, BasicRangeModel)
|
||||
|
||||
# create nodes, must set a position for wlan basic range model
|
||||
node_options = NodeOptions()
|
||||
node_options.set_position(0, 0)
|
||||
for _ in range(options.nodes):
|
||||
node = session.add_node(node_options=node_options)
|
||||
options = NodeOptions(model="mdr")
|
||||
options.set_position(0, 0)
|
||||
for _ in range(args.nodes):
|
||||
node = session.add_node(node_options=options)
|
||||
interface = prefixes.create_interface(node)
|
||||
session.add_link(node.id, wlan.id, interface_one=interface)
|
||||
|
||||
|
@ -36,13 +36,14 @@ def example(options):
|
|||
|
||||
# get nodes for example run
|
||||
first_node = session.get_node(2)
|
||||
last_node = session.get_node(options.nodes + 1)
|
||||
last_node = session.get_node(args.nodes + 1)
|
||||
|
||||
logging.info("starting iperf server on node: %s", first_node.name)
|
||||
first_node.cmd("iperf -s -D")
|
||||
address = prefixes.ip4_address(first_node)
|
||||
logging.info("node %s connecting to %s", last_node.name, address)
|
||||
last_node.cmd(f"iperf -t {options.time} -c {address}")
|
||||
output = last_node.cmd(f"iperf -t {args.time} -c {address}")
|
||||
logging.info(output)
|
||||
first_node.cmd("killall -9 iperf")
|
||||
|
||||
# shutdown session
|
||||
|
@ -51,13 +52,11 @@ def example(options):
|
|||
|
||||
def main():
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
options = parser.parse_options("wlan")
|
||||
args = parser.parse("wlan")
|
||||
|
||||
start = datetime.datetime.now()
|
||||
logging.info(
|
||||
"running wlan example: nodes(%s) time(%s)", options.nodes, options.time
|
||||
)
|
||||
example(options)
|
||||
logging.info("running wlan example: nodes(%s) time(%s)", args.nodes, args.time)
|
||||
example(args)
|
||||
logging.info("elapsed time: %s", datetime.datetime.now() - start)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue