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

Python node.Controller类代码示例

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

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



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

示例1: __init__

    def __init__(self, name,
                 command='java -jar ' + fl_root_dir + 'target/floodlight.jar',
                 cargs='',
                 ip='127.0.0.1',
                 **kwargs):
        # Check to make sure Floodlight is installed before moving forward.
        installFloodlight()

        # Increment the number of controller instances for naming purposes.
        Floodlight.controller_number += 1

        # Initialize attributes
        self.name = name
        self.properties_path = ''
        self.properties_file = ''

        self.createUniqueFloodlightPropertiesFile()

        # Create the command that will start Floodlight, including the path to the unique properties file.
        self.command = command + ' -cf ' + self.properties_path + self.properties_file

        # Initialize the parent class.
        Controller.__init__(self, name, cdir=self.fl_root_dir,
                            command=self.command,
                            cargs=cargs, ip=ip, **kwargs)
开发者ID:OpenFlow-Clemson,项目名称:EAGERProject,代码行数:25,代码来源:floodlight.py


示例2: __init__

 def __init__( self, name, n=1, reactive=True, runAsRoot=False, **params):
     """n: number of ONOS instances to run (1)
        reactive: run in reactive mode (True)
        runAsRoot: run ONOS as root (False)"""
     self.check()
     self.count = n
     self.reactive = reactive
     self.runAsRoot = runAsRoot
     self.ids = range( 0, self.count )
     Controller.__init__( self, name, **params )
     self.proxies = []
     # We don't need to run as root, and it can interfere
     # with starting Zookeeper manually
     self.user = None
     if not self.runAsRoot:
         try:
             self.user = quietRun( 'who am i' ).split()[ 0 ]
             self.sendCmd( 'su', self.user )
             self.waiting = False
         except:
             warn( '__init__: failed to drop privileges\n' )
     self.cmd( 'mkdir -p', self.logDir )
     # Need to run commands from ONOS dir
     self.cmd( 'cd', self.onosDir )
     self.cmd( 'export PATH=$PATH:%s' % self.onosDir )
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:25,代码来源:onos.py


示例3: __init__

 def __init__( self, name, ip=CONTROLLER_IP, port=6633, **kwargs):
     """Init.
        name: name to give controller
        ip: the IP address where the remote controller is
        listening
        port: the port where the remote controller is listening"""
     Controller.__init__( self, name, ip=ip, port=port, **kwargs )
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:7,代码来源:fat_tree.py


示例4: __init__

 def __init__(self, name, cdir=FAUCET_DIR,
              command='ryu-manager faucet.py',
              cargs='--ofp-tcp-listen-port=%s --verbose --use-stderr',
              **kwargs):
     Controller.__init__(self, name, cdir=cdir,
                         command=command,
                         cargs=cargs, **kwargs)
开发者ID:KitL,项目名称:faucet,代码行数:7,代码来源:faucet_mininet_test.py


示例5: emptyNet

def emptyNet():

    net = Mininet(topo=None, build=False)
    c0 = Controller('c0', inNamespace=False)

    h1 = Host('h1')
    h2 = Host('h2')
    #intf1 = Intf("h1-eth1")
    #intf2 = Intf("h2-eth1")
    s1 = OVSSwitch('br0', inNamespace=False)    

    Link(h1, s1)
    Link(h2, s1)


    c0.start()
    s1.start([c0])

    net.start()    
    #s1.cmd('ovs-vsctl set bridge br0 protocols=OpenFlow13')
    CLI(net)

    net.stop()
    h1.stop()
    h2.stop()
    s1.stop()
    c0.stop()
开发者ID:exuuwen,项目名称:study,代码行数:27,代码来源:mininet_basic.py


示例6: __init__

    def __init__(self, name, cdir=POXDIR, command='python pox.py',
                 cargs='openflow.of_01 --port=%s', **kwargs):
        if 'script' in kwargs:
            cargs += ' ' + kwargs['script']
        else:
            cargs += ' forwarding.l2_learning'

        Controller.__init__(self, name, cdir=cdir, command=command, cargs=cargs, **kwargs)
开发者ID:bolek117,项目名称:mininet_sdn,代码行数:8,代码来源:pox.py


示例7: __init__

 def __init__( self, name, **kwargs ):
     "alertAction: exception|ignore|warn|exit (exception)"
     kwargs.update( inNamespace=True )
     self.alertAction = kwargs.pop( 'alertAction', 'exception' )
     Controller.__init__( self, name, **kwargs )
     self.dir = '/tmp/%s' % self.name
     self.client = self.dir + '/karaf/bin/client'
     self.ONOS_HOME = '/tmp'
开发者ID:maheshraju-Huawei,项目名称:actn,代码行数:8,代码来源:onos.py


示例8: __init__

 def __init__( self, name, cdir=MAPLEDIR,
               command='/home/vagrant/.maple/lib/maple',
               cargs=( '-u /vagrant/classes -l %s SP '),
               **kwargs):
     Controller.__init__( self, name, cdir=cdir,
                          command=command,
                          cargs=cargs, **kwargs )
     print command, cargs
开发者ID:snlab,项目名称:utilities,代码行数:8,代码来源:ysn_8.py


示例9: __init__

 def __init__(self, name, cdir = POXDIR,
              command = 'python pox-debug.py',
              # cargs = ('openflow.of_01 --port=%s forwarding.l2_learning'),
              cargs = 'forwarding.l2_learning openflow.of_01 --port=%s',
              **kwargs):
     Controller.__init__(self, name, cdir = cdir,
                         command = command,
                         cargs = cargs, **kwargs)
开发者ID:netixx,项目名称:mininet-NetProbes,代码行数:8,代码来源:builder.py


示例10: __init__

 def __init__(self, name, cdir=FLDIR,
              command='java -jar target/floodlight.jar',
              cargs='',
              ip='127.0.0.1',
              port=6653,
              **kwargs):
     Controller.__init__(self, name, cdir=cdir,
                         command=command,
                         cargs=cargs, ip=ip, port=port, **kwargs)
开发者ID:cbarrin,项目名称:MininetScripts,代码行数:9,代码来源:floodlight.py


示例11: __init__

    def __init__( self, name, cdir=POXDIR,
                  command='python pox.py',
			  
                  cargs=( 'openflow.of_01 --port=%s '
			  'tests.controller' ),
                  **kwargs ):
        Controller.__init__( self, name, cdir=cdir,
                             command=command,
                             cargs=cargs, **kwargs )
开发者ID:rakeshgn31,项目名称:SDN_Project,代码行数:9,代码来源:custcontroller.py


示例12: __init__

 def __init__( self, name, inNamespace=False, command='controller',
              cargs='-v ptcp:%d', cdir=None, ip="127.0.0.1",
              port=6633, **params ):
     """command: controller command name
        cargs: controller command arguments
        cdir: director to cd to before running controller
        ip: IP address for controller
        port: port for controller to listen at
        params: other params passed to Node.__init__()"""
     Controller.__init__( self, name, ip=ip, port=port, **params)
开发者ID:petergrabowski,项目名称:networks,代码行数:10,代码来源:lab3.py


示例13: __init__

 def __init__(
     self,
     name,
     cdir=faucet_mininet_test_util.FAUCET_DIR,
     command="timeout 180s ryu-manager gauge.py",
     cargs="--ofp-tcp-listen-port=%s --verbose --use-stderr",
     **kwargs
 ):
     name = "gauge-%u" % os.getpid()
     Controller.__init__(self, name, cdir=cdir, command=command, cargs=cargs, **kwargs)
开发者ID:REANNZ,项目名称:faucet,代码行数:10,代码来源:faucet_mininet_test_base.py


示例14: __init__

 def __init__(self,
              name,
              cdir=CURRENT_DIR,
              command='./pox-wrapper.py',
              cargs=('controller.loop_discovery --port=%s --file=pox.log'),
              **kwargs):
     Controller.__init__(self,
                         name,
                         cdir=cdir,
                         command=command,
                         cargs=cargs,
                         **kwargs)
开发者ID:butjar,项目名称:pox-playground,代码行数:12,代码来源:ring.py


示例15: __init__

 def __init__(self,
              name,
              command='ryu-manager {0}/faucet.py test_api.py'.format(
                 faucet_mininet_test_util.FAUCET_DIR),
              cargs='--ofp-tcp-listen-port=%s --verbose --use-stderr',
              **kwargs):
     name = 'faucet-api-%u' % os.getpid()
     Controller.__init__(
         self,
         name,
         command=command,
         cargs=cargs,
         **kwargs)
开发者ID:Baloc,项目名称:faucet,代码行数:13,代码来源:faucet_mininet_test_base.py


示例16: topology

def topology():
    "Create a network."
    net = Mininet( link=TCLink, switch=OVSSwitch )
    c0 = Controller( 'c0', port=6634 )
    c1 = RemoteController( 'c1', ip='127.0.0.1', port=6633 )
    net.addController(c0)
    net.addController(c1) 

    
    print "*** Creating nodes"
    s0 = net.addSwitch('s0')
    ap1 = net.addBaseStation( 'ap1', ssid="ssid_ap1", mode="g", channel="5" )
    ap2 = net.addBaseStation( 'ap2', ssid="ssid_ap2", mode="g", channel="1" )
   
    
    sta1 = net.addStation( 'sta1', ip='192.168.0.1/24' )
    sta2 = net.addStation( 'sta2', ip='192.168.0.2/24' )
    sta3 = net.addStation( 'sta3', ip='192.168.0.3/24' )
    sta4 = net.addStation( 'sta4', ip='192.168.0.4/24' )
    h1 = net.addHost('h0', ip='192.168.0.5')
    h2 = net.addHost('h1', ip='192.168.0.6')
       
    print "*** Adding Link"
    net.addLink(sta1, ap1, bw=10, loss=0)
    net.addLink(sta2, ap1, bw=10, loss=0)
    net.addLink(sta3, ap2, bw=10, loss=0)
    net.addLink(sta4, ap2, bw=10, loss=0)
    net.addLink(ap1, s0)
    net.addLink(ap2, s0)
    net.addLink(h1, s0)
    net.addLink(h2, s0)

    net.build()
    c0.start()
    c1.start()
                                 
                                 
    ap1.start( [c0] )
    ap2.start( [c0] )
    #nat0.start( [c0] )
    s0.start([c1])

    print "*** Running CLI"
    CLI( net )

    print "*** Stopping network"
    net.stop()
开发者ID:Ryuretic,项目名称:RAP,代码行数:47,代码来源:ap2cntl2.py


示例17: __init__

    def __init__(self, name, *poxArgs, **kwargs):
        """Init.
           name: name to give controller
           poxArgs: arguments (strings) to pass to POX"""
        if not poxArgs:
            warn('warning: no POX modules specified; '
                  'running packetdump only\n')
            poxArgs = ['packetdump']
        elif type(poxArgs) not in (list, tuple):
            poxArgs = [poxArgs]

        Controller.__init__(self, name,
                             command=POX_DIR + '/pox.py',
                             cargs='--libdir=/usr/local/lib -v -i ptcp:%s ' +
                             ' '.join(poxArgs),
                             cdir=POX_DIR,
                             **kwargs)
开发者ID:ZubairNabi,项目名称:minerva,代码行数:17,代码来源:mininet_setup.py


示例18: __init__

 def __init__( self, name, **params ):
     self.sw_clist_map = {}
     self.cmap = {}
     
     Controller.__init__( self, name, **params )
     
     for cname, addr in conf[ 'controllers' ].iteritems():
         cname = cname.strip()
         addr = addr.strip()
         ip, port = addr.split( ':' )
         self.cmap[ cname ] = RemoteController( cname, ip=ip, port=int( port ) )
     
     for sw, params in conf[ 'switches' ].iteritems():
         clist = []
         for c in params[ 'controllers' ]:
             assert not self.cmap[ c ] is None
             clist.append( self.cmap[ c ] )
         self.sw_clist_map[ sw ] = clist
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:18,代码来源:start_topo.py


示例19: __init__

 def __init__(self, name, cdir=POXDIR,
              command='python pox.py',
              cargs=('openflow.of_01 --port=%s '
                     'forwarding.l2_learning '
                     'openflow.discovery '
                     'misc.gephi_topo '
                     'openflow.spanning_tree --no-flood --hold-down '
                     'host_tracker '
                     'info.packet_dump '
                     'samples.pretty_log '
                     'log --file=pox.log,w '
                     'log.level --DEBUG'),
              **kwargs):
     print str(cargs)
     Controller.__init__(self, name, cdir=cdir,
                         command=command,
                         cargs=cargs,
                         **kwargs)
开发者ID:bets90,项目名称:ami-sdn,代码行数:18,代码来源:controller.py


示例20: __init__

    def __init__(self, name, working_dir, *ryuArgs, **kwargs):
        """Init.
        name: name to give controller.
        ryuArgs: arguments and modules to pass to Ryu
        working_dir: working dir of the controller"""
        ryuCoreDir = working_dir
        if not ryuArgs:
            warn('warning: no Ryu modules specified; '
                 'running simple_switch only\n')
            ryuArgs = [ryuCoreDir + 'simple_switch.py']
        elif type(ryuArgs) not in ( list, tuple ):
            ryuArgs = [ryuArgs]

        Controller.__init__(self, name,
                            command='ryu-manager',
                            cargs='--ofp-tcp-listen-port %s ' +
                                  ' '.join(ryuArgs),
                            cdir=ryuCoreDir,
                            **kwargs)
开发者ID:BenjaminUJun,项目名称:ryuo,代码行数:19,代码来源:node.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python node.Host类代码示例发布时间:2022-05-27
下一篇:
Python net.Mininet类代码示例发布时间: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