コード例 #1
0
ファイル: fie.py プロジェクト: tz70s/fie
    def __init__(self,
                 topo=None,
                 switch=OVSKernelSwitch,
                 host=Host,
                 controller=DefaultController,
                 link=Link,
                 intf=Intf,
                 build=True,
                 xterms=False,
                 cleanup=False,
                 ipBase='10.0.0.0/8',
                 inNamespace=False,
                 autoSetMacs=False,
                 autoStaticArp=False,
                 autoPinCpus=False,
                 listenPort=None,
                 waitConnected=False):

        Mininet.__init__(self, topo, switch, host, controller, link, intf,
                         build, xterms, cleanup, ipBase, inNamespace,
                         autoSetMacs, autoStaticArp, autoPinCpus, listenPort,
                         waitConnected)

        # We add abstraction nodes in this class.
        # Automatically wraps mininet host, containers, internal network

        self.absnode_map = {}
        e = Env(len(self.hosts))
        self.env = e

        for h in self.hosts:
            self.absnode_map[h.name] = AbstractionNode(h.name, h,
                                                       e.assign_cidr(),
                                                       e.docker_client)
コード例 #2
0
ファイル: cluster.py プロジェクト: xiaozhou/mininet
 def __init__( self, *args, **kwargs ):
     """servers: a list of servers to use (note: include
        localhost or None to use local system as well)
        user: user name for server ssh
        placement: Placer() subclass"""
     params = { 'host': RemoteHost,
                'switch': RemoteOVSSwitch,
                'link': RemoteLink,
                'precheck': True }
     params.update( kwargs )
     servers = params.pop( 'servers', [ 'localhost' ] )
     servers = [ s if s else 'localhost' for s in servers ]
     self.servers = servers
     self.serverIP = params.pop( 'serverIP', {} )
     if not self.serverIP:
         self.serverIP = { server: RemoteMixin.findServerIP( server )
                           for server in self.servers }
     self.user = params.pop( 'user', findUser() )
     if params.pop( 'precheck' ):
         self.precheck()
     self.connections = {}
     self.placement = params.pop( 'placement', SwitchBinPlacer )
     # Make sure control directory exists
     self.cdir = os.environ[ 'HOME' ] + '/.ssh/mn'
     errRun( [ 'mkdir', '-p', self.cdir ] )
     Mininet.__init__( self, *args, **params )
コード例 #3
0
ファイル: cluster.py プロジェクト: rubiruchi/mininet-cluster
 def __init__(self, *args, **kwargs):
     """servers: a list of servers to use (note: include
        localhost or None to use local system as well)
        user: user name for server ssh
        placement: Placer() subclass"""
     params = {
         'host': RemoteHost,
         'switch': RemoteOVSSwitch,
         'link': RemoteLink,
         'precheck': True
     }
     params.update(kwargs)
     servers = params.pop('servers', ['localhost'])
     servers = [s if s else 'localhost' for s in servers]
     self.servers = servers
     self.serverIP = params.pop('serverIP', {})
     if not self.serverIP:
         self.serverIP = {
             server: RemoteMixin.findServerIP(server)
             for server in self.servers
         }
     self.user = params.pop('user', findUser())
     if params.pop('precheck'):
         self.precheck()
     self.connections = {}
     self.placement = params.pop('placement', SwitchBinPlacer)
     # Make sure control directory exists
     self.cdir = os.environ['HOME'] + '/.ssh/mn'
     errRun(['mkdir', '-p', self.cdir])
     Mininet.__init__(self, *args, **params)
コード例 #4
0
    def __init__(self,
                 controllers=[],
                 gratuitousArp=True,
                 build=True,
                 *args,
                 **kwargs):
        """Create Mininet object for ONOS.
        controllers: List of controller IP addresses
        gratuitousArp: Send an ARP from each host to aid controller's host discovery"""

        # delay building for a second
        kwargs['build'] = False

        Mininet.__init__(self, *args, **kwargs)

        self.gratArp = gratuitousArp

        # If a controller is not provided, use list of remote controller IPs instead.
        if 'controller' not in kwargs or not kwargs['controller']:
            info('*** Adding controllers\n')
            ctrl_count = 0
            for controllerIP in controllers:
                self.addController('c%d' % ctrl_count,
                                   RemoteController,
                                   ip=controllerIP)
                info('   c%d (%s)\n' % (ctrl_count, controllerIP))
                ctrl_count = ctrl_count + 1

        if self.topo and build:
            self.build()
