当前位置: 首页>>代码示例>>Python>>正文


Python ExperimentController.trace方法代码示例

本文整理汇总了Python中nepi.execution.ec.ExperimentController.trace方法的典型用法代码示例。如果您正苦于以下问题:Python ExperimentController.trace方法的具体用法?Python ExperimentController.trace怎么用?Python ExperimentController.trace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nepi.execution.ec.ExperimentController的用法示例。


在下文中一共展示了ExperimentController.trace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: t_dce_ccnpeek_with_stack

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import trace [as 别名]
    def t_dce_ccnpeek_with_stack(self, host, user = None, identity = None):
        ec = ExperimentController(exp_id = "test-dce-peek-lostack")
        
        node = ec.register_resource("linux::Node")
        if host == "localhost":
            ec.set(node, "hostname", host)
        else:
            ec.set(node, "hostname", host)
            ec.set(node, "username", user)
            ec.set(node, "identity", identity)
        
        ec.set(node, "cleanProcesses", True)
        #ec.set(node, "cleanHome", True)

        simu = ec.register_resource("linux::ns3::Simulation")
        ec.set(simu, "verbose", True)
        ec.register_connection(simu, node)

        nsnode = ec.register_resource("ns3::Node")
        ec.set(nsnode, "enableStack", True)
        ec.register_connection(nsnode, simu)

        ### create applications
        ccnd = ec.register_resource("linux::ns3::dce::CCND")
        ec.set (ccnd, "stackSize", 1<<20)
        ec.set (ccnd, "StartTime", "1s")
        ec.register_connection(ccnd, nsnode)

        ccnpoke = ec.register_resource("linux::ns3::dce::CCNPoke")
        ec.set (ccnpoke, "contentName", "ccnx:/chunk0")
        ec.set (ccnpoke, "content", "DATA")
        ec.set (ccnpoke, "stackSize", 1<<20)
        ec.set (ccnpoke, "StartTime", "2s")
        ec.register_connection(ccnpoke, nsnode)

        ccnpeek = ec.register_resource("linux::ns3::dce::CCNPeek")
        ec.set (ccnpeek, "contentName", "ccnx:/chunk0")
        ec.set (ccnpeek, "stackSize", 1<<20)
        ec.set (ccnpeek, "StartTime", "4s")
        ec.set (ccnpeek, "StopTime", "20s")
        ec.register_connection(ccnpeek, nsnode)

        ec.deploy()

        ec.wait_finished([ccnpeek])

        expected = "ccnpeek ccnx:/chunk0"
        cmdline = ec.trace(ccnpeek, "cmdline")
        self.assertTrue(cmdline.find(expected) > -1, cmdline)

        expected = "Start Time: NS3 Time:          4s ("
        status = ec.trace(ccnpeek, "status")
        self.assertTrue(status.find(expected) > -1, status)

        expected = "DATA"
        stdout = ec.trace(ccnpeek, "stdout")
        self.assertTrue(stdout.find(expected) > -1, stdout)

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:61,代码来源:ns3dceccnpeek.py

示例2: t_compile_debug_mode

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import trace [as 别名]
    def t_compile_debug_mode(self, host, user = None, identity = None):
        ec = ExperimentController(exp_id = "test-ns3-debug-mode")
        
        node = ec.register_resource("linux::Node")
        if host == "localhost":
            ec.set(node, "hostname", host)
        else:
            ec.set(node, "hostname", host)
            ec.set(node, "username", user)
            ec.set(node, "identity", identity)

        ec.set(node, "cleanProcesses", True)
        #ec.set(node, "cleanHome", True)

        simu = ec.register_resource("linux::ns3::Simulation")
        ec.set(simu, "verbose", True)
        ec.set(simu, "nsLog", "V4Ping:Node")
        ec.set(simu, "buildMode", "debug")
        ec.register_connection(simu, node)

        nsnode1 = add_ns3_node(ec, simu)
        dev1 = add_csma_device(ec, nsnode1, "10.0.0.1", "30")

        nsnode2 = add_ns3_node(ec, simu)
        dev2 = add_csma_device(ec, nsnode2, "10.0.0.2", "30")

        # Create channel
        chan = ec.register_resource("ns3::CsmaChannel")
        ec.set(chan, "Delay", "0s")
        ec.register_connection(chan, dev1)
        ec.register_connection(chan, dev2)

        ### create pinger
        ping = ec.register_resource("ns3::V4Ping")
        ec.set (ping, "Remote", "10.0.0.2")
        ec.set (ping, "Interval", "1s")
        ec.set (ping, "Verbose", True)
        ec.set (ping, "StartTime", "0s")
        ec.set (ping, "StopTime", "20s")
        ec.register_connection(ping, nsnode1)

        ec.deploy()

        ec.wait_finished([ping])
        
        stdout = ec.trace(simu, "stdout") 

        expected = "20 packets transmitted, 20 received, 0% packet loss"
        self.assertTrue(stdout.find(expected) > -1)
        
        stderr = ec.trace(simu, "stderr")
        expected = "V4Ping:Read32"
        self.assertTrue(stderr.find(expected) > -1)

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:57,代码来源:ns3simulation.py

