updated missed commands to be string based
This commit is contained in:
parent
5b3308a231
commit
2bfd050880
5 changed files with 15 additions and 12 deletions
|
@ -974,9 +974,10 @@ class EmaneManager(ModelManager):
|
||||||
|
|
||||||
def emanerunning(self, node):
|
def emanerunning(self, node):
|
||||||
"""
|
"""
|
||||||
Return True if an EMANE process associated with the given node is running, False otherwise.
|
Return True if an EMANE process associated with the given node is running,
|
||||||
|
False otherwise.
|
||||||
"""
|
"""
|
||||||
args = ["pkill", "-0", "-x", "emane"]
|
args = "pkill -0 -x emane"
|
||||||
try:
|
try:
|
||||||
node.node_net_cmd(args)
|
node.node_net_cmd(args)
|
||||||
result = True
|
result = True
|
||||||
|
|
|
@ -2025,7 +2025,8 @@ class Session(object):
|
||||||
data,
|
data,
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: if data is None, this blows up, but this ties into how event functions are ran, need to clean that up
|
# TODO: if data is None, this blows up, but this ties into how event functions
|
||||||
|
# are ran, need to clean that up
|
||||||
def run_event(self, node_id=None, name=None, data=None):
|
def run_event(self, node_id=None, name=None, data=None):
|
||||||
"""
|
"""
|
||||||
Run a scheduled event, executing commands in the data string.
|
Run a scheduled event, executing commands in the data string.
|
||||||
|
|
|
@ -6,7 +6,8 @@ import logging
|
||||||
import os
|
import os
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from core import constants, utils
|
from core import utils
|
||||||
|
from core.constants import MOUNT_BIN, UMOUNT_BIN
|
||||||
from core.emulator.enumerations import NodeTypes
|
from core.emulator.enumerations import NodeTypes
|
||||||
from core.errors import CoreCommandError
|
from core.errors import CoreCommandError
|
||||||
from core.nodes.base import CoreNodeBase
|
from core.nodes.base import CoreNodeBase
|
||||||
|
@ -190,13 +191,13 @@ class PhysicalNode(CoreNodeBase):
|
||||||
source = os.path.abspath(source)
|
source = os.path.abspath(source)
|
||||||
logging.info("mounting %s at %s", source, target)
|
logging.info("mounting %s at %s", source, target)
|
||||||
os.makedirs(target)
|
os.makedirs(target)
|
||||||
self.net_cmd([constants.MOUNT_BIN, "--bind", source, target], cwd=self.nodedir)
|
self.net_cmd("%s --bind %s %s" % (MOUNT_BIN, source, target), cwd=self.nodedir)
|
||||||
self._mounts.append((source, target))
|
self._mounts.append((source, target))
|
||||||
|
|
||||||
def umount(self, target):
|
def umount(self, target):
|
||||||
logging.info("unmounting '%s'" % target)
|
logging.info("unmounting '%s'" % target)
|
||||||
try:
|
try:
|
||||||
self.net_cmd([constants.UMOUNT_BIN, "-l", target], cwd=self.nodedir)
|
self.net_cmd("%s -l %s" % (UMOUNT_BIN, target), cwd=self.nodedir)
|
||||||
except CoreCommandError:
|
except CoreCommandError:
|
||||||
logging.exception("unmounting failed for %s", target)
|
logging.exception("unmounting failed for %s", target)
|
||||||
|
|
||||||
|
|
|
@ -43,14 +43,14 @@ def example(options):
|
||||||
last_node = session.get_node(options.nodes + 1)
|
last_node = session.get_node(options.nodes + 1)
|
||||||
|
|
||||||
print("starting iperf server on node: %s" % first_node.name)
|
print("starting iperf server on node: %s" % first_node.name)
|
||||||
first_node.node_net_cmd(["iperf", "-s", "-D"])
|
first_node.node_net_cmd("iperf -s -D")
|
||||||
first_node_address = prefixes.ip4_address(first_node)
|
first_node_address = prefixes.ip4_address(first_node)
|
||||||
print("node %s connecting to %s" % (last_node.name, first_node_address))
|
print("node %s connecting to %s" % (last_node.name, first_node_address))
|
||||||
output = last_node.node_net_cmd(
|
output = last_node.node_net_cmd(
|
||||||
["iperf", "-t", str(options.time), "-c", first_node_address]
|
"iperf -t %s -c %s" % (options.time, first_node_address)
|
||||||
)
|
)
|
||||||
print(output)
|
print(output)
|
||||||
first_node.node_net_cmd(["killall", "-9", "iperf"])
|
first_node.node_net_cmd("killall -9 iperf")
|
||||||
|
|
||||||
# shutdown session
|
# shutdown session
|
||||||
coreemu.shutdown()
|
coreemu.shutdown()
|
||||||
|
|
|
@ -47,11 +47,11 @@ def example(options):
|
||||||
last_node = session.get_node(options.nodes + 1)
|
last_node = session.get_node(options.nodes + 1)
|
||||||
|
|
||||||
print("starting iperf server on node: %s" % first_node.name)
|
print("starting iperf server on node: %s" % first_node.name)
|
||||||
first_node.node_net_cmd(["iperf", "-s", "-D"])
|
first_node.node_net_cmd("iperf -s -D")
|
||||||
address = prefixes.ip4_address(first_node)
|
address = prefixes.ip4_address(first_node)
|
||||||
print("node %s connecting to %s" % (last_node.name, address))
|
print("node %s connecting to %s" % (last_node.name, address))
|
||||||
last_node.node_net_cmd(["iperf", "-t", str(options.time), "-c", address])
|
last_node.node_net_cmd("iperf -t %s -c %s" % (options.time, address))
|
||||||
first_node.node_net_cmd(["killall", "-9", "iperf"])
|
first_node.node_net_cmd("killall -9 iperf")
|
||||||
|
|
||||||
# shutdown session
|
# shutdown session
|
||||||
coreemu.shutdown()
|
coreemu.shutdown()
|
||||||
|
|
Loading…
Add table
Reference in a new issue