コード例 #5
0
ファイル: onosnet.py プロジェクト: K-OpenNet/ONOS-ApSM
    def __init__( self, controllers=[], gratuitousArp=True, build=True, *args, **kwargs ):
        """Create Mininet object for ONOS.
        controllers: List of controller IP addresses
        gratuitousArp: Send an ARP from each host to aid controller's host discovery"""
        # discarding provided controller (if any),
        # using list of remote controller IPs instead
        kwargs[ 'controller' ] = None

        # delay building for a second
        kwargs[ 'build' ] = False

        Mininet.__init__(self, *args, **kwargs )

        self.gratArp = gratuitousArp
        self.useArping = ONOSMininet.useArping

        info ( '*** Adding controllers\n' )
        ctrl_count = 0
        for controllerIP in controllers:
            self.addController( 'c%d' % ctrl_count, RemoteController, ip=controllerIP )
            info( '   c%d (%s)\n' % ( ctrl_count, controllerIP ) )
            ctrl_count = ctrl_count + 1

        if self.topo and build:
            self.build()
コード例 #6
0
ファイル: services.py プロジェクト: ARCCN/nps
    def __init__(self, *pargs, **kwargs):

        #extra args support
        self.service_factory = None 
        self.service_flag = kwargs.pop('services', None)
        if self.service_flag:
            self.service_factory = mnServices()
        Mininet.__init__(self, *pargs, **kwargs)
コード例 #7
0
ファイル: run.py プロジェクト: esnet/enos
 def __init__(self, **args):
     global controllerIp, controllerPort, configFileName
     self.topo = TestbedTopo()
     args['topo'] = self.topo
     args['switch'] = OVSKernelSwitch
     args['controller'] = RemoteController
     args['build'] = False
     Mininet.__init__(self, **args)
     self.ctrl = self.addController( 'c0', controller=RemoteController, ip=controllerIp, port=controllerPort)
コード例 #8
0
	def __init__(self, tableIP, verbose=False):

		Mininet.__init__(self, build=False)
		self.tableIP = tableIP
		self.vsfs = []
		self.rootnodes = []
		self.verbose = verbose
		lg.setLogLevel('info')
		self.name_to_root_nodes = {}
		self.node_to_pw_data = defaultdict(list)
コード例 #9
0
ファイル: doopnet.py プロジェクト: arwankhoiruddin/doopnet
 def __init__(self, dimage=None, hostExchangeFolder=None, *args, **kwargs):
     self.ipToNameMap = {}
     self.hadoopClusterConfig = {}
     self.containerDoopnetPath = '/home/doopnet'
     self.containerHadoopClusterConfigPath = '/home/hduser/cluster-config'
     self.containerModifyHadoopConfigShell = '/bin/bash %s/container-setup/modify-hadoop-config.sh %s' % (
         self.containerDoopnetPath, self.containerHadoopClusterConfigPath)
     self.setupSshKnownHostsShell = '/bin/bash %s/container-setup/setup-ssh-known-hosts' % self.containerDoopnetPath
     self.dimage = dimage
     self.hostExchangeFolder = hostExchangeFolder
     Mininet.__init__(self, *args, **kwargs)
コード例 #10
0
ファイル: chain_net.py プロジェクト: JinLabIIT/Minichain
    def __init__(self, chain_topo=None, tdf = 1, **params):
        Mininet.__init__(self,link=TCLink,**params)
        self.name_to_peer={}
        self.s1_node_to_port={}
        self.s1_max_port = 0
        self.chain_topo = chain_topo
        self.tdf = tdf

        self.s1 = self.addSwitch('s1', protocols='OpenFlow13', failMode='standalone')

        if chain_topo is not None:
            self.buildChainTopo()
