• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python term.makeTerms函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mininet.term.makeTerms函数的典型用法代码示例。如果您正苦于以下问题:Python makeTerms函数的具体用法?Python makeTerms怎么用?Python makeTerms使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: startTerms

 def startTerms(self):
     "Start a terminal for each node."
     info("*** Running terms on %s\n" % os.environ["DISPLAY"])
     cleanUpScreens()
     self.terms += makeTerms(self.controllers, "controller")
     self.terms += makeTerms(self.switches, "switch")
     self.terms += makeTerms(self.hosts, "host")
开发者ID:schuerg,项目名称:mn-ccnx,代码行数:7,代码来源:net.py


示例2: startTerms

 def startTerms( self ):
     "Start a terminal for each node."
     info( "*** Running terms on %s\n" % os.environ[ 'DISPLAY' ] )
     cleanUpScreens()
     self.terms += makeTerms( self.controllers, 'controller' )
     self.terms += makeTerms( self.switches, 'switch' )
     self.terms += makeTerms( self.hosts, 'host' )
开发者ID:arjunkrishnapr,项目名称:mininet,代码行数:7,代码来源:net.py


示例3: run_exercise

def run_exercise():
    #Create and start a new network with our custom topology
    topo = SSHTopo()
    net = Mininet(topo=topo)
    net.start()
    pids = []

    net['httpd'].cmd('ip addr add fc00::5:80/64 dev httpd-eth0')
    net['httpd'].cmd('ip addr add fc00::5:88/64 dev httpd-eth0')
    net['httpd'].cmd('ip addr add fc00::5:8080/64 dev httpd-eth0')
    net['httpd'].cmd('ip addr add fc00::5:8888/64 dev httpd-eth0')
    net['httpd'].cmd('ip addr add fc00::5:8889/64 dev httpd-eth0')
    for i in range(1,20):
        net['proxy%i'%i].cmd('ip addr add fc00::5:%x/64 dev proxy%i-eth0'%(i*111, i))
        pids.append(net["proxy%i"%i].popen('/usr/sbin/sshd', '-o', 'PermitTTY=no', '-o', 'ForceCommand=/usr/sbin/nologin').pid)

    httpd_pid = net["httpd"].popen('nginx', '-c', '/home/vagrant/assignments/ssh/nginx.conf').pid
    ssh1_sshd_pid = net["ssh1"].popen('/usr/sbin/sshd', '-o', 'Ciphers=3des-cbc', '-o', 'PrintMotd=yes').pid #, '-f', '/home/vagrant/assignments/ssh/ssh1_sshd.conf').pid
    ssh3_sshd_pid = net["ssh3"].popen('/usr/sbin/sshd', '-o', 'PrintMotd=no').pid

    pids += [httpd_pid, ssh1_sshd_pid, ssh3_sshd_pid]

    makeTerms([net["you"]], title="term1")
    makeTerms([net["you"]], title="term2")

    state = ExerciseState(net, pids)
    return state
开发者ID:ut-dacs,项目名称:MOOC-Internet-Security-Protocols,代码行数:27,代码来源:ssh.py


示例4: startTerms

 def startTerms(self):
     "Start a terminal for each node."
     if "DISPLAY" not in os.environ:
         error("Error starting terms: Cannot connect to display\n")
         return
     info("*** Running terms on %s\n" % os.environ["DISPLAY"])
     cleanUpScreens()
     self.terms += makeTerms(self.controllers, "controller")
     self.terms += makeTerms(self.switches, "switch")
     self.terms += makeTerms(self.hosts, "host")
开发者ID:ruifcardoso,项目名称:mininet,代码行数:10,代码来源:net.py


示例5: startTerms

 def startTerms( self ):
     "Start a terminal for each node."
     if 'DISPLAY' not in os.environ:
         error( "Error starting terms: Cannot connect to display\n" )
         return
     info( "*** Running terms on %s\n" % os.environ[ 'DISPLAY' ] )
     cleanUpScreens()
     self.terms += makeTerms( self.controllers, 'controller' )
     self.terms += makeTerms( self.switches, 'switch' )
     self.terms += makeTerms( self.hosts, 'host' )
开发者ID:hackerenRG,项目名称:mininet,代码行数:10,代码来源:net.py


示例6: run_exercise