示例3: test_ccnpeek

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import trace [as 别名]
    def test_ccnpeek(self):
        ec = ExperimentController(exp_id = "test-linux-ccnpeek")
        
        node = ec.register_resource("linux::Node")
        ec.set(node, "hostname", self.fedora_host)
        ec.set(node, "username", self.fedora_user)
        ec.set(node, "identity", self.fedora_identity)
        #ec.set(node, "cleanProcesses", True)
        #ec.set(node, "cleanExperiment", True)

        ccnd = ec.register_resource("linux::CCND")
        ec.register_connection(ccnd, node)

        peek = ec.register_resource("linux::CCNPeek")
        ec.set(peek, "contentName", "ccnx:/chunk0")
        ec.register_connection(peek, ccnd)

        poke = ec.register_resource("linux::CCNPoke")
        ec.set(poke, "contentName", "ccnx:/chunk0")
        ec.set(poke, "content", "DATA")
        ec.register_connection(poke, ccnd)

        ec.register_condition(peek, ResourceAction.START, poke,
            ResourceState.STARTED)
 
        ec.deploy()

        ec.wait_finished(peek)

        stdout = ec.trace(peek, "stdout")
        print stdout
        expected = "DATA"
        self.assertTrue(stdout.find(expected) > -1)

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:37,代码来源:ccnpeek.py

示例4: t_tofile

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import trace [as 别名]
    def t_tofile(self, host, user):
        ec = ExperimentController(exp_id = "test-to-file")
        
        node = ec.register_resource("linux::Node")
        ec.set(node, "hostname", host)
        ec.set(node, "username", user)
        ec.set(node, "cleanExperiment", True)
        ec.set(node, "cleanProcesses", True)

        pcap = ec.register_resource("linux::Tcpdump")
        ec.set(pcap, "i", "eth0")
        ec.set(pcap, "w", "custom_output")
        ec.register_connection(pcap, node)

        app = ec.register_resource("linux::Ping")
        ec.set(app, "count", "20")
        ec.set(app, "target", self.target)
        ec.register_connection(app, node)

        ec.deploy()

        ec.wait_finished(app)

        output = ec.trace(pcap, "custom_output")
        self.assertTrue(len(output) > 0)

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:29,代码来源:tcpdump.py

示例5: t_stdout

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import trace [as 别名]
    def t_stdout(self, host, user):

        ec = ExperimentController(exp_id = "test-stdout")
        
        node = ec.register_resource("linux::Node")
        ec.set(node, "hostname", host)
        ec.set(node, "username", user)
        ec.set(node, "cleanExperiment", True)
        ec.set(node, "cleanProcesses", True)

        app = ec.register_resource("linux::Application")
        cmd = "echo 'HOLA'"
        ec.set(app, "command", cmd)
        ec.register_connection(app, node)

        ec.deploy()

        ec.wait_finished(app)

        self.assertTrue(ec.state(node) == ResourceState.STARTED)
        self.assertTrue(ec.state(app) == ResourceState.STOPPED)

        stdout = ec.trace(app, "stdout")
        self.assertTrue(stdout.strip() == "HOLA")

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:28,代码来源:application.py

示例6: t_nping

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import trace [as 别名]
    def t_nping(self, host, user):

        ec = ExperimentController(exp_id = "test-nping")
        
        node = ec.register_resource("linux::Node")
        ec.set(node, "hostname", host)
        ec.set(node, "username", user)
        ec.set(node, "cleanExperiment", True)
        ec.set(node, "cleanProcesses", True)

        app = ec.register_resource("linux::NPing")
        ec.set(app, "c", 1)
        ec.set(app, "tcp", True)
        ec.set(app, "p", 80)
        ec.set(app, "target", self.target)
        ec.register_connection(app, node)

        ec.deploy()

        ec.wait_finished(app)

        stdout = ec.trace(app, "stdout")
        self.assertTrue(stdout.find("1 IP address pinged in") > -1)

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:27,代码来源:nping.py

示例7: t_tun_create

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import trace [as 别名]
    def t_tun_create(self, host, user, identity):

        ec = ExperimentController(exp_id="test-un-create")
        
        node = ec.register_resource("planetlab::Node")
        ec.set(node, "hostname", host)
        ec.set(node, "username", user)
        ec.set(node, "identity", identity)
        ec.set(node, "cleanExperiment", True)
        ec.set(node, "cleanProcesses", True)

        tun = ec.register_resource("planetlab::Tun")
        ec.set(tun, "ip", "%s.1" % self.netblock)
        ec.set(tun, "prefix", "24")
        ec.register_connection(tun, node)

        app = ec.register_resource("linux::Application")
        cmd = "ping -c3 %s.1" % self.netblock
        ec.set(app, "command", cmd)
        ec.register_connection(app, node)

        ec.deploy()

        ec.wait_finished(app)

        ping = ec.trace(app, "stdout")
        expected = """3 packets transmitted, 3 received, 0% packet loss"""
        self.assertTrue(ping.find(expected) > -1)
        
        if_name = ec.get(tun, "deviceName")
        self.assertTrue(if_name.startswith("tun"))

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:35,代码来源:tun.py

示例8: t_rtt

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import trace [as 别名]
    def t_rtt(self, user1, host1, user2, host2):

        ec = ExperimentController(exp_id = "test-udptest-rtt")
        
        node1 = ec.register_resource("linux::Node")
        ec.set(node1, "hostname", host1)
        ec.set(node1, "username", user1)
        ec.set(node1, "cleanExperiment", True)
        ec.set(node1, "cleanProcesses", True)

        server = ec.register_resource("linux::UdpTest")
        ec.set(server, "s", True)
        ec.register_connection(server, node1)
 
        node2 = ec.register_resource("linux::Node")
        ec.set(node2, "hostname", host2)
        ec.set(node2, "username", user2)
        ec.set(node2, "cleanExperiment", True)
        ec.set(node2, "cleanProcesses", True)

        client = ec.register_resource("linux::UdpTest")
        ec.set(client, "a", True)
        ec.set(client, "target", host1)
        ec.register_connection(client, node2)

        ec.deploy()

        ec.wait_finished(client)

        stdout = ec.trace(client, "stderr")
        self.assertTrue(stdout.find("10 trials with message size 64 Bytes.") > -1)

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:35,代码来源:udptest.py