コード例 #11
0
ファイル: CCN_net.py プロジェクト: Phi-Ho/mn-ccnx
    def __init__( self, topo=None, switch=OVSKernelSwitch, host=Host,
                  controller=Controller, link=Link, intf=Intf,
                  build=True, xterms=False, cleanup=False, ipBase='10.0.0.0/8',
                  inNamespace=False,
                  autoSetMacs=False, autoStaticArp=False, autoPinCpus=False,
                  listenPort=None ):

        self.ccnNetBase = '1.0.0.0'

        Mininet.__init__( self, topo, switch, host, controller, link, intf,
                          build, xterms, cleanup, ipBase, inNamespace,
                          autoSetMacs, autoStaticArp, autoPinCpus, listenPort )
コード例 #12
0
ファイル: run.py プロジェクト: cygmris/enos
 def __init__(self, **args):
     global controllerIp, controllerPort, configFileName
     self.topo = TestbedTopo()
     args['topo'] = self.topo
     args['switch'] = OVSKernelSwitch
     args['controller'] = RemoteController
     args['build'] = False
     Mininet.__init__(self, **args)
     self.ctrl = self.addController('c0',
                                    controller=RemoteController,
                                    ip=controllerIp,
                                    port=controllerPort)
コード例 #13
0
    def __init__(self, verbose=False):

        self.checkPATHs()

        Mininet.__init__(self, build=False)

        self.cr_oshis = []
        self.pe_oshis = []
        self.ce_routers = []
        self.ctrls = []
        self.nodes_in_rn = []
        self.node_to_data = defaultdict(list)
        self.node_to_node = {}
        self.node_to_default_via = {}
        self.coex = {}
        

        self.verbose = verbose
        lg.setLogLevel('info')

        self.vlls = []

        self.node_to_pw_data = defaultdict(list)
        self.pws = []

        self.cer_to_customer = {}
        self.customer_to_vtepallocator = {}

        self.vsfs = []
        self.pe_cer_to_vsf = {}

        self.is_vs = False
        self.vss = []
        self.vss_data = []
        self.id_peo_to_vs = {}
        self.last_ipnet = IPv4Network(u'0.0.0.0/24')

        self.id_to_node = {}
        self.ip_to_mac = {}

        self.overall_info = {}
        
        self.mgmt = None

        root = Node( 'root', inNamespace=False )
        root.cmd('/etc/init.d/network-manager stop')
        mylog("*** Stop Network Manager\n")

        self.cluster_to_ctrl = defaultdict(list)
        self.cluster_to_nodes = defaultdict(list)
        self.nodes_to_cluster = {}
コード例 #14
0
    def __init__(self, controller, network_size, host_num):
        self.switch_num = network_size
        self.server_num = 2
        self.host_num = host_num  #3*network_size/2
        self.topo = {}

        # Create network
        #setLogLevel('info')
        self.topo = RandomTopo(self.switch_num, self.host_num)
        Mininet.__init__(self, topo=self.topo, controller=None)  #, link=TCLink
        self.addController('c0',
                           controller=RemoteController,
                           ip=controller.ip,
                           port=6633)
コード例 #15
0
    def __init__(self, verbose=False):

        self.checkPATHs()

        Mininet.__init__(self, build=False)

        self.cr_oshis = []
        self.pe_oshis = []
        self.ce_routers = []
        self.ctrls = []
        self.nodes_in_rn = []
        self.node_to_data = defaultdict(list)
        self.node_to_node = {}
        self.node_to_default_via = {}
        self.coex = {}

        self.verbose = verbose
        lg.setLogLevel('info')

        self.vlls = []

        self.node_to_pw_data = defaultdict(list)
        self.pws = []

        self.cer_to_customer = {}
        self.customer_to_vtepallocator = {}

        self.vsfs = []
        self.pe_cer_to_vsf = {}

        self.is_vs = False
        self.vss = []
        self.vss_data = []
        self.id_peo_to_vs = {}
        self.last_ipnet = IPv4Network(u'0.0.0.0/24')

        self.id_to_node = {}
        self.ip_to_mac = {}

        self.overall_info = {}

        self.mgmt = None

        root = Node('root', inNamespace=False)
        root.cmd('/etc/init.d/network-manager stop')
        mylog("*** Stop Network Manager\n")

        self.cluster_to_ctrl = defaultdict(list)
        self.cluster_to_nodes = defaultdict(list)
        self.nodes_to_cluster = {}