def run_exercise():
    #Create and start a new network with our custom topology
    topo = TLSTopo()
    net = Mininet(topo=topo)
    net.start()
    net.pingAll()

    processes = []

    #Start Nginx HTTP-server
    processes.append(net["Server-1"].popen('nginx -p /home/vagrant/assignments/ssl_tls/nginx -c nginx_1.conf'))
    processes.append(net["Server-2"].popen('nginx -p /home/vagrant/assignments/ssl_tls/nginx -c nginx_2.conf'))
    processes.append(net["Server-3"].popen('nginx -p /home/vagrant/assignments/ssl_tls/nginx -c nginx_3.conf'))
    processes.append(net["Server-4"].popen('nginx -p /home/vagrant/assignments/ssl_tls/nginx -c nginx_4.conf'))
    processes.append(net["Server-5"].popen('nginx -p /home/vagrant/assignments/ssl_tls/nginx -c nginx_5.conf'))

    #Open wireshark
    processes.append(net["A"].popen('wireshark'))

    #Open terminals
    processes.append(makeTerms([net["A"]], title="Student terminal")[0])

    raw_input("Press Enter to exit....")
    for process in processes:
        process.kill()
    Cleanup.cleanup()
开发者ID:ut-dacs,项目名称:MOOC-Internet-Security-Protocols,代码行数:26,代码来源:excercise.py


示例7: dhcpdemo

def dhcpdemo( firefox=True , controller=None):
    "Rogue DHCP server demonstration"
    checkRequired()
    topo = DHCPTopo()
    net = Mininet( topo=topo, link=TCLink , switch=OVSSwitch, controller=controller)
    h1, dhcp, evil = net.get( 'h1', 'dhcp', 'evil' )
    # connectToInternet calls net.start() for us!
    rootnode = connectToInternet( net, 's1' )
    mountPrivateResolvconf( h1 )
    # Set up a good but slow DHCP server
    startDHCPserver( dhcp, gw=rootnode.IP(), dns='8.8.8.8')
    startDHCPclient( h1 )
    waitForIP( h1 )
    # Make sure we can fetch the good google.com
    info( '* Fetching google.com:\n' )
    print h1.cmd( 'curl google.com' )
    # For firefox, start it up and tell user what to do
    if firefox:
        net.terms += makeTerms( [ h1 ], 'h1' )
        h1.cmd( 'firefox www.stanford.edu -geometry 400x400-50+50 &' )
        print '*** You may want to do some DNS lookups using dig'
        print '*** Please go to amazon.com in Firefox'
        print '*** You may also wish to start up wireshark and look at bootp and/or dns'
        prompt( "*** Press return to start up evil DHCP server: " )
    # Now start up an evil but fast DHCP server
    startDHCPserver( evil, gw=rootnode.IP(), dns=evil.IP() )
    # And an evil fake DNS server
    startFakeDNS( evil )
    # And an evil web server
    startEvilWebServer( evil )
    h1.cmd( 'ifconfig', h1.defaultIntf(), '0' )
    waitForIP( h1 )
    info( '* New DNS result:\n' )
    info( h1.cmd( 'host google.com' ) )
    # Test http request
    if firefox:
        print "*** You may wish to look at DHCP and DNS results in wireshark"
        print "*** You may also wish to do some DNS lookups using dig"
        print "*** Please go to google.com in Firefox"
        print "*** You may also want to try going back to amazon.com and hitting shift-refresh"
    else:
        info( '* Fetching google.com:\n' )
        print h1.cmd( 'curl google.com' )
    if firefox:
        prompt( "*** Press return to shut down evil DHCP/DNS/Web servers: " )
    # Clean up everything
    stopFakeDNS( evil )
    stopEvilWebServer( evil )
    stopDHCPserver( evil )
    if firefox:
        print "*** Try going to some other web sites if you like"
        prompt( "*** Press return to exit: " )
    stopDHCPserver( dhcp )
    stopDHCPclient( h1 )
    stopNAT( rootnode )
    unmountPrivateResolvconf( h1 )
    net.stop()
开发者ID:rishdas,项目名称:secure_pox_l2_learning_switch,代码行数:57,代码来源:dhcp.py


示例8: do_xterm

 def do_xterm( self, line, term='xterm' ):
     "Spawn xterm(s) for the given node(s)."
     args = line.split()
     if not args:
         error( 'usage: %s node1 node2 ...\n' % term )
     else:
         for arg in args:
             if arg not in self.mn:
                 error( "node '%s' not in network\n" % arg )
             else:
                 node = self.mn[ arg ]
                 self.mn.terms += makeTerms( [ node ], term = term )
开发者ID:ActiveCK,项目名称:mininet,代码行数:12,代码来源:cli.py