示例9: t_real_time

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import trace [as 别名]
    def t_real_time(self, host, user = None, identity = None):
        ec = ExperimentController(exp_id = "test-ns3-real-time")
        
        node = ec.register_resource("linux::Node")
        if host == "localhost":
            ec.set(node, "hostname", "localhost")
        else:
            ec.set(node, "hostname", host)
            ec.set(node, "username", user)
            ec.set(node, "identity", identity)
            ec.set(node, "cleanProcesses", True)

        #ec.set(node, "cleanHome", True)

        simu = ec.register_resource("linux::ns3::Simulation")
        ec.set(simu, "simulatorImplementationType", "ns3::RealtimeSimulatorImpl")
        ec.set(simu, "checksumEnabled", True)
        ec.set(simu, "verbose", True)
        ec.register_connection(simu, node)

        nsnode1 = add_ns3_node(ec, simu)
        dev1 = add_point2point_device(ec, nsnode1, "10.0.0.1", "30")

        nsnode2 = add_ns3_node(ec, simu)
        dev2 = add_point2point_device(ec, nsnode2, "10.0.0.2", "30")

        # Create channel
        chan = ec.register_resource("ns3::PointToPointChannel")
        ec.set(chan, "Delay", "0s")
        ec.register_connection(chan, dev1)
        ec.register_connection(chan, dev2)

        ### create pinger
        ping = ec.register_resource("ns3::V4Ping")
        ec.set (ping, "Remote", "10.0.0.2")
        ec.set (ping, "Interval", "1s")
        ec.set (ping, "Verbose", True)
        ec.set (ping, "StartTime", "0s")
        ec.set (ping, "StopTime", "20s")
        ec.register_connection(ping, nsnode1)

        ec.deploy()

        ec.wait_finished([ping])
      
        stdout = ec.trace(simu, "stdout") 

        expected = "20 packets transmitted, 20 received, 0% packet loss"
        self.assertTrue(stdout.find(expected) > -1)

        rm = ec.get_resource(ping)
        start_time = rm.start_time
        stop_time = rm.stop_time
        delta = stop_time - start_time

        self.assertTrue(delta.seconds >= 20, "Time elapsed %d" % delta.seconds)
        self.assertTrue(delta.seconds < 25, "Time elapsed %d" % delta.seconds)

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:61,代码来源:ns3simulation.py

示例10: t_traces

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import trace [as 别名]
    def t_traces(self, host, user):

        ec = ExperimentController(exp_id = "test-fib-traces")
        
        node1 = ec.register_resource("linux::Node")
        ec.set(node1, "hostname", host)
        ec.set(node1, "username", user)
        ec.set(node1, "cleanExperiment", True)
        ec.set(node1, "cleanProcesses", True)

        ccnd1 = ec.register_resource("linux::CCND")
        ec.register_connection(ccnd1, node1)

        entry1 = ec.register_resource("linux::FIBEntry")
        ec.set(entry1, "host", self.target)
        ec.enable_trace(entry1, "ping")
        ec.enable_trace(entry1, "mtr")
        ec.register_connection(entry1, ccnd1)
 
        node2 = ec.register_resource("linux::Node")
        ec.set(node2, "hostname", self.target)
        ec.set(node2, "username", self.fedora_user)
        ec.set(node2, "cleanExperiment", True)
        ec.set(node2, "cleanProcesses", True)

        ccnd2 = ec.register_resource("linux::CCND")
        ec.register_connection(ccnd2, node2)

        entry2 = ec.register_resource("linux::FIBEntry")
        ec.set(entry2, "host", host)
        ec.register_connection(entry2, ccnd2)

        ec.deploy()

        ec.wait_started([ccnd1, ccnd2])

        stdout = ec.trace(entry1, "ping")
        expected = "icmp_seq=1" 
        self.assertTrue(stdout.find(expected) > -1)

        stdout = ec.trace(entry1, "mtr")
        expected = "1." 
        self.assertTrue(stdout.find(expected) > -1)

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:47,代码来源:fibentry.py

示例11: t_wifi_ping

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import trace [as 别名]
    def t_wifi_ping(self, host, user = None, identity = None):
        bounds_width = bounds_height = 200
        x = y = 100
        speed = 1

        ec = ExperimentController(exp_id = "test-ns3-wifi-ping")
        
        node = ec.register_resource("linux::Node")
        if host == "localhost":
            ec.set(node, "hostname", "localhost")
        else:
            ec.set(node, "hostname", host)
            ec.set(node, "username", user)
            ec.set(node, "identity", identity)

        ec.set(node, "cleanProcesses", True)
        #ec.set(node, "cleanHome", True)

        simu = ec.register_resource("linux::ns3::Simulation")
        ec.set(simu, "verbose", True)
        ec.register_connection(simu, node)

        nsnode1 = add_ns3_node(ec, simu)
        dev1, phy1 = add_wifi_device(ec, nsnode1, "10.0.0.1", "24", access_point = True)
        mobility1 = add_constant_mobility(ec, nsnode1, x, y, 0)

        nsnode2 = add_ns3_node(ec, simu)
        dev2, phy2 = add_wifi_device(ec, nsnode2, "10.0.0.2", "24", access_point = False)
        mobility1 = add_constant_mobility(ec, nsnode2, x, y, 0)
        #mobility2 = add_random_mobility(ec, nsnode2, x, y, 0, speed, bounds_width, bounds_height)

        # Create channel
        chan = add_wifi_channel(ec)
        ec.register_connection(chan, phy1)
        ec.register_connection(chan, phy2)

        ### create pinger
        ping = ec.register_resource("ns3::V4Ping")
        ec.set (ping, "Remote", "10.0.0.1")
        ec.set (ping, "Interval", "1s")
        ec.set (ping, "Verbose", True)
        ec.set (ping, "StartTime", "1s")
        ec.set (ping, "StopTime", "21s")
        ec.register_connection(ping, nsnode2)

        ec.deploy()

        ec.wait_finished([ping])
        
        stdout = ec.trace(simu, "stdout")

        expected = "20 packets transmitted, 20 received, 0% packet loss"
        self.assertTrue(stdout.find(expected) > -1)

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:57,代码来源:ns3simulation.py