コード例 #16
0
 def __init__( self, **params ):
   """Mininet set up to test barrier transactions with one client
      and a specified number of servers.
      numberOfServers: number of servers 
      linkBandwidth: link bandwidth in Mb/s
      roundTripTime: unloaded round trip time from client to server, in microseconds"""
   
   host = custom( CPULimitedHost, cpu=cpuShare() )  
   link = custom( TCLink, bw=args.bandwidth, delay=delay() )
   
   Mininet.__init__(
     self,
     topo=BarrierTransactionTopo( **params ),
     host=host,
     link=link )
コード例 #17
0
ファイル: topo6.py プロジェクト: sumitece87/comnet2_2020
    def __init__(self):
        Mininet.__init__(self, link=TCLink, controller=None, cleanup=True)

        #Creating Hosts
        info("Creating nodes\n")
        r1 = self.addHost('r1', inNamespace=False)
        r2 = self.addHost('r2', inNamespace=False)
        h1 = self.addHost('h1', inNamespace=False)
        h2 = self.addHost('h2', inNamespace=False)
        h3 = self.addHost('h3', inNamespace=False)

        #Establishing the links from hosts to routers
        info("Creating links\n")
        self.addLink(h1, r1, intfName2='r1-eth0')
        self.addLink(h2, r2, intfName2='r2-eth2')
        self.addLink(h3, r2, intfName2='r2-eth3')
        self.addLink(r1,
                     r2,
                     intfName1='r1-eth1',
                     intfName2='r2-eth1',
                     bw=10,
                     delay='1ms',
                     loss=10)

        #Setting interface ip addresses since params1 or params2 just will not work
        host1 = self.get('h1')
        host2 = self.get('h2')
        host3 = self.get('h3')
        router1 = self.get('r1')
        router2 = self.get('r2')
        host1.setIP('192.168.1.1/24', intf='h1-eth0')
        host2.setIP('192.168.2.1/24', intf='h2-eth0')
        host3.setIP('192.168.3.1/24', intf='h3-eth0')
        router1.setIP('192.168.1.2/24', intf='r1-eth0')
        router1.setIP('10.0.1.0/24', intf='r1-eth1')
        router2.setIP('10.0.1.1/24', intf='r2-eth1')
        router2.setIP('192.168.2.2/24', intf='r2-eth2')
        router2.setIP('192.168.3.2/24', intf='r2-eth3')

        #Setting default routes for each interface
        h1.cmd('ip route add default via 192.168.1.2')
        h2.cmd('ip route add default via 192.168.2.2')
        h3.cmd('ip route add default via 192.168.3.2')
        r1.cmd('sysctl net.ipv4.ip_forward=1')
        r2.cmd('sysctl net.ipv4.ip_forward=1')
コード例 #18
0
ファイル: net.py プロジェクト: stevelorenz/comnetsemu
    def __init__(self, **params):
        """Create a Containernet object with the same parameters provided by
        Mininet.
        """
        self._appcontainers = list()

        # ISSUE: This is a bad workaround to allow X11 forwarding with sudo ...
        #        It is used because running mininet needs root privileges currently ...
        #        The X-forwarding does not work when a user uses `sudo xterm`, the magic cookie is not there.
        sudo_user = os.environ.get("SUDO_USER", None)
        if os.path.exists(f"/home/{sudo_user}/.Xauthority"):
            subprocess.run(
                f"xauth add $(xauth -f /home/{sudo_user}/.Xauthority list|tail -1)",
                check=True,
                shell=True,
                stderr=subprocess.DEVNULL,
            )

        Mininet.__init__(self, **params)
コード例 #19
0
ファイル: p4app.py プロジェクト: nerds-ufes/tutorial-P4
    def __init__(self, *args, **kwargs):
        if 'controller' not in kwargs:
            kwargs['controller'] = None
        if 'host' not in kwargs:
            kwargs['host'] = P4Host
        if 'topo' not in kwargs:
            kwargs['topo'] = SingleSwitchTopo(2)
        if 'program' not in kwargs:
            raise Exception("Must specify p4 program")

        start_controller = True
        if 'start_controller' in kwargs:
            start_controller = kwargs['start_controller']
            del kwargs['start_controller']

        enable_debugger = False
        if 'enable_debugger' in kwargs:
            enable_debugger = kwargs['enable_debugger']
            del kwargs['enable_debugger']

        if 'switch' not in kwargs:
            assert 'program' in kwargs
            prog_or_filename = kwargs['program']
            kwargs['switch'] = configureP4RuntimeSimpleSwitch(
                prog_or_filename,
                start_controller=start_controller,
                enable_debugger=enable_debugger)

        if 'program' in kwargs: del kwargs['program']

        self.auto_arp = True
        if 'auto_arp' in kwargs:
            self.auto_arp = kwargs['auto_arp']
            del kwargs['auto_arp']

        Mininet.__init__(self, *args, **kwargs)
コード例 #20
0
ファイル: mn-s2.py プロジェクト: anvial/mininet
 def __init__(self, *pargs, **kwargs):
     Mininet.__init__(self, *pargs, **kwargs)
     self.services = {}
コード例 #21
0
 def __init__(self, config_path=None, **params):
     self.config_path = LINC_CONFIG if config_path is None else config_path
     Mininet.__init__(self, **params)
コード例 #22
0
ファイル: net.py プロジェクト: USC-NSL/miniNExT
 def __init__(self, *args, **kwargs):
     info("** Using Mininet Extended (MiniNExT) Handler\n")
     Mininet.__init__(self, *args, **kwargs)
コード例 #23
0
 def __init__(self, *args, **kwargs):
     info("** Using Mininet Extended (MiniNExT) Handler\n")
     Mininet.__init__(self, *args, **kwargs)
コード例 #24
0
 def __init__(self):
     Mininet.__init__(self, switch=OVSSwitch, controller=RemoteController)
     self.servers = []  # list of server nodes
     self.httpd = {}  # dict of HTTP listener processes
