コード例 #1
0
 def __init__(self, name, ryuArgs = 'simple_switch_13.py', **kwargs):
     if ryuArgs == None:
         ryuArgs = 'simple_switch_13.py'        
     Controller.__init__(self, name,
                         command = '/usr/local/bin/ryu-manager',
                         cargs='--ofp-tcp-listen-port %s ' + ryuArgs,
                         **kwargs)
コード例 #2
0
ファイル: fat_tree_topology.py プロジェクト: originye/OVS
def createTopo():
    logging.debug("LV1 Create HugeTopo")
    topo = HugeTopo()
    topo.createTopo()
    topo.createLink()
    # TODO  add multiple controller here
    logging.debug("LV1 Start Mininet")
    CONTROLLER_IP = "127.0.0.1"
    CONTROLLER_PORT = 6633
    c0 = Controller('c0', port=6633)
    c1 = Controller('c1', port=6634)
    c2 = Controller('c2', port=6635)
    c3 = Controller('c3', port=6636)
    c5 = RemoteController('c2', ip='127.0.0.1')
    net = Mininet(topo=topo, link=TCLink, controller=POX)
    for c in [c0, c1, c2, c3 ]:
        net.addController(c)
    net.start()
    logger.debug("LV1 dumpNode")
    enableSTP()
    dumpNodeConnections(net.hosts)

    #pingTest(net)
    #iperfTest(net, topo)


    CLI(net)
    p = pexpect.spawn( 'controller test' )
    # but first a simple ping test
    p.sendline( 'xterm c0' )
    net.stop()
コード例 #3
0
ファイル: faucet_mininet_test.py プロジェクト: KitL/faucet
 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)
コード例 #4
0
ファイル: onos.py プロジェクト: opennetworkinglab/spring-open
 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 )
コード例 #5
0
 def __init__(self, name, tmpdir, controller_intf,
              ctl_privkey, ctl_cert, ca_certs,
              ports_sock, port, **kwargs):
     name = 'faucet-%u' % os.getpid()
     self.tmpdir = tmpdir
     self.controller_intf = controller_intf
     # pylint: disable=no-member
     self.controller_ipv4 = netifaces.ifaddresses(
         self.controller_intf)[socket.AF_INET][0]['addr']
     self.ofctl_port, _ = faucet_mininet_test_util.find_free_port(
         ports_sock)
     command = 'PYTHONPATH=../ ryu-manager ryu.app.ofctl_rest faucet.faucet'
     cargs = ' '.join((
         '--verbose',
         '--use-stderr',
         '--wsapi-host=127.0.0.1',
         '--wsapi-port=%u' % self.ofctl_port,
         '--ofp-listen-host=%s' % self.controller_ipv4,
         '--ofp-tcp-listen-port=%s',
         self._tls_cargs(port, ctl_privkey, ctl_cert, ca_certs)))
     Controller.__init__(
         self,
         name,
         cdir=faucet_mininet_test_util.FAUCET_DIR,
         command=command,
         cargs=cargs,
         port=port,
         **kwargs)
コード例 #6
0
 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 )
コード例 #7
0
 def __init__( self, name, ip='127.0.0.1', 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 )
コード例 #8
0
ファイル: mininet_basic.py プロジェクト: exuuwen/study
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()
コード例 #9
0
    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)
コード例 #10
0
 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)
コード例 #11
0
ファイル: controlador.py プロジェクト: helpu1409/test-dos1
 def __init__(self,
              name,
              cdir=POXDIR,
              command='python pox.py',
              poxArgs='forwarding.l2_learning_04',
              **kwargs):
     """
     Parameters
     ----------
     name : str
         Nombre del controlador en la topologia
     cdir : str
         Directorio donde se encuentran las aplicaciones de POX
     command : str
         Comando de invocacion del controlador
     poxArgs : str
         Aplicaciones que se ejecutaran en el controlador
     """
     if poxArgs == None:
         poxArgs = 'forwarding.l2_learning_04'
     cargs = 'openflow.of_04 --port=%s ' + poxArgs
     Controller.__init__(self,
                         name,
                         cdir=cdir,
                         command=command,
                         cargs=cargs,
                         **kwargs)
コード例 #12
0
ファイル: faucet_mininet_test.py プロジェクト: rsanger/faucet
 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)
コード例 #13
0
 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)
コード例 #14
0
ファイル: onos.py プロジェクト: maheshraju-Huawei/actn
 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'
