updated missed commands to be string based

This commit is contained in:
bharnden 2019-10-11 22:37:33 -07:00
parent 5b3308a231
commit 2bfd050880
5 changed files with 15 additions and 12 deletions

View file

@ -974,9 +974,10 @@ class EmaneManager(ModelManager):
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:
node.node_net_cmd(args)
result = True

View file

@ -2025,7 +2025,8 @@ class Session(object):
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):
"""
Run a scheduled event, executing commands in the data string.

View file

@ -6,7 +6,8 @@ import logging
import os
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.errors import CoreCommandError
from core.nodes.base import CoreNodeBase
@ -190,13 +191,13 @@ class PhysicalNode(CoreNodeBase):
source = os.path.abspath(source)
logging.info("mounting %s at %s", source, 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))
def umount(self, target):
logging.info("unmounting '%s'" % target)
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:
logging.exception("unmounting failed for %s", target)

View file

@ -43,14 +43,14 @@ def example(options):
last_node = session.get_node(options.nodes + 1)
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)
print("node %s connecting to %s" % (last_node.name, first_node_address))
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)
first_node.node_net_cmd(["killall", "-9", "iperf"])
first_node.node_net_cmd("killall -9 iperf")
# shutdown session
coreemu.shutdown()

View file

@ -47,11 +47,11 @@ def example(options):
last_node = session.get_node(options.nodes + 1)
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)
print("node %s connecting to %s" % (last_node.name, address))
last_node.node_net_cmd(["iperf", "-t", str(options.time), "-c", address])
first_node.node_net_cmd(["killall", "-9", "iperf"])
last_node.node_net_cmd("iperf -t %s -c %s" % (options.time, address))
first_node.node_net_cmd("killall -9 iperf")
# shutdown session
coreemu.shutdown()