コード例 #25
0
    def __init__(self):
        Mininet.__init__(self, link=TCLink, controller=None, cleanup=True)

        #Creating Hosts
        info("Creating nodes\n")
        r1 = self.addHost('r1', inNamespace=False)
        r2 = self.addHost('r2', inNamespace=False)
        r3 = self.addHost('r3', inNamespace=False)
        r4 = self.addHost('r4', inNamespace=False)
        r5 = self.addHost('r5', inNamespace=False)
        r6 = self.addHost('r6', inNamespace=False)
        s1 = self.addHost('s1', inNamespace=False)
        d1 = self.addHost('d1', inNamespace=False)
        d2 = self.addHost('d2', inNamespace=False)
        d3 = self.addHost('d3', inNamespace=False)

        #Establishing the links from hosts to routers
        info("Creating links\n")
        self.addLink(s1, r1, intfName2='r1-eth0')
        self.addLink(r1, r2, intfName1='r1-eth1', intfName2='r2-eth0')
        self.addLink(r1, r3, intfName1='r1-eth2', intfName2='r3-eth0')
        self.addLink(r2, r4, intfName1='r2-eth1', intfName2='r4-eth0')
        self.addLink(r3, r4, intfName1='r3-eth1', intfName2='r4-eth1')
        self.addLink(r3, r5, intfName1='r3-eth2', intfName2='r5-eth0')
        self.addLink(r5, r6, intfName1='r5-eth1', intfName2='r6-eth0')
        self.addLink(d1, r4, intfName2='r4-eth2')
        self.addLink(d2, r6, intfName2='r6-eth1')
        self.addLink(d3, r6, intfName2='r6-eth2')

        #Setting interface ip addresses since params1 or params2 just will not work
        source = self.get('s1')
        dest1 = self.get('d1')
        dest2 = self.get('d2')
        dest3 = self.get('d3')
        router1 = self.get('r1')
        router2 = self.get('r2')
        router3 = self.get('r3')
        router4 = self.get('r4')
        router5 = self.get('r5')
        router6 = self.get('r6')
        source.setIP('192.168.1.1/24', intf='s1-eth0')
        dest1.setIP('192.168.2.1/24', intf='d1-eth0')
        dest2.setIP('192.168.3.1/24', intf='d2-eth0')
        dest3.setIP('192.168.4.1/24', intf='d3-eth0')
        router1.setIP('192.168.1.2/24', intf='r1-eth0')
        router1.setIP('10.0.1.0/24', intf='r1-eth1')
        router1.setIP('10.0.2.0/24', intf='r1-eth2')
        router2.setIP('10.0.1.1/24', intf='r2-eth0')
        router2.setIP('10.0.3.1/24', intf='r2-eth1')
        router3.setIP('10.0.4.1/24', intf='r3-eth1')
        router3.setIP('10.0.2.1/24', intf='r3-eth0')
        router4.setIP('10.0.3.2/24', intf='r4-eth0')
        router3.setIP('10.0.5.1/24', intf='r3-eth2')
        router5.setIP('10.0.6.1/24', intf='r5-eth1')
        router4.setIP('10.0.4.2/24', intf='r4-eth1')
        router5.setIP('10.0.5.2/24', intf='r5-eth0')
        router6.setIP('192.168.3.2/24', intf='r6-eth1')
        router6.setIP('10.0.6.2/24', intf='r6-eth0')
        router6.setIP('192.168.4.2/24', intf='r6-eth2')
        router4.setIP('192.168.2.2/24', intf='r4-eth2')

        #Setting default routes for each interface
        s1.cmd('ip route add default via 192.168.1.2')
        d1.cmd('ip route add default via 192.168.2.2')
        d2.cmd('ip route add default via 192.168.3.2')
        d3.cmd('ip route add default via 192.168.4.2')
        r1.cmd('sysctl net.ipv4.ip_forward=1')
        r2.cmd('sysctl net.ipv4.ip_forward=1')
        r3.cmd('sysctl net.ipv4.ip_forward=1')
        r4.cmd('sysctl net.ipv4.ip_forward=1')
        r5.cmd('sysctl net.ipv4.ip_forward=1')
        r6.cmd('sysctl net.ipv4.ip_forward=1')
コード例 #26
0
ファイル: architecture.py プロジェクト: Fdall/VCDN
	def __init__(self, **params):
		Mininet.__init__(self, **params)
	
		# Default controller
		defaultController = self.addController('defaultController')
		self.defaultController = defaultController
 def __init__( self ):
     Mininet.__init__( self, switch=OVSSwitch, controller=RemoteController )
     self.servers = []   # list of server nodes
     self.httpd = {}     # dict of HTTP listener processes
コード例 #28
0
ファイル: optical.py プロジェクト: vmehmeri/sfc-lab
 def __init__(self, config_path=None, **params):
     self.config_path = LINC_CONFIG if config_path is None else config_path
     Mininet.__init__(self, **params)
コード例 #29
0
 def __init__(self, **params):
     """Create a Containernet object with the same parameters provided by
     Mininet.
     """
     self._appcontainers = list()
     Mininet.__init__(self, **params)
コード例 #30
0
ファイル: basenet.py プロジェクト: JasonatBuaa/Ez
 def __init__(self,*args,**kwargs):
     Mininet.__init__(self,*args,**kwargs)
コード例 #31
0
 def __init__(self, topo, controller):
     Mininet.__init__(self, topo = topo, controller = controller)
     self.iperf_s = []
     self.iperf_c = []