コード例 #15
0
ファイル: ysn_8.py プロジェクト: snlab/utilities
 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
コード例 #16
0
ファイル: builder.py プロジェクト: netixx/mininet-NetProbes
 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)
コード例 #17
0
ファイル: builder.py プロジェクト: netixx/mininet-NetProbes
 def __init__(self, name, cdir = None,
              command = BEACON_EXEC,
              # cargs = ('openflow.of_01 --port=%s forwarding.l2_learning'),
              cargs = "--port %s",
              **kwargs):
     Controller.__init__(self, name, cdir = cdir,
                         command = command,
                         cargs = cargs, **kwargs)
コード例 #18
0
ファイル: pox.py プロジェクト: bolek117/mininet_sdn
    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)
コード例 #19
0
 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'
コード例 #20
0
 def __init__( self, name, cdir=ONOSDIR,
               command='python onos.py',
               cargs=( 'openflow.of_01 --port=%s '
                       'forwarding.l2_learning' ),
               **kwargs ):
     Controller.__init__( self, name, cdir=cdir,
                          command=command,
                          cargs=cargs, **kwargs )
コード例 #21
0
ファイル: topogen.py プロジェクト: kumokay/randomstuff
 def __init__(self):
     self.ap_dict = {}
     self.sw_dict = {}
     self.host_dict = {}
     self.sta_dict = {}
     self.net = Mininet_wifi(accessPoint=OVSKernelAP)
     self.net.propagationModel(model="logDistance", exp=3)
     self.c1 = Controller('c1')
     self.add_nodes()
コード例 #22
0
    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 )
コード例 #23
0
ファイル: floodlight.py プロジェクト: cbarrin/MininetScripts
 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)
コード例 #24
0
 def __init__( self, name, cdir=POXDIR,
               command='python pox.py',
               poxArgs = 'forwarding.l2_learning_04',
               **kwargs ):
     if poxArgs == None:
         poxArgs = 'forwarding.l2_learning_04'
     cargs = 'openflow.of_04 --port=%s ' + poxArgs
     Controller.__init__( self, name, cdir=cdir,
                          command=command,
                          cargs=cargs, **kwargs )
コード例 #25
0
ファイル: lab3.py プロジェクト: petergrabowski/networks
 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)
コード例 #26
0
 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)
コード例 #27
0
ファイル: lab5.py プロジェクト: erfa-habib/pa2
 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)
コード例 #28
0
ファイル: builder.py プロジェクト: netixx/mininet-NetProbes
 def __init__(self, name, cdir = None,
              command = FLOODLIGHT_EXEC,
              # cargs = ('openflow.of_01 --port=%s forwarding.l2_learning'),
              cargs = "--port %s",
              **kwargs):
     self.shell = True
     Controller.__init__(self, name, cdir = cdir,
                         command = command,
                         cargs = cargs, **kwargs)
     self.shell = True
コード例 #29
0
ファイル: pox.py プロジェクト: jueyaye/SmartDDOSDetection
 def __init__(self,
              name,
              cdir=POXDIR,
              command='python pox.py',
              cargs=config.get("POX", "rules"),
              **kwargs):
     Controller.__init__(self,
                         name,
                         cdir=cdir,
                         command=command,
                         cargs=cargs,
                         **kwargs)
コード例 #30
0
ファイル: ring.py プロジェクト: butjar/pox-playground
 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)
コード例 #31
0
 def __init__(
     self,
     name,
     cdir=faucet_mininet_test_util.FAUCET_DIR,
     command="timeout 180s ryu-manager ryu.app.ofctl_rest faucet.py",
     cargs="--ofp-tcp-listen-port=%s --verbose --use-stderr",
     **kwargs
 ):
     name = "faucet-%u" % os.getpid()
     self.ofctl_port, _ = faucet_mininet_test_util.find_free_port()
     cargs = "--wsapi-port=%u %s" % (self.ofctl_port, cargs)
     Controller.__init__(self, name, cdir=cdir, command=command, cargs=cargs, **kwargs)
コード例 #32
0
 def __init__(self, name):
     args = {
         "name":
         name,
         "command":
         "../pox.py",
         "cargs":
         ("{} "
          "openflow.of_01 --port=%d "
          "tree_controller".format(
              "--verbose log.level --DEBUG" if comm.DEBUG_POX else ""))
     }
     Controller.__init__(self, **args)
コード例 #33
0
 def __init__(self, name, **kwargs):
     name = 'faucet-api-%u' % os.getpid()
     command = 'PYTHONPATH=../ ryu-manager faucet.faucet test_api.py'
     cargs = ' '.join((
         '--verbose',
         '--use-stderr',
         '--ofp-tcp-listen-port=%s'))
     Controller.__init__(
         self,
         name,
         command=command,
         cargs=cargs,
         **kwargs)
コード例 #34
0
 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
コード例 #35
0
 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)
コード例 #36
0
ファイル: hw2.py プロジェクト: 2204bestdvd/ece158b-wi19
 def __init__(self,
              name,
              cdir=POXDIR,
              command='python pox.py',
              cargs=('openflow.of_01 --port=%s '
                     'forwarding.hub'),
              **kwargs):
     Controller.__init__(self,
                         name,
                         cdir=cdir,
                         command=command,
                         cargs=cargs,
                         **kwargs)
コード例 #37
0
 def __init__(
         self,
         name,
         cdir=POXDIR,
         command='./pox.py',
         cargs=('openflow.of_01 forwarding.l2_multi openflow.discovery'),
         **kwargs):
     Controller.__init__(self,
                         name,
                         cdir=cdir,
                         command=command,
                         cargs=cargs,
                         **kwargs)
コード例 #38
0
 def __init__(self,
              name,
              cdir=faucet_mininet_test_util.FAUCET_DIR,
              command='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)
コード例 #39
0
 def __init__(self,
              name,
              cdir=POXDIR,
              command='python pox.py',
              cargs=('openflow.of_01 --port=%s '
                     'openflow.discovery'
                     'openflow.spanning_tree'),
              **kwargs):
     Controller.__init__(self,
                         name,
                         cdir=cdir,
                         command=command,
                         cargs=cargs,
                         **kwargs)
コード例 #40
0
 def __init__(self,
              name,
              cdir=POXDIR,
              command='python pox.py',
              cargs=None,
              **kwargs):
     cargs = ("log --file=jelly.log,w log.level openflow.of_01 --port=%s "
              "ext.jellyfish_controller")
     Controller.__init__(self,
                         name,
                         cdir=cdir,
                         command=command,
                         cargs=cargs,
                         **kwargs)
コード例 #41
0
 def __init__(
         self,
         name,
         cdir=None,
         command=BEACON_EXEC,
         # cargs = ('openflow.of_01 --port=%s forwarding.l2_learning'),
         cargs="--port %s",
         **kwargs):
     Controller.__init__(self,
                         name,
                         cdir=cdir,
                         command=command,
                         cargs=cargs,
                         **kwargs)
コード例 #42
0
 def __init__(self,
              name,
              cdir=faucet_mininet_test_util.FAUCET_DIR,
              command='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)
コード例 #43
0
 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)
コード例 #44
0
 def __init__(self,
              name,
              cdir='/home/dshvetsov/runos',
              command='execute',
              port=6653,
              cargs='./build/runos %d',
              **kwargs):
     Controller.__init__(self,
                         name,
                         cdir=cdir,
                         port=port,
                         command=command,
                         cargs=cargs,
                         **kwargs)
コード例 #45
0
ファイル: controlador.py プロジェクト: helpu1409/test-dos1
 def __init__(self, name, ryuArgs='simple_switch_13.py', **kwargs):
     """
     Parameters
     ----------
     name : str
         Nombre del controlador en la topologia
     ryuArgs : str
         Aplicacion que ejecutara el controlador
     """
     Controller.__init__(self,
                         name,
                         command='/usr/local/bin/ryu-manager',
                         cargs='--ofp-tcp-listen-port %s ' + ryuArgs,
                         **kwargs)
コード例 #46
0
 def __init__(self, name):
     args = {
         "name":
         name,
         "command":
         "../pox.py",
         "cargs":
         ("{} "
          "openflow.of_01 --port=%d "
          "openflow.discovery --link_timeout={} "
          "dcell_controller".format(
              "--verbose log.level --DEBUG" if comm.DEBUG_POX else "",
              comm.LINK_TIMEOUT))
     }
     Controller.__init__(self, **args)
コード例 #47
0
 def __init__(
         self,
         name,
         cdir=POXDIR,
         command='python pox.py',
         cargs=(
             'log.level --WARNING log --file=jelly.log,w openflow.of_01 --port=%s ext.jelly_controller'
         ),
         **kwargs):
     Controller.__init__(self,
                         name,
                         cdir=cdir,
                         command=command,
                         cargs=cargs,
                         **kwargs)
コード例 #48
0
 def __init__(
         self,
         name,
         cdir=POX_DEFAULT_DIR,
         command='python pox.py',
         cargs=(
             'log.level --DEBUG openflow.of_01 --port=%s forwarding.l2_learning'
         ),
         **kwargs):
     Controller.__init__(self,
                         name,
                         cdir=cdir,
                         command=command,
                         cargs=cargs,
                         **kwargs)
コード例 #49
0
 def __init__(
         self,
         name,
         cdir=POXDIR,
         command='python pox.py',
         cargs=(
             'log --file=jelly.log,w openflow.of_01 --port=%s pox.forwarding.topo_proactive'
         ),
         **kwargs):
     Controller.__init__(self,
                         name,
                         cdir=cdir,
                         command=command,
                         cargs=cargs,
                         **kwargs)
コード例 #50
0
ファイル: ap2cntl2.py プロジェクト: Ryuretic/RAP
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()
コード例 #51
0
ファイル: mininet_setup.py プロジェクト: ZubairNabi/minerva
    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)
コード例 #52
0
ファイル: controller.py プロジェクト: bets90/ami-sdn
 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)
コード例 #53
0
 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
コード例 #54
0
ファイル: node.py プロジェクト: BenjaminUJun/ryuo
    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)
コード例 #55
0
ファイル: simulator.py プロジェクト: uchicago-cs/chirouter
    def __init__( self, name, pox_location, topo_file, chirouter, **kwargs):

        if chirouter is None:
            chirouter_host, chirouter_port = "localhost", 23300
        else:
            chirouter_host, chirouter_port = chirouter

        command = "python2 pox.py"

        params  = ["log.level", "--DEBUG", "--packet=CRITICAL", "--port=%s"]
        params += ["chirouter.pox_controller"]
        params += ["--topo-file=" + topo_file]
        params += ["--chirouter-host=" + chirouter_host]
        params += ["--chirouter-port=" + str(chirouter_port)]

        cargs = " ".join(params)

        Controller.__init__( self, name, cdir=pox_location,
                             command=command,
                             cargs=cargs, **kwargs)
コード例 #56
0
ファイル: onos.py プロジェクト: packet-tracker/onos-1.3.0
    def __init__( self, name, onosDir=onosDir,
                  reactive=True, features=[ 'onos-app-tvue' ],
                  **kwargs ):
        '''TODO'''

        Controller.__init__( self, name, **kwargs )
        # the following have been done for us:
        #self.ip = ip ('127.0.0.1')
        #self.port = port (6633)
        #self.protocol = protocol ('tcp')
        #self.checkListening()

        self.onosDir = onosDir
        self.karafDir = onosDir + 'apache-karaf-3.0.3/'
        self.instanceDir = self.karafDir

        # add default modules
        # TODO: consider an ordered set
        self.features = Set([ 'webconsole',
                              'onos-rest',
                              'onos-api',
                              'onos-cli',
                              'onos-openflow' ])
        self.features.update( features )
        # add reactive forwarding modules
        if reactive:
            self.features.update( ['onos-app-fwd', 
                                   'onos-app-proxyarp',
                                   'onos-app-mobility' ] )
        # add the distributed core if we are in a namespace with no trivial core
        if self.inNamespace and 'onos-core-trivial' not in self.features:
            self.features.add( 'onos-core' )
        # if there is no core, add the trivial one
        if 'onos-core' not in self.features:
            self.features.add( 'onos-core-trivial' )
        print self.features  
コード例 #57
0
ファイル: cenarioTesteLAN-WAN.py プロジェクト: gomex/Of-IDPS
def emptyNet():

    "Create an empty network and add nodes to it."

    net = Mininet( controller=Controller)

    info( '*** Adding controller\n' )
    ctrlRemote = RemoteController( 'c0', ip=ipControladorOF )
    net.addController(ctrlRemote)
    info('--> remote IP controller - c0:' + ctrlRemote.IP() +'\n')
    
    #ctrlLocal = RemoteController('c1', port=6633, ip="127.0.0.1")
    ctrlLocal = Controller('c1', port=6634)
    net.addController(ctrlLocal)
    info('--> local IP controller - c1:' + ctrlLocal.IP() +'\n')
    
    
    
    info( '*** Adding hosts\n' )
    lanH1 = net.addHost('h1', ip='10.0.0.1')
    lanH2 = net.addHost('h2', ip='10.0.0.2')
    lanIDS = net.addHost('h3', ip='10.0.0.3')
    lanRouter = net.addHost('h4')
    wanH1 = net.addHost('h5', ip='192.168.0.5')
    wanH2 = net.addHost('h6', ip='192.168.0.6')

    info( '*** Adding switch\n' )
    lanSw = net.addSwitch('s1')
    wanSw = net.addSwitch('s2')

    info( '*** Creating links\n' )
    net.addLink(lanH1, lanSw)
    net.addLink(lanH2, lanSw)
    net.addLink(lanIDS, lanSw)
    net.addLink(lanRouter, lanSw)
    net.addLink(lanRouter, wanSw)
    net.addLink(wanH1, wanSw)
    net.addLink(wanH2, wanSw)

    info( '*** Starting network\n')
    net.start()
    
    info('*** Starting controllers and switches')
    #link remote controller to s0 internal network swith
    ctrlRemote.start()
    #use remote controller
    lanSw.start([ctrlRemote])
    
    #use local controller
    #info('\n\n\n************ using local controller for swLAN')
    #lanSw.start([ctrlLocal])
    
    #start local controller to switch from s1 external network
    ctrlLocal.start()
    wanSw.start([ctrlLocal])
    
    info( '*** Executing hosts scripts\n')
    execCmds(net)
    
    sleep(5) # wai 5 seconds to start IDS!
    
    #log tests in files, the name of file and directory will be composed by date/time of start execution of test
    hst1 = net.getNodeByName('h1')
    hst1.cmdPrint('mkdir /var/log/tcpdump/'+date)
    arquivo = open('/var/log/tcpdump/'+date+'/teste.txt', 'w')
    textoTeste = """
    Test -
    \n Begin at:\n
    """
    data = datetime.datetime.now()
    textoTeste=textoTeste+"%s/%s/%s as %s:%s:%s:%s\n"%(data.year,data.month,data.day,data.hour,data.minute,data.second,data.microsecond)
    arquivo.write(textoTeste)
    
    ### Tests
    
    #
    # Start the testes here!
    #
    # Select the test to run. For that uncomment the line of the desired test.
	   
    info( '*** Executing Tests\n')
    textoTeste = textoTeste =teste1(net)
    #textoTeste = testeIperf(net)
    #textoTeste = testeIDSWakeupExternoInterno(net)
    #textoTeste = testeDDoSExtInt(net)
    #textoTeste = testeDDoSIntExt(net)
    #textoTeste = testeDDoSIntInt(net)
    
    # record attack test!
    textoTeste = textoTeste+"""
     
    put comment of test here
    
    """
    
    arquivo.write(textoTeste)

    ### end of test!
    
    # register the time that test was finished
    data = datetime.datetime.now()
    textoTeste=' \nFinished at:\n '+"%s/%s/%s as %s:%s:%s:%s\n"%(data.year,data.month,data.day,data.hour,data.minute,data.second,data.microsecond)
    arquivo.write(textoTeste)
    arquivo.close()

    info( '*** Running CLI\n' )
    #Uncomment below line for execute the test with CLI console
    #CLI( net )
    sleep(5)
    info('*** Stoping IDS process\n')
    desligarIDS(net,'h3')
    #thIds.join()

    info( '*** Stopping network\n' )
    lanSw.stop()
    ctrlRemote.stop()

    net.stop() 
    exit()
コード例 #58
0
ファイル: failover.py プロジェクト: frenetic-lang/fattire
 def __init__(self, name):
     pdir = "/home/openflow/pathetic/ocaml"
     command = pdir + "/Main_OpenFlow0x04.byte"
     Controller.__init__( self, name, command=command, cargs='', cdir=pdir )
コード例 #59
0
ファイル: PaneDemoUtil.py プロジェクト: brownsys/pane-demo-vm
 def __init__(self, name, pane_cmd='/home/paneuser/pane/pane', ip='127.0.0.1',
              pane_config="/home/paneuser/etc/pane.cfg", pane_port=4242,
              ofport=6633, **kwags):
     Controller.__init__(self, name, command=pane_cmd,
                         cargs='-c %s -p %d %%d' % (pane_config, pane_port),
                         ip=ip, port=ofport, **kwags)
コード例 #60
0
ファイル: PaneDemoUtil.py プロジェクト: brownsys/pane-demo-vm
 def start(self):
     Controller.start(self)
     sleep(1)