コード例 #1
0
    def __init__(self,
                 name,
                 inNamespace=True,
                 server='',
                 sargs='',
                 sdir='/tmp/bcn',
                 client='',
                 cargs='{command}',
                 cdir=None,
                 ip="127.0.0.1",
                 port='',
                 **params):
        # Server params
        self.server = server
        self.sargs = sargs
        self.sdir = sdir
        # Client params
        self.client = client
        self.cargs = cargs
        self.cdir = cdir

        self.ip = ip
        self.port = port
        CPULimitedHost.__init__(self,
                                name,
                                inNamespace=inNamespace,
                                ip=ip,
                                **params)
コード例 #2
0
ファイル: ndn_host.py プロジェクト: ndncomm/mini-ndn
    def __init__(self, name, sched='cfs', **kwargs):

        CPULimitedHost.__init__(self, name, sched, **kwargs)
        if not NdnHost.inited:
            NdnHostCommon.init()

        self.nfd = Nfd(self)
        self.nfd.start()

        self.peerList = {}
コード例 #3
0
    def __init__(self, name, sched='cfs', **kwargs):

        CPULimitedHost.__init__(self, name, sched, **kwargs)
        if not NdnHost.inited:
            NdnHostCommon.init()

        # Create home directory for a node
        self.homeFolder = "%s/%s" % (self.params['workdir'], self.name)
        self.cmd("mkdir -p %s" % self.homeFolder)
        self.cmd("cd %s" % self.homeFolder)

        self.nfd = None

        self.peerList = {}
コード例 #4
0
ファイル: ndn_host.py プロジェクト: alvyC/mini-ndn
    def __init__(self, name, sched='cfs', **kwargs):

        CPULimitedHost.__init__(self, name, sched, **kwargs)
        if not NdnHost.inited:
            NdnHostCommon.init()

        # Create home directory for a node
        self.homeFolder = "%s/%s" % (self.params['workdir'], self.name)
        self.cmd("mkdir -p %s" % self.homeFolder)
        self.cmd("cd %s" % self.homeFolder)

        self.nfd = Nfd(self)
        self.nfd.start()

        self.peerList = {}
コード例 #5
0
ファイル: ndn_host.py プロジェクト: xuanvl95/mini-ndn
    def config(self, app=None, cpu=None, cores=None, cache=None, **params):

        r = CPULimitedHost.config(self,cpu,cores, **params)

        self.setParam(r, 'app', app=app)
        self.setParam(r, 'cache', cache=cache)

        return r
コード例 #6
0
ファイル: ndn_host.py プロジェクト: alvyC/mini-ndn
    def config(self, app=None, cpu=None, cores=None, cache=None, **params):

        r = CPULimitedHost.config(self,cpu,cores, **params)

        self.setParam(r, 'app', app=app)
        self.setParam(r, 'cache', cache=cache)

        return r
コード例 #7
0
ファイル: ndn_host.py プロジェクト: ndncomm/mini-ndn
    def config(self, fib=None, app=None, cpu=None, cores=None, cache=None, **params):

        r = CPULimitedHost.config(self,cpu,cores, **params)

        self.setParam(r, 'app', fib=fib)   #????? shoud it be app=app
        self.setParam(r, 'fib', app=app)
        self.setParam(r, 'cache', cache=cache)

        return r
コード例 #8
0
ファイル: onos.py プロジェクト: opennetworkinglab/spring-open
 def startRamcloud( self, cpu=.6 ):
     """Start Ramcloud
        cpu: CPU usage limit (in seconds/s)"""
     # Create a cgroup so Ramcloud doesn't eat all of our CPU
     ramcloud = CPULimitedHost( 'ramcloud', inNamespace=False, period_us=5000 )
     ramcloud.setCPUFrac( cpu / numCores() )
     info( '\n' )
     ramcloud.cmd( 'export PATH=%s:$PATH' % self.onosDir )
     ramcloud.cmd( 'export ONOS_LOGDIR=%s' % self.logDir )
     for daemon in 'coord', 'server':
         ramcloud.cmd( 'onos.sh rc-%s start' % daemon )
         pid = self.waitStart( 'Ramcloud %s' % daemon, 'obj.master/' + daemon )
         self.waitNetstat( pid )
         status = self.cmd( 'onos.sh rc-%s.sh status' % daemon )
         if 'running' not in status:
             raise Exception( 'Ramcloud %s startup failed: ' % daemon + status )
     self.ramcloud = ramcloud
コード例 #9
0
 def startRamcloud(self, cpu=.6):
     """Start Ramcloud
        cpu: CPU usage limit (in seconds/s)"""
     # Create a cgroup so Ramcloud doesn't eat all of our CPU
     ramcloud = CPULimitedHost('ramcloud',
                               inNamespace=False,
                               period_us=5000)
     ramcloud.setCPUFrac(cpu / numCores())
     info('\n')
     ramcloud.cmd('export PATH=%s:$PATH' % self.onosDir)
     ramcloud.cmd('export ONOS_LOGDIR=%s' % self.logDir)
     for daemon in 'coord', 'server':
         ramcloud.cmd('onos.sh rc-%s start' % daemon)
         pid = self.waitStart('Ramcloud %s' % daemon,
                              'obj.master/' + daemon)
         self.waitNetstat(pid)
         status = self.cmd('onos.sh rc-%s.sh status' % daemon)
         if 'running' not in status:
             raise Exception('Ramcloud %s startup failed: ' % daemon +
                             status)
     self.ramcloud = ramcloud
コード例 #10
0
 def __init__( self, name, **kwargs ):
     # First N (=pairs) hosts are clients, in root NS
     kwargs.pop('inNamespace', True)
     isServer = int( name[ 1: ] ) > pairs
     CPULimitedHost.__init__( self, name, inNamespace=isServer, **kwargs )
コード例 #11
0
 def __init__(self, name, inNamespace=True, **params):
     CPULimitedHost.__init__(self, name, inNamespace=inNamespace, **params)
コード例 #12
0
 def __init__(self, name, **params):
     CPULimitedHost.__init__(self, name, **params)
     self.status = "INIT"
コード例 #13
0
 def terminate(self):
     "Stop node."
     if self.nfd is not None:
         self.nfd.stop()
     CPULimitedHost.terminate(self)