updates to consolidate commands that need to be defined by a new node type
This commit is contained in:
parent
0b8ee7760d
commit
d3bd61ddcf
25 changed files with 314 additions and 175 deletions
|
@ -82,7 +82,7 @@ def main():
|
|||
for i in xrange(1, num_local + 1):
|
||||
node = session.add_object(cls=nodes.CoreNode, name="n%d" % i, objid=i)
|
||||
node.newnetif(switch, ["%s/%s" % (prefix.addr(i), prefix.prefixlen)])
|
||||
node.client.cmd([constants.SYSCTL_BIN, "net.ipv4.icmp_echo_ignore_broadcasts=0"])
|
||||
node.cmd([constants.SYSCTL_BIN, "net.ipv4.icmp_echo_ignore_broadcasts=0"])
|
||||
node.setposition(x=150 * i, y=150)
|
||||
n.append(node)
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ def main():
|
|||
for i in xrange(1, options.numnodes + 1):
|
||||
tmp = session.add_object(cls=nodes.CoreNode, name="n%d" % i, objid=i)
|
||||
tmp.newnetif(wlan, ["%s/%s" % (prefix.addr(i), prefix.prefixlen)])
|
||||
tmp.client.cmd([constants.SYSCTL_BIN, "net.ipv4.icmp_echo_ignore_broadcasts=0"])
|
||||
tmp.cmd([constants.SYSCTL_BIN, "net.ipv4.icmp_echo_ignore_broadcasts=0"])
|
||||
tmp.setposition(x=150 * i, y=150)
|
||||
session.services.addservicestonode(tmp, "", services_str)
|
||||
n.append(tmp)
|
||||
|
|
|
@ -159,7 +159,7 @@ def main():
|
|||
try:
|
||||
n = session.add_object(cls=nodes.LxcNode, name="n%d" % i)
|
||||
n.newnetif(switch, ["%s/%s" % (prefix.addr(i), prefix.prefixlen)])
|
||||
n.client.cmd([constants.SYSCTL_BIN, "net.ipv4.icmp_echo_ignore_broadcasts=0"])
|
||||
n.cmd([constants.SYSCTL_BIN, "net.ipv4.icmp_echo_ignore_broadcasts=0"])
|
||||
if options.services is not None:
|
||||
session.services.addservicestonode(n, "", options.services)
|
||||
n.boot()
|
||||
|
|
|
@ -72,9 +72,9 @@ def main():
|
|||
prefix = ipaddress.Ipv4Prefix("10.83.%d.0/24" % i)
|
||||
right = session.add_object(cls=nodes.PtpNet)
|
||||
tmp.newnetif(right, ["%s/%s" % (prefix.addr(1), prefix.prefixlen)])
|
||||
tmp.client.cmd([constants.SYSCTL_BIN, "net.ipv4.icmp_echo_ignore_broadcasts=0"])
|
||||
tmp.client.cmd([constants.SYSCTL_BIN, "net.ipv4.conf.all.forwarding=1"])
|
||||
tmp.client.cmd([constants.SYSCTL_BIN, "net.ipv4.conf.default.rp_filter=0"])
|
||||
tmp.cmd([constants.SYSCTL_BIN, "net.ipv4.icmp_echo_ignore_broadcasts=0"])
|
||||
tmp.cmd([constants.SYSCTL_BIN, "net.ipv4.conf.all.forwarding=1"])
|
||||
tmp.cmd([constants.SYSCTL_BIN, "net.ipv4.conf.default.rp_filter=0"])
|
||||
tmp.setposition(x=100 * i, y=150)
|
||||
n.append(tmp)
|
||||
left = right
|
||||
|
|
|
@ -268,7 +268,7 @@ class ManetExperiment(object):
|
|||
self.nodes[i].boot()
|
||||
# run the boot.sh script on all nodes to start Quagga
|
||||
for i in xrange(numnodes):
|
||||
self.nodes[i].client.cmd(["./%s" % self.nodes[i].bootsh])
|
||||
self.nodes[i].cmd(["./%s" % self.nodes[i].bootsh])
|
||||
|
||||
def compareroutes(self, node, kr, zr):
|
||||
""" Compare two lists of Route objects.
|
||||
|
@ -386,8 +386,7 @@ class Cmd:
|
|||
|
||||
def open(self):
|
||||
""" Exceute call to node.popen(). """
|
||||
self.id, self.stdin, self.out, self.err = \
|
||||
self.node.client.popen(self.args)
|
||||
self.id, self.stdin, self.out, self.err = self.node.client.popen(self.args)
|
||||
|
||||
def parse(self):
|
||||
""" This method is overloaded by child classes and should return some
|
||||
|
|
|
@ -57,7 +57,7 @@ def main():
|
|||
for i in xrange(1, options.numnodes + 1):
|
||||
tmp = session.add_object(cls=nodes.CoreNode, name="n%d" % i, objid=i)
|
||||
tmp.newnetif(switch, ["%s/%s" % (prefix.addr(i), prefix.prefixlen)])
|
||||
tmp.client.cmd([constants.SYSCTL_BIN, "net.ipv4.icmp_echo_ignore_broadcasts=0"])
|
||||
tmp.cmd([constants.SYSCTL_BIN, "net.ipv4.icmp_echo_ignore_broadcasts=0"])
|
||||
tmp.setposition(x=150 * i, y=150)
|
||||
n.append(tmp)
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ def test(numnodes, testsec):
|
|||
tmp = session.add_object(cls=nodes.LxcNode, name="n%d" % i)
|
||||
tmp.newnetif(net, ["%s/%s" % (prefix.addr(i), prefix.prefixlen)])
|
||||
n.append(tmp)
|
||||
n[0].client.cmd(["iperf", "-s", "-D"])
|
||||
n[0].cmd(["iperf", "-s", "-D"])
|
||||
n[-1].client.icmd(["iperf", "-t", str(int(testsec)), "-c", str(prefix.addr(1))])
|
||||
n[0].client.cmd(["killall", "-9", "iperf"])
|
||||
n[0].cmd(["killall", "-9", "iperf"])
|
||||
|
||||
raw_input("press enter to exit")
|
||||
session.shutdown()
|
||||
|
|
|
@ -166,7 +166,7 @@ class ClientServerCmd(Cmd):
|
|||
self.client_open() # client
|
||||
status = self.client_id.wait()
|
||||
# stop the server
|
||||
self.node.client.cmdresult(["killall", self.args[0]])
|
||||
self.node.cmd_output(["killall", self.args[0]])
|
||||
r = self.parse()
|
||||
self.cleanup()
|
||||
return r
|
||||
|
@ -207,7 +207,7 @@ class PingCmd(Cmd):
|
|||
def run(self):
|
||||
if self.verbose:
|
||||
self.info("%s initial test ping (max 1 second)..." % self.node.name)
|
||||
(status, result) = self.node.client.cmdresult(["ping", "-q", "-c", "1", "-w", "1", self.addr])
|
||||
(status, result) = self.node.cmd_output(["ping", "-q", "-c", "1", "-w", "1", self.addr])
|
||||
if status != 0:
|
||||
self.warn("initial ping from %s to %s failed! result:\n%s" %
|
||||
(self.node.name, self.addr, result))
|
||||
|
@ -226,7 +226,7 @@ class PingCmd(Cmd):
|
|||
stats = stats_str.split("/")
|
||||
avg_latency = float(stats[1])
|
||||
mdev = float(stats[3].split(" ")[0])
|
||||
except Exception, e:
|
||||
except:
|
||||
self.warn("ping parsing exception: %s" % e)
|
||||
return avg_latency, mdev
|
||||
|
||||
|
@ -487,13 +487,13 @@ class Experiment(object):
|
|||
if i > 1:
|
||||
neigh_left = "%s" % prefix.addr(i - 1)
|
||||
cmd = routecmd + [neigh_left, "dev", node.netif(0).name]
|
||||
(status, result) = node.client.cmdresult(cmd)
|
||||
(status, result) = node.cmd_output(cmd)
|
||||
if status != 0:
|
||||
self.warn("failed to add interface route: %s" % cmd)
|
||||
if i < numnodes:
|
||||
neigh_right = "%s" % prefix.addr(i + 1)
|
||||
cmd = routecmd + [neigh_right, "dev", node.netif(0).name]
|
||||
(status, result) = node.client.cmdresult(cmd)
|
||||
(status, result) = node.cmd_output(cmd)
|
||||
if status != 0:
|
||||
self.warn("failed to add interface route: %s" % cmd)
|
||||
|
||||
|
@ -507,7 +507,7 @@ class Experiment(object):
|
|||
else:
|
||||
gw = neigh_right
|
||||
cmd = routecmd + [addr, "via", gw]
|
||||
(status, result) = node.client.cmdresult(cmd)
|
||||
(status, result) = node.cmd_output(cmd)
|
||||
if status != 0:
|
||||
self.warn("failed to add route: %s" % cmd)
|
||||
|
||||
|
@ -635,7 +635,7 @@ class Experiment(object):
|
|||
if self.verbose:
|
||||
self.info("%s initial test ping (max 1 second)..." % \
|
||||
self.firstnode.name)
|
||||
(status, result) = self.firstnode.client.cmdresult(["ping", "-q", "-c", "1",
|
||||
(status, result) = self.firstnode.cmd_output(["ping", "-q", "-c", "1",
|
||||
"-w", "1", self.lastaddr])
|
||||
if status != 0:
|
||||
self.warn("initial ping from %s to %s failed! result:\n%s" % \
|
||||
|
|
|
@ -37,9 +37,9 @@ def test(numnodes, testsec):
|
|||
tmp.newnetif(net, ["%s/%s" % (prefix.addr(i), prefix.prefixlen)])
|
||||
n.append(tmp)
|
||||
net.link(n[0].netif(0), n[-1].netif(0))
|
||||
n[0].client.cmd(["iperf", "-s", "-D"])
|
||||
n[0].cmd(["iperf", "-s", "-D"])
|
||||
n[-1].client.icmd(["iperf", "-t", str(int(testsec)), "-c", str(prefix.addr(1))])
|
||||
n[0].client.cmd(["killall", "-9", "iperf"])
|
||||
n[0].cmd(["killall", "-9", "iperf"])
|
||||
session.shutdown()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue