# Copyright (C) 2013 INRIA
#
# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#
# Author: Alina Quereilhac <alina.quereilhac@inria.fr>
+from __future__ import print_function
+
from nepi.execution.ec import ExperimentController
from nepi.execution.trace import TraceAttr
-from test_utils import skipIfNotAlive
+from test_utils import skipIfNotAlive, skipIf
import os
import time
ec.set(ip, "prefix", prefix)
ec.register_connection(ip, iface)
- print ec.get(ip, "ip"), addr
- print ec.get(ip, "prefix"), prefix
+ print(ec.get(ip, "ip"), addr)
+ print(ec.get(ip, "prefix"), prefix)
return node, iface
self.fedora_identity = "%s/.ssh/id_rsa" % (os.environ['HOME'])
@skipIfNotAlive
+ @skipIf(os.getuid() != 0, "Test requires root privileges")
def t_ping(self, host, user = None, identity = None):
ec = ExperimentController(exp_id = "test-netns-p2p-ping")
- node = ec.register_resource("LinuxNode")
+ node = ec.register_resource("linux::Node")
if host == "localhost":
ec.set(node, "hostname", "localhost")
else:
ec.set(node, "cleanProcesses", True)
#ec.set(node, "cleanHome", True)
- emu = ec.register_resource("LinuxNetNSEmulation")
+ emu = ec.register_resource("linux::netns::Emulation")
ec.set(emu, "verbose", True)
ec.register_connection(emu, node)
ec.register_connection(iface2, switch)
ping = ec.register_resource("netns::Application")
- ec.set(ping, "command", "10.0.0.2")
+ ec.set(ping, "command", "ping -c20 10.0.0.2")
ec.register_connection(ping, netnode1)
ec.deploy()