示例12: t_tun_hybrid_gre_tunnel

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import trace [as 别名]
    def t_tun_hybrid_gre_tunnel(self, user1, host1, identity1, 
            user2, host2, identity2):

        ec = ExperimentController(exp_id="test-tap-hybrid-gre-tunnel")
        
        node1 = ec.register_resource("planetlab::Node")
        ec.set(node1, "hostname", host1)
        ec.set(node1, "username", user1)
        ec.set(node1, "identity", identity1)
        ec.set(node1, "cleanExperiment", True)
        ec.set(node1, "cleanProcesses", True)

        tun1 = ec.register_resource("planetlab::Tun")
        ec.set(tun1, "ip", "%s.1" % self.netblock)
        ec.set(tun1, "prefix", "24")
        ec.register_connection(tun1, node1)

        node2 = ec.register_resource("linux::Node")
        ec.set(node2, "hostname", host2)
        ec.set(node2, "username", user2)
        ec.set(node2, "identity", identity2)
        ec.set(node2, "cleanExperiment", True)
        ec.set(node2, "cleanProcesses", True)

        tun2 = ec.register_resource("linux::Tun")
        ec.set(tun2, "ip", "%s.2" % self.netblock)
        ec.set(tun2, "prefix", "24")
        ec.register_connection(tun2, node2)

        gretun = ec.register_resource("linux::GRETunnel")
        ec.register_connection(tun1, gretun)
        ec.register_connection(tun2, gretun)

        app = ec.register_resource("linux::Application")
        # It seems the hybrid tunnel takes some time to setup... we add a sleep 5
        # XXX: Debug this to see if it can be fixed on the RMs
        cmd = "sleep 5; ping -c3 %s.2" % self.netblock
        ec.set(app, "command", cmd)
        ec.register_connection(app, node1)

        ec.deploy()

        ec.wait_finished(app)

        ping = ec.trace(app, "stdout")
        expected = """3 packets transmitted, 3 received, 0% packet loss"""
        self.assertTrue(ping.find(expected) > -1)
        
        if_name = ec.get(tun1, "deviceName")
        self.assertTrue(if_name.startswith("tun"))
        
        if_name = ec.get(tun2, "deviceName")
        self.assertTrue(if_name.startswith("tun"))

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:57,代码来源:gretunnel.py

示例13: t_concurrency

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import trace [as 别名]
    def t_concurrency(self, host, user):

        ec = ExperimentController(exp_id="test-concurrency")
        
        node = ec.register_resource("linux::Node")
        ec.set(node, "hostname", host)
        ec.set(node, "username", user)
        ec.set(node, "cleanExperiment", True)
        ec.set(node, "cleanProcesses", True)

        apps = list()
        for i in xrange(50):
            app = ec.register_resource("linux::Application")
            cmd = "ping -c5 %s" % self.target 
            ec.set(app, "command", cmd)
            ec.register_connection(app, node)
            apps.append(app)

        ec.deploy()

        ec.wait_finished(apps)

        self.assertTrue(ec.state(node) == ResourceState.STARTED)
        self.assertTrue(
               all([ec.state(guid) == ResourceState.STOPPED \
                for guid in apps])
                )

        for app in apps:
            stdout = ec.trace(app, 'stdout')
            size = ec.trace(app, 'stdout', attr = TraceAttr.SIZE)
            self.assertEquals(len(stdout), size)
            
            block = ec.trace(app, 'stdout', attr = TraceAttr.STREAM, block = 5, offset = 1)
            self.assertEquals(block, stdout[5:10])

            path = ec.trace(app, 'stdout', attr = TraceAttr.PATH)
            rm = ec.get_resource(app)
            p = os.path.join(rm.run_home, 'stdout')
            self.assertEquals(path, p)

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:44,代码来源:application.py