示例9: do_xterm

 def do_xterm( self, line, term='xterm' ):
     "Spawn xterm(s) for the given component(s)."
     args = line.split()
     if not args:
         error( 'usage: %s comp1 comp2 ...\n' % term )
     else:
         for arg in args:
             if arg not in self.cn:
                 error( "component '%s' not in network\n" % arg )
             else:
                 comp = self.cn[ arg ]
                 self.cn.terms += makeTerms( [ comp.node ], term = term )
开发者ID:eternia478,项目名称:mininetcetera_public,代码行数:12,代码来源:cms_cli.py


示例10: process_message

 def process_message(self, msg):
     if msg == 'current_network':
         self.send_network()
     elif msg.startswith('link '):
         self.mininet.configLinkStatus( *msg.split()[1:] )
     elif msg.startswith('node xterm'):
         node = self.mininet[msg.split()[-1]]
         self.mininet.terms += makeTerms([node], term = 'xterm')
     elif msg == 'port_stats_request':
         self.handle_port_stats_request()
     elif msg == 'flow_stats_request':
         self.handle_flow_stats_request()
     else:
         self.log.warn('Unrecognized message from browser: %s' % msg)
开发者ID:chenjian221,项目名称:pyreticVisMod,代码行数:14,代码来源:visualizer.py


示例11: newTerm

 def newTerm( net=self.net, node=self.node, title=self.title ):
     "Pop up a new terminal window for a node."
     net.terms += makeTerms( [ node ], title )
开发者ID:1514louluo,项目名称:mininet,代码行数:3,代码来源:consoles.py


示例12: _createHostAtDummy

    def _createHostAtDummy( self, hostName, **params ):
        """
        Add a host node to Mininet and link it to the dummy.

        hostName: name of the host
        params: parameters for host
        """
        if self.debug_flag1:
            print "EXEC: createHostAtDummy(%s):" % hostName

        # Part 0: Main assertions.
        assert hostName not in self.mn.nameToNode
        assert self.mn.built

        # Part 1: Getting dummy.
        dummy = self.mn.nameToNode.get("dummy", None)
        if dummy is None:
            error('dummy node does not exist\n')
            return
        assert isinstance(dummy, Dummy)

        # The following corresponds to code in self.build()

        # if self.topo:
        #     self.buildFromTopo( self.topo )
        info( '*** Adding host: %s\n' % hostName )
        host = self.mn.addHost( hostName, **params )
        info( '*** Adding link: (%s, %s)\n' % ( host.name, dummy.name ) )
        hostPort = host.newPort()
        dummyPort = dummy.newPort()
        self.mn.addLink( host, dummy, hostPort, dummyPort )

        # if ( self.inNamespace ):
        #     self.configureControlNetwork()        
        if ( self.mn.inNamespace ):
            self.mn.configureControlNetwork()

        # info( '*** Configuring hosts\n' )
        # self.configHosts()
        info( '*** Configuring host: %s\n' % host.name )
        intf = host.defaultIntf()
        if intf:
            host.configDefault()
        else:       # Don't configure nonexistent intf
            host.configDefault( ip=None, mac=None ) 
        host.cmd( 'ifconfig lo up' )

        # if self.xterms:
        #     self.startTerms()
        if self.mn.xterms:
            if 'DISPLAY' not in os.environ:
                error( "Error starting terms: Cannot connect to display\n" )
                return
            info( "*** Running term on %s\n" % os.environ[ 'DISPLAY' ] )
            self.mn.terms += makeTerms( [host], 'host' )

        # if self.autoStaticArp:
        #     self.staticArp()
        if self.mn.autoStaticArp:
            for dst in self.mn.hosts:
                if host != dst:
                    host.setARP( ip=dst.IP(), mac=dst.MAC() )
                    dst.setARP( ip=host.IP(), mac=host.MAC() )

        # self.built = True
        self.mn.built = True
        
        return host
开发者ID:eternia478,项目名称:mininetcetera_public,代码行数:68,代码来源:cms_net.py


示例13: _tempStartDummy

 def _tempStartDummy(self):
     info( '\n*** Adding dummy:\n' )
     dummy = self._addDummy()
     self.mn.terms += makeTerms( [dummy], 'dummy' )
开发者ID:eternia478,项目名称:mininetcetera_public,代码行数:4,代码来源:cms_net.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python topo.Topo类代码示例发布时间:2022-05-27
下一篇:
Python term.cleanUpScreens函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap