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


Python ExperimentController.get方法代码示例

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


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

示例1: t_tun_hybrid_gre_tunnel

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import get [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

示例2: t_tap_udp_tunnel

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

        ec = ExperimentController(exp_id="test-tap-udp-tunnel")
        
        node1 = ec.register_resource("linux::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)

        tap1 = ec.register_resource("linux::Tap")
        ec.set(tap1, "ip", "%s.1" % self.netblock)
        ec.set(tap1, "prefix", "32")
        ec.register_connection(tap1, 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)

        tap2 = ec.register_resource("linux::Tap")
        ec.set(tap2, "ip", "%s.2" % self.netblock)
        ec.set(tap2, "prefix", "32")
        ec.register_connection(tap2, node2)

        udptun = ec.register_resource("linux::UdpTunnel")
        ec.register_connection(tap1, udptun)
        ec.register_connection(tap2, udptun)

        app = ec.register_resource("linux::Application")
        cmd = "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)
        
        vif_name = ec.get(tap1, "deviceName")
        self.assertTrue(vif_name.startswith("tap"))
        
        vif_name = ec.get(tap2, "deviceName")
        self.assertTrue(vif_name.startswith("tap"))

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

示例3: t_tun_create

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import get [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

示例4: t_deploy

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import get [as 别名]
    def t_deploy(self, host, user):
        from nepi.execution.resource import ResourceFactory
        
        ResourceFactory.register_type(LinuxNode)
        ResourceFactory.register_type(LinuxInterface)
        ResourceFactory.register_type(LinuxChannel)

        ec = ExperimentController()
        
        node = ec.register_resource("linux::Node")
        ec.set(node, "hostname", host)
        ec.set(node, "username", user)

        iface = ec.register_resource("linux::Interface")
        chan = ec.register_resource("linux::Channel")

        ec.register_connection(iface, node)
        ec.register_connection(iface, chan)

        ec.deploy()

        while not all([ ec.state(guid) == ResourceState.STARTED \
                for guid in [node, iface]]):
            time.sleep(0.5)

        self.assertTrue(ec.state(node) == ResourceState.STARTED)
        self.assertTrue(ec.state(iface) == ResourceState.STARTED)
        self.assertTrue(ec.get(iface, "deviceName") == "eth0")

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

示例5: create_app

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import get [as 别名]
	nodes.append(node)
	command_client = "iperf  -i 1 -f m -c %s -t %d -p %d  -y c > node%d.out " % (bonfire_host[1],seconds,port,node)
	app = create_app(ec,command_client,dependencies="iperf")
	ec.register_connection(app,node)
	#The app will be started once the app_bf application is running
	apps.append(app)
	node_app[node] = app
	ec.register_condition(app,ResourceAction.START, app_bonfire, ResourceState.STARTED)

#print "NODE under APP :" ,node_app	

# Deploy the experiment:

#pdb.set_trace()
ec.deploy()

ec.wait_finished(apps)


for node, app in node_app.iteritems():
#	print "iteration :",node,app
	trace=ec.trace(app,"node%d.out"%(node))
	f = open(ec.get(node,"country")+":"+ec.get(node,"ip")+":"+"node%d.out"%(node),"w")
	f.write(trace)
	f.close()
#print ec.trace(app1,"stdout")
# Do the experiment controller shutdown:
ec.shutdown()

# END
开发者ID:ruben11291,项目名称:master-thesis,代码行数:32,代码来源:pPLE.py

示例6: OMFEachTestCase

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import get [as 别名]
class OMFEachTestCase(unittest.TestCase):
    def setUp(self):
        self.ec = ExperimentController(exp_id = "99999")

        self.node1 = self.ec.register_resource("omf::Node")
        self.ec.set(self.node1, 'hostname', 'wlab12')
        self.ec.set(self.node1, 'xmppUser', "nepi")
        self.ec.set(self.node1, 'xmppServer', "xmpp-plexus.onelab.eu")
        self.ec.set(self.node1, 'xmppPort', "5222")
        self.ec.set(self.node1, 'xmppPassword', "1234")
        
        self.iface1 = self.ec.register_resource("omf::WifiInterface")
        self.ec.set(self.iface1, 'name', "wlan0")
        self.ec.set(self.iface1, 'mode', "adhoc")
        self.ec.set(self.iface1, 'hw_mode', "g")
        self.ec.set(self.iface1, 'essid', "vlcexp")
        self.ec.set(self.iface1, 'ip', "10.0.0.17/24")
        
        self.channel = self.ec.register_resource("omf::Channel")
        self.ec.set(self.channel, 'channel', "6")
        self.ec.set(self.channel, 'xmppUser', "nepi")
        self.ec.set(self.channel, 'xmppServer', "xmpp-plexus.onelab.eu")
        self.ec.set(self.channel, 'xmppPort', "5222")
        self.ec.set(self.channel, 'xmppPassword', "1234")
        
        self.app1 = self.ec.register_resource("omf::Application")
        self.ec.set(self.app1, 'appid', 'Vlc#1')
        self.ec.set(self.app1, 'command', "/opt/vlc-1.1.13/cvlc /opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
        self.ec.set(self.app1, 'env', "DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority")

        self.app2 = self.ec.register_resource("omf::Application")

        self.app3 = self.ec.register_resource("omf::Application")

        self.app4 = self.ec.register_resource("omf::Application")

        self.app5 = self.ec.register_resource("omf::Application")

        self.ec.register_connection(self.app1, self.node1)
        self.ec.register_connection(self.app2, self.node1)
        self.ec.register_connection(self.app3, self.node1)
        self.ec.register_connection(self.app4, self.node1)
        self.ec.register_connection(self.app5, self.node1)
        self.ec.register_connection(self.node1, self.iface1)
        self.ec.register_connection(self.iface1, self.channel)

        self.ec.register_condition(self.app2, ResourceAction.START, self.app1, ResourceState.STARTED , "3s")
        self.ec.register_condition(self.app3, ResourceAction.START, self.app2, ResourceState.STARTED , "2s")
        self.ec.register_condition(self.app4, ResourceAction.START, self.app3, ResourceState.STARTED , "3s")
        self.ec.register_condition(self.app5, ResourceAction.START, [self.app3, self.app2], ResourceState.STARTED , "2s")
        self.ec.register_condition(self.app5, ResourceAction.START, self.app1, ResourceState.STARTED , "25s")

        self.ec.register_condition([self.app1, self.app2, self.app3,self.app4, self.app5], ResourceAction.STOP, self.app5, ResourceState.STARTED , "1s")

    def tearDown(self):
        self.ec.shutdown()

    def test_creation_and_configuration_node(self):
        self.assertEquals(self.ec.get(self.node1, 'hostname'), 'wlab12')
        self.assertEquals(self.ec.get(self.node1, 'xmppUser'), 'nepi')
        self.assertEquals(self.ec.get(self.node1, 'xmppServer'), 'xmpp-plexus.onelab.eu')
        self.assertEquals(self.ec.get(self.node1, 'xmppPort'), '5222')
        self.assertEquals(self.ec.get(self.node1, 'xmppPassword'), '1234')
        self.assertEquals(self.ec.get(self.node1, 'version'), '6')


    def test_creation_and_configuration_interface(self):
        self.assertEquals(self.ec.get(self.iface1, 'name'), 'wlan0')
        self.assertEquals(self.ec.get(self.iface1, 'mode'), 'adhoc')
        self.assertEquals(self.ec.get(self.iface1, 'hw_mode'), 'g')
        self.assertEquals(self.ec.get(self.iface1, 'essid'), 'vlcexp')
        self.assertEquals(self.ec.get(self.iface1, 'ip'), '10.0.0.17/24')
        self.assertEquals(self.ec.get(self.iface1, 'version'), '6')

    def test_creation_and_configuration_channel(self):
        self.assertEquals(self.ec.get(self.channel, 'channel'), '6')
        self.assertEquals(self.ec.get(self.channel, 'xmppUser'), 'nepi')
        self.assertEquals(self.ec.get(self.channel, 'xmppServer'), 'xmpp-plexus.onelab.eu')
        self.assertEquals(self.ec.get(self.channel, 'xmppPort'), '5222')
        self.assertEquals(self.ec.get(self.channel, 'xmppPassword'), '1234')
        self.assertEquals(self.ec.get(self.channel, 'version'), '6')


    def test_creation_and_configuration_application(self):
        self.assertEquals(self.ec.get(self.app1, 'appid'), 'Vlc#1')
        self.assertEquals(self.ec.get(self.app1, 'command'), "/opt/vlc-1.1.13/cvlc /opt/10-by-p0d.avi --sout '#rtp{dst=10.0.0.37,port=1234,mux=ts}'")
        self.assertEquals(self.ec.get(self.app1, 'env'), 'DISPLAY=localhost:10.0 XAUTHORITY=/root/.Xauthority')
        self.assertEquals(self.ec.get(self.app1, 'version'), '6')

    def test_connection(self):
        self.assertEquals(len(self.ec.get_resource(self.node1).connections), 6)
        self.assertEquals(len(self.ec.get_resource(self.iface1).connections), 2)
        self.assertEquals(len(self.ec.get_resource(self.channel).connections), 1)
        self.assertEquals(len(self.ec.get_resource(self.app1).connections), 1)
        self.assertEquals(len(self.ec.get_resource(self.app2).connections), 1)

    def test_condition(self):
        self.assertEquals(len(self.ec.get_resource(self.app1).conditions[ResourceAction.STOP]), 1)
        self.assertEquals(len(self.ec.get_resource(self.app2).conditions[ResourceAction.START]), 1)
        self.assertEquals(len(self.ec.get_resource(self.app3).conditions[ResourceAction.START]), 1)
#.........这里部分代码省略.........
开发者ID:phiros,项目名称:nepi,代码行数:103,代码来源:omf6_vlc_normal_case.py

示例7: t_ovs

# 需要导入模块: from nepi.execution.ec import ExperimentController [as 别名]
# 或者: from nepi.execution.ec.ExperimentController import get [as 别名]
    def t_ovs(self, user1, switch1, user2, switch2, user3, host1, user4, host2):

        ec = ExperimentController(exp_id = "test-ovs")
        
        node1 = ec.register_resource("planetlab::Node")
        ec.set(node1, "hostname", switch1)
        ec.set(node1, "username", user1)
        ec.set(node1, "cleanExperiment", True)
        ec.set(node1, "cleanProcesses", True)  

        ovs1 = ec.register_resource("planetlab::OVSSwitch")
        ec.set(ovs1, "bridge_name", "nepi_bridge")
        ec.set(ovs1, "virtual_ip_pref", "192.168.3.1/24")
        ec.set(ovs1, "controller_ip", "85.23.168.77")
        ec.set(ovs1, "controller_port", "6633")
        ec.register_connection(ovs1, node1)

        port1 = ec.register_resource("planetlab::OVSPort")
        ec.set(port1, "port_name", "port-1")
        ec.register_connection(port1, ovs1)

        port2 = ec.register_resource("planetlab::OVSPort")
        ec.set(port2, "port_name", "port-2")
        ec.register_connection(port2, ovs1)

        node2 = ec.register_resource("planetlab::PlanetlabNode")
        ec.set(node2, "hostname", switch2)
        ec.set(node2, "username", user2)
        ec.set(node2, "cleanExperiment", True)
        ec.set(node2, "cleanProcesses", True) 

        ovs2 = ec.register_resource("planetlab::OVSSwitch")
        ec.set(ovs2, "bridge_name", "nepi_bridge")
        ec.set(ovs2, "virtual_ip_pref", "192.168.3.2/24")
        ec.set(ovs2, "controller_ip", "85.23.168.77")
        ec.set(ovs2, "controller_port", "6633")
        ec.register_connection(ovs2, node2)

        port3 = ec.register_resource("planetlab::OVSPort")
        ec.set(port3, "port_name", "port-3")
        ec.register_connection(port3, ovs2)  

        port4 = ec.register_resource("planetlab::OVSPort")
        ec.set(port4, "port_name", "port-4")
        ec.register_connection(port4, ovs2)

        node3 = ec.register_resource("planetlab::Node")
        ec.set(node3, "hostname", host1)
        ec.set(node3, "username", user3)
        ec.set(node3, "cleanExperiment", True)
        ec.set(node3, "cleanProcesses", True)

        tap1 = ec.register_resource("planetlab::Tap")
        ec.set(tap1, "ip4", "192.168.3.3")
        ec.set(tap1, "pointopoint", "192.168.3.1")
        ec.set(tap1, "prefix4", 24)
        ec.register_connection(tap1, node3)

        node4 = ec.register_resource("planetlab::Node")
        ec.set(node4, "hostname", host2)
        ec.set(node4, "username", user4)
        ec.set(node4, "cleanExperiment", True)
        ec.set(node4, "cleanProcesses", True)

        tap2 = ec.register_resource("planetlab::Tap")
        ec.set(tap2, "ip4", "192.168.3.4")
        ec.set(tap2, "pointopoint", "192.168.3.2")
        ec.set(tap2, "prefix4", 24)
        ec.register_connection(tap2, node4)

        ovstun1 = ec.register_resource("planetlab::OVSTunnel")
        ec.register_connection(port1, ovstun1)
        ec.register_connection(tap1, ovstun1)

        ovstun2 = ec.register_resource("plantelab::OVSTunnel")
        ec.register_connection(port3, ovstun2)
        ec.register_connection(tap2, ovstun2)

        ovstun3 = ec.register_resource("planetlab::OVSTunnel")
        ec.register_connection(port2, ovstun3)
        ec.register_connection(port4, ovstun3)

        app1 = ec.register_resource("linux::Application")
        cmd = "ping -c3 192.168.3.2"
        ec.set(app1, "command", cmd)
        ec.register_connection(app1, node1)

        app2 = ec.register_resource("linux::Application")
        cmd = "ping -c3 192.168.3.4"
        ec.set(app2, "command", cmd)
        ec.register_connection(app2, node2)

        ec.deploy()

        ec.wait_finished(app2)
        
        if_name = ec.get(tap1, "deviceName")
        self.assertTrue(if_name.startswith("tap"))
        
        if_name = ec.get(tap2, "deviceName")
#.........这里部分代码省略.........
开发者ID:phiros,项目名称:nepi,代码行数:103,代码来源:ovs.py


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