示例14: t_http_sources

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import trace [as 别名]
    def t_http_sources(self, host, user):

        ec = ExperimentController(exp_id="test-http-sources")
        
        node = ec.register_resource("linux::Node")
        ec.set(node, "hostname", host)
        ec.set(node, "username", user)
        ec.set(node, "cleanExperiment", True)
        ec.set(node, "cleanProcesses", True)

        sources = "http://yans.pl.sophia.inria.fr/code/nef/archive/tip.tar.gz;" \
                "http://yans.pl.sophia.inria.fr/code/nef/raw-file/8ace577d4079/src/nef/images/menu/connect.png"

        app = ec.register_resource("linux::Application")
        ec.set(app, "sources", sources)

        command = "ls ${SRC}"
        ec.set(app, "command", command)

        ec.register_connection(app, node)


        ec.deploy()

        ec.wait_finished([app])

        self.assertTrue(ec.state(node) == ResourceState.STARTED)
        self.assertTrue(ec.state(app) == ResourceState.STOPPED)

        exitcode = ec.trace(app, "deploy_exitcode")
        self.assertTrue(exitcode.strip() == "0")
        
        out = ec.trace(app, "deploy_stdout")
        self.assertTrue(out.find("tip.tar.gz") > -1)
        self.assertTrue(out.find("connect.png") > -1)

        stdout = ec.trace(app, "stdout")
        self.assertTrue(stdout.find("tip.tar.gz") > -1)
        self.assertTrue(stdout.find("connect.png") > -1)

        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:43,代码来源:application.py

示例15: t_user_sources

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import trace [as 别名]
    def t_user_sources(self, host, user = None, identity = None):
        ec = ExperimentController(exp_id = "test-ns3-user-sources")
        
        node = ec.register_resource("linux::Node")
        if host == "localhost":
            ec.set(node, "hostname", "localhost")
        else:
            ec.set(node, "hostname", host)
            ec.set(node, "username", user)
            ec.set(node, "identity", identity)
        
        ec.set(node, "cleanProcesses", True)
        #ec.set(node, "cleanHome", True)

        simu = ec.register_resource("linux::ns3::Simulation")
        ec.set(simu, "verbose", True)
        sources = os.path.join(os.path.dirname(os.path.realpath(__file__)), 
                "ns-3.18-user.tar.gz")
        ec.set(simu, "sources", sources)
        ec.set(simu, "pybindgenVersion", "834")
        ec.register_connection(simu, node)

        nsnode1 = add_ns3_node(ec, simu)
        dev1 = add_csma_device(ec, nsnode1, "10.0.0.1", "30")

        nsnode2 = add_ns3_node(ec, simu)
        dev2 = add_csma_device(ec, nsnode2, "10.0.0.2", "30")

        # Create channel
        chan = ec.register_resource("ns3::CsmaChannel")
        ec.set(chan, "Delay", "0s")
        ec.register_connection(chan, dev1)
        ec.register_connection(chan, dev2)

        ### create pinger
        ping = ec.register_resource("ns3::V4Ping")
        ec.set (ping, "Remote", "10.0.0.2")
        ec.set (ping, "Interval", "1s")
        ec.set (ping, "Verbose", True)
        ec.set (ping, "StartTime", "0s")
        ec.set (ping, "StopTime", "20s")
        ec.register_connection(ping, nsnode1)

        ec.deploy()

        ec.wait_finished([ping])
        
        stdout = ec.trace(simu, "stdout") 

        expected = "20 packets transmitted, 20 received, 0% packet loss"
        self.assertTrue(stdout.find(expected) > -1)
        
        ec.shutdown()
开发者ID:phiros,项目名称:nepi,代码行数:55,代码来源:ns3simulation.py


注:本文中的nepi.execution.ec.ExperimentController